diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/CopierManagerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/CopierManagerImpl.java index 3b348d1ef..1aa048efc 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/CopierManagerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/CopierManagerImpl.java @@ -18,46 +18,43 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.copyobject ; +package com.sun.corba.ee.impl.copyobject; import com.sun.corba.ee.spi.copyobject.CopierManager; import org.glassfish.pfl.basic.contain.DenseIntMapImpl; import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory; -public class CopierManagerImpl implements CopierManager -{ - private int defaultId ; - private final DenseIntMapImpl map ; +public class CopierManagerImpl implements CopierManager { + private int defaultId; + private final DenseIntMapImpl map; - public CopierManagerImpl() - { - defaultId = 0 ; - map = new DenseIntMapImpl<>() ; + public CopierManagerImpl() { + defaultId = 0; + map = new DenseIntMapImpl<>(); } @Override - public void setDefaultId( int id ) { - defaultId = id ; + public void setDefaultId(int id) { + defaultId = id; } @Override public int getDefaultId() { - return defaultId ; + return defaultId; } @Override public ObjectCopierFactory getObjectCopierFactory(int id) { - return map.get( id ) ; + return map.get(id); } @Override public ObjectCopierFactory getDefaultObjectCopierFactory() { - return map.get( defaultId ) ; + return map.get(defaultId); } @Override public void registerObjectCopierFactory(ObjectCopierFactory factory, int id) { - map.set( id, factory ) ; + map.set(id, factory); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/JavaStreamORBObjectCopierImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/JavaStreamORBObjectCopierImpl.java index 490b0c95b..a8bdf3386 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/JavaStreamORBObjectCopierImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/JavaStreamORBObjectCopierImpl.java @@ -18,26 +18,25 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.copyobject ; +package com.sun.corba.ee.impl.copyobject; import java.rmi.Remote; -import org.omg.CORBA.ORB ; +import org.omg.CORBA.ORB; import com.sun.corba.ee.impl.util.Utility; -import org.glassfish.pfl.dynamic.copyobject.impl.JavaStreamObjectCopierImpl ; - +import org.glassfish.pfl.dynamic.copyobject.impl.JavaStreamObjectCopierImpl; public class JavaStreamORBObjectCopierImpl extends JavaStreamObjectCopierImpl { - private final ORB orb ; + private final ORB orb; - public JavaStreamORBObjectCopierImpl( ORB orb ) { - this.orb = orb ; + public JavaStreamORBObjectCopierImpl(ORB orb) { + this.orb = orb; } - public Object copy(Object obj, boolean debug ) { - return copy( obj ) ; + public Object copy(Object obj, boolean debug) { + return copy(obj); } @Override @@ -45,9 +44,9 @@ public Object copy(Object obj) { if (obj instanceof Remote) { // Yes, so make sure it is connected and converted // to a stub (if needed)... - return Utility.autoConnect(obj,orb,true); + return Utility.autoConnect(obj, orb, true); } - return super.copy( obj ) ; + return super.copy(obj); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/ORBStreamObjectCopierImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/ORBStreamObjectCopierImpl.java index 02515f81e..27d8b20bd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/ORBStreamObjectCopierImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/ORBStreamObjectCopierImpl.java @@ -18,30 +18,28 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.copyobject ; - +package com.sun.corba.ee.impl.copyobject; import java.io.Serializable; import java.rmi.Remote; import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA.ORB ; +import org.omg.CORBA.ORB; import com.sun.corba.ee.impl.util.Utility; import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopier; public class ORBStreamObjectCopierImpl implements ObjectCopier { - + private final ORB orb; - public ORBStreamObjectCopierImpl( ORB orb ) - { - this.orb = orb ; + public ORBStreamObjectCopierImpl(ORB orb) { + this.orb = orb; } public Object copy(Object obj, boolean debug) { - return copy( obj ) ; + return copy(obj); } @Override @@ -49,13 +47,13 @@ public Object copy(Object obj) { if (obj instanceof Remote) { // Yes, so make sure it is connected and converted // to a stub (if needed)... - return Utility.autoConnect(obj,orb,true); + return Utility.autoConnect(obj, orb, true); } - OutputStream out = (OutputStream)orb.create_output_stream(); - out.write_value((Serializable)obj); - InputStream in = (InputStream)out.create_input_stream(); + OutputStream out = (OutputStream) orb.create_output_stream(); + out.write_value((Serializable) obj); + InputStream in = (InputStream) out.create_input_stream(); return in.read_value(); } - + } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/OldReflectObjectCopierImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/OldReflectObjectCopierImpl.java index 505a85619..0cd032134 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/OldReflectObjectCopierImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/copyobject/OldReflectObjectCopierImpl.java @@ -30,7 +30,7 @@ * FINEST = logs everything, including exception stack traces */ -package com.sun.corba.ee.impl.copyobject ; +package com.sun.corba.ee.impl.copyobject; import com.sun.corba.ee.impl.util.Utility; import com.sun.corba.ee.spi.orb.ORB; @@ -57,39 +57,32 @@ import java.util.Map; /** - * Provides the functionality of copying objects using reflection. - * NOTE: Currently the implementation does not implement this copying - * functionality for objects which have fields whose types are - * based on inner classes. - * If for any reason copying cannot be done using reflection it uses - * the original ORB serialization to implement the copying + * Provides the functionality of copying objects using reflection. NOTE: Currently the implementation does not implement + * this copying functionality for objects which have fields whose types are based on inner classes. If for any reason + * copying cannot be done using reflection it uses the original ORB serialization to implement the copying */ -public class OldReflectObjectCopierImpl implements ObjectCopier -{ +public class OldReflectObjectCopierImpl implements ObjectCopier { private final IdentityHashMap objRefs; private final ORB orb; - public OldReflectObjectCopierImpl( org.omg.CORBA.ORB orb ) - { + public OldReflectObjectCopierImpl(org.omg.CORBA.ORB orb) { objRefs = new IdentityHashMap(); - this.orb = (ORB)orb ; + this.orb = (ORB) orb; } /** - * reflectCache is used to cache the reflection attributes of - * a class + * reflectCache is used to cache the reflection attributes of a class */ private static Map reflectCache = new HashMap<>(); /** - * Provides the functionality of a cache for storing the various - * reflection attributes of a class so that access to these methods - * is not done repeatedly + * Provides the functionality of a cache for storing the various reflection attributes of a class so that access to + * these methods is not done repeatedly */ class ReflectAttrs { public Field[] fields; public Constructor constr; - public Class thisClass ; + public Class thisClass; public Class arrayClass; public Class superClass; public boolean isImmutable; @@ -97,13 +90,13 @@ class ReflectAttrs { public boolean isSQLDate; public ReflectAttrs(Class cls) { - thisClass = cls ; + thisClass = cls; String name = cls.getName(); char ch = name.charAt(0); isImmutable = false; isDate = false; - isSQLDate = false; + isSQLDate = false; fields = null; constr = null; superClass = null; @@ -116,11 +109,13 @@ public ReflectAttrs(Class cls) { } else if (name.equals("java.sql.Date")) { isSQLDate = true; } else { - if (Externalizable.class.isAssignableFrom( cls )) - constr = getExternalizableConstructor(cls) ; - else if (Serializable.class.isAssignableFrom( cls )) - constr = getSerializableConstructor(cls) ; - if (constr != null) { constr.setAccessible(true); } + if (Externalizable.class.isAssignableFrom(cls)) + constr = getExternalizableConstructor(cls); + else if (Serializable.class.isAssignableFrom(cls)) + constr = getSerializableConstructor(cls); + if (constr != null) { + constr.setAccessible(true); + } fields = cls.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); superClass = cls.getSuperclass(); @@ -128,38 +123,33 @@ else if (Serializable.class.isAssignableFrom( cls )) } }; - /** Bridge is used to access the reflection factory for - * obtaining serialization constructors. - * This must be carefully protected! + /** + * Bridge is used to access the reflection factory for obtaining serialization constructors. This must be carefully + * protected! */ - private static final Bridge bridge = - (Bridge)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return Bridge.get() ; - } - } - ) ; + private static final Bridge bridge = (Bridge) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return Bridge.get(); + } + }); /** - * Returns public no-arg constructor of given class, or null if none found. - * Access checks are disabled on the returned constructor (if any), since - * the defining class may still be non-public. + * Returns public no-arg constructor of given class, or null if none found. Access checks are disabled on the returned + * constructor (if any), since the defining class may still be non-public. */ private Constructor getExternalizableConstructor(Class cl) { try { Constructor cons = cl.getDeclaredConstructor(new Class[0]); cons.setAccessible(true); - return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ? cons : null; + return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ? cons : null; } catch (NoSuchMethodException ex) { - //test for null on calling routine will avoid NPE just to be safe + // test for null on calling routine will avoid NPE just to be safe return null; } } - /** - * Returns true if classes are defined in the same package, false - * otherwise. + /** + * Returns true if classes are defined in the same package, false otherwise. * * Copied from the Merlin java.io.ObjectStreamClass. */ @@ -169,15 +159,14 @@ private boolean packageEquals(Class cl1, Class cl2) { } /** - * Returns subclass-accessible no-arg constructor of first non-serializable - * superclass, or null if none found. Access checks are disabled on the - * returned constructor (if any). + * Returns subclass-accessible no-arg constructor of first non-serializable superclass, or null if none found. Access + * checks are disabled on the returned constructor (if any). */ private Constructor getSerializableConstructor(Class cl) { Class initCl = cl; if (initCl == null) { - //should not be possible for initCl==null but log and return null - //test for null on calling routine will avoid NPE just to be safe + // should not be possible for initCl==null but log and return null + // test for null on calling routine will avoid NPE just to be safe return null; } while (Serializable.class.isAssignableFrom(initCl)) { @@ -188,31 +177,27 @@ private Constructor getSerializableConstructor(Class cl) { try { Constructor cons = initCl.getDeclaredConstructor(new Class[0]); int mods = cons.getModifiers(); - if ((mods & Modifier.PRIVATE) != 0 || - ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && - !packageEquals(cl, initCl))) - { - //test for null on calling routine will avoid NPE just to be safe - return null; + if ((mods & Modifier.PRIVATE) != 0 || ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 && !packageEquals(cl, initCl))) { + // test for null on calling routine will avoid NPE just to be safe + return null; } cons = bridge.newConstructorForSerialization(cl, cons); cons.setAccessible(true); return cons; } catch (NoSuchMethodException ex) { - //test for null on calling routine will avoid NPE just to be safe + // test for null on calling routine will avoid NPE just to be safe return null; } } /** - * Gets the reflection attributes for a class from the cache or - * if it is not in the cache yet, computes the attributes and - * populates the cache + * Gets the reflection attributes for a class from the cache or if it is not in the cache yet, computes the attributes + * and populates the cache + * * @param cls the class whose attributes are needed * @return the attributes needed for reflection * - * This method must be synchronized so that reflectCache.put can - * safely update the reflectCache. + * This method must be synchronized so that reflectCache.put can safely update the reflectCache. */ private synchronized ReflectAttrs getClassAttrs(Class cls) { ReflectAttrs attrs = reflectCache.get(cls); @@ -226,17 +211,10 @@ private synchronized ReflectAttrs getClassAttrs(Class cls) { public static boolean isImmutable(String classname) { if (classname.startsWith("java.lang.")) { String typename = classname.substring(10); - if (typename.compareTo("String") == 0 || - typename.compareTo("Class") == 0 || - typename.compareTo("Integer") == 0 || - typename.compareTo("Boolean") == 0 || - typename.compareTo("Long") == 0 || - typename.compareTo("Double") == 0 || - typename.compareTo("Byte") == 0 || - typename.compareTo("Char") == 0 || - typename.compareTo("Short") == 0 || - typename.compareTo("Object") == 0 || - typename.compareTo("Float") == 0) { + if (typename.compareTo("String") == 0 || typename.compareTo("Class") == 0 || typename.compareTo("Integer") == 0 + || typename.compareTo("Boolean") == 0 || typename.compareTo("Long") == 0 || typename.compareTo("Double") == 0 + || typename.compareTo("Byte") == 0 || typename.compareTo("Char") == 0 || typename.compareTo("Short") == 0 + || typename.compareTo("Object") == 0 || typename.compareTo("Float") == 0) { return true; } } @@ -244,39 +222,37 @@ public static boolean isImmutable(String classname) { } /** - * Utility to copy array of primitive types or objects. Used by local - * stubs to copy objects + * Utility to copy array of primitive types or objects. Used by local stubs to copy objects + * * @param obj the object to copy or connect. * @return the copied object. * @exception RemoteException if any object could not be copied. */ - private Object arrayCopy(Object obj, Class aClass) - throws RemoteException, InstantiationException, - IllegalAccessException, InvocationTargetException - { + private Object arrayCopy(Object obj, Class aClass) + throws RemoteException, InstantiationException, IllegalAccessException, InvocationTargetException { Object acopy = null; if (aClass.isPrimitive()) { if (aClass == byte.class) { - acopy = ((byte[])obj).clone(); + acopy = ((byte[]) obj).clone(); } else if (aClass == char.class) { - acopy = ((char[])obj).clone(); + acopy = ((char[]) obj).clone(); } else if (aClass == short.class) { - acopy = ((short[])obj).clone(); + acopy = ((short[]) obj).clone(); } else if (aClass == int.class) { - acopy = ((int[])obj).clone(); + acopy = ((int[]) obj).clone(); } else if (aClass == long.class) { - acopy = ((long[])obj).clone(); + acopy = ((long[]) obj).clone(); } else if (aClass == double.class) { - acopy = ((double[])obj).clone(); + acopy = ((double[]) obj).clone(); } else if (aClass == float.class) { - acopy = ((float[])obj).clone(); + acopy = ((float[]) obj).clone(); } else if (aClass == boolean.class) { - acopy = ((boolean[])obj).clone(); + acopy = ((boolean[]) obj).clone(); } objRefs.put(obj, acopy); } else if (aClass == String.class) { - acopy = ((String [])obj).clone(); + acopy = ((String[]) obj).clone(); objRefs.put(obj, acopy); } else { int alen = Array.getLength(obj); @@ -285,35 +261,32 @@ private Object arrayCopy(Object obj, Class aClass) acopy = Array.newInstance(aClass, alen); - - objRefs.put(obj, acopy); - for (int idx=0; idx()); } else { @@ -159,25 +150,23 @@ public ReflectObjectCopierImpl( ORB orb ) } } - /** Return a deep copy of obj. Aliasing is preserved within - * obj and between objects passed in multiple calls to the - * same instance of ReflectObjectCopierImpl. + /** + * Return a deep copy of obj. Aliasing is preserved within obj and between objects passed in multiple calls to the same + * instance of ReflectObjectCopierImpl. */ @Override - public Object copy( Object obj ) throws ReflectiveCopyException - { - return copy( obj, false ) ; + public Object copy(Object obj) throws ReflectiveCopyException { + return copy(obj, false); } - public Object copy( Object obj, boolean debug ) throws ReflectiveCopyException - { + public Object copy(Object obj, boolean debug) throws ReflectiveCopyException { if (obj == null) { return null; } - OperationTracer.begin( "ReflectObjectCopierImpl" ) ; - Class cls = obj.getClass() ; - ClassCopier copier = ccf.getClassCopier( cls ) ; - return copier.copy( oldToNew, obj) ; + OperationTracer.begin("ReflectObjectCopierImpl"); + Class cls = obj.getClass(); + ClassCopier copier = ccf.getClassCopier(cls); + return copier.copy(oldToNew, obj); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AnyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AnyImpl.java index 19470c849..1547fc9da 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AnyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AnyImpl.java @@ -59,37 +59,31 @@ public class AnyImpl extends Any { private static final long serialVersionUID = -8646067979785949029L; - private static final class AnyInputStream extends EncapsInputStream - { + private static final class AnyInputStream extends EncapsInputStream { private static final long serialVersionUID = -1719923004953871705L; - public AnyInputStream(EncapsInputStream theStream ) - { - super( theStream ); + + public AnyInputStream(EncapsInputStream theStream) { + super(theStream); } } - private static final class AnyOutputStream extends EncapsOutputStream - { + private static final class AnyOutputStream extends EncapsOutputStream { private static final long serialVersionUID = 9105274185226938185L; - public AnyOutputStream(ORB orb) - { + + public AnyOutputStream(ORB orb) { super(orb); } @Override - public org.omg.CORBA.portable.InputStream create_input_stream() - { - final org.omg.CORBA.portable.InputStream is = super - .create_input_stream(); - AnyInputStream aIS = AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public AnyInputStream run() { - return new AnyInputStream( - (com.sun.corba.ee.impl.encoding.EncapsInputStream) is); - } - - }); + public org.omg.CORBA.portable.InputStream create_input_stream() { + final org.omg.CORBA.portable.InputStream is = super.create_input_stream(); + AnyInputStream aIS = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public AnyInputStream run() { + return new AnyInputStream((com.sun.corba.ee.impl.encoding.EncapsInputStream) is); + } + + }); return aIS; } @@ -100,12 +94,11 @@ public AnyInputStream run() { // private TypeCodeImpl typeCode; - @Copy( CopyType.IDENTITY ) + @Copy(CopyType.IDENTITY) protected transient ORB orb; - @Copy( CopyType.IDENTITY ) - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + @Copy(CopyType.IDENTITY) + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // // Validity depends upon typecode. The 'value' and 'object' instance @@ -115,7 +108,7 @@ public AnyInputStream run() { // stream type is an Any extension of CDR stream that is used to // detect an optimization in read_value(). // - @Copy( CopyType.IDENTITY ) + @Copy(CopyType.IDENTITY) private transient CDRInputObject stream; private long value; @@ -127,69 +120,66 @@ public AnyInputStream run() { private boolean isInitialized = false; /* - * This boolean array tells us if a given typecode must be - * streamed. Objects that are immutable don't have to be streamed. + * This boolean array tells us if a given typecode must be streamed. Objects that are immutable don't have to be + * streamed. */ - static boolean isStreamed[] = { - false, // null - false, // void - false, // short - false, // long - false, // ushort - false, // ulong - false, // float - false, // double - false, // boolean - false, // char - false, // octet - false, // any - false, // TypeCode - true, // Principal - false, // objref - true, // struct - true, // union - false, // enum - false, // string - true, // sequence - true, // array - true, // alias - true, // except - false, // longlong - false, // ulonglong - false, // longdouble - false, // wchar - false, // wstring - false, // fixed - false, // value - false, // value_box (used to be true) - false, // native - false // abstract interface + static boolean isStreamed[] = { false, // null + false, // void + false, // short + false, // long + false, // ushort + false, // ulong + false, // float + false, // double + false, // boolean + false, // char + false, // octet + false, // any + false, // TypeCode + true, // Principal + false, // objref + true, // struct + true, // union + false, // enum + false, // string + true, // sequence + true, // array + true, // alias + true, // except + false, // longlong + false, // ulonglong + false, // longdouble + false, // wchar + false, // wstring + false, // fixed + false, // value + false, // value_box (used to be true) + false, // native + false // abstract interface }; // Usual FindBugs Kluge: this class isn't really Serializable in the // normal Java sense (it is marshallable to a CDR stream), so we need // to create a method that sets transients to null (which will never be // called) to remove large numbers of FindBugs errors. - private void readObject( ObjectInputStream is ) - throws IOException, ClassNotFoundException { + private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { is.defaultReadObject(); - stream = null ; - orb = null ; + stream = null; + orb = null; } /////////////////////////////////////////////////////////////////////////// // Constructors /** - * A constructor that sets the Any to contain a null. It also marks - * the value as being invalid so that extractions throw an exception - * until an insertion has been performed. + * A constructor that sets the Any to contain a null. It also marks the value as being invalid so that extractions throw + * an exception until an insertion has been performed. + * * @param orb ORB to use for this any */ - public AnyImpl(ORB orb) - { + public AnyImpl(ORB orb) { this.orb = orb; typeCode = orb.get_primitive_tc(TCKind._tk_null); @@ -207,7 +197,7 @@ public AnyImpl(ORB orb, Any obj) { this(orb); if ((obj instanceof AnyImpl)) { - AnyImpl objImpl = (AnyImpl)obj; + AnyImpl objImpl = (AnyImpl) obj; typeCode = objImpl.typeCode; value = objImpl.value; object = objImpl.object; @@ -228,7 +218,7 @@ public AnyImpl(ORB orb, Any obj) { /** * returns the type of the element contained in the Any. * - * @return the TypeCode for the element in the Any + * @return the TypeCode for the element in the Any */ public TypeCode type() { return typeCode; @@ -246,7 +236,7 @@ private TypeCode realType(TypeCode aType) { realType = realType.content_type(); } } catch (BadKind bad) { // impossible - throw wrapper.badkindCannotOccur( bad ) ; + throw wrapper.badkindCannotOccur(bad); } return realType; } @@ -254,11 +244,10 @@ private TypeCode realType(TypeCode aType) { /** * sets the type of the element to be contained in the Any. * - * @param tc the TypeCode for the element in the Any + * @param tc the TypeCode for the element in the Any */ - public void type(TypeCode tc) - { - //debug.log ("type2"); + public void type(TypeCode tc) { + // debug.log ("type2"); // set the typecode typeCode = TypeCodeImpl.convertToNative(orb, tc); @@ -272,8 +261,8 @@ public void type(TypeCode tc) /** * checks for equality between Anys. * - * @param otherAny the Any to be compared with. - * @return true if the Anys are equal, false otherwise. + * @param otherAny the Any to be compared with. + * @return true if the Anys are equal, false otherwise. */ @DynamicType public boolean equal(Any otherAny) { @@ -291,207 +280,205 @@ public boolean equal(Any otherAny) { TypeCode realType = realType(); switch (realType.kind().value()) { + // handle primitive types + case TCKind._tk_null: + case TCKind._tk_void: + return true; + case TCKind._tk_short: + return (extract_short() == otherAny.extract_short()); + case TCKind._tk_long: + return (extract_long() == otherAny.extract_long()); + case TCKind._tk_ushort: + return (extract_ushort() == otherAny.extract_ushort()); + case TCKind._tk_ulong: + return (extract_ulong() == otherAny.extract_ulong()); + case TCKind._tk_float: + return (extract_float() == otherAny.extract_float()); + case TCKind._tk_double: + return (extract_double() == otherAny.extract_double()); + case TCKind._tk_boolean: + return (extract_boolean() == otherAny.extract_boolean()); + case TCKind._tk_char: + return (extract_char() == otherAny.extract_char()); + case TCKind._tk_wchar: + return (extract_wchar() == otherAny.extract_wchar()); + case TCKind._tk_octet: + return (extract_octet() == otherAny.extract_octet()); + case TCKind._tk_any: + return extract_any().equal(otherAny.extract_any()); + case TCKind._tk_TypeCode: + return extract_TypeCode().equal(otherAny.extract_TypeCode()); + case TCKind._tk_string: + return extract_string().equals(otherAny.extract_string()); + case TCKind._tk_wstring: + return (extract_wstring().equals(otherAny.extract_wstring())); + case TCKind._tk_longlong: + return (extract_longlong() == otherAny.extract_longlong()); + case TCKind._tk_ulonglong: + return (extract_ulonglong() == otherAny.extract_ulonglong()); + + case TCKind._tk_objref: + return (extract_Object().equals(otherAny.extract_Object())); + case TCKind._tk_Principal: + return (extract_Principal().equals(otherAny.extract_Principal())); + + case TCKind._tk_enum: + return (extract_long() == otherAny.extract_long()); + case TCKind._tk_fixed: + return (extract_fixed().compareTo(otherAny.extract_fixed()) == 0); + case TCKind._tk_except: + case TCKind._tk_struct: + case TCKind._tk_union: + case TCKind._tk_sequence: + case TCKind._tk_array: + InputStream copyOfMyStream = this.create_input_stream(); + InputStream copyOfOtherStream = otherAny.create_input_stream(); + return equalMember(realType, copyOfMyStream, copyOfOtherStream); + + // Too complicated to handle value types the way we handle + // other complex types above. Don't try to decompose it here + // for faster comparison, just use Object.equals(). + case TCKind._tk_value: + case TCKind._tk_value_box: + return extract_Value().equals(otherAny.extract_Value()); + + case TCKind._tk_alias: + throw wrapper.errorResolvingAlias(); + + case TCKind._tk_longdouble: + // Unspecified for Java + throw wrapper.tkLongDoubleNotSupported(); + + default: + throw wrapper.typecodeNotSupported(); + } + } + + // Needed for equal() in order to achieve linear performance for complex types. + // Uses up (recursively) copies of the InputStream in both Anys that got created in equal(). + @DynamicType + private boolean equalMember(TypeCode memberType, InputStream myStream, InputStream otherStream) { + // Resolve aliases here + TypeCode realType = realType(memberType); + + try { + switch (realType.kind().value()) { // handle primitive types case TCKind._tk_null: case TCKind._tk_void: return true; case TCKind._tk_short: - return (extract_short() == otherAny.extract_short()); + return (myStream.read_short() == otherStream.read_short()); case TCKind._tk_long: - return (extract_long() == otherAny.extract_long()); + return (myStream.read_long() == otherStream.read_long()); case TCKind._tk_ushort: - return (extract_ushort() == otherAny.extract_ushort()); + return (myStream.read_ushort() == otherStream.read_ushort()); case TCKind._tk_ulong: - return (extract_ulong() == otherAny.extract_ulong()); + return (myStream.read_ulong() == otherStream.read_ulong()); case TCKind._tk_float: - return (extract_float() == otherAny.extract_float()); + return (myStream.read_float() == otherStream.read_float()); case TCKind._tk_double: - return (extract_double() == otherAny.extract_double()); + return (myStream.read_double() == otherStream.read_double()); case TCKind._tk_boolean: - return (extract_boolean() == otherAny.extract_boolean()); + return (myStream.read_boolean() == otherStream.read_boolean()); case TCKind._tk_char: - return (extract_char() == otherAny.extract_char()); + return (myStream.read_char() == otherStream.read_char()); case TCKind._tk_wchar: - return (extract_wchar() == otherAny.extract_wchar()); + return (myStream.read_wchar() == otherStream.read_wchar()); case TCKind._tk_octet: - return (extract_octet() == otherAny.extract_octet()); + return (myStream.read_octet() == otherStream.read_octet()); case TCKind._tk_any: - return extract_any().equal(otherAny.extract_any()); + return myStream.read_any().equal(otherStream.read_any()); case TCKind._tk_TypeCode: - return extract_TypeCode().equal(otherAny.extract_TypeCode()); + return myStream.read_TypeCode().equal(otherStream.read_TypeCode()); case TCKind._tk_string: - return extract_string().equals(otherAny.extract_string()); + return myStream.read_string().equals(otherStream.read_string()); case TCKind._tk_wstring: - return (extract_wstring().equals(otherAny.extract_wstring())); + return (myStream.read_wstring().equals(otherStream.read_wstring())); case TCKind._tk_longlong: - return (extract_longlong() == otherAny.extract_longlong()); + return (myStream.read_longlong() == otherStream.read_longlong()); case TCKind._tk_ulonglong: - return (extract_ulonglong() == otherAny.extract_ulonglong()); + return (myStream.read_ulonglong() == otherStream.read_ulonglong()); case TCKind._tk_objref: - return (extract_Object().equals(otherAny.extract_Object())); + return (myStream.read_Object().equals(otherStream.read_Object())); case TCKind._tk_Principal: - return (extract_Principal().equals(otherAny.extract_Principal())); + return (myStream.read_Principal().equals(otherStream.read_Principal())); case TCKind._tk_enum: - return (extract_long() == otherAny.extract_long()); + return (myStream.read_long() == otherStream.read_long()); case TCKind._tk_fixed: - return (extract_fixed().compareTo(otherAny.extract_fixed()) == 0); + return (myStream.read_fixed().compareTo(otherStream.read_fixed()) == 0); case TCKind._tk_except: - case TCKind._tk_struct: - case TCKind._tk_union: - case TCKind._tk_sequence: - case TCKind._tk_array: - InputStream copyOfMyStream = this.create_input_stream(); - InputStream copyOfOtherStream = otherAny.create_input_stream(); - return equalMember(realType, copyOfMyStream, copyOfOtherStream); + case TCKind._tk_struct: { + int length = realType.member_count(); + for (int i = 0; i < length; i++) { + if (!equalMember(realType.member_type(i), myStream, otherStream)) { + return false; + } + } + return true; + } + case TCKind._tk_union: { + Any myDiscriminator = orb.create_any(); + Any otherDiscriminator = orb.create_any(); + myDiscriminator.read_value(myStream, realType.discriminator_type()); + otherDiscriminator.read_value(otherStream, realType.discriminator_type()); + + if (!myDiscriminator.equal(otherDiscriminator)) { + return false; + } + TypeCodeImpl realTypeCodeImpl = TypeCodeImpl.convertToNative(orb, realType); + int memberIndex = realTypeCodeImpl.currentUnionMemberIndex(myDiscriminator); + if (memberIndex == -1) { + throw wrapper.unionDiscriminatorError(); + } + + return equalMember(realType.member_type(memberIndex), myStream, otherStream); + } + case TCKind._tk_sequence: { + int length = myStream.read_long(); + otherStream.read_long(); // just so that the two stream are in sync + for (int i = 0; i < length; i++) { + if (!equalMember(realType.content_type(), myStream, otherStream)) { + return false; + } + } + return true; + } + case TCKind._tk_array: { + int length = realType.member_count(); + for (int i = 0; i < length; i++) { + if (!equalMember(realType.content_type(), myStream, otherStream)) { + return false; + } + } + return true; + } // Too complicated to handle value types the way we handle // other complex types above. Don't try to decompose it here // for faster comparison, just use Object.equals(). case TCKind._tk_value: case TCKind._tk_value_box: - return extract_Value().equals(otherAny.extract_Value()); + org.omg.CORBA_2_3.portable.InputStream mine = (org.omg.CORBA_2_3.portable.InputStream) myStream; + org.omg.CORBA_2_3.portable.InputStream other = (org.omg.CORBA_2_3.portable.InputStream) otherStream; + return mine.read_value().equals(other.read_value()); case TCKind._tk_alias: - throw wrapper.errorResolvingAlias() ; + // error resolving alias above + throw wrapper.errorResolvingAlias(); case TCKind._tk_longdouble: - // Unspecified for Java - throw wrapper.tkLongDoubleNotSupported() ; + throw wrapper.tkLongDoubleNotSupported(); default: - throw wrapper.typecodeNotSupported() ; - } - } - - // Needed for equal() in order to achieve linear performance for complex types. - // Uses up (recursively) copies of the InputStream in both Anys that got created in equal(). - @DynamicType - private boolean equalMember(TypeCode memberType, InputStream myStream, InputStream otherStream) { - // Resolve aliases here - TypeCode realType = realType(memberType); - - try { - switch (realType.kind().value()) { - // handle primitive types - case TCKind._tk_null: - case TCKind._tk_void: - return true; - case TCKind._tk_short: - return (myStream.read_short() == otherStream.read_short()); - case TCKind._tk_long: - return (myStream.read_long() == otherStream.read_long()); - case TCKind._tk_ushort: - return (myStream.read_ushort() == otherStream.read_ushort()); - case TCKind._tk_ulong: - return (myStream.read_ulong() == otherStream.read_ulong()); - case TCKind._tk_float: - return (myStream.read_float() == otherStream.read_float()); - case TCKind._tk_double: - return (myStream.read_double() == otherStream.read_double()); - case TCKind._tk_boolean: - return (myStream.read_boolean() == otherStream.read_boolean()); - case TCKind._tk_char: - return (myStream.read_char() == otherStream.read_char()); - case TCKind._tk_wchar: - return (myStream.read_wchar() == otherStream.read_wchar()); - case TCKind._tk_octet: - return (myStream.read_octet() == otherStream.read_octet()); - case TCKind._tk_any: - return myStream.read_any().equal(otherStream.read_any()); - case TCKind._tk_TypeCode: - return myStream.read_TypeCode().equal(otherStream.read_TypeCode()); - case TCKind._tk_string: - return myStream.read_string().equals(otherStream.read_string()); - case TCKind._tk_wstring: - return (myStream.read_wstring().equals(otherStream.read_wstring())); - case TCKind._tk_longlong: - return (myStream.read_longlong() == otherStream.read_longlong()); - case TCKind._tk_ulonglong: - return (myStream.read_ulonglong() == otherStream.read_ulonglong()); - - case TCKind._tk_objref: - return (myStream.read_Object().equals(otherStream.read_Object())); - case TCKind._tk_Principal: - return (myStream.read_Principal().equals(otherStream.read_Principal())); - - case TCKind._tk_enum: - return (myStream.read_long() == otherStream.read_long()); - case TCKind._tk_fixed: - return (myStream.read_fixed().compareTo(otherStream.read_fixed()) == 0); - case TCKind._tk_except: - case TCKind._tk_struct: { - int length = realType.member_count(); - for (int i=0; i() { - @Override - public OutputStream run() { - return new AnyOutputStream(finalOrb); - } - + @Override + public OutputStream run() { + return new AnyOutputStream(finalOrb); + } + }); } /** * returns an input stream that an Any value can be marshaled out of. * - * @return the InputStream to marshal value of Any out of. + * @return the InputStream to marshal value of Any out of. */ @DynamicType public org.omg.CORBA.portable.InputStream create_input_stream() { // We create a new InputStream so that multiple threads can call here // and read the streams in parallel without thread safety problems. // - //debug.log ("create_input_stream"); + // debug.log ("create_input_stream"); if (AnyImpl.isStreamed[realType().kind().value()]) { return stream.dup(); } else { @@ -547,7 +533,7 @@ public org.omg.CORBA.portable.InputStream create_input_stream() { // since it is in our format and does not have alignment issues. // @DynamicType - public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc) { + public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc) { // Assume that someone isn't going to think they can keep reading // from this stream after calling us. That would be likely for // an IIOPInputStream but if it is an AnyInputStream then they @@ -559,18 +545,17 @@ public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc) { typeCode = TypeCodeImpl.convertToNative(orb, tc); int kind = realType().kind().value(); if (kind >= isStreamed.length) { - throw wrapper.invalidIsstreamedTckind( kind) ; + throw wrapper.invalidIsstreamedTckind(kind); } if (AnyImpl.isStreamed[kind]) { - if ( in instanceof AnyInputStream ) { + if (in instanceof AnyInputStream) { // could only have been created here - stream = (CDRInputObject)in; + stream = (CDRInputObject) in; } else { - org.omg.CORBA_2_3.portable.OutputStream out = - (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream(); + org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) orb.create_output_stream(); typeCode.copy(in, out); - stream = (CDRInputObject)out.create_input_stream(); + stream = (CDRInputObject) out.create_input_stream(); } } else { java.lang.Object[] objholder = new java.lang.Object[1]; @@ -585,7 +570,6 @@ public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc) { isInitialized = true; } - // // We could optimize this by noticing whether the target stream // has ever had anything marshaled on it that required an @@ -606,22 +590,20 @@ public void write_value(OutputStream out) { /** * takes a streamable and inserts its reference into the any * - * @param s the streamable to insert + * @param s the streamable to insert */ @Override - public void insert_Streamable(Streamable s) - { - //debug.log ("insert_Streamable"); + public void insert_Streamable(Streamable s) { + // debug.log ("insert_Streamable"); typeCode = TypeCodeImpl.convertToNative(orb, s._type()); object = s; isInitialized = true; } - + @Override - public Streamable extract_Streamable() - { - //debug.log( "extract_Streamable" ) ; - return (Streamable)object; + public Streamable extract_Streamable() { + // debug.log( "extract_Streamable" ) ; + return (Streamable) object; } /////////////////////////////////////////////////////////////////////////// @@ -630,16 +612,14 @@ public Streamable extract_Streamable() /** * See the description of the general Any operations. */ - public void insert_short(short s) - { - //debug.log ("insert_short"); + public void insert_short(short s) { + // debug.log ("insert_short"); typeCode = orb.get_primitive_tc(TCKind._tk_short); value = s; isInitialized = true; } - private String getTCKindName( int tc ) - { + private String getTCKindName(int tc) { if ((tc >= 0) && (tc < TypeCodeImpl.kindNames.length)) { return TypeCodeImpl.kindNames[tc]; } else { @@ -647,58 +627,54 @@ private String getTCKindName( int tc ) } } - private void checkExtractBadOperation( int expected ) - { + private void checkExtractBadOperation(int expected) { if (!isInitialized) { throw wrapper.extractNotInitialized(); } - int tc = realType().kind().value() ; + int tc = realType().kind().value(); if (tc != expected) { - String tcName = getTCKindName( tc ) ; - String expectedName = getTCKindName( expected ) ; - throw wrapper.extractWrongType( expectedName, tcName ) ; + String tcName = getTCKindName(tc); + String expectedName = getTCKindName(expected); + throw wrapper.extractWrongType(expectedName, tcName); } } - private void checkExtractBadOperationList( int[] expected ) - { + private void checkExtractBadOperationList(int[] expected) { if (!isInitialized) { throw wrapper.extractNotInitialized(); } - int tc = realType().kind().value() ; + int tc = realType().kind().value(); for (int anExpected1 : expected) { if (tc == anExpected1) { return; } } - List list = new ArrayList() ; + List list = new ArrayList(); for (int anExpected : expected) { list.add(getTCKindName(anExpected)); } - String tcName = getTCKindName( tc ) ; - throw wrapper.extractWrongTypeList( list, tcName ) ; + String tcName = getTCKindName(tc); + throw wrapper.extractWrongTypeList(list, tcName); } /** * See the description of the general Any operations. */ - public short extract_short() - { - //debug.log ("extract_short"); - checkExtractBadOperation( TCKind._tk_short ) ; - return (short)value; + public short extract_short() { + // debug.log ("extract_short"); + checkExtractBadOperation(TCKind._tk_short); + return (short) value; } /** * See the description of the general Any operations. */ - public void insert_long(int l) - { - //debug.log ("insert_long"); + public void insert_long(int l) { + // debug.log ("insert_long"); // A long value is applicable to enums as well, so don't erase the enum type code // in case it was initialized that way before. int kind = realType().kind().value(); @@ -712,19 +688,17 @@ public void insert_long(int l) /** * See the description of the general Any operations. */ - public int extract_long() - { - //debug.log ("extract_long"); - checkExtractBadOperationList( new int[] { TCKind._tk_long, TCKind._tk_enum } ) ; - return (int)value; + public int extract_long() { + // debug.log ("extract_long"); + checkExtractBadOperationList(new int[] { TCKind._tk_long, TCKind._tk_enum }); + return (int) value; } /** * See the description of the general Any operations. */ - public void insert_ushort(short s) - { - //debug.log ("insert_ushort"); + public void insert_ushort(short s) { + // debug.log ("insert_ushort"); typeCode = orb.get_primitive_tc(TCKind._tk_ushort); value = s; isInitialized = true; @@ -733,19 +707,17 @@ public void insert_ushort(short s) /** * See the description of the general Any operations. */ - public short extract_ushort() - { - //debug.log ("extract_ushort"); - checkExtractBadOperation( TCKind._tk_ushort ) ; - return (short)value; + public short extract_ushort() { + // debug.log ("extract_ushort"); + checkExtractBadOperation(TCKind._tk_ushort); + return (short) value; } /** * See the description of the general Any operations. */ - public void insert_ulong(int l) - { - //debug.log ("insert_ulong"); + public void insert_ulong(int l) { + // debug.log ("insert_ulong"); typeCode = orb.get_primitive_tc(TCKind._tk_ulong); value = l; isInitialized = true; @@ -754,19 +726,17 @@ public void insert_ulong(int l) /** * See the description of the general Any operations. */ - public int extract_ulong() - { - //debug.log ("extract_ulong"); - checkExtractBadOperation( TCKind._tk_ulong ) ; - return (int)value; + public int extract_ulong() { + // debug.log ("extract_ulong"); + checkExtractBadOperation(TCKind._tk_ulong); + return (int) value; } /** * See the description of the general Any operations. */ - public void insert_float(float f) - { - //debug.log ("insert_float"); + public void insert_float(float f) { + // debug.log ("insert_float"); typeCode = orb.get_primitive_tc(TCKind._tk_float); value = Float.floatToIntBits(f); isInitialized = true; @@ -775,19 +745,17 @@ public void insert_float(float f) /** * See the description of the general Any operations. */ - public float extract_float() - { - //debug.log ("extract_float"); - checkExtractBadOperation( TCKind._tk_float ) ; - return Float.intBitsToFloat((int)value); + public float extract_float() { + // debug.log ("extract_float"); + checkExtractBadOperation(TCKind._tk_float); + return Float.intBitsToFloat((int) value); } /** * See the description of the general Any operations. */ - public void insert_double(double d) - { - //debug.log ("insert_double"); + public void insert_double(double d) { + // debug.log ("insert_double"); typeCode = orb.get_primitive_tc(TCKind._tk_double); value = Double.doubleToLongBits(d); isInitialized = true; @@ -796,19 +764,17 @@ public void insert_double(double d) /** * See the description of the general Any operations. */ - public double extract_double() - { - //debug.log ("extract_double"); - checkExtractBadOperation( TCKind._tk_double ) ; + public double extract_double() { + // debug.log ("extract_double"); + checkExtractBadOperation(TCKind._tk_double); return Double.longBitsToDouble(value); } /** * See the description of the general Any operations. */ - public void insert_longlong(long l) - { - //debug.log ("insert_longlong"); + public void insert_longlong(long l) { + // debug.log ("insert_longlong"); typeCode = orb.get_primitive_tc(TCKind._tk_longlong); value = l; isInitialized = true; @@ -817,19 +783,17 @@ public void insert_longlong(long l) /** * See the description of the general Any operations. */ - public long extract_longlong() - { - //debug.log ("extract_longlong"); - checkExtractBadOperation( TCKind._tk_longlong ) ; + public long extract_longlong() { + // debug.log ("extract_longlong"); + checkExtractBadOperation(TCKind._tk_longlong); return value; } /** * See the description of the general Any operations. */ - public void insert_ulonglong(long l) - { - //debug.log ("insert_ulonglong"); + public void insert_ulonglong(long l) { + // debug.log ("insert_ulonglong"); typeCode = orb.get_primitive_tc(TCKind._tk_ulonglong); value = l; isInitialized = true; @@ -838,40 +802,36 @@ public void insert_ulonglong(long l) /** * See the description of the general Any operations. */ - public long extract_ulonglong() - { - //debug.log ("extract_ulonglong"); - checkExtractBadOperation( TCKind._tk_ulonglong ) ; + public long extract_ulonglong() { + // debug.log ("extract_ulonglong"); + checkExtractBadOperation(TCKind._tk_ulonglong); return value; } /** * See the description of the general Any operations. */ - public void insert_boolean(boolean b) - { - //debug.log ("insert_boolean"); + public void insert_boolean(boolean b) { + // debug.log ("insert_boolean"); typeCode = orb.get_primitive_tc(TCKind._tk_boolean); - value = (b)? 1:0; + value = (b) ? 1 : 0; isInitialized = true; } /** * See the description of the general Any operations. */ - public boolean extract_boolean() - { - //debug.log ("extract_boolean"); - checkExtractBadOperation( TCKind._tk_boolean ) ; + public boolean extract_boolean() { + // debug.log ("extract_boolean"); + checkExtractBadOperation(TCKind._tk_boolean); return value != 0; } /** * See the description of the general Any operations. */ - public void insert_char(char c) - { - //debug.log ("insert_char"); + public void insert_char(char c) { + // debug.log ("insert_char"); typeCode = orb.get_primitive_tc(TCKind._tk_char); value = c; isInitialized = true; @@ -880,19 +840,17 @@ public void insert_char(char c) /** * See the description of the general Any operations. */ - public char extract_char() - { - //debug.log ("extract_char"); - checkExtractBadOperation( TCKind._tk_char ) ; - return (char)value; + public char extract_char() { + // debug.log ("extract_char"); + checkExtractBadOperation(TCKind._tk_char); + return (char) value; } /** * See the description of the general Any operations. */ - public void insert_wchar(char c) - { - //debug.log ("insert_wchar"); + public void insert_wchar(char c) { + // debug.log ("insert_wchar"); typeCode = orb.get_primitive_tc(TCKind._tk_wchar); value = c; isInitialized = true; @@ -901,20 +859,17 @@ public void insert_wchar(char c) /** * See the description of the general Any operations. */ - public char extract_wchar() - { - //debug.log ("extract_wchar"); - checkExtractBadOperation( TCKind._tk_wchar ) ; - return (char)value; + public char extract_wchar() { + // debug.log ("extract_wchar"); + checkExtractBadOperation(TCKind._tk_wchar); + return (char) value; } - /** * See the description of the general Any operations. */ - public void insert_octet(byte b) - { - //debug.log ("insert_octet"); + public void insert_octet(byte b) { + // debug.log ("insert_octet"); typeCode = orb.get_primitive_tc(TCKind._tk_octet); value = b; isInitialized = true; @@ -923,31 +878,29 @@ public void insert_octet(byte b) /** * See the description of the general Any operations. */ - public byte extract_octet() - { - //debug.log ("extract_octet"); - checkExtractBadOperation( TCKind._tk_octet ) ; - return (byte)value; + public byte extract_octet() { + // debug.log ("extract_octet"); + checkExtractBadOperation(TCKind._tk_octet); + return (byte) value; } /** * See the description of the general Any operations. */ - public void insert_string(String s) - { - //debug.log ("insert_string"); + public void insert_string(String s) { + // debug.log ("insert_string"); // Make sure type code information for bounded strings is not erased if (typeCode.kind() == TCKind.tk_string) { int length; - try { - length = typeCode.length(); + try { + length = typeCode.length(); } catch (BadKind bad) { - throw wrapper.badkindCannotOccur() ; + throw wrapper.badkindCannotOccur(); } // Check if bounded strings length is not exceeded if (length != 0 && s != null && s.length() > length) { - throw wrapper.badStringBounds(s.length(), length) ; + throw wrapper.badStringBounds(s.length(), length); } } else { typeCode = orb.get_primitive_tc(TCKind._tk_string); @@ -959,31 +912,29 @@ public void insert_string(String s) /** * See the description of the general Any operations. */ - public String extract_string() - { - //debug.log ("extract_string"); - checkExtractBadOperation( TCKind._tk_string ) ; - return (String)object; + public String extract_string() { + // debug.log ("extract_string"); + checkExtractBadOperation(TCKind._tk_string); + return (String) object; } /** * See the description of the general Any operations. */ - public void insert_wstring(String s) - { - //debug.log ("insert_wstring"); + public void insert_wstring(String s) { + // debug.log ("insert_wstring"); // Make sure type code information for bounded strings is not erased if (typeCode.kind() == TCKind.tk_wstring) { int length; - try { - length = typeCode.length(); + try { + length = typeCode.length(); } catch (BadKind bad) { - throw wrapper.badkindCannotOccur() ; + throw wrapper.badkindCannotOccur(); } // Check if bounded strings length is not exceeded if (length != 0 && s != null && s.length() > length) { - throw wrapper.badStringBounds( s.length(), length ) ; + throw wrapper.badStringBounds(s.length(), length); } } else { typeCode = orb.get_primitive_tc(TCKind._tk_wstring); @@ -995,19 +946,17 @@ public void insert_wstring(String s) /** * See the description of the general Any operations. */ - public String extract_wstring() - { - //debug.log ("extract_wstring"); - checkExtractBadOperation( TCKind._tk_wstring ) ; - return (String)object; + public String extract_wstring() { + // debug.log ("extract_wstring"); + checkExtractBadOperation(TCKind._tk_wstring); + return (String) object; } /** * See the description of the general Any operations. */ - public void insert_any(Any a) - { - //debug.log ("insert_any"); + public void insert_any(Any a) { + // debug.log ("insert_any"); typeCode = orb.get_primitive_tc(TCKind._tk_any); object = a; stream = null; @@ -1017,51 +966,48 @@ public void insert_any(Any a) /** * See the description of the general Any operations. */ - public Any extract_any() - { - //debug.log ("extract_any"); - checkExtractBadOperation( TCKind._tk_any ) ; - return (Any)object; + public Any extract_any() { + // debug.log ("extract_any"); + checkExtractBadOperation(TCKind._tk_any); + return (Any) object; } /** * See the description of the general Any operations. */ - public void insert_Object(org.omg.CORBA.Object o) - { - //debug.log ("insert_Object"); - if ( o == null ) { + public void insert_Object(org.omg.CORBA.Object o) { + // debug.log ("insert_Object"); + if (o == null) { typeCode = orb.get_primitive_tc(TCKind._tk_objref); } else { if (StubAdapter.isStub(o)) { - String[] ids = StubAdapter.getTypeIds( o ) ; + String[] ids = StubAdapter.getTypeIds(o); typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], ""); } else { - throw wrapper.badInsertobjParam( o.getClass().getName() ) ; + throw wrapper.badInsertobjParam(o.getClass().getName()); } } - + object = o; isInitialized = true; } /** - * A variant of the insertion operation that takes a typecode - * argument as well. + * A variant of the insertion operation that takes a typecode argument as well. + * * @param tc TypeCode to insert into o. */ - public void insert_Object(org.omg.CORBA.Object o, TypeCode tc) - { - //debug.log ("insert_Object2"); + public void insert_Object(org.omg.CORBA.Object o, TypeCode tc) { + // debug.log ("insert_Object2"); try { - if ( tc.id().equals("IDL:omg.org/CORBA/Object:1.0") || o._is_a(tc.id()) ) { + if (tc.id().equals("IDL:omg.org/CORBA/Object:1.0") || o._is_a(tc.id())) { typeCode = TypeCodeImpl.convertToNative(orb, tc); object = o; } else { - throw wrapper.insertObjectIncompatible() ; + throw wrapper.insertObjectIncompatible(); } - } catch ( Exception ex ) { - throw wrapper.insertObjectFailed(ex) ; + } catch (Exception ex) { + throw wrapper.insertObjectFailed(ex); } isInitialized = true; @@ -1070,9 +1016,8 @@ public void insert_Object(org.omg.CORBA.Object o, TypeCode tc) /** * See the description of the general Any operations. */ - public org.omg.CORBA.Object extract_Object() - { - //debug.log ("extract_Object"); + public org.omg.CORBA.Object extract_Object() { + // debug.log ("extract_Object"); if (!isInitialized) { throw wrapper.extractNotInitialized(); } @@ -1084,20 +1029,20 @@ public org.omg.CORBA.Object extract_Object() if (typeCode.id().equals("IDL:omg.org/CORBA/Object:1.0") || obj._is_a(typeCode.id())) { return obj; } else { - throw wrapper.extractObjectIncompatible() ; + throw wrapper.extractObjectIncompatible(); } - } catch ( Exception ex ) { + } catch (Exception ex) { throw wrapper.extractObjectFailed(ex); } } /** * See the description of the general Any operations. + * * @param tc TypeCode to insert. */ - public void insert_TypeCode(TypeCode tc) - { - //debug.log ("insert_TypeCode"); + public void insert_TypeCode(TypeCode tc) { + // debug.log ("insert_TypeCode"); typeCode = orb.get_primitive_tc(TCKind._tk_TypeCode); object = tc; isInitialized = true; @@ -1106,58 +1051,50 @@ public void insert_TypeCode(TypeCode tc) /** * See the description of the general Any operations. */ - public TypeCode extract_TypeCode() - { - //debug.log ("extract_TypeCode"); - checkExtractBadOperation( TCKind._tk_TypeCode ) ; - return (TypeCode)object; + public TypeCode extract_TypeCode() { + // debug.log ("extract_TypeCode"); + checkExtractBadOperation(TCKind._tk_TypeCode); + return (TypeCode) object; } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) @Override - public void insert_Principal(org.omg.CORBA.Principal p) - { + public void insert_Principal(org.omg.CORBA.Principal p) { typeCode = orb.get_primitive_tc(TCKind._tk_Principal); object = p; isInitialized = true; } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) @Override - public org.omg.CORBA.Principal extract_Principal() - { - checkExtractBadOperation( TCKind._tk_Principal ) ; - return org.omg.CORBA.Principal.class.cast( object ) ; + public org.omg.CORBA.Principal extract_Principal() { + checkExtractBadOperation(TCKind._tk_Principal); + return org.omg.CORBA.Principal.class.cast(object); } /** - * Note that the Serializable really should be an IDLEntity of - * some kind. It shouldn't just be an RMI-IIOP type. Currently, - * we accept and will produce RMI repIds with the latest - * calculations if given a non-IDLEntity Serializable. + * Note that the Serializable really should be an IDLEntity of some kind. It shouldn't just be an RMI-IIOP type. + * Currently, we accept and will produce RMI repIds with the latest calculations if given a non-IDLEntity Serializable. */ - public Serializable extract_Value() - { - //debug.log ("extract_Value"); - checkExtractBadOperationList( new int[] { TCKind._tk_value, - TCKind._tk_value_box, TCKind._tk_abstract_interface } ) ; - return (Serializable)object; + public Serializable extract_Value() { + // debug.log ("extract_Value"); + checkExtractBadOperationList(new int[] { TCKind._tk_value, TCKind._tk_value_box, TCKind._tk_abstract_interface }); + return (Serializable) object; } - public void insert_Value(Serializable v) - { - //debug.log ("insert_Value"); + public void insert_Value(Serializable v) { + // debug.log ("insert_Value"); object = v; TypeCode tc; - if ( v == null ) { - tc = orb.get_primitive_tc (TCKind.tk_value); + if (v == null) { + tc = orb.get_primitive_tc(TCKind.tk_value); } else { - // See note in getPrimitiveTypeCodeForClass. We + // See note in getPrimitiveTypeCodeForClass. We // have to use the latest type code fixes in this // case since there is no way to know what ORB will - // actually send this Any. In RMI-IIOP, when using + // actually send this Any. In RMI-IIOP, when using // Util.writeAny, we can do the versioning correctly, // and use the insert_Value(Serializable, TypeCode) // method. @@ -1169,10 +1106,9 @@ public void insert_Value(Serializable v) typeCode = TypeCodeImpl.convertToNative(orb, tc); isInitialized = true; } - - public void insert_Value(Serializable v, org.omg.CORBA.TypeCode t) - { - //debug.log ("insert_Value2"); + + public void insert_Value(Serializable v, org.omg.CORBA.TypeCode t) { + // debug.log ("insert_Value2"); object = v; typeCode = TypeCodeImpl.convertToNative(orb, t); isInitialized = true; @@ -1180,24 +1116,20 @@ public void insert_Value(Serializable v, org.omg.CORBA.TypeCode t) @Override public void insert_fixed(java.math.BigDecimal value) { - typeCode = TypeCodeImpl.convertToNative(orb, - orb.create_fixed_tc(TypeCodeImpl.digits(value), TypeCodeImpl.scale(value))); + typeCode = TypeCodeImpl.convertToNative(orb, orb.create_fixed_tc(TypeCodeImpl.digits(value), TypeCodeImpl.scale(value))); object = value; isInitialized = true; } @Override - public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type) - { + public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type) { try { - if (TypeCodeImpl.digits(value) > type.fixed_digits() || - TypeCodeImpl.scale(value) > type.fixed_scale()) - { - throw wrapper.fixedNotMatch() ; + if (TypeCodeImpl.digits(value) > type.fixed_digits() || TypeCodeImpl.scale(value) > type.fixed_scale()) { + throw wrapper.fixedNotMatch(); } } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) { // type isn't even of kind fixed - throw wrapper.fixedBadTypecode( bk ) ; + throw wrapper.fixedBadTypecode(bk); } typeCode = TypeCodeImpl.convertToNative(orb, type); object = value; @@ -1206,21 +1138,21 @@ public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type @Override public java.math.BigDecimal extract_fixed() { - checkExtractBadOperation( TCKind._tk_fixed ) ; - return (BigDecimal)object; + checkExtractBadOperation(TCKind._tk_fixed); + return (BigDecimal) object; } /** * Utility method for insert_Value and Util.writeAny. * - * The ORB passed in should have the desired ORBVersion. It - * is used to generate the type codes. + * The ORB passed in should have the desired ORBVersion. It is used to generate the type codes. + * * @param c The Class for which a TypeCode is needed. * @param tcORB ORB to use when creating TypeCode. * @return The newly created TypeCode. */ @DynamicType - public static TypeCode createTypeCodeForClass (java.lang.Class c, ORB tcORB) { + public static TypeCode createTypeCodeForClass(java.lang.Class c, ORB tcORB) { // Look in the cache first TypeCodeImpl classTC = tcORB.getTypeCodeForClass(c); if (classTC != null) { @@ -1231,40 +1163,36 @@ public static TypeCode createTypeCodeForClass (java.lang.Class c, ORB tcORB) { // // See bug 4391648 for more info about the tcORB in this // case. - RepositoryIdStrings repStrs - = RepositoryIdFactory.getRepIdStringsFactory(); - + RepositoryIdStrings repStrs = RepositoryIdFactory.getRepIdStringsFactory(); // Assertion: c instanceof Serializable? - if ( c.isArray() ) { + if (c.isArray()) { // Arrays - may recurse for multi-dimensional arrays Class componentClass = c.getComponentType(); TypeCode embeddedType; - if ( componentClass.isPrimitive() ) { - embeddedType = getPrimitiveTypeCodeForClass(componentClass, - tcORB); + if (componentClass.isPrimitive()) { + embeddedType = getPrimitiveTypeCodeForClass(componentClass, tcORB); } else { - embeddedType = createTypeCodeForClass (componentClass, - tcORB); + embeddedType = createTypeCodeForClass(componentClass, tcORB); } - TypeCode t = tcORB.create_sequence_tc (0, embeddedType); + TypeCode t = tcORB.create_sequence_tc(0, embeddedType); String id = repStrs.createForJavaType(c); - return tcORB.create_value_box_tc (id, "Sequence", t); - } else if ( c == java.lang.String.class ) { + return tcORB.create_value_box_tc(id, "Sequence", t); + } else if (c == java.lang.String.class) { // Strings - TypeCode t = tcORB.create_string_tc (0); + TypeCode t = tcORB.create_string_tc(0); String id = repStrs.createForJavaType(c); - return tcORB.create_value_box_tc (id, "StringValue", t); + return tcORB.create_value_box_tc(id, "StringValue", t); } // Anything else // We know that this is a TypeCodeImpl since it is our ORB - classTC = (TypeCodeImpl)ValueUtility.createTypeCodeForClass(tcORB, c, ORBUtility.createValueHandler()); + classTC = (TypeCodeImpl) ValueUtility.createTypeCodeForClass(tcORB, c, ORBUtility.createValueHandler()); // Intruct classTC to store its buffer classTC.setCaching(true); // Update the cache @@ -1273,55 +1201,53 @@ public static TypeCode createTypeCodeForClass (java.lang.Class c, ORB tcORB) { } /** - * It looks like this was copied from io.ValueUtility at some - * point. + * It looks like this was copied from io.ValueUtility at some point. * - * It's used by createTypeCodeForClass. The tcORB passed in - * should have the desired ORB version, and is used to - * create the type codes. + * It's used by createTypeCodeForClass. The tcORB passed in should have the desired ORB version, and is used to create + * the type codes. + * * @param c the class * @param tcORB the orb to use to find the type code * @return the appropriate primitive type code */ - private static TypeCode getPrimitiveTypeCodeForClass (Class c, ORB tcORB) - { - //debug.log ("getPrimitiveTypeCodeForClass"); + private static TypeCode getPrimitiveTypeCodeForClass(Class c, ORB tcORB) { + // debug.log ("getPrimitiveTypeCodeForClass"); if (c == Integer.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_long); + return tcORB.get_primitive_tc(TCKind.tk_long); } else if (c == Byte.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_octet); + return tcORB.get_primitive_tc(TCKind.tk_octet); } else if (c == Long.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_longlong); + return tcORB.get_primitive_tc(TCKind.tk_longlong); } else if (c == Float.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_float); + return tcORB.get_primitive_tc(TCKind.tk_float); } else if (c == Double.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_double); + return tcORB.get_primitive_tc(TCKind.tk_double); } else if (c == Short.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_short); + return tcORB.get_primitive_tc(TCKind.tk_short); } else if (c == Character.TYPE) { // For Merlin or later JDKs, or for foreign ORBs, // we correctly say that a Java char maps to a - // CORBA wchar. For backwards compatibility + // CORBA wchar. For backwards compatibility // with our older ORBs, we say it maps to a - // CORBA char. This is only used in RMI-IIOP + // CORBA char. This is only used in RMI-IIOP // in our javax.rmi.CORBA.Util delegate's - // writeAny method. In Java IDL, there's no way + // writeAny method. In Java IDL, there's no way // to know the ORB version that the Any will be // sent out with -- it could be different than // the one used to create the Any -- so we use the // most recent version (see insert_Value). - if (ORBVersionFactory.getFOREIGN().compareTo(tcORB.getORBVersion()) == 0 || - ORBVersionFactory.getNEWER().compareTo(tcORB.getORBVersion()) <= 0) { + if (ORBVersionFactory.getFOREIGN().compareTo(tcORB.getORBVersion()) == 0 + || ORBVersionFactory.getNEWER().compareTo(tcORB.getORBVersion()) <= 0) { return tcORB.get_primitive_tc(TCKind.tk_wchar); } else { return tcORB.get_primitive_tc(TCKind.tk_char); } } else if (c == Boolean.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_boolean); + return tcORB.get_primitive_tc(TCKind.tk_boolean); } else { // _REVISIT_ Not sure if this is right. - return tcORB.get_primitive_tc (TCKind.tk_any); + return tcORB.get_primitive_tc(TCKind.tk_any); } } @@ -1340,4 +1266,3 @@ public boolean isInitialized() { return isInitialized; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AnyImplHelper.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AnyImplHelper.java index 3f227c687..39dbeac7e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AnyImplHelper.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AnyImplHelper.java @@ -20,46 +20,39 @@ package com.sun.corba.ee.impl.corba; -abstract public class AnyImplHelper -{ - private static String _id = "IDL:omg.org/CORBA/Any:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Any that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); +abstract public class AnyImplHelper { + private static String _id = "IDL:omg.org/CORBA/Any:1.0"; + + public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.Any that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static org.omg.CORBA.Any extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static org.omg.CORBA.Any extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_any); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static org.omg.CORBA.Any read (org.omg.CORBA.portable.InputStream istream) - { - return istream.read_any (); + public static org.omg.CORBA.Any read(org.omg.CORBA.portable.InputStream istream) { + return istream.read_any(); } - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any value) - { - ostream.write_any (value); + public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any value) { + ostream.write_any(value); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AsynchInvoke.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AsynchInvoke.java index cce6ce8a4..3e322b76e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AsynchInvoke.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/AsynchInvoke.java @@ -20,7 +20,7 @@ package com.sun.corba.ee.impl.corba; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; /////////////////////////////////////////////////////////////////////////// // helper class for deferred invocations @@ -36,32 +36,27 @@ public class AsynchInvoke implements Runnable { private final RequestImpl _req; - private final ORB _orb; - private final boolean _notifyORB; + private final ORB _orb; + private final boolean _notifyORB; - public AsynchInvoke (ORB o, RequestImpl reqToInvokeOn, boolean n) - { + public AsynchInvoke(ORB o, RequestImpl reqToInvokeOn, boolean n) { _orb = o; _req = reqToInvokeOn; _notifyORB = n; }; - /* - * The run operation calls the invocation on the request object, - * updates the RequestImpl state to indicate that the asynchronous - * invocation is complete, and wakes up any client that might be - * waiting on a 'get_response' call. + * The run operation calls the invocation on the request object, updates the RequestImpl state to indicate that the + * asynchronous invocation is complete, and wakes up any client that might be waiting on a 'get_response' call. * */ - public void run() - { + public void run() { synchronized (_req) { // do the actual invocation _req.doInvocation(); } - + // for the asynchronous case, note that the response has been // received. synchronized (_req) { @@ -71,9 +66,9 @@ public void run() // notify any client waiting on a 'get_response' _req.notify(); } - + if (_notifyORB == true) { - _orb.notifyORB() ; + _orb.notifyORB(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ContextImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ContextImpl.java index c9c19480a..660111608 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ContextImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ContextImpl.java @@ -24,60 +24,46 @@ import org.omg.CORBA.Context; import org.omg.CORBA.NVList; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; public final class ContextImpl extends Context { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private org.omg.CORBA.ORB _orb; - public ContextImpl(org.omg.CORBA.ORB orb) - { + public ContextImpl(org.omg.CORBA.ORB orb) { _orb = orb; } - public ContextImpl(Context parent) - { + public ContextImpl(Context parent) { // Ignore: no wrapper available } - - public String context_name() - { - throw wrapper.contextNotImplemented() ; - } - public Context parent() - { - throw wrapper.contextNotImplemented() ; + public String context_name() { + throw wrapper.contextNotImplemented(); } - public Context create_child(String name) - { - throw wrapper.contextNotImplemented() ; + public Context parent() { + throw wrapper.contextNotImplemented(); } - public void set_one_value(String propName, Any propValue) - { - throw wrapper.contextNotImplemented() ; + public Context create_child(String name) { + throw wrapper.contextNotImplemented(); } - public void set_values(NVList values) - { - throw wrapper.contextNotImplemented() ; + public void set_one_value(String propName, Any propValue) { + throw wrapper.contextNotImplemented(); } + public void set_values(NVList values) { + throw wrapper.contextNotImplemented(); + } - public void delete_values(String propName) - { - throw wrapper.contextNotImplemented() ; + public void delete_values(String propName) { + throw wrapper.contextNotImplemented(); } - public NVList get_values(String startScope, - int opFlags, - String propName) - { - throw wrapper.contextNotImplemented() ; + public NVList get_values(String startScope, int opFlags, String propName) { + throw wrapper.contextNotImplemented(); } }; - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ContextListImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ContextListImpl.java index d4f51573e..7cb60993a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ContextListImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ContextListImpl.java @@ -26,33 +26,27 @@ import org.omg.CORBA.Bounds; import org.omg.CORBA.ORB; -public class ContextListImpl extends ContextList -{ - private final static int INITIAL_CAPACITY = 2; +public class ContextListImpl extends ContextList { + private final static int INITIAL_CAPACITY = 2; private org.omg.CORBA.ORB _orb; private List _contexts; - public ContextListImpl(org.omg.CORBA.ORB orb) - { + public ContextListImpl(org.omg.CORBA.ORB orb) { // Note: This orb could be an instanceof ORBSingleton or ORB _orb = orb; _contexts = new ArrayList(INITIAL_CAPACITY); } - public synchronized int count() - { + public synchronized int count() { return _contexts.size(); } - public synchronized void add(String ctxt) - { + public synchronized void add(String ctxt) { _contexts.add(ctxt); } - public synchronized String item(int index) - throws Bounds - { + public synchronized String item(int index) throws Bounds { try { return _contexts.get(index); } catch (IndexOutOfBoundsException e) { @@ -60,9 +54,7 @@ public synchronized String item(int index) } } - public synchronized void remove(int index) - throws Bounds - { + public synchronized void remove(int index) throws Bounds { try { _contexts.remove(index); } catch (IndexOutOfBoundsException e) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/EnvironmentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/EnvironmentImpl.java index c18e7b822..c23a61f5f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/EnvironmentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/EnvironmentImpl.java @@ -28,22 +28,18 @@ public class EnvironmentImpl extends Environment { private Exception _exc; - public EnvironmentImpl() - { + public EnvironmentImpl() { } - - public Exception exception() - { + + public Exception exception() { return _exc; } - public void exception(Exception exc) - { + public void exception(Exception exc) { _exc = exc; } - public void clear() - { + public void clear() { _exc = null; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ExceptionListImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ExceptionListImpl.java index b6bcd8a94..7d1a901ef 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ExceptionListImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ExceptionListImpl.java @@ -28,10 +28,9 @@ import org.omg.CORBA.TypeCode; import org.omg.CORBA.ORB; - public class ExceptionListImpl extends ExceptionList { - private static final int INITIAL_CAPACITY = 2; + private static final int INITIAL_CAPACITY = 2; private List _exceptions; @@ -39,19 +38,15 @@ public ExceptionListImpl() { _exceptions = new ArrayList(INITIAL_CAPACITY); } - public synchronized int count() - { + public synchronized int count() { return _exceptions.size(); } - public synchronized void add(TypeCode tc) - { + public synchronized void add(TypeCode tc) { _exceptions.add(tc); } - public synchronized TypeCode item(int index) - throws Bounds - { + public synchronized TypeCode item(int index) throws Bounds { try { return _exceptions.get(index); } catch (IndexOutOfBoundsException e) { @@ -59,9 +54,7 @@ public synchronized TypeCode item(int index) } } - public synchronized void remove(int index) - throws Bounds - { + public synchronized void remove(int index) throws Bounds { try { _exceptions.remove(index); } catch (IndexOutOfBoundsException e) { @@ -70,4 +63,3 @@ public synchronized void remove(int index) } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/NVListImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/NVListImpl.java index 8fa5720c1..e04dbf302 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/NVListImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/NVListImpl.java @@ -28,60 +28,50 @@ import org.omg.CORBA.NVList; import org.omg.CORBA.NamedValue; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -public class NVListImpl extends NVList -{ - private final static int INITIAL_CAPACITY = 4; +public class NVListImpl extends NVList { + private final static int INITIAL_CAPACITY = 4; private List _namedValues; private ORB orb; - public NVListImpl(ORB orb) - { + public NVListImpl(ORB orb) { // Note: This orb could be an instanceof ORBSingleton or ORB this.orb = orb; _namedValues = new ArrayList(INITIAL_CAPACITY); } - public NVListImpl(ORB orb, int size) - { + public NVListImpl(ORB orb, int size) { this.orb = orb; // Note: the size arg is only a hint of the size of the NVList. _namedValues = new ArrayList(size); } - public synchronized int count() - { + public synchronized int count() { return _namedValues.size(); } - public synchronized NamedValue add(int flags) - { + public synchronized NamedValue add(int flags) { NamedValue tmpVal = new NamedValueImpl(orb, "", new AnyImpl(orb), flags); _namedValues.add(tmpVal); return tmpVal; } - public synchronized NamedValue add_item(String itemName, int flags) - { - NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb), - flags); + public synchronized NamedValue add_item(String itemName, int flags) { + NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb), flags); _namedValues.add(tmpVal); return tmpVal; } - public synchronized NamedValue add_value(String itemName, Any val, int flags) - { + public synchronized NamedValue add_value(String itemName, Any val, int flags) { NamedValue tmpVal = new NamedValueImpl(orb, itemName, val, flags); _namedValues.add(tmpVal); return tmpVal; } - public synchronized NamedValue item(int index) - throws Bounds - { + public synchronized NamedValue item(int index) throws Bounds { try { return _namedValues.get(index); } catch (IndexOutOfBoundsException e) { @@ -89,9 +79,7 @@ public synchronized NamedValue item(int index) } } - public synchronized void remove(int index) - throws Bounds - { + public synchronized void remove(int index) throws Bounds { try { _namedValues.remove(index); } catch (IndexOutOfBoundsException e) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/NamedValueImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/NamedValueImpl.java index 2af951af7..3bda294dd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/NamedValueImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/NamedValueImpl.java @@ -23,46 +23,37 @@ import org.omg.CORBA.NamedValue; import org.omg.CORBA.Any; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -public class NamedValueImpl extends NamedValue -{ +public class NamedValueImpl extends NamedValue { private String _name; - private Any _value; - private int _flags; - private ORB _orb; - - public NamedValueImpl(ORB orb) - { + private Any _value; + private int _flags; + private ORB _orb; + + public NamedValueImpl(ORB orb) { // Note: This orb could be an instanceof ORBSingleton or ORB _orb = orb; _value = new AnyImpl(_orb); } - public NamedValueImpl(ORB orb, - String name, - Any value, - int flags) - { + public NamedValueImpl(ORB orb, String name, Any value, int flags) { // Note: This orb could be an instanceof ORBSingleton or ORB - _orb = orb; - _name = name; - _value = value; - _flags = flags; + _orb = orb; + _name = name; + _value = value; + _flags = flags; } - - public String name() - { + + public String name() { return _name; } - public Any value() - { + public Any value() { return _value; } - public int flags() - { + public int flags() { return _flags; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/PrincipalImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/PrincipalImpl.java index 59cabfa1d..9514ca9a1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/PrincipalImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/PrincipalImpl.java @@ -20,19 +20,15 @@ package com.sun.corba.ee.impl.corba; - -@SuppressWarnings({"deprecation"}) -public class PrincipalImpl extends org.omg.CORBA.Principal -{ +@SuppressWarnings({ "deprecation" }) +public class PrincipalImpl extends org.omg.CORBA.Principal { private byte[] value; - public void name(byte[] value) - { + public void name(byte[] value) { this.value = value.clone(); } - public byte[] name() - { - return value.clone() ; + public byte[] name() { + return value.clone(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/RequestImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/RequestImpl.java index 51bd6cec4..693ce6f43 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/RequestImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/RequestImpl.java @@ -20,7 +20,6 @@ package com.sun.corba.ee.impl.corba; - import org.omg.CORBA.Any; import org.omg.CORBA.ARG_IN; import org.omg.CORBA.ARG_OUT; @@ -36,65 +35,55 @@ import org.omg.CORBA.TCKind; import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.ApplicationException ; -import org.omg.CORBA.portable.RemarshalException ; -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -public class RequestImpl - extends Request -{ +public class RequestImpl extends Request { /////////////////////////////////////////////////////////////////////////// // data members protected org.omg.CORBA.Object _target; - protected String _opName; - protected NVList _arguments; - protected ExceptionList _exceptions; - private NamedValue _result; - protected Environment _env; - private Context _ctx; - private ContextList _ctxList; - protected ORB _orb; - private static final ORBUtilSystemException _wrapper = - ORBUtilSystemException.self ; + protected String _opName; + protected NVList _arguments; + protected ExceptionList _exceptions; + private NamedValue _result; + protected Environment _env; + private Context _ctx; + private ContextList _ctxList; + protected ORB _orb; + private static final ORBUtilSystemException _wrapper = ORBUtilSystemException.self; // invocation-specific stuff - protected boolean _isOneWay = false; - private int[] _paramCodes; - private long[] _paramLongs; - private java.lang.Object[] _paramObjects; + protected boolean _isOneWay = false; + private int[] _paramCodes; + private long[] _paramLongs; + private java.lang.Object[] _paramObjects; - // support for deferred invocations. + // support for deferred invocations. // protected instead of private since it needs to be set by the // thread object doing the asynchronous invocation. - protected boolean gotResponse = false; + protected boolean gotResponse = false; /////////////////////////////////////////////////////////////////////////// // constructor - // REVISIT - used to be protected. Now public so it can be + // REVISIT - used to be protected. Now public so it can be // accessed from xgiop. - public RequestImpl (ORB orb, - org.omg.CORBA.Object targetObject, - Context ctx, - String operationName, - NVList argumentList, - NamedValue resultContainer, - ExceptionList exceptionList, - ContextList ctxList) - { + public RequestImpl(ORB orb, org.omg.CORBA.Object targetObject, Context ctx, String operationName, NVList argumentList, + NamedValue resultContainer, ExceptionList exceptionList, ContextList ctxList) { // initialize the orb - _orb = orb; + _orb = orb; // initialize target, context and operation name - _target = targetObject; - _ctx = ctx; + _target = targetObject; + _ctx = ctx; _opName = operationName; // initialize argument list if not passed in @@ -104,7 +93,7 @@ public RequestImpl (ORB orb, _arguments = argumentList; } - // set result container. + // set result container. _result = resultContainer; // initialize exception list if not passed in @@ -121,175 +110,148 @@ public RequestImpl (ORB orb, _ctxList = ctxList; } - // initialize environment - _env = new EnvironmentImpl(); + // initialize environment + _env = new EnvironmentImpl(); } - public synchronized org.omg.CORBA.Object target() - { + public synchronized org.omg.CORBA.Object target() { return _target; } - public synchronized String operation() - { + public synchronized String operation() { return _opName; } - public synchronized NVList arguments() - { + public synchronized NVList arguments() { return _arguments; } - - public synchronized NamedValue result() - { + + public synchronized NamedValue result() { return _result; } - - public synchronized Environment env() - { + + public synchronized Environment env() { return _env; } - - public synchronized ExceptionList exceptions() - { + + public synchronized ExceptionList exceptions() { return _exceptions; } - - public synchronized ContextList contexts() - { + + public synchronized ContextList contexts() { return _ctxList; } - - public synchronized Context ctx() - { + + public synchronized Context ctx() { if (_ctx == null) { _ctx = new ContextImpl(_orb); } return _ctx; } - - public synchronized void ctx(Context newCtx) - { + + public synchronized void ctx(Context newCtx) { _ctx = newCtx; } - public synchronized Any add_in_arg() - { + public synchronized Any add_in_arg() { return _arguments.add(org.omg.CORBA.ARG_IN.value).value(); } - public synchronized Any add_named_in_arg(String name) - { + public synchronized Any add_named_in_arg(String name) { return _arguments.add_item(name, org.omg.CORBA.ARG_IN.value).value(); } - public synchronized Any add_inout_arg() - { + public synchronized Any add_inout_arg() { return _arguments.add(org.omg.CORBA.ARG_INOUT.value).value(); } - public synchronized Any add_named_inout_arg(String name) - { + public synchronized Any add_named_inout_arg(String name) { return _arguments.add_item(name, org.omg.CORBA.ARG_INOUT.value).value(); } - public synchronized Any add_out_arg() - { + public synchronized Any add_out_arg() { return _arguments.add(org.omg.CORBA.ARG_OUT.value).value(); } - public synchronized Any add_named_out_arg(String name) - { + public synchronized Any add_named_out_arg(String name) { return _arguments.add_item(name, org.omg.CORBA.ARG_OUT.value).value(); } - public synchronized void set_return_type(TypeCode tc) - { + public synchronized void set_return_type(TypeCode tc) { if (_result == null) { _result = new NamedValueImpl(_orb); } _result.value().type(tc); } - public synchronized Any return_value() - { + public synchronized Any return_value() { if (_result == null) { _result = new NamedValueImpl(_orb); } return _result.value(); } - public synchronized void add_exception(TypeCode exceptionType) - { + public synchronized void add_exception(TypeCode exceptionType) { _exceptions.add(exceptionType); } - - public synchronized void invoke() - { + + public synchronized void invoke() { doInvocation(); } - public synchronized void send_oneway() - { + public synchronized void send_oneway() { _isOneWay = true; doInvocation(); } - - public synchronized void send_deferred() - { + + public synchronized void send_deferred() { AsynchInvoke invokeObject = new AsynchInvoke(_orb, this, false); new Thread(invokeObject).start(); } - - public synchronized boolean poll_response() - { + + public synchronized boolean poll_response() { // this method has to be synchronized even though it seems // "readonly" since the thread object doing the asynchronous // invocation can potentially update this variable in parallel. // updates are currently simply synchronized againt the request - // object. + // object. return gotResponse; } - - public synchronized void get_response() - throws org.omg.CORBA.WrongTransaction - { + + public synchronized void get_response() throws org.omg.CORBA.WrongTransaction { while (gotResponse == false) { // release the lock. wait to be notified by the thread that is // doing the asynchronous invocation. try { wait(); - } - catch (InterruptedException e) {} + } catch (InterruptedException e) { + } } } - + /////////////////////////////////////////////////////////////////////////// // private helper methods /* - * The doInvocation operation is where the real mechanics of - * performing the request invocation is done. + * The doInvocation operation is where the real mechanics of performing the request invocation is done. */ - protected void doInvocation() - { - org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate( - _target ) ; - - // Initiate Client Portable Interceptors. Inform the PIHandler that - // this is a DII request so that it knows to ignore the second - // inevitable call to initiateClientPIRequest in createRequest. - // Also, save the RequestImpl object for later use. - _orb.getPIHandler().initiateClientPIRequest( true ); - _orb.getPIHandler().setClientPIInfo( this ); + protected void doInvocation() { + org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate(_target); + + // Initiate Client Portable Interceptors. Inform the PIHandler that + // this is a DII request so that it knows to ignore the second + // inevitable call to initiateClientPIRequest in createRequest. + // Also, save the RequestImpl object for later use. + _orb.getPIHandler().initiateClientPIRequest(true); + _orb.getPIHandler().setClientPIInfo(this); InputStream $in = null; try { OutputStream $out = delegate.request(null, _opName, !_isOneWay); // Marshal args try { - for (int i=0; i<_arguments.count() ; i++) { + for (int i = 0; i < _arguments.count(); i++) { NamedValue nv = _arguments.item(i); switch (nv.flags()) { case ARG_IN.value: @@ -303,8 +265,8 @@ protected void doInvocation() default: } } - } catch ( org.omg.CORBA.Bounds ex ) { - throw _wrapper.boundsErrorInDiiRequest( ex ) ; + } catch (org.omg.CORBA.Bounds ex) { + throw _wrapper.boundsErrorInDiiRequest(ex); } $in = delegate.invoke(null, $out); @@ -312,10 +274,10 @@ protected void doInvocation() // REVISIT - minor code. // This is already handled in subcontract. // REVISIT - uncomment. - //throw new INTERNAL(); + // throw new INTERNAL(); } catch (RemarshalException e) { doInvocation(); - } catch( SystemException ex ) { + } catch (SystemException ex) { _env.exception(ex); // NOTE: The exception should not be thrown. // However, JDK 1.4 and earlier threw the exception, @@ -326,33 +288,32 @@ protected void doInvocation() } } - // REVISIT - make protected after development - so xgiop can get it. - public synchronized void unmarshalReply(InputStream is) - { + // REVISIT - make protected after development - so xgiop can get it. + public synchronized void unmarshalReply(InputStream is) { // First unmarshal the return value if it is not void - if ( _result != null ) { + if (_result != null) { Any returnAny = _result.value(); TypeCode returnType = returnAny.type(); - if ( returnType.kind().value() != TCKind._tk_void ) + if (returnType.kind().value() != TCKind._tk_void) returnAny.read_value(is, returnType); } - + // Now unmarshal the out/inout args try { - for ( int i=0; i<_arguments.count() ; i++) { + for (int i = 0; i < _arguments.count(); i++) { NamedValue nv = _arguments.item(i); - switch( nv.flags() ) { + switch (nv.flags()) { case ARG_IN.value: break; case ARG_OUT.value: case ARG_INOUT.value: - Any any = nv.value(); + Any any = nv.value(); any.read_value(is, any.type()); break; default: } } - } catch ( org.omg.CORBA.Bounds ex ) { + } catch (org.omg.CORBA.Bounds ex) { // Cannot happen since we only iterate till _arguments.count() } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ServerRequestImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ServerRequestImpl.java index 8cdda89bf..290f569f9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ServerRequestImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/ServerRequestImpl.java @@ -31,38 +31,36 @@ import org.omg.CORBA.portable.InputStream; import org.omg.CORBA.portable.OutputStream; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.protocol.MessageMediator; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; public class ServerRequestImpl extends ServerRequest { - private static final ORBUtilSystemException _wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException _wrapper = ORBUtilSystemException.self; /////////////////////////////////////////////////////////////////////////// // data members - private ORB _orb = null; - private String _opName = null; - private NVList _arguments = null; - private Context _ctx = null; - private InputStream _ins = null; - + private ORB _orb = null; + private String _opName = null; + private NVList _arguments = null; + private Context _ctx = null; + private InputStream _ins = null; + // booleans to check for various operation invocation restrictions - private boolean _paramsCalled = false; - private boolean _resultSet = false; - private boolean _exceptionSet = false; - private Any _resultAny = null; - private Any _exception = null; - - - public ServerRequestImpl (MessageMediator req, ORB orb) { - _opName = req.getOperationName(); - _ins = (InputStream)req.getInputObject(); - _ctx = null; // if we support contexts, this would - // presumably also be available on - // the server invocation + private boolean _paramsCalled = false; + private boolean _resultSet = false; + private boolean _exceptionSet = false; + private Any _resultAny = null; + private Any _exception = null; + + public ServerRequestImpl(MessageMediator req, ORB orb) { + _opName = req.getOperationName(); + _ins = (InputStream) req.getInputObject(); + _ctx = null; // if we support contexts, this would + // presumably also be available on + // the server invocation _orb = orb; } @@ -72,95 +70,92 @@ public String operation() { } @Override - public void arguments(NVList args) - { + public void arguments(NVList args) { if (_paramsCalled) - throw _wrapper.argumentsCalledMultiple() ; + throw _wrapper.argumentsCalledMultiple(); - if (_exceptionSet) - throw _wrapper.argumentsCalledAfterException() ; + if (_exceptionSet) + throw _wrapper.argumentsCalledAfterException(); - if (args == null ) - throw _wrapper.argumentsCalledNullArgs() ; + if (args == null) + throw _wrapper.argumentsCalledNullArgs(); _paramsCalled = true; NamedValue arg = null; - for (int i=0; i < args.count() ; i++) { + for (int i = 0; i < args.count(); i++) { try { arg = args.item(i); - } catch (Bounds e) { - throw _wrapper.boundsCannotOccur(e) ; + } catch (Bounds e) { + throw _wrapper.boundsCannotOccur(e); } try { - if ((arg.flags() == org.omg.CORBA.ARG_IN.value) || - (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) { + if ((arg.flags() == org.omg.CORBA.ARG_IN.value) || (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) { // unmarshal the value into the Any arg.value().read_value(_ins, arg.value().type()); } - } catch ( Exception ex ) { - throw _wrapper.badArgumentsNvlist( ex ) ; + } catch (Exception ex) { + throw _wrapper.badArgumentsNvlist(ex); } } // hang on to the NVList for marshaling the result _arguments = args; - _orb.getPIHandler().setServerPIInfo( _arguments ); + _orb.getPIHandler().setServerPIInfo(_arguments); _orb.getPIHandler().invokeServerPIIntermediatePoint(); } - + @Override public void set_result(Any res) { // check for invocation restrictions - if (!_paramsCalled) - throw _wrapper.argumentsNotCalled() ; + if (!_paramsCalled) + throw _wrapper.argumentsNotCalled(); if (_resultSet) - throw _wrapper.setResultCalledMultiple() ; + throw _wrapper.setResultCalledMultiple(); if (_exceptionSet) - throw _wrapper.setResultAfterException() ; - if ( res == null ) - throw _wrapper.setResultCalledNullArgs() ; + throw _wrapper.setResultAfterException(); + if (res == null) + throw _wrapper.setResultCalledNullArgs(); _resultAny = res; _resultSet = true; - // Notify portable interceptors of the result so that + // Notify portable interceptors of the result so that // ServerRequestInfo.result() functions as desired. - _orb.getPIHandler().setServerPIInfo( _resultAny ); + _orb.getPIHandler().setServerPIInfo(_resultAny); // actual marshaling of the reply msg header and params takes place // after the DSI returns control to the ORB. } @Override - public void set_exception(Any exc) - { + public void set_exception(Any exc) { // except can be called by the DIR at any time (CORBA 2.2 section 6.3). - if ( exc == null ) - throw _wrapper.setExceptionCalledNullArgs() ; + if (exc == null) + throw _wrapper.setExceptionCalledNullArgs(); - // Ensure that the Any contains a SystemException or a + // Ensure that the Any contains a SystemException or a // UserException. If the UserException is not a declared exception, // the client will get an UNKNOWN exception. TCKind kind = exc.type().kind(); - if ( kind != TCKind.tk_except ) - throw _wrapper.setExceptionCalledBadType() ; + if (kind != TCKind.tk_except) + throw _wrapper.setExceptionCalledBadType(); _exception = exc; // Inform Portable interceptors of the exception that was set // so sending_exception can return the right value. - _orb.getPIHandler().setServerPIExceptionInfo( _exception ); + _orb.getPIHandler().setServerPIExceptionInfo(_exception); // The user can only call arguments once and not at all after - // set_exception. (internal flags ensure this). However, the user - // can call set_exception multiple times. Therefore, we only + // set_exception. (internal flags ensure this). However, the user + // can call set_exception multiple times. Therefore, we only // invoke receive_request the first time set_exception is // called (if they haven't already called arguments). - if( !_exceptionSet && !_paramsCalled ) { + if (!_exceptionSet && !_paramsCalled) { // We need to invoke intermediate points here. _orb.getPIHandler().invokeServerPIIntermediatePoint(); } @@ -170,77 +165,75 @@ public void set_exception(Any exc) // actual marshaling of the reply msg header and exception takes place // after the DSI returns control to the ORB. } - - /** This is called from the ORB after the DynamicImplementation.invoke - * returns. Here we set the result if result() has not already been called. - * @return the exception if there is one (then ORB will not call - * marshalReplyParams()) otherwise return null. + /** + * This is called from the ORB after the DynamicImplementation.invoke returns. Here we set the result if result() has + * not already been called. + * + * @return the exception if there is one (then ORB will not call marshalReplyParams()) otherwise return null. */ - public Any checkResultCalled() - { + public Any checkResultCalled() { // Two things to be checked (CORBA 2.2 spec, section 6.3): // 1. Unless it calls set_exception(), the DIR must call arguments() - // exactly once, even if the operation signature contains - // no parameters. - // 2. Unless set_exception() is called, if the invoked operation has a - // non-void result type, set_result() must be called exactly once - // before the DIR returns. + // exactly once, even if the operation signature contains + // no parameters. + // 2. Unless set_exception() is called, if the invoked operation has a + // non-void result type, set_result() must be called exactly once + // before the DIR returns. - if ( _paramsCalled && _resultSet ) // normal invocation return + if (_paramsCalled && _resultSet) // normal invocation return return null; - else if ( _paramsCalled && !_resultSet && !_exceptionSet ) { + else if (_paramsCalled && !_resultSet && !_exceptionSet) { try { // Neither a result nor an exception has been set. // Assume that the return type is void. If this is not so, // the client will throw a MARSHAL exception while // unmarshaling the return value. - TypeCode result_tc = _orb.get_primitive_tc( - org.omg.CORBA.TCKind.tk_void); + TypeCode result_tc = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_void); _resultAny = _orb.create_any(); _resultAny.type(result_tc); _resultSet = true; return null; - } catch ( Exception ex ) { - throw _wrapper.dsiResultException( ex ) ; + } catch (Exception ex) { + throw _wrapper.dsiResultException(ex); } - } else if ( _exceptionSet ) + } else if (_exceptionSet) return _exception; - else { - throw _wrapper.dsimethodNotcalled( ) ; + else { + throw _wrapper.dsimethodNotcalled(); } } - /** This is called from the ORB after the DynamicImplementation.invoke - * returns. Here we marshal the return value and inout/out params. + /** + * This is called from the ORB after the DynamicImplementation.invoke returns. Here we marshal the return value and + * inout/out params. + * * @param os OutputStream into which to marshal the parameters */ - public void marshalReplyParams(OutputStream os) - { + public void marshalReplyParams(OutputStream os) { // marshal the operation return value _resultAny.write_value(os); // marshal the inouts/outs NamedValue arg = null; - for (int i=0; i < _arguments.count() ; i++) { + for (int i = 0; i < _arguments.count(); i++) { try { arg = _arguments.item(i); - } catch (Bounds e) {} + } catch (Bounds e) { + } - if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) || - (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) { + if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) || (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) { arg.value().write_value(os); } } } - public Context ctx() - { - if ( !_paramsCalled || _resultSet || _exceptionSet ) - throw _wrapper.contextCalledOutOfOrder() ; + public Context ctx() { + if (!_paramsCalled || _resultSet || _exceptionSet) + throw _wrapper.contextCalledOutOfOrder(); - throw _wrapper.contextNotImplemented() ; - } + throw _wrapper.contextNotImplemented(); + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TCUtility.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TCUtility.java index e95e08855..3d7e1a2f4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TCUtility.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TCUtility.java @@ -30,16 +30,15 @@ import com.sun.corba.ee.impl.encoding.CDROutputObject; import java.io.Serializable; import java.math.BigDecimal; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** - * Static functions for TypeCode interpretation. + * Static functions for TypeCode interpretation. */ public final class TCUtility { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, long l, Object o) { switch (typeCode.kind().value()) { case TCKind._tk_null: @@ -49,24 +48,24 @@ static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, break; case TCKind._tk_short: - s.write_short((short)(l & 0xFFFFL)); + s.write_short((short) (l & 0xFFFFL)); break; case TCKind._tk_ushort: - s.write_ushort((short)(l & 0xFFFFL)); + s.write_ushort((short) (l & 0xFFFFL)); break; case TCKind._tk_enum: case TCKind._tk_long: - s.write_long((int)(l & 0xFFFFFFFFL)); + s.write_long((int) (l & 0xFFFFFFFFL)); break; case TCKind._tk_ulong: - s.write_ulong((int)(l & 0xFFFFFFFFL)); + s.write_ulong((int) (l & 0xFFFFFFFFL)); break; case TCKind._tk_float: - s.write_float(Float.intBitsToFloat((int)(l & 0xFFFFFFFFL))); + s.write_float(Float.intBitsToFloat((int) (l & 0xFFFFFFFFL))); break; case TCKind._tk_double: @@ -74,26 +73,26 @@ static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, break; case TCKind._tk_boolean: - if ( l == 0 ) + if (l == 0) s.write_boolean(false); - else + else s.write_boolean(true); break; case TCKind._tk_char: - s.write_char((char)(l & 0xFFFFL)); + s.write_char((char) (l & 0xFFFFL)); break; case TCKind._tk_octet: - s.write_octet((byte)(l & 0xFFL)); + s.write_octet((byte) (l & 0xFFL)); break; case TCKind._tk_any: - s.write_any((Any)o); + s.write_any((Any) o); break; case TCKind._tk_TypeCode: - s.write_TypeCode((TypeCode)o); + s.write_TypeCode((TypeCode) o); break; case TCKind._tk_Principal: @@ -101,7 +100,7 @@ static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, break; case TCKind._tk_objref: - s.write_Object((org.omg.CORBA.Object)o); + s.write_Object((org.omg.CORBA.Object) o); break; case TCKind._tk_longlong: @@ -113,20 +112,20 @@ static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, break; case TCKind._tk_wchar: - s.write_wchar((char)(l & 0xFFFFL)); + s.write_wchar((char) (l & 0xFFFFL)); break; case TCKind._tk_string: - s.write_string((String)o); + s.write_string((String) o); break; case TCKind._tk_wstring: - s.write_wstring((String)o); + s.write_wstring((String) o); break; case TCKind._tk_value: case TCKind._tk_value_box: - ((org.omg.CORBA_2_3.portable.OutputStream)s).write_value((Serializable)o); + ((org.omg.CORBA_2_3.portable.OutputStream) s).write_value((Serializable) o); break; case TCKind._tk_fixed: @@ -134,13 +133,11 @@ static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, // OutputStream, this check will be unnecessary if (s instanceof CDROutputObject) { try { - ((CDROutputObject)s).write_fixed((BigDecimal)o, - typeCode.fixed_digits(), - typeCode.fixed_scale()); + ((CDROutputObject) s).write_fixed((BigDecimal) o, typeCode.fixed_digits(), typeCode.fixed_scale()); } catch (BadKind badKind) { // impossible } } else { - s.write_fixed((BigDecimal)o); + s.write_fixed((BigDecimal) o); } break; @@ -150,25 +147,24 @@ static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, case TCKind._tk_array: case TCKind._tk_alias: case TCKind._tk_except: - ((Streamable)o)._write(s); + ((Streamable) o)._write(s); break; case TCKind._tk_abstract_interface: - ((org.omg.CORBA_2_3.portable.OutputStream)s).write_abstract_interface(o); + ((org.omg.CORBA_2_3.portable.OutputStream) s).write_abstract_interface(o); break; case TCKind._tk_longdouble: // Unspecified for Java default: - throw wrapper.typecodeNotSupported() ; + throw wrapper.typecodeNotSupported(); } } - static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, long[] la, Object[] oa) - { + static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, long[] la, Object[] oa) { int type = typeCode.kind().value(); - long l=0; - Object o=oa[0]; + long l = 0; + Object o = oa[0]; switch (type) { case TCKind._tk_null: @@ -189,19 +185,19 @@ static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, case TCKind._tk_long: l = s.read_long() & 0xFFFFFFFFL; break; - + case TCKind._tk_ulong: l = s.read_ulong() & 0xFFFFFFFFL; - break; - + break; + case TCKind._tk_float: l = Float.floatToIntBits(s.read_float()) & 0xFFFFFFFFL; break; - + case TCKind._tk_double: l = Double.doubleToLongBits(s.read_double()); break; - + case TCKind._tk_char: l = s.read_char() & 0xFFFFL; break; @@ -211,7 +207,7 @@ static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, break; case TCKind._tk_boolean: - if ( s.read_boolean() ) + if (s.read_boolean()) l = 1; else l = 0; @@ -231,23 +227,23 @@ static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, case TCKind._tk_objref: if (o instanceof Streamable) - ((Streamable)o)._read(s); + ((Streamable) o)._read(s); else o = s.read_Object(); break; - + case TCKind._tk_longlong: l = s.read_longlong(); break; - + case TCKind._tk_ulonglong: l = s.read_ulonglong(); - break; + break; case TCKind._tk_wchar: l = s.read_wchar() & 0xFFFFL; break; - + case TCKind._tk_string: o = s.read_string(); break; @@ -258,7 +254,7 @@ static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, case TCKind._tk_value: case TCKind._tk_value_box: - o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_value (); + o = ((org.omg.CORBA_2_3.portable.InputStream) s).read_value(); break; case TCKind._tk_fixed: @@ -266,11 +262,10 @@ static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to // InputStream, this check will be unnecessary if (s instanceof CDRInputObject) { - o = ((CDRInputObject)s).read_fixed(typeCode.fixed_digits(), - typeCode.fixed_scale()); + o = ((CDRInputObject) s).read_fixed(typeCode.fixed_digits(), typeCode.fixed_scale()); } else { BigDecimal bigDecimal = s.read_fixed(); - o = bigDecimal.movePointLeft((int)typeCode.fixed_scale()); + o = bigDecimal.movePointLeft((int) typeCode.fixed_scale()); } } catch (BadKind badKind) { // impossible } @@ -282,17 +277,17 @@ static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, case TCKind._tk_array: case TCKind._tk_alias: case TCKind._tk_except: - ((Streamable)o)._read(s); + ((Streamable) o)._read(s); break; case TCKind._tk_abstract_interface: - o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_abstract_interface(); + o = ((org.omg.CORBA_2_3.portable.InputStream) s).read_abstract_interface(); break; case TCKind._tk_longdouble: // Unspecified for Java default: - throw wrapper.typecodeNotSupported() ; + throw wrapper.typecodeNotSupported(); } oa[0] = o; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TypeCodeFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TypeCodeFactory.java index cd4d20aee..533dd9a7b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TypeCodeFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TypeCodeFactory.java @@ -24,7 +24,7 @@ public interface TypeCodeFactory { TypeCodeImpl getTypeCode(String id); - void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl ) ; + void setTypeCodeForClass(Class c, TypeCodeImpl tcimpl); - TypeCodeImpl getTypeCodeForClass( Class c ) ; + TypeCodeImpl getTypeCodeForClass(Class c); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TypeCodeImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TypeCodeImpl.java index 6d1f40c50..004f5f7c2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TypeCodeImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/corba/TypeCodeImpl.java @@ -22,13 +22,13 @@ import java.io.PrintStream; import java.io.ByteArrayOutputStream; -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.UnionMember ; -import org.omg.CORBA.ValueMember ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.TypeCodePackage.BadKind ; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.UnionMember; +import org.omg.CORBA.ValueMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCodePackage.BadKind; import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; @@ -47,7 +47,7 @@ import java.io.IOException; import java.io.ObjectInputStream; -import com.sun.corba.ee.spi.trace.DynamicType ; +import com.sun.corba.ee.spi.trace.DynamicType; import org.glassfish.pfl.dynamic.copyobject.spi.Copy; import org.glassfish.pfl.dynamic.copyobject.spi.CopyType; @@ -56,136 +56,101 @@ public final class TypeCodeImpl extends TypeCode { private static final long serialVersionUID = -5320808494290154449L; - // the indirection TCKind, needed for recursive typecodes. + // the indirection TCKind, needed for recursive typecodes. private static final int tk_indirect = 0xFFFFFFFF; - + // typecode encodings have three different categories that determine // how the encoding should be done. - - private static final int EMPTY = 0; // no parameters - private static final int SIMPLE = 1; // simple parameters. - private static final int COMPLEX = 2; // complex parameters. need to - // use CDR encapsulation for parameters + + private static final int EMPTY = 0; // no parameters + private static final int SIMPLE = 1; // simple parameters. + private static final int COMPLEX = 2; // complex parameters. need to + // use CDR encapsulation for parameters // a table storing the encoding category for the various typecodes. - private static final int typeTable[] = { - EMPTY, // tk_null - EMPTY, // tk_void - EMPTY, // tk_short - EMPTY, // tk_long - EMPTY, // tk_ushort - EMPTY, // tk_ulong - EMPTY, // tk_float - EMPTY, // tk_double - EMPTY, // tk_boolean - EMPTY, // tk_char - EMPTY, // tk_octet - EMPTY, // tk_any - EMPTY, // tk_typecode - EMPTY, // tk_principal - COMPLEX, // tk_objref - COMPLEX, // tk_struct - COMPLEX, // tk_union - COMPLEX, // tk_enum - SIMPLE, // tk_string - COMPLEX, // tk_sequence - COMPLEX, // tk_array - COMPLEX, // tk_alias - COMPLEX, // tk_except - EMPTY, // tk_longlong - EMPTY, // tk_ulonglong - EMPTY, // tk_longdouble - EMPTY, // tk_wchar - SIMPLE, // tk_wstring - SIMPLE, // tk_fixed - COMPLEX, // tk_value - COMPLEX, // tk_value_box - COMPLEX, // tk_native - COMPLEX // tk_abstract_interface + private static final int typeTable[] = { EMPTY, // tk_null + EMPTY, // tk_void + EMPTY, // tk_short + EMPTY, // tk_long + EMPTY, // tk_ushort + EMPTY, // tk_ulong + EMPTY, // tk_float + EMPTY, // tk_double + EMPTY, // tk_boolean + EMPTY, // tk_char + EMPTY, // tk_octet + EMPTY, // tk_any + EMPTY, // tk_typecode + EMPTY, // tk_principal + COMPLEX, // tk_objref + COMPLEX, // tk_struct + COMPLEX, // tk_union + COMPLEX, // tk_enum + SIMPLE, // tk_string + COMPLEX, // tk_sequence + COMPLEX, // tk_array + COMPLEX, // tk_alias + COMPLEX, // tk_except + EMPTY, // tk_longlong + EMPTY, // tk_ulonglong + EMPTY, // tk_longdouble + EMPTY, // tk_wchar + SIMPLE, // tk_wstring + SIMPLE, // tk_fixed + COMPLEX, // tk_value + COMPLEX, // tk_value_box + COMPLEX, // tk_native + COMPLEX // tk_abstract_interface }; // Maps TCKind values to names // This is also used in AnyImpl. - static final String[] kindNames = { - "null", - "void", - "short", - "long", - "ushort", - "ulong", - "float", - "double", - "boolean", - "char", - "octet", - "any", - "typecode", - "principal", - "objref", - "struct", - "union", - "enum", - "string", - "sequence", - "array", - "alias", - "exception", - "longlong", - "ulonglong", - "longdouble", - "wchar", - "wstring", - "fixed", - "value", - "valueBox", - "native", - "abstractInterface" - }; - - private int _kind = 0; // the typecode kind - - // data members for representing the various kinds of typecodes. - private String _id = ""; // the typecode repository id - private String _name = ""; // the typecode name - private int _memberCount = 0; // member count - private String _memberNames[] = null; // names of members - private TypeCodeImpl _memberTypes[] = null; // types of members - private AnyImpl _unionLabels[] = null; // values of union labels - private TypeCodeImpl _discriminator = null; // union discriminator type - private int _defaultIndex = -1; // union default index - private int _length = 0; // string/seq/array length - private TypeCodeImpl _contentType = null; // seq/array/alias type + static final String[] kindNames = { "null", "void", "short", "long", "ushort", "ulong", "float", "double", "boolean", "char", "octet", + "any", "typecode", "principal", "objref", "struct", "union", "enum", "string", "sequence", "array", "alias", "exception", + "longlong", "ulonglong", "longdouble", "wchar", "wstring", "fixed", "value", "valueBox", "native", "abstractInterface" }; + + private int _kind = 0; // the typecode kind + + // data members for representing the various kinds of typecodes. + private String _id = ""; // the typecode repository id + private String _name = ""; // the typecode name + private int _memberCount = 0; // member count + private String _memberNames[] = null; // names of members + private TypeCodeImpl _memberTypes[] = null; // types of members + private AnyImpl _unionLabels[] = null; // values of union labels + private TypeCodeImpl _discriminator = null; // union discriminator type + private int _defaultIndex = -1; // union default index + private int _length = 0; // string/seq/array length + private TypeCodeImpl _contentType = null; // seq/array/alias type // fixed - private short _digits = 0; - private short _scale = 0; + private short _digits = 0; + private short _scale = 0; // value type - private short _type_modifier = -1; // VM_NONE, VM_CUSTOM, + private short _type_modifier = -1; // VM_NONE, VM_CUSTOM, // VM_ABSTRACT, VM_TRUNCATABLE - private TypeCodeImpl _concrete_base = null; // concrete base type - private short _memberAccess[] = null; // visibility of ValueMember + private TypeCodeImpl _concrete_base = null; // concrete base type + private short _memberAccess[] = null; // visibility of ValueMember // recursive sequence support - private TypeCodeImpl _parent = null; // the enclosing type code - private int _parentOffset = 0; // the level of enclosure + private TypeCodeImpl _parent = null; // the enclosing type code + private int _parentOffset = 0; // the level of enclosure // recursive type code support - private TypeCodeImpl _indirectType = null; + private TypeCodeImpl _indirectType = null; // caches the byte buffer written in write_value for quick remarshaling... - private byte[] outBuffer = null; + private byte[] outBuffer = null; // ... but only if caching is enabled - private boolean cachingEnabled = false; + private boolean cachingEnabled = false; // the ORB instance: may be instanceof ORBSingleton or ORB - @Copy( CopyType.IDENTITY ) - private transient ORB _orb; + @Copy(CopyType.IDENTITY) + private transient ORB _orb; - @Copy( CopyType.IDENTITY ) - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + @Copy(CopyType.IDENTITY) + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Present only to suppress FindBugs warnings - private void readObject( ObjectInputStream is ) throws IOException, - ClassNotFoundException { - _orb = null ; + private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { + _orb = null; } /////////////////////////////////////////////////////////////////////////// @@ -195,24 +160,24 @@ public TypeCodeImpl(ORB orb) { // initialized to tk_null _orb = orb; } - + public TypeCodeImpl(ORB orb, TypeCode tc) // to handle conversion of "remote" typecodes into "native" style. // also see the 'convertToNative(ORB orb, TypeCode tc)' function { - this(orb) ; + this(orb); - createFromNonNativeTypeCode( orb, tc ) ; + createFromNonNativeTypeCode(orb, tc); } @DynamicType - private void createFromNonNativeTypeCode( ORB orb, TypeCode tc ) { + private void createFromNonNativeTypeCode(ORB orb, TypeCode tc) { // This is a protection against misuse of this constructor. // Should only be used if tc is not an instance of this class! // Otherwise we run into problems with recursive/indirect type codes. // _REVISIT_ We should make this constructor private if (tc instanceof TypeCodeImpl) { - TypeCodeImpl tci = (TypeCodeImpl)tc; + TypeCodeImpl tci = (TypeCodeImpl) tc; if (tci._kind == tk_indirect) { throw wrapper.badRemoteTypecode(); } @@ -222,7 +187,7 @@ private void createFromNonNativeTypeCode( ORB orb, TypeCode tc ) { } // set up kind - _kind = tc.kind().value(); + _kind = tc.kind().value(); try { // set up parameters @@ -236,10 +201,10 @@ private void createFromNonNativeTypeCode( ORB orb, TypeCode tc ) { } else { _concrete_base = null; } - //_memberAccess = tc._memberAccess; + // _memberAccess = tc._memberAccess; // Need to reconstruct _memberAccess using member_count() and member_visibility() _memberAccess = new short[tc.member_count()]; - for (int i=0; i < tc.member_count(); i++) { + for (int i = 0; i < tc.member_count(); i++) { _memberAccess[i] = tc.member_visibility(i); } case TCKind._tk_except: @@ -247,14 +212,14 @@ private void createFromNonNativeTypeCode( ORB orb, TypeCode tc ) { case TCKind._tk_union: // set up member types _memberTypes = new TypeCodeImpl[tc.member_count()]; - for (int i=0; i < tc.member_count(); i++) { + for (int i = 0; i < tc.member_count(); i++) { _memberTypes[i] = convertToNative(_orb, tc.member_type(i)); _memberTypes[i].setParent(this); } case TCKind._tk_enum: // set up member names _memberNames = new String[tc.member_count()]; - for (int i=0; i < tc.member_count(); i++) { + for (int i = 0; i < tc.member_count(); i++) { _memberNames[i] = tc.member_name(i); } // set up member count @@ -268,19 +233,19 @@ private void createFromNonNativeTypeCode( ORB orb, TypeCode tc ) { _name = tc.name(); break; } - + // set up stuff for unions switch (_kind) { case TCKind._tk_union: _discriminator = convertToNative(_orb, tc.discriminator_type()); - _defaultIndex = tc.default_index(); + _defaultIndex = tc.default_index(); _unionLabels = new AnyImpl[_memberCount]; - for (int i=0; i < _memberCount; i++) { + for (int i = 0; i < _memberCount; i++) { _unionLabels[i] = new AnyImpl(_orb, tc.member_label(i)); } break; } - + // set up length switch (_kind) { case TCKind._tk_string: @@ -289,7 +254,7 @@ private void createFromNonNativeTypeCode( ORB orb, TypeCode tc ) { case TCKind._tk_array: _length = tc.length(); } - + // set up content type switch (_kind) { case TCKind._tk_sequence: @@ -299,96 +264,94 @@ private void createFromNonNativeTypeCode( ORB orb, TypeCode tc ) { _contentType = convertToNative(_orb, tc.content_type()); } } catch (org.omg.CORBA.TypeCodePackage.Bounds e) { - wrapper.exceptionOnCreatingTypecode( e ) ; + wrapper.exceptionOnCreatingTypecode(e); } catch (BadKind e) { - wrapper.exceptionOnCreatingTypecode( e ) ; + wrapper.exceptionOnCreatingTypecode(e); } // dont have to worry about these since code ensures we dont step // out of bounds. } - + public TypeCodeImpl(ORB orb, int creationKind) { this(orb); - createPrimitiveTypeCode( orb, creationKind ) ; + createPrimitiveTypeCode(orb, creationKind); } @DynamicType - private void createPrimitiveTypeCode( ORB orb, int creationKind ) { + private void createPrimitiveTypeCode(ORB orb, int creationKind) { // private API. dont bother checking that - // (creationKind < 0 || creationKind > typeTable.length) + // (creationKind < 0 || creationKind > typeTable.length) _kind = creationKind; // do initialization for special cases switch (_kind) { - case TCKind._tk_objref: - // this is being used to create typecode for CORBA::Object - setId("IDL:omg.org/CORBA/Object:1.0"); - _name = "Object"; - break; + case TCKind._tk_objref: + // this is being used to create typecode for CORBA::Object + setId("IDL:omg.org/CORBA/Object:1.0"); + _name = "Object"; + break; - case TCKind._tk_string: - case TCKind._tk_wstring: - _length =0; - break; + case TCKind._tk_string: + case TCKind._tk_wstring: + _length = 0; + break; - case TCKind._tk_value: - _concrete_base = null; - break; + case TCKind._tk_value: + _concrete_base = null; + break; } } - public TypeCodeImpl(ORB orb, int creationKind, - String id, String name, StructMember[] members) { + public TypeCodeImpl(ORB orb, int creationKind, String id, String name, StructMember[] members) { this(orb); - createStructTypeCode( orb, creationKind, id, name, members ) ; + createStructTypeCode(orb, creationKind, id, name, members); } @DynamicType - private void createStructTypeCode(ORB orb, int creationKind, - String id, String name, StructMember[] members) { + private void createStructTypeCode(ORB orb, int creationKind, String id, String name, StructMember[] members) { if ((creationKind == TCKind._tk_struct) || (creationKind == TCKind._tk_except)) { - _kind = creationKind; + _kind = creationKind; setId(id); - _name = name; - _memberCount = members.length; - + _name = name; + _memberCount = members.length; + _memberNames = new String[_memberCount]; _memberTypes = new TypeCodeImpl[_memberCount]; - for (int i = 0 ; i < _memberCount ; i++) { + for (int i = 0; i < _memberCount; i++) { _memberNames[i] = members[i].name; _memberTypes[i] = convertToNative(_orb, members[i].type); _memberTypes[i].setParent(this); } - } + } } @DynamicType - private void createUnionTypeCode(ORB orb, int creationKind, String id, String name, - TypeCode discriminator_type, UnionMember[] members) { + private void createUnionTypeCode(ORB orb, int creationKind, String id, String name, TypeCode discriminator_type, + UnionMember[] members) { if (creationKind == TCKind._tk_union) { - _kind = creationKind; + _kind = creationKind; setId(id); - _name = name; - _memberCount = members.length; - _discriminator = convertToNative(_orb, discriminator_type); + _name = name; + _memberCount = members.length; + _discriminator = convertToNative(_orb, discriminator_type); _memberNames = new String[_memberCount]; _memberTypes = new TypeCodeImpl[_memberCount]; _unionLabels = new AnyImpl[_memberCount]; - for (int i = 0 ; i < _memberCount ; i++) { + for (int i = 0; i < _memberCount; i++) { _memberNames[i] = members[i].name; _memberTypes[i] = convertToNative(_orb, members[i].type); _memberTypes[i].setParent(this); _unionLabels[i] = new AnyImpl(_orb, members[i].label); // check whether this is the default branch. if (_unionLabels[i].type().kind() == TCKind.tk_octet) { - if (_unionLabels[i].extract_octet() == (byte)0) { + if (_unionLabels[i].extract_octet() == (byte) 0) { _defaultIndex = i; } } @@ -396,32 +359,31 @@ private void createUnionTypeCode(ORB orb, int creationKind, String id, String na } // else initializes to null } - public TypeCodeImpl(ORB orb, int creationKind, String id, String name, - TypeCode discriminator_type, UnionMember[] members) { + public TypeCodeImpl(ORB orb, int creationKind, String id, String name, TypeCode discriminator_type, UnionMember[] members) { - this(orb) ; - createUnionTypeCode( orb, creationKind, id, name, discriminator_type, members ) ; + this(orb); + createUnionTypeCode(orb, creationKind, id, name, discriminator_type, members); } @DynamicType - private void createValueTypeCode(ORB orb, int creationKind, String id, String name, - short type_modifier, TypeCode concrete_base, ValueMember[] members) { + private void createValueTypeCode(ORB orb, int creationKind, String id, String name, short type_modifier, TypeCode concrete_base, + ValueMember[] members) { if (creationKind == TCKind._tk_value) { - _kind = creationKind; + _kind = creationKind; setId(id); - _name = name; - _type_modifier = type_modifier; + _name = name; + _type_modifier = type_modifier; if (_concrete_base != null) { _concrete_base = convertToNative(_orb, concrete_base); } - _memberCount = members.length; + _memberCount = members.length; _memberNames = new String[_memberCount]; _memberTypes = new TypeCodeImpl[_memberCount]; _memberAccess = new short[_memberCount]; - for (int i = 0 ; i < _memberCount ; i++) { + for (int i = 0; i < _memberCount; i++) { _memberNames[i] = members[i].name; _memberTypes[i] = convertToNative(_orb, members[i].type); _memberTypes[i].setParent(this); @@ -430,74 +392,68 @@ private void createValueTypeCode(ORB orb, int creationKind, String id, String na } // else initializes to null } - public TypeCodeImpl(ORB orb, int creationKind, String id, String name, - short type_modifier, TypeCode concrete_base, ValueMember[] members) { - this(orb) ; + public TypeCodeImpl(ORB orb, int creationKind, String id, String name, short type_modifier, TypeCode concrete_base, + ValueMember[] members) { + this(orb); - createValueTypeCode( orb, creationKind, id, name, type_modifier, concrete_base, members ) ; + createValueTypeCode(orb, creationKind, id, name, type_modifier, concrete_base, members); } @DynamicType - private void createEnumTypeCode(ORB orb, int creationKind, String id, String name, - String[] members) { + private void createEnumTypeCode(ORB orb, int creationKind, String id, String name, String[] members) { if (creationKind == TCKind._tk_enum) { - _kind = creationKind; + _kind = creationKind; setId(id); - _name = name; - _memberCount = members.length; + _name = name; + _memberCount = members.length; _memberNames = new String[_memberCount]; - for (int i = 0 ; i < _memberCount ; i++) { + for (int i = 0; i < _memberCount; i++) { _memberNames[i] = members[i]; } } // else initializes to null } public TypeCodeImpl(ORB orb, int creationKind, String id, String name, String[] members) { - this(orb) ; + this(orb); - createEnumTypeCode( orb, creationKind, id, name, members ) ; + createEnumTypeCode(orb, creationKind, id, name, members); } @DynamicType - private void createAliasTypeCode(ORB orb, int creationKind, String id, String name, - TypeCode original_type) { + private void createAliasTypeCode(ORB orb, int creationKind, String id, String name, TypeCode original_type) { - if (creationKind == TCKind._tk_alias - || creationKind == TCKind._tk_value_box) { + if (creationKind == TCKind._tk_alias || creationKind == TCKind._tk_value_box) { - _kind = creationKind; + _kind = creationKind; setId(id); - _name = name; - _contentType = convertToNative(_orb, original_type); + _name = name; + _contentType = convertToNative(_orb, original_type); } // else initializes to null } public TypeCodeImpl(ORB orb, int creationKind, String id, String name, TypeCode original_type) { - this(orb) ; - createAliasTypeCode( orb, creationKind, id, name, original_type ) ; + this(orb); + createAliasTypeCode(orb, creationKind, id, name, original_type); } @DynamicType private void createObjrefTypeCode(ORB orb, int creationKind, String id, String name) { - if (creationKind == TCKind._tk_objref || - creationKind == TCKind._tk_native || - creationKind == TCKind._tk_abstract_interface) { + if (creationKind == TCKind._tk_objref || creationKind == TCKind._tk_native || creationKind == TCKind._tk_abstract_interface) { - _kind = creationKind; + _kind = creationKind; setId(id); - _name = name; + _name = name; } // else initializes to null } public TypeCodeImpl(ORB orb, int creationKind, String id, String name) { - this(orb) ; - createObjrefTypeCode( orb, creationKind, id, name ) ; + this(orb); + createObjrefTypeCode(orb, creationKind, id, name); } - @DynamicType private void createStringTypeCode(ORB orb, int creationKind, int bound) { if (bound < 0) { @@ -505,75 +461,74 @@ private void createStringTypeCode(ORB orb, int creationKind, int bound) { } if ((creationKind == TCKind._tk_string) || (creationKind == TCKind._tk_wstring)) { - _kind = creationKind; - _length = bound; + _kind = creationKind; + _length = bound; } // else initializes to null } public TypeCodeImpl(ORB orb, int creationKind, int bound) { - this(orb) ; - createStringTypeCode( orb, creationKind, bound ) ; + this(orb); + createStringTypeCode(orb, creationKind, bound); } @DynamicType private void createArrayTypeCode(ORB orb, int creationKind, int bound, TypeCode element_type) { - if ( creationKind == TCKind._tk_sequence || creationKind == TCKind._tk_array ) { - _kind = creationKind; - _length = bound; - _contentType = convertToNative(_orb, element_type); + if (creationKind == TCKind._tk_sequence || creationKind == TCKind._tk_array) { + _kind = creationKind; + _length = bound; + _contentType = convertToNative(_orb, element_type); } // else initializes to null } public TypeCodeImpl(ORB orb, int creationKind, int bound, TypeCode element_type) { - this(orb) ; - createArrayTypeCode( orb, creationKind, bound, element_type ) ; + this(orb); + createArrayTypeCode(orb, creationKind, bound, element_type); } - + @DynamicType private void createRecursiveSequenceTypeCode(ORB orb, int creationKind, int bound, int offset) { if (creationKind == TCKind._tk_sequence) { - _kind = creationKind; - _length = bound; - _parentOffset = offset; + _kind = creationKind; + _length = bound; + _parentOffset = offset; } // else initializes to null } public TypeCodeImpl(ORB orb, int creationKind, int bound, int offset) { - this(orb) ; + this(orb); - createRecursiveSequenceTypeCode( orb, creationKind, bound, offset ) ; + createRecursiveSequenceTypeCode(orb, creationKind, bound, offset); } - @DynamicType private void createRecursiveTypeCode(ORB orb, String id) { - _kind = tk_indirect; + _kind = tk_indirect; // This is the type code of the type we stand in for, not our own. - _id = id; + _id = id; // Try to resolve it now. May return null in which case // we try again later (see indirectType()). tryIndirectType(); } public TypeCodeImpl(ORB orb, String id) { - this(orb) ; + this(orb); - createRecursiveTypeCode( orb, id ) ; + createRecursiveTypeCode(orb, id); } @DynamicType private void createFixedTypeCode(ORB orb, int creationKind, short digits, short scale) { if (creationKind == TCKind._tk_fixed) { - _kind = creationKind; - _digits = digits; - _scale = scale; + _kind = creationKind; + _digits = digits; + _scale = scale; } // else initializes to null } public TypeCodeImpl(ORB orb, int creationKind, short digits, short scale) { - this(orb) ; + this(orb); - createFixedTypeCode( orb, creationKind, digits, scale ) ; + createFixedTypeCode(orb, creationKind, digits, scale); } /////////////////////////////////////////////////////////////////////////// @@ -584,9 +539,7 @@ public TypeCodeImpl(ORB orb, int creationKind, short digits, short scale) { // here we could reduce object creation and also enable more // efficient typecode comparisons for primitive typecodes. // - protected static TypeCodeImpl convertToNative(ORB orb, - TypeCode tc) - { + protected static TypeCodeImpl convertToNative(ORB orb, TypeCode tc) { if (tc instanceof TypeCodeImpl) { return (TypeCodeImpl) tc; } else { @@ -596,7 +549,7 @@ protected static TypeCodeImpl convertToNative(ORB orb, public static CDROutputObject newOutputStream(ORB orb) { TypeCodeOutputStream tcos = OutputStreamFactory.newTypeCodeOutputStream(orb); - //if (debug) System.out.println("Created TypeCodeOutputStream " + tcos + + // if (debug) System.out.println("Created TypeCodeOutputStream " + tcos + // " with no parent"); return tcos; } @@ -607,7 +560,7 @@ private TypeCodeImpl indirectType() { _indirectType = tryIndirectType(); if (_indirectType == null) { // Nothing we can do about that. - throw wrapper.unresolvedRecursiveTypecode() ; + throw wrapper.unresolvedRecursiveTypecode(); } return _indirectType; } @@ -630,8 +583,8 @@ private void setIndirectType(TypeCodeImpl newType) { _id = _indirectType.id(); } catch (BadKind e) { // can't happen - throw wrapper.badkindCannotOccur() ; - } + throw wrapper.badkindCannotOccur(); + } } } @@ -682,9 +635,9 @@ private TypeCode realType(TypeCode aType) { while (realType.kind().value() == TCKind._tk_alias) { realType = realType.content_type(); } - } catch (BadKind bad) { + } catch (BadKind bad) { // impossible - throw wrapper.badkindCannotOccur() ; + throw wrapper.badkindCannotOccur(); } return realType; } @@ -701,7 +654,7 @@ public final boolean equal(TypeCode tc) { try { if (_kind == tk_indirect) { - //return indirectType().equal(tc); + // return indirectType().equal(tc); if (_id != null && tc.id() != null) { return _id.equals(tc.id()); } @@ -717,7 +670,7 @@ public final boolean equal(TypeCode tc) { case EMPTY: // no parameters to check. return true; - + case SIMPLE: switch (_kind) { case TCKind._tk_string: @@ -730,191 +683,178 @@ public final boolean equal(TypeCode tc) { default: return false; } - - case COMPLEX: - switch(_kind) { + case COMPLEX: - case TCKind._tk_objref: - { - // check for logical id. - if (_id.compareTo(tc.id()) == 0) { - return true; - } + switch (_kind) { - if (_id.compareTo( - (_orb.get_primitive_tc(_kind)).id()) == 0) - { - return true; - } + case TCKind._tk_objref: { + // check for logical id. + if (_id.compareTo(tc.id()) == 0) { + return true; + } - if (tc.id().compareTo( - (_orb.get_primitive_tc(_kind)).id()) == 0) - { - return true; - } + if (_id.compareTo((_orb.get_primitive_tc(_kind)).id()) == 0) { + return true; + } - return false; + if (tc.id().compareTo((_orb.get_primitive_tc(_kind)).id()) == 0) { + return true; } + return false; + } + case TCKind._tk_native: - case TCKind._tk_abstract_interface: - { - // check for logical id. - if (_id.compareTo(tc.id()) != 0) { - return false; + case TCKind._tk_abstract_interface: { + // check for logical id. + if (_id.compareTo(tc.id()) != 0) { + return false; - } - // ignore name since its optional. - return true; } + // ignore name since its optional. + return true; + } case TCKind._tk_struct: - case TCKind._tk_except: - { - // check for member count - if (_memberCount != tc.member_count()) { - return false; - } - // check for repository id - if (_id.compareTo(tc.id()) != 0) { + case TCKind._tk_except: { + // check for member count + if (_memberCount != tc.member_count()) { + return false; + } + // check for repository id + if (_id.compareTo(tc.id()) != 0) { + return false; + } + // check for member types. + for (int i = 0; i < _memberCount; i++) { + if (!_memberTypes[i].equal(tc.member_type(i))) { return false; } - // check for member types. - for (int i = 0 ; i < _memberCount ; i++) { - if (!_memberTypes[i].equal(tc.member_type(i))) { - return false; - } - } - // ignore id and names since those are optional. - return true; } + // ignore id and names since those are optional. + return true; + } - case TCKind._tk_union: - { - // check for member count - if (_memberCount != tc.member_count()) { - return false; - } - // check for repository id - if (_id.compareTo(tc.id()) != 0) { - return false; - } - // check for default index - if (_defaultIndex != tc.default_index()) { + case TCKind._tk_union: { + // check for member count + if (_memberCount != tc.member_count()) { + return false; + } + // check for repository id + if (_id.compareTo(tc.id()) != 0) { + return false; + } + // check for default index + if (_defaultIndex != tc.default_index()) { + return false; + } + // check for discriminator type + if (!_discriminator.equal(tc.discriminator_type())) { + return false; + } + // check for label types and values + for (int i = 0; i < _memberCount; i++) { + if (!_unionLabels[i].equal(tc.member_label(i))) { return false; } - // check for discriminator type - if (!_discriminator.equal(tc.discriminator_type())) { + } + // check for branch types + for (int i = 0; i < _memberCount; i++) { + if (!_memberTypes[i].equal(tc.member_type(i))) { return false; } - // check for label types and values - for (int i = 0 ; i < _memberCount ; i++) { - if (!_unionLabels[i].equal(tc.member_label(i))) { - return false; - } - } - // check for branch types - for (int i = 0 ; i < _memberCount ; i++) { - if (!_memberTypes[i].equal(tc.member_type(i))) { - return false; - } - } - // ignore id and names since those are optional. - return true; } + // ignore id and names since those are optional. + return true; + } - case TCKind._tk_enum: - { - // check for repository id - if (_id.compareTo(tc.id()) != 0) { - return false; - } - // check member count - if (_memberCount != tc.member_count()) { - return false; - } - // ignore names since those are optional. - return true; + case TCKind._tk_enum: { + // check for repository id + if (_id.compareTo(tc.id()) != 0) { + return false; + } + // check member count + if (_memberCount != tc.member_count()) { + return false; } + // ignore names since those are optional. + return true; + } case TCKind._tk_sequence: - case TCKind._tk_array: - { - // check bound/length - if (_length != tc.length()) { - return false; - } - // check content type - if (! lazy_content_type().equal(tc.content_type())) { - return false; - } - // ignore id and name since those are optional. - return true; + case TCKind._tk_array: { + // check bound/length + if (_length != tc.length()) { + return false; + } + // check content type + if (!lazy_content_type().equal(tc.content_type())) { + return false; } + // ignore id and name since those are optional. + return true; + } - case TCKind._tk_value: - { - // check for member count - if (_memberCount != tc.member_count()) { - return false; - } + case TCKind._tk_value: { + // check for member count + if (_memberCount != tc.member_count()) { + return false; + } - // check for repository id - if (_id.compareTo(tc.id()) != 0) { - return false; - } - - // check for member types. - for (int i = 0 ; i < _memberCount ; i++) { - if (_memberAccess[i] != tc.member_visibility(i) || !_memberTypes[i].equal(tc.member_type(i))) { - return false; - } - } - if (_type_modifier == tc.type_modifier()) { + // check for repository id + if (_id.compareTo(tc.id()) != 0) { + return false; + } + + // check for member types. + for (int i = 0; i < _memberCount; i++) { + if (_memberAccess[i] != tc.member_visibility(i) || !_memberTypes[i].equal(tc.member_type(i))) { return false; } - - // concrete_base may be null - TypeCode tccb = tc.concrete_base_type(); + } + if (_type_modifier == tc.type_modifier()) { + return false; + } - if (_concrete_base == null) { - return tccb == null ; - } + // concrete_base may be null + TypeCode tccb = tc.concrete_base_type(); - if (tccb == null) { - return false ; - } + if (_concrete_base == null) { + return tccb == null; + } - // ignore id and names since those are optional. - return _concrete_base.equal(tccb) ; + if (tccb == null) { + return false; } + // ignore id and names since those are optional. + return _concrete_base.equal(tccb); + } + case TCKind._tk_alias: - case TCKind._tk_value_box: - { - // check for repository id - if (_id.compareTo(tc.id()) != 0) { - return false; - } - // check for equality with the true type - return _contentType.equal(tc.content_type()); + case TCKind._tk_value_box: { + // check for repository id + if (_id.compareTo(tc.id()) != 0) { + return false; } + // check for equality with the true type + return _contentType.equal(tc.content_type()); + } } } } catch (org.omg.CORBA.TypeCodePackage.Bounds e) { - wrapper.exceptionInTypecodeEquals( e ) ; + wrapper.exceptionInTypecodeEquals(e); } catch (BadKind e) { - wrapper.exceptionInTypecodeEquals( e ) ; + wrapper.exceptionInTypecodeEquals(e); } return false; } /** - * The equivalent operation is used by the ORB when determining type equivalence - * for values stored in an IDL any. - */ + * The equivalent operation is used by the ORB when determining type equivalence for values stored in an IDL any. + */ @DynamicType public boolean equivalent(TypeCode tc) { if (tc == this) { @@ -922,14 +862,14 @@ public boolean equivalent(TypeCode tc) { } // If the result of the kind operation on either TypeCode is tk_alias, recursively - // replace the TypeCode with the result of calling content_type, until the kind + // replace the TypeCode with the result of calling content_type, until the kind // is no longer tk_alias. // Note: Always resolve indirect types first! TypeCode myRealType = (_kind == tk_indirect ? indirectType() : this); myRealType = realType(myRealType); TypeCode otherRealType = realType(tc); - // If results of the kind operation on each typecode differ, + // If results of the kind operation on each typecode differ, // equivalent returns false. if (myRealType.kind().value() != otherRealType.kind().value()) { return false; @@ -957,77 +897,57 @@ public boolean equivalent(TypeCode tc) { int myKind = myRealType.kind().value(); try { - if (myKind == TCKind._tk_struct || - myKind == TCKind._tk_union || - myKind == TCKind._tk_enum || - myKind == TCKind._tk_except || - myKind == TCKind._tk_value) - { + if (myKind == TCKind._tk_struct || myKind == TCKind._tk_union || myKind == TCKind._tk_enum || myKind == TCKind._tk_except + || myKind == TCKind._tk_value) { if (myRealType.member_count() != otherRealType.member_count()) { return false; } } - if (myKind == TCKind._tk_union) - { + if (myKind == TCKind._tk_union) { if (myRealType.default_index() != otherRealType.default_index()) { return false; } } - if (myKind == TCKind._tk_string || - myKind == TCKind._tk_wstring || - myKind == TCKind._tk_sequence || - myKind == TCKind._tk_array) - { + if (myKind == TCKind._tk_string || myKind == TCKind._tk_wstring || myKind == TCKind._tk_sequence + || myKind == TCKind._tk_array) { if (myRealType.length() != otherRealType.length()) { return false; } } - if (myKind == TCKind._tk_fixed) - { - if (myRealType.fixed_digits() != otherRealType.fixed_digits() || - myRealType.fixed_scale() != otherRealType.fixed_scale()) { + if (myKind == TCKind._tk_fixed) { + if (myRealType.fixed_digits() != otherRealType.fixed_digits() || myRealType.fixed_scale() != otherRealType.fixed_scale()) { return false; } } - if (myKind == TCKind._tk_union) - { - for (int i=0; i typeTable.length) && _kind != tk_indirect) { - throw wrapper.cannotMarshalBadTckind() ; + throw wrapper.cannotMarshalBadTckind(); } // Don't do any work if this is native @@ -1356,9 +1253,9 @@ boolean read_value_kind(TypeCodeReader tcis) { // Now we have to find the referenced type // by its indirectTypePosition within topStream. - //if (debug) System.out.println( + // if (debug) System.out.println( // "TypeCodeImpl looking up indirection at position topPos " + - //topPos + " - 4 + offset " + streamOffset + " = " + indirectTypePosition); + // topPos + " - 4 + offset " + streamOffset + " = " + indirectTypePosition); TypeCodeImpl type = topStream.getTypeCodeAtPosition(indirectTypePosition); if (type == null) { throw wrapper.indirectionNotFound(indirectTypePosition); @@ -1377,7 +1274,7 @@ void read_value_kind(InputStream is) { // check validity of kind if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) { - throw wrapper.cannotMarshalBadTckind() ; + throw wrapper.cannotMarshalBadTckind(); } // Don't do any work if this is native @@ -1386,28 +1283,28 @@ void read_value_kind(InputStream is) { } if (_kind == tk_indirect) { - throw wrapper.recursiveTypecodeError() ; + throw wrapper.recursiveTypecodeError(); } } @DynamicType - private void readValueBodySimple( InputStream is ) { + private void readValueBodySimple(InputStream is) { switch (_kind) { - case TCKind._tk_string: - case TCKind._tk_wstring: - _length = is.read_long(); - break; - case TCKind._tk_fixed: - _digits = is.read_ushort(); - _scale = is.read_short(); - break; - default: - throw wrapper.invalidSimpleTypecode() ; + case TCKind._tk_string: + case TCKind._tk_wstring: + _length = is.read_long(); + break; + case TCKind._tk_fixed: + _digits = is.read_ushort(); + _scale = is.read_short(); + break; + default: + throw wrapper.invalidSimpleTypecode(); } } @DynamicType - private void readValueBodyComplexObjref( TypeCodeInputStream _encap ) { + private void readValueBodyComplexObjref(TypeCodeInputStream _encap) { // get the repository id setId(_encap.read_string()); // get the name @@ -1415,12 +1312,11 @@ private void readValueBodyComplexObjref( TypeCodeInputStream _encap ) { } @DynamicType - private void readValueBodyComplexUnion( InputStream is, - TypeCodeInputStream _encap ) { + private void readValueBodyComplexUnion(InputStream is, TypeCodeInputStream _encap) { setId(_encap.read_string()); _name = _encap.read_string(); - _discriminator = new TypeCodeImpl((ORB)is.orb()); + _discriminator = new TypeCodeImpl((ORB) is.orb()); _discriminator.read_value_recursive(_encap); _defaultIndex = _encap.read_long(); _memberCount = _encap.read_long(); @@ -1428,105 +1324,101 @@ private void readValueBodyComplexUnion( InputStream is, _memberNames = new String[_memberCount]; _memberTypes = new TypeCodeImpl[_memberCount]; - for (int i=0; i < _memberCount; i++) { - _unionLabels[i] = new AnyImpl((ORB)is.orb()); + for (int i = 0; i < _memberCount; i++) { + _unionLabels[i] = new AnyImpl((ORB) is.orb()); if (i == _defaultIndex) { _unionLabels[i].insert_octet(_encap.read_octet()); } else { switch (realType(_discriminator).kind().value()) { - case TCKind._tk_short: - _unionLabels[i].insert_short(_encap.read_short()); - break; - case TCKind._tk_long: - _unionLabels[i].insert_long(_encap.read_long()); - break; - case TCKind._tk_ushort: - _unionLabels[i].insert_ushort(_encap.read_short()); - break; - case TCKind._tk_ulong: - _unionLabels[i].insert_ulong(_encap.read_long()); - break; - case TCKind._tk_float: - _unionLabels[i].insert_float(_encap.read_float()); - break; - case TCKind._tk_double: - _unionLabels[i].insert_double(_encap.read_double()); - break; - case TCKind._tk_boolean: - _unionLabels[i].insert_boolean(_encap.read_boolean()); - break; - case TCKind._tk_char: - _unionLabels[i].insert_char(_encap.read_char()); - break; - case TCKind._tk_enum: - _unionLabels[i].type(_discriminator); - _unionLabels[i].insert_long(_encap.read_long()); - break; - case TCKind._tk_longlong: - _unionLabels[i].insert_longlong(_encap.read_longlong()); - break; - case TCKind._tk_ulonglong: - _unionLabels[i].insert_ulonglong(_encap.read_longlong()); - break; - // _REVISIT_ figure out long double mapping - // case TCKind.tk_longdouble: - // _unionLabels[i].insert_longdouble(_encap.getDouble()); - // break; - case TCKind._tk_wchar: - _unionLabels[i].insert_wchar(_encap.read_wchar()); - break; - default: - throw wrapper.invalidComplexTypecode() ; + case TCKind._tk_short: + _unionLabels[i].insert_short(_encap.read_short()); + break; + case TCKind._tk_long: + _unionLabels[i].insert_long(_encap.read_long()); + break; + case TCKind._tk_ushort: + _unionLabels[i].insert_ushort(_encap.read_short()); + break; + case TCKind._tk_ulong: + _unionLabels[i].insert_ulong(_encap.read_long()); + break; + case TCKind._tk_float: + _unionLabels[i].insert_float(_encap.read_float()); + break; + case TCKind._tk_double: + _unionLabels[i].insert_double(_encap.read_double()); + break; + case TCKind._tk_boolean: + _unionLabels[i].insert_boolean(_encap.read_boolean()); + break; + case TCKind._tk_char: + _unionLabels[i].insert_char(_encap.read_char()); + break; + case TCKind._tk_enum: + _unionLabels[i].type(_discriminator); + _unionLabels[i].insert_long(_encap.read_long()); + break; + case TCKind._tk_longlong: + _unionLabels[i].insert_longlong(_encap.read_longlong()); + break; + case TCKind._tk_ulonglong: + _unionLabels[i].insert_ulonglong(_encap.read_longlong()); + break; + // _REVISIT_ figure out long double mapping + // case TCKind.tk_longdouble: + // _unionLabels[i].insert_longdouble(_encap.getDouble()); + // break; + case TCKind._tk_wchar: + _unionLabels[i].insert_wchar(_encap.read_wchar()); + break; + default: + throw wrapper.invalidComplexTypecode(); } } _memberNames[i] = _encap.read_string(); - _memberTypes[i] = new TypeCodeImpl((ORB)is.orb()); + _memberTypes[i] = new TypeCodeImpl((ORB) is.orb()); _memberTypes[i].read_value_recursive(_encap); _memberTypes[i].setParent(this); } } @DynamicType - private void readValueBodyComplexEnum( TypeCodeInputStream _encap ) { + private void readValueBodyComplexEnum(TypeCodeInputStream _encap) { setId(_encap.read_string()); _name = _encap.read_string(); _memberCount = _encap.read_long(); _memberNames = new String[_memberCount]; - for (int i=0; i < _memberCount; i++) { + for (int i = 0; i < _memberCount; i++) { _memberNames[i] = _encap.read_string(); } } @DynamicType - private void readValueBodyComplexSequence( InputStream is, - TypeCodeInputStream _encap ) { + private void readValueBodyComplexSequence(InputStream is, TypeCodeInputStream _encap) { - _contentType = new TypeCodeImpl((ORB)is.orb()); + _contentType = new TypeCodeImpl((ORB) is.orb()); _contentType.read_value_recursive(_encap); _length = _encap.read_long(); } @DynamicType - private void readValueBodyComplexArray( InputStream is, - TypeCodeInputStream _encap ) { - _contentType = new TypeCodeImpl((ORB)is.orb()); + private void readValueBodyComplexArray(InputStream is, TypeCodeInputStream _encap) { + _contentType = new TypeCodeImpl((ORB) is.orb()); _contentType.read_value_recursive(_encap); _length = _encap.read_long(); } @DynamicType - private void readValueBodyComplexAlias( InputStream is, - TypeCodeInputStream _encap ) { + private void readValueBodyComplexAlias(InputStream is, TypeCodeInputStream _encap) { setId(_encap.read_string()); _name = _encap.read_string(); - _contentType = new TypeCodeImpl((ORB)is.orb()); + _contentType = new TypeCodeImpl((ORB) is.orb()); _contentType.read_value_recursive(_encap); } @DynamicType - private void readValueBodyComplexStruct( InputStream is, - TypeCodeInputStream _encap ) { + private void readValueBodyComplexStruct(InputStream is, TypeCodeInputStream _encap) { setId(_encap.read_string()); _name = _encap.read_string(); @@ -1534,22 +1426,21 @@ private void readValueBodyComplexStruct( InputStream is, _memberNames = new String[_memberCount]; _memberTypes = new TypeCodeImpl[_memberCount]; - for (int i=0; i < _memberCount; i++) { + for (int i = 0; i < _memberCount; i++) { _memberNames[i] = _encap.read_string(); - _memberTypes[i] = new TypeCodeImpl((ORB)is.orb()); + _memberTypes[i] = new TypeCodeImpl((ORB) is.orb()); _memberTypes[i].read_value_recursive(_encap); _memberTypes[i].setParent(this); } } @DynamicType - private void readValueBodyComplexValue( InputStream is, - TypeCodeInputStream _encap ) { + private void readValueBodyComplexValue(InputStream is, TypeCodeInputStream _encap) { setId(_encap.read_string()); _name = _encap.read_string(); _type_modifier = _encap.read_short(); - _concrete_base = new TypeCodeImpl((ORB)is.orb()); + _concrete_base = new TypeCodeImpl((ORB) is.orb()); _concrete_base.read_value_recursive(_encap); if (_concrete_base.kind().value() == TCKind._tk_null) { _concrete_base = null; @@ -1560,9 +1451,9 @@ private void readValueBodyComplexValue( InputStream is, _memberTypes = new TypeCodeImpl[_memberCount]; _memberAccess = new short[_memberCount]; - for (int i=0; i < _memberCount; i++) { + for (int i = 0; i < _memberCount; i++) { _memberNames[i] = _encap.read_string(); - _memberTypes[i] = new TypeCodeImpl((ORB)is.orb()); + _memberTypes[i] = new TypeCodeImpl((ORB) is.orb()); _memberTypes[i].read_value_recursive(_encap); _memberTypes[i].setParent(this); _memberAccess[i] = _encap.read_short(); @@ -1572,65 +1463,64 @@ private void readValueBodyComplexValue( InputStream is, @DynamicType void read_value_body(InputStream is) { switch (typeTable[_kind]) { - case EMPTY: + case EMPTY: + break; + + case SIMPLE: + readValueBodySimple(is); + break; + + case COMPLEX: + TypeCodeInputStream _encap; + _encap = TypeCodeInputStream.readEncapsulation(is, is.orb()); + + switch (_kind) { + case TCKind._tk_objref: + case TCKind._tk_abstract_interface: + readValueBodyComplexObjref(_encap); break; - case SIMPLE: - readValueBodySimple( is ) ; - break ; + case TCKind._tk_union: + readValueBodyComplexUnion(is, _encap); + break; - case COMPLEX: - TypeCodeInputStream _encap ; - _encap = TypeCodeInputStream.readEncapsulation(is, - is.orb()); - - switch(_kind) { - case TCKind._tk_objref: - case TCKind._tk_abstract_interface: - readValueBodyComplexObjref( _encap ) ; - break; - - case TCKind._tk_union: - readValueBodyComplexUnion( is, _encap ) ; - break; - - case TCKind._tk_enum: - readValueBodyComplexEnum( _encap ) ; - break; - - case TCKind._tk_sequence: - readValueBodyComplexSequence( is, _encap ) ; - break; - - case TCKind._tk_array: - readValueBodyComplexArray( is, _encap ) ; - break; - - case TCKind._tk_alias: - case TCKind._tk_value_box: - readValueBodyComplexAlias( is, _encap ) ; - break; - - case TCKind._tk_except: - case TCKind._tk_struct: - readValueBodyComplexStruct( is, _encap ) ; - break; - - case TCKind._tk_value: - readValueBodyComplexValue( is, _encap ) ; - break; - - default: - throw wrapper.invalidTypecodeKindMarshal() ; - } + case TCKind._tk_enum: + readValueBodyComplexEnum(_encap); + break; + + case TCKind._tk_sequence: + readValueBodyComplexSequence(is, _encap); + break; + + case TCKind._tk_array: + readValueBodyComplexArray(is, _encap); + break; + + case TCKind._tk_alias: + case TCKind._tk_value_box: + readValueBodyComplexAlias(is, _encap); + break; + + case TCKind._tk_except: + case TCKind._tk_struct: + readValueBodyComplexStruct(is, _encap); + break; + + case TCKind._tk_value: + readValueBodyComplexValue(is, _encap); break; + + default: + throw wrapper.invalidTypecodeKindMarshal(); + } + break; } } @DynamicType public void write_value(OutputStream os) { if (os instanceof TypeCodeOutputStream) { - this.write_value((TypeCodeOutputStream)os); + this.write_value((TypeCodeOutputStream) os); } else { if (outBuffer == null) { TypeCodeOutputStream wrapperOutStream = TypeCodeOutputStream.wrapOutputStream(os); @@ -1662,184 +1552,182 @@ public void write_value(TypeCodeOutputStream tcos) { } tcos.write_long(_kind); - + // Bug fix 5034649: // Do this AFTER the write of the _kind in case the alignment // for the long changes the position. - topStream.addIDAtPosition(_id, tcos.getTopLevelPosition()-4); + topStream.addIDAtPosition(_id, tcos.getTopLevelPosition() - 4); switch (typeTable[_kind]) { - case EMPTY: - // nothing more to marshal + case EMPTY: + // nothing more to marshal + break; + + case SIMPLE: + switch (_kind) { + case TCKind._tk_string: + case TCKind._tk_wstring: + // marshal the bound on string length + tcos.write_long(_length); break; - - case SIMPLE: - switch (_kind) { - case TCKind._tk_string: - case TCKind._tk_wstring: - // marshal the bound on string length - tcos.write_long(_length); - break; - - case TCKind._tk_fixed: - tcos.write_ushort(_digits); - tcos.write_short(_scale); - break; - - default: - // unknown typecode kind - throw wrapper.invalidSimpleTypecode() ; - } + + case TCKind._tk_fixed: + tcos.write_ushort(_digits); + tcos.write_short(_scale); break; - - case COMPLEX: - TypeCodeOutputStream _encap = tcos.createEncapsulation(tcos.orb()); - - switch(_kind) { - case TCKind._tk_objref: - case TCKind._tk_abstract_interface: - _encap.write_string(_id); - _encap.write_string(_name); - break; - - case TCKind._tk_union: - _encap.write_string(_id); - _encap.write_string(_name); - _discriminator.write_value(_encap); - _encap.write_long(_defaultIndex); - _encap.write_long(_memberCount); - - for (int i=0; i < _memberCount; i++) { - if (i == _defaultIndex) { - _encap.write_octet(_unionLabels[i].extract_octet()); - } else { - switch (realType(_discriminator).kind().value()) { - case TCKind._tk_short: - _encap.write_short(_unionLabels[i].extract_short()); - break; - case TCKind._tk_long: - _encap.write_long(_unionLabels[i].extract_long()); - break; - case TCKind._tk_ushort: - _encap.write_short(_unionLabels[i].extract_ushort()); - break; - case TCKind._tk_ulong: - _encap.write_long(_unionLabels[i].extract_ulong()); - break; - case TCKind._tk_float: - _encap.write_float(_unionLabels[i].extract_float()); - break; - case TCKind._tk_double: - _encap.write_double(_unionLabels[i].extract_double()); - break; - case TCKind._tk_boolean: - _encap.write_boolean(_unionLabels[i].extract_boolean()); - break; - case TCKind._tk_char: - _encap.write_char(_unionLabels[i].extract_char()); - break; - case TCKind._tk_enum: - _encap.write_long(_unionLabels[i].extract_long()); - break; - case TCKind._tk_longlong: - _encap.write_longlong(_unionLabels[i].extract_longlong()); - break; - case TCKind._tk_ulonglong: - _encap.write_longlong(_unionLabels[i].extract_ulonglong()); - break; - case TCKind._tk_wchar: - _encap.write_wchar(_unionLabels[i].extract_wchar()); - break; - default: - throw wrapper.invalidComplexTypecode() ; - } - } - _encap.write_string(_memberNames[i]); - _memberTypes[i].write_value(_encap); - } - break; - case TCKind._tk_enum: - _encap.write_string(_id); - _encap.write_string(_name); - _encap.write_long(_memberCount); + default: + // unknown typecode kind + throw wrapper.invalidSimpleTypecode(); + } + break; - for (int i=0; i < _memberCount; i++) { - _encap.write_string(_memberNames[i]); - } - break; - - case TCKind._tk_sequence: - lazy_content_type().write_value(_encap); - _encap.write_long(_length); - break; - - case TCKind._tk_array: - _contentType.write_value(_encap); - _encap.write_long(_length); - break; - - case TCKind._tk_alias: - case TCKind._tk_value_box: - _encap.write_string(_id); - _encap.write_string(_name); - _contentType.write_value(_encap); - break; - - case TCKind._tk_struct: - case TCKind._tk_except: - _encap.write_string(_id); - _encap.write_string(_name); - _encap.write_long(_memberCount); - - for (int i=0; i < _memberCount; i++) { - _encap.write_string(_memberNames[i]); - _memberTypes[i].write_value(_encap); - } - break; - - case TCKind._tk_value: - _encap.write_string(_id); - _encap.write_string(_name); - _encap.write_short(_type_modifier); - - if (_concrete_base == null) { - _orb.get_primitive_tc(TCKind._tk_null).write_value(_encap); - } else { - _concrete_base.write_value(_encap); - } + case COMPLEX: + TypeCodeOutputStream _encap = tcos.createEncapsulation(tcos.orb()); - _encap.write_long(_memberCount); + switch (_kind) { + case TCKind._tk_objref: + case TCKind._tk_abstract_interface: + _encap.write_string(_id); + _encap.write_string(_name); + break; - for (int i=0; i < _memberCount; i++) { - _encap.write_string(_memberNames[i]); - _memberTypes[i].write_value(_encap); - _encap.write_short(_memberAccess[i]); + case TCKind._tk_union: + _encap.write_string(_id); + _encap.write_string(_name); + _discriminator.write_value(_encap); + _encap.write_long(_defaultIndex); + _encap.write_long(_memberCount); + + for (int i = 0; i < _memberCount; i++) { + if (i == _defaultIndex) { + _encap.write_octet(_unionLabels[i].extract_octet()); + } else { + switch (realType(_discriminator).kind().value()) { + case TCKind._tk_short: + _encap.write_short(_unionLabels[i].extract_short()); + break; + case TCKind._tk_long: + _encap.write_long(_unionLabels[i].extract_long()); + break; + case TCKind._tk_ushort: + _encap.write_short(_unionLabels[i].extract_ushort()); + break; + case TCKind._tk_ulong: + _encap.write_long(_unionLabels[i].extract_ulong()); + break; + case TCKind._tk_float: + _encap.write_float(_unionLabels[i].extract_float()); + break; + case TCKind._tk_double: + _encap.write_double(_unionLabels[i].extract_double()); + break; + case TCKind._tk_boolean: + _encap.write_boolean(_unionLabels[i].extract_boolean()); + break; + case TCKind._tk_char: + _encap.write_char(_unionLabels[i].extract_char()); + break; + case TCKind._tk_enum: + _encap.write_long(_unionLabels[i].extract_long()); + break; + case TCKind._tk_longlong: + _encap.write_longlong(_unionLabels[i].extract_longlong()); + break; + case TCKind._tk_ulonglong: + _encap.write_longlong(_unionLabels[i].extract_ulonglong()); + break; + case TCKind._tk_wchar: + _encap.write_wchar(_unionLabels[i].extract_wchar()); + break; + default: + throw wrapper.invalidComplexTypecode(); } - break; - - default: - throw wrapper.invalidTypecodeKindMarshal() ; + } + _encap.write_string(_memberNames[i]); + _memberTypes[i].write_value(_encap); + } + break; + + case TCKind._tk_enum: + _encap.write_string(_id); + _encap.write_string(_name); + _encap.write_long(_memberCount); + + for (int i = 0; i < _memberCount; i++) { + _encap.write_string(_memberNames[i]); + } + break; + + case TCKind._tk_sequence: + lazy_content_type().write_value(_encap); + _encap.write_long(_length); + break; + + case TCKind._tk_array: + _contentType.write_value(_encap); + _encap.write_long(_length); + break; + + case TCKind._tk_alias: + case TCKind._tk_value_box: + _encap.write_string(_id); + _encap.write_string(_name); + _contentType.write_value(_encap); + break; + + case TCKind._tk_struct: + case TCKind._tk_except: + _encap.write_string(_id); + _encap.write_string(_name); + _encap.write_long(_memberCount); + + for (int i = 0; i < _memberCount; i++) { + _encap.write_string(_memberNames[i]); + _memberTypes[i].write_value(_encap); } + break; + + case TCKind._tk_value: + _encap.write_string(_id); + _encap.write_string(_name); + _encap.write_short(_type_modifier); + + if (_concrete_base == null) { + _orb.get_primitive_tc(TCKind._tk_null).write_value(_encap); + } else { + _concrete_base.write_value(_encap); + } + + _encap.write_long(_memberCount); - // marshal the encapsulation - _encap.writeOctetSequenceTo(tcos); + for (int i = 0; i < _memberCount; i++) { + _encap.write_string(_memberNames[i]); + _memberTypes[i].write_value(_encap); + _encap.write_short(_memberAccess[i]); + } break; + + default: + throw wrapper.invalidTypecodeKindMarshal(); + } + + // marshal the encapsulation + _encap.writeOctetSequenceTo(tcos); + break; } } /** - * This is not a copy of the TypeCodeImpl objects, but instead it - * copies the value this type code is representing. - * See AnyImpl read_value and write_value for usage. - * The state of this TypeCodeImpl instance isn't changed, only used - * by the Any to do the correct copy. + * This is not a copy of the TypeCodeImpl objects, but instead it copies the value this type code is representing. See + * AnyImpl read_value and write_value for usage. The state of this TypeCodeImpl instance isn't changed, only used by the + * Any to do the correct copy. + * * @param src InputStream to copy. * @param dst target for copy. */ @DynamicType - protected void copy(org.omg.CORBA.portable.InputStream src, - org.omg.CORBA.portable.OutputStream dst) { + protected void copy(org.omg.CORBA.portable.InputStream src, org.omg.CORBA.portable.OutputStream dst) { switch (_kind) { case TCKind._tk_null: @@ -1872,12 +1760,12 @@ protected void copy(org.omg.CORBA.portable.InputStream src, break; case TCKind._tk_longdouble: - throw wrapper.tkLongDoubleNotSupported() ; + throw wrapper.tkLongDoubleNotSupported(); case TCKind._tk_boolean: dst.write_boolean(src.read_boolean()); break; - + case TCKind._tk_char: dst.write_char(src.read_char()); break; @@ -1885,7 +1773,7 @@ protected void copy(org.omg.CORBA.portable.InputStream src, case TCKind._tk_wchar: dst.write_wchar(src.read_wchar()); break; - + case TCKind._tk_octet: dst.write_octet(src.read_octet()); break; @@ -1917,20 +1805,20 @@ protected void copy(org.omg.CORBA.portable.InputStream src, dst.write_short(src.read_short()); break; - case TCKind._tk_any: - Any tmp = ((CDRInputObject)src).orb().create_any(); - TypeCodeImpl t = new TypeCodeImpl((ORB)dst.orb()); - t.read_value((org.omg.CORBA_2_3.portable.InputStream)src); - t.write_value((org.omg.CORBA_2_3.portable.OutputStream)dst); + case TCKind._tk_any: + Any tmp = ((CDRInputObject) src).orb().create_any(); + TypeCodeImpl t = new TypeCodeImpl((ORB) dst.orb()); + t.read_value((org.omg.CORBA_2_3.portable.InputStream) src); + t.write_value((org.omg.CORBA_2_3.portable.OutputStream) dst); tmp.read_value(src, t); tmp.write_value(dst); break; - - case TCKind._tk_TypeCode: + + case TCKind._tk_TypeCode: dst.write_TypeCode(src.read_TypeCode()); break; - - case TCKind._tk_Principal: + + case TCKind._tk_Principal: dst.write_Principal(src.read_Principal()); break; @@ -1942,111 +1830,111 @@ protected void copy(org.omg.CORBA.portable.InputStream src, // Copy repositoryId dst.write_string(src.read_string()); - // Fall into ... - // _REVISIT_ what about the inherited members of this values concrete base type? + // Fall into ... + // _REVISIT_ what about the inherited members of this values concrete base type? case TCKind._tk_value: case TCKind._tk_struct: // copy each element, using the corresponding member type - for (int i=0; i < _memberTypes.length; i++) { + for (int i = 0; i < _memberTypes.length; i++) { _memberTypes[i].copy(src, dst); } break; case TCKind._tk_union: - Any tagValue = new AnyImpl( (ORB)src.orb()); + Any tagValue = new AnyImpl((ORB) src.orb()); - switch (realType(_discriminator).kind().value()) { - case TCKind._tk_short: { - short value = src.read_short(); - tagValue.insert_short(value); - dst.write_short(value); - break; - } + switch (realType(_discriminator).kind().value()) { + case TCKind._tk_short: { + short value = src.read_short(); + tagValue.insert_short(value); + dst.write_short(value); + break; + } - case TCKind._tk_long: { - int value = src.read_long(); - tagValue.insert_long(value); - dst.write_long(value); - break; - } + case TCKind._tk_long: { + int value = src.read_long(); + tagValue.insert_long(value); + dst.write_long(value); + break; + } - case TCKind._tk_ushort: { - short value = src.read_short(); - tagValue.insert_ushort(value); - dst.write_short(value); - break; - } + case TCKind._tk_ushort: { + short value = src.read_short(); + tagValue.insert_ushort(value); + dst.write_short(value); + break; + } - case TCKind._tk_ulong: { - int value = src.read_long(); - tagValue.insert_ulong(value); - dst.write_long(value); - break; - } + case TCKind._tk_ulong: { + int value = src.read_long(); + tagValue.insert_ulong(value); + dst.write_long(value); + break; + } - case TCKind._tk_float: { - float value = src.read_float(); - tagValue.insert_float(value); - dst.write_float(value); - break; - } + case TCKind._tk_float: { + float value = src.read_float(); + tagValue.insert_float(value); + dst.write_float(value); + break; + } - case TCKind._tk_double: { - double value = src.read_double(); - tagValue.insert_double(value); - dst.write_double(value); - break; - } + case TCKind._tk_double: { + double value = src.read_double(); + tagValue.insert_double(value); + dst.write_double(value); + break; + } - case TCKind._tk_boolean: { - boolean value = src.read_boolean(); - tagValue.insert_boolean(value); - dst.write_boolean(value); - break; - } + case TCKind._tk_boolean: { + boolean value = src.read_boolean(); + tagValue.insert_boolean(value); + dst.write_boolean(value); + break; + } - case TCKind._tk_char: { - char value = src.read_char(); - tagValue.insert_char(value); - dst.write_char(value); - break; - } + case TCKind._tk_char: { + char value = src.read_char(); + tagValue.insert_char(value); + dst.write_char(value); + break; + } - case TCKind._tk_enum: { - int value = src.read_long(); - tagValue.type(_discriminator); - tagValue.insert_long(value); - dst.write_long(value); - break; - } + case TCKind._tk_enum: { + int value = src.read_long(); + tagValue.type(_discriminator); + tagValue.insert_long(value); + dst.write_long(value); + break; + } - case TCKind._tk_longlong: { - long value = src.read_longlong(); - tagValue.insert_longlong(value); - dst.write_longlong(value); - break; - } - - case TCKind._tk_ulonglong: { - long value = src.read_longlong(); - tagValue.insert_ulonglong(value); - dst.write_longlong(value); - break ; - } + case TCKind._tk_longlong: { + long value = src.read_longlong(); + tagValue.insert_longlong(value); + dst.write_longlong(value); + break; + } - case TCKind._tk_wchar: { - char value = src.read_wchar(); - tagValue.insert_wchar(value); - dst.write_wchar(value); - break; - } + case TCKind._tk_ulonglong: { + long value = src.read_longlong(); + tagValue.insert_ulonglong(value); + dst.write_longlong(value); + break; + } - default: - throw wrapper.illegalUnionDiscriminatorType() ; + case TCKind._tk_wchar: { + char value = src.read_wchar(); + tagValue.insert_wchar(value); + dst.write_wchar(value); + break; + } + + default: + throw wrapper.illegalUnionDiscriminatorType(); } // using the value of the tag, find out the type of the value - // following. + // following. int labelIndex; for (labelIndex = 0; labelIndex < _unionLabels.length; labelIndex++) { @@ -2070,7 +1958,7 @@ protected void copy(org.omg.CORBA.portable.InputStream src, case TCKind._tk_enum: dst.write_long(src.read_long()); break; - + case TCKind._tk_sequence: int seqLength = src.read_long(); @@ -2081,13 +1969,13 @@ protected void copy(org.omg.CORBA.portable.InputStream src, dst.write_long(seqLength); lazy_content_type(); // make sure it's resolved - for (int i=0; i < seqLength; i++) { + for (int i = 0; i < seqLength; i++) { _contentType.copy(src, dst); } break; case TCKind._tk_array: - for (int i=0; i < _length; i++) { + for (int i = 0; i < _length; i++) { _contentType.copy(src, dst); } break; @@ -2106,16 +1994,15 @@ protected void copy(org.omg.CORBA.portable.InputStream src, break; default: - throw wrapper.invalidTypecodeKindMarshal() ; + throw wrapper.invalidTypecodeKindMarshal(); } } - static protected short digits(java.math.BigDecimal value) { if (value == null) { return 0; } - short length = (short)value.unscaledValue().toString().length(); + short length = (short) value.unscaledValue().toString().length(); if (value.signum() == -1) { length--; } @@ -2126,7 +2013,7 @@ static protected short scale(java.math.BigDecimal value) { if (value == null) { return 0; } - return (short)value.scale(); + return (short) value.scale(); } // Utility methods @@ -2140,7 +2027,7 @@ int currentUnionMemberIndex(Any discriminatorValue) throws BadKind { } try { - for (int i=0; i"); - } + case TCKind._tk_null: + case TCKind._tk_void: + case TCKind._tk_short: + case TCKind._tk_long: + case TCKind._tk_ushort: + case TCKind._tk_ulong: + case TCKind._tk_float: + case TCKind._tk_double: + case TCKind._tk_boolean: + case TCKind._tk_char: + case TCKind._tk_octet: + case TCKind._tk_any: + case TCKind._tk_TypeCode: + case TCKind._tk_Principal: + case TCKind._tk_objref: + case TCKind._tk_longlong: + case TCKind._tk_ulonglong: + case TCKind._tk_longdouble: + case TCKind._tk_wchar: + case TCKind._tk_native: + s.print(kindNames[_kind] + " " + _name); + break; - s.println(" " + _memberNames[i] + ";"); + case TCKind._tk_struct: + case TCKind._tk_except: + case TCKind._tk_value: + s.println(kindNames[_kind] + " " + _name + " = {"); + for (int i = 0; i < _memberCount; i++) { + // memberName might differ from the name of the member. + s.print(indent(level + 1)); + if (_memberTypes[i] != null) { + _memberTypes[i].printStream(s, level + 1); + } else { + s.print(""); } - s.print(indent(level) + "}"); - break; - case TCKind._tk_union: - s.print("union " + _name + "..."); - break; + s.println(" " + _memberNames[i] + ";"); + } + s.print(indent(level) + "}"); + break; - case TCKind._tk_enum: - s.print("enum " + _name + "..."); - break; + case TCKind._tk_union: + s.print("union " + _name + "..."); + break; - case TCKind._tk_string: - if (_length == 0) { - s.print("unbounded string " + _name); - } else { - s.print("bounded string(" + _length + ") " + _name); - } - break; + case TCKind._tk_enum: + s.print("enum " + _name + "..."); + break; - case TCKind._tk_sequence: - case TCKind._tk_array: - s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {"); - s.print(indent(level + 1)); - if (lazy_content_type() != null) { - lazy_content_type().printStream(s, level + 1); - } - s.println(indent(level) + "}"); - break; + case TCKind._tk_string: + if (_length == 0) { + s.print("unbounded string " + _name); + } else { + s.print("bounded string(" + _length + ") " + _name); + } + break; - case TCKind._tk_alias: - s.print("alias " + _name + " = " + - (_contentType != null ? _contentType._name : "")); - break; + case TCKind._tk_sequence: + case TCKind._tk_array: + s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {"); + s.print(indent(level + 1)); + if (lazy_content_type() != null) { + lazy_content_type().printStream(s, level + 1); + } + s.println(indent(level) + "}"); + break; - case TCKind._tk_wstring: - s.print("wstring[" + _length + "] " + _name); - break; + case TCKind._tk_alias: + s.print("alias " + _name + " = " + (_contentType != null ? _contentType._name : "")); + break; - case TCKind._tk_fixed: - s.print("fixed(" + _digits + ", " + _scale + ") " + _name); - break; + case TCKind._tk_wstring: + s.print("wstring[" + _length + "] " + _name); + break; - case TCKind._tk_value_box: - s.print("valueBox " + _name + "..."); - break; + case TCKind._tk_fixed: + s.print("fixed(" + _digits + ", " + _scale + ") " + _name); + break; - case TCKind._tk_abstract_interface: - s.print("abstractInterface " + _name + "..."); - break; + case TCKind._tk_value_box: + s.print("valueBox " + _name + "..."); + break; - default: - s.print(""); - break; + case TCKind._tk_abstract_interface: + s.print("abstractInterface " + _name + "..."); + break; + + default: + s.print(""); + break; } } private String indent(int level) { - StringBuilder sb = new StringBuilder() ; - for(int i=0; i= names.length) { + if (!checkInitComponents() || index < 0 || index >= names.length) { throw new InvalidValue(); } return names[index]; } - public TCKind current_member_kind () - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { + public TCKind current_member_kind() + throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; + throw wrapper.dynAnyDestroyed(); } - if( ! checkInitComponents() || index < 0 || index >= components.length) { + if (!checkInitComponents() || index < 0 || index >= components.length) { throw new InvalidValue(); } return components[index].type().kind(); } // Creates references to the parameter instead of copying it. - public void set_members (org.omg.DynamicAny.NameValuePair[] value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { + public void set_members(org.omg.DynamicAny.NameValuePair[] value) + throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; + throw wrapper.dynAnyDestroyed(); } if (value == null || value.length == 0) { clearData(); @@ -152,13 +136,13 @@ public void set_members (org.omg.DynamicAny.NameValuePair[] value) allocComponents(value); - for (int i=0; i= memberCount()) { throw new InvalidValue(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynFixedImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynFixedImpl.java index 2b7878fb5..3dd1e8803 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynFixedImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynFixedImpl.java @@ -25,20 +25,19 @@ import java.math.BigInteger; import org.omg.CORBA.TypeCodePackage.BadKind; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; import org.omg.DynamicAny.DynAnyPackage.InvalidValue; import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; import org.omg.DynamicAny.DynFixed; -public class DynFixedImpl extends DynAnyBasicImpl implements DynFixed -{ +public class DynFixedImpl extends DynAnyBasicImpl implements DynFixed { private static final long serialVersionUID = -426296363713464920L; // // Constructors // private DynFixedImpl() { - this(null, (Any)null, false); + this(null, (Any) null, false); } protected DynFixedImpl(ORB orb, Any any, boolean copyValue) { @@ -54,18 +53,16 @@ protected DynFixedImpl(ORB orb, TypeCode typeCode) { // // DynAny interface methods // -/* - public int component_count() { - return 0; - } -*/ + /* + * public int component_count() { return 0; } + */ // // DynFixed interface methods // - public String get_value () { + public String get_value() { if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; + throw wrapper.dynAnyDestroyed(); } return any.extract_fixed().toString(); } @@ -87,12 +84,10 @@ public String get_value () { // If val does not contain a valid fixed-point literal or contains extraneous characters // other than leading or trailing white space, the operation raises TypeMismatch. // - public boolean set_value (String val) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { + public boolean set_value(String val) + throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; + throw wrapper.dynAnyDestroyed(); } int digits = 0; boolean preservedPrecision = true; @@ -137,7 +132,7 @@ public boolean set_value (String val) fractionPart = null; currentScale = 0; currentDigits = integerPart.length(); - } else if (dotIndex == 0 ) { + } else if (dotIndex == 0) { integerPart = null; fractionPart = string; currentScale = fractionPart.length(); @@ -149,22 +144,21 @@ public boolean set_value (String val) currentDigits = integerPart.length() + currentScale; } - int integerPartLength = (integerPart == null) ? 0 - : integerPart.length() ; - + int integerPartLength = (integerPart == null) ? 0 : integerPart.length(); + // Let's see if we have to drop some precision if (currentDigits > digits) { preservedPrecision = false; // truncate the fraction part if (integerPartLength < digits) { - fractionPart = fractionPart.substring(0, digits - integerPartLength ) ; + fractionPart = fractionPart.substring(0, digits - integerPartLength); } else if (integerPartLength == digits) { // currentScale > 0 // drop the fraction completely fractionPart = null; } else { // integerPartLength > digits - // unable to truncate fraction part + // unable to truncate fraction part throw new InvalidValue(); } } @@ -172,11 +166,9 @@ public boolean set_value (String val) // the operation raises InvalidValue. // Reinterpreted to mean raise InvalidValue only if the integer part exceeds precision, // which is handled above (integerPart.length() > digits) -/* - if (currentScale > scale) { - throw new InvalidValue("Scale exceeds " + scale); - } -*/ + /* + * if (currentScale > scale) { throw new InvalidValue("Scale exceeds " + scale); } + */ // Now check whether both parts are valid numbers BigDecimal result; try { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynSequenceImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynSequenceImpl.java index 6c9ac9fd2..5d54d2502 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynSequenceImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynSequenceImpl.java @@ -27,16 +27,16 @@ import org.omg.DynamicAny.DynAnyPackage.InvalidValue; import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; import org.omg.DynamicAny.DynAny; import org.omg.DynamicAny.DynSequence; // _REVIST_ Could make this a subclass of DynArrayImpl // But that would mean that an object that implements DynSequence also implements DynArray // which the spec doesn't mention (it also doesn't forbid it). -public class DynSequenceImpl extends DynAnyCollectionImpl implements DynSequence -{ +public class DynSequenceImpl extends DynAnyCollectionImpl implements DynSequence { private static final long serialVersionUID = 5355861023015151151L; + // // Constructors // @@ -67,7 +67,7 @@ protected boolean initializeComponentsFromAny() { components = new DynAny[length]; anys = new Any[length]; - for (int i=0; i 0 && len > bound) { @@ -166,7 +163,7 @@ public void set_length(int len) // Newly added elements are default-initialized TypeCode contentType = getContentType(); - for (int i=oldLength; i= len) { index = NO_INDEX; @@ -216,19 +213,16 @@ public void set_length(int len) // the operation raises InvalidValue. // If value contains one or more elements whose TypeCode is not equivalent // to the element TypeCode of the DynSequence, the operation raises TypeMismatch. -/* - public void set_elements(org.omg.CORBA.Any[] value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue; -*/ + /* + * public void set_elements(org.omg.CORBA.Any[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, + * org.omg.DynamicAny.DynAnyPackage.InvalidValue; + */ // // Utility methods // - protected void checkValue(Object[] value) - throws org.omg.DynamicAny.DynAnyPackage.InvalidValue - { + protected void checkValue(Object[] value) throws org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (value == null || value.length == 0) { clearData(); index = NO_INDEX; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynStructImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynStructImpl.java index 8328e0c1e..7b2971278 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynStructImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynStructImpl.java @@ -22,11 +22,10 @@ import org.omg.CORBA.TypeCode; import org.omg.CORBA.Any; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; import org.omg.DynamicAny.DynStruct; -public class DynStructImpl extends DynAnyComplexImpl implements DynStruct -{ +public class DynStructImpl extends DynAnyComplexImpl implements DynStruct { private static final long serialVersionUID = 2832306671453429704L; // @@ -51,19 +50,19 @@ protected DynStructImpl(ORB orb, TypeCode typeCode) { // // Methods differing from DynValues // - public org.omg.DynamicAny.NameValuePair[] get_members () { + public org.omg.DynamicAny.NameValuePair[] get_members() { if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; + throw wrapper.dynAnyDestroyed(); } checkInitComponents(); - return nameValuePairs.clone() ; + return nameValuePairs.clone(); } - public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any () { + public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any() { if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; + throw wrapper.dynAnyDestroyed(); } checkInitComponents(); - return nameDynAnyPairs.clone() ; + return nameDynAnyPairs.clone(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynUnionImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynUnionImpl.java index 80e50601c..9dd7c119e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynUnionImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/dynamicany/DynUnionImpl.java @@ -28,12 +28,11 @@ import org.omg.DynamicAny.DynAnyPackage.InvalidValue; import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; import org.omg.DynamicAny.DynAny; import org.omg.DynamicAny.DynUnion; -public class DynUnionImpl extends DynAnyConstructedImpl implements DynUnion -{ +public class DynUnionImpl extends DynAnyConstructedImpl implements DynUnion { private static final long serialVersionUID = 5712467966035057576L; // // Instance variables @@ -66,7 +65,7 @@ protected boolean initializeComponentsFromAny() { currentMemberIndex = currentUnionMemberIndex(discriminatorAny); Any memberAny = DynAnyUtil.extractAnyFromStream(memberType(currentMemberIndex), input, orb); currentMember = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false); - components = new DynAny[] {discriminator, currentMember}; + components = new DynAny[] { discriminator, currentMember }; } catch (InconsistentTypeCode ictc) { // impossible } return true; @@ -76,14 +75,14 @@ protected boolean initializeComponentsFromAny() { // The discriminator value is set to a value consistent with the first named member // of the union. That member is activated and (recursively) initialized to its default value. protected boolean initializeComponentsFromTypeCode() { - //System.out.println(this + " initializeComponentsFromTypeCode"); + // System.out.println(this + " initializeComponentsFromTypeCode"); try { // We can be sure that memberCount() > 0 according to the IDL language spec discriminator = DynAnyUtil.createMostDerivedDynAny(memberLabel(0), orb, false); index = 0; currentMemberIndex = 0; currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(0), orb); - components = new DynAny[] {discriminator, currentMember}; + components = new DynAny[] { discriminator, currentMember }; } catch (InconsistentTypeCode ictc) { // impossible } return true; @@ -153,7 +152,7 @@ private int defaultIndex() { private int currentUnionMemberIndex(Any discriminatorValue) { int memberCount = memberCount(); Any memberLabel; - for (int i=0; i available - // even after fragmenting. This is the large array case, so + // even after fragmenting. This is the large array case, so // the caller should retry when it runs out of space. byteBuffer.position(0); byteBuffer.limit(byteBuffer.capacity()); @@ -101,9 +98,9 @@ protected ByteBuffer overflow(ByteBuffer byteBuffer, int numBytesNeeded) { // REVISIT - we can optimize this by not creating the fragment message // each time. - FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage(); + FragmentMessage header = ((CDROutputObject) outputObject).getMessageHeader().createFragmentMessage(); - header.write(((CDROutputObject)outputObject)); + header.write(((CDROutputObject) outputObject)); return byteBuffer; } @@ -112,17 +109,16 @@ public boolean isFragmentOnOverflow() { return true; } - private void sendFragment(boolean isLastFragment) - { - Connection conn = ((CDROutputObject)outputObject).getMessageMediator().getConnection(); + private void sendFragment(boolean isLastFragment) { + Connection conn = ((CDROutputObject) outputObject).getMessageMediator().getConnection(); // REVISIT: need an ORB - //System.out.println("sendFragment: last?: " + isLastFragment); + // System.out.println("sendFragment: last?: " + isLastFragment); conn.writeLock(); try { // Send the fragment - conn.sendWithoutLock(((CDROutputObject)outputObject)); + conn.sendWithoutLock(((CDROutputObject) outputObject)); fragmentCount++; @@ -134,8 +130,7 @@ private void sendFragment(boolean isLastFragment) } // Sends the last fragment - public void sendMessage () - { + public void sendMessage() { sendFragment(true); sentFullMessage = true; @@ -146,13 +141,15 @@ public void sendMessage () * * No work to do for a BufferManagerWriteStream */ - public void close(){}; + public void close() { + }; /** * Get CorbaContactInfoListIterator * * NOTE: Requires this.orb - * @return the ContactInfoListIterator + * + * @return the ContactInfoListIterator */ protected ContactInfoListIterator getContactInfoListIterator() { return (ContactInfoListIterator) this.orb.getInvocationInfo().getContactInfoListIterator(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/BufferQueue.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/BufferQueue.java index fe8cae7d0..9e319ce40 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/BufferQueue.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/BufferQueue.java @@ -26,33 +26,27 @@ /** * Simple unsynchronized queue implementation for ByteBuffer. */ -public class BufferQueue -{ - private LinkedList list = - new LinkedList(); - - public void enqueue(ByteBuffer item) - { +public class BufferQueue { + private LinkedList list = new LinkedList(); + + public void enqueue(ByteBuffer item) { list.addLast(item); } - - public ByteBuffer dequeue() throws NoSuchElementException - { + + public ByteBuffer dequeue() throws NoSuchElementException { return list.removeFirst(); } - - public int size() - { + + public int size() { return list.size(); } // Adds the given ByteBuffer to the front of the queue. - public void push(ByteBuffer item) - { + public void push(ByteBuffer item) { list.addFirst(item); } public void clear() { - list.clear() ; + list.clear(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputObject.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputObject.java index 5302b12d8..bc6b26fbf 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputObject.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputObject.java @@ -38,7 +38,7 @@ import com.sun.corba.ee.impl.misc.ORBUtility; import com.sun.corba.ee.spi.protocol.MessageMediator; import com.sun.corba.ee.spi.trace.Transport; -import com.sun.corba.ee.spi.trace.MonitorRead ; +import com.sun.corba.ee.spi.trace.MonitorRead; import java.io.IOException; import java.io.ObjectInputStream; import java.nio.ByteOrder; @@ -51,32 +51,26 @@ */ @Transport @MonitorRead -public class CDRInputObject - extends org.omg.CORBA_2_3.portable.InputStream - implements com.sun.corba.ee.impl.encoding.MarshalInputStream, - org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - private static final OMGSystemException omgWrapper = - OMGSystemException.self ; +public class CDRInputObject extends org.omg.CORBA_2_3.portable.InputStream implements com.sun.corba.ee.impl.encoding.MarshalInputStream, + org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + private static final OMGSystemException omgWrapper = OMGSystemException.self; private static final long serialVersionUID = 3654171034620991056L; - private transient ORB orb ; + private transient ORB orb; private transient CDRInputStreamBase impl; private transient Connection corbaConnection; private transient Message header; protected transient MessageMediator messageMediator; // Present only to suppress FindBugs errors - private void readObject( ObjectInputStream is ) throws IOException, - ClassNotFoundException { + private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { - orb = null ; - impl = null ; - corbaConnection = null ; - header = null ; - messageMediator = null ; + orb = null; + impl = null; + corbaConnection = null; + header = null; + messageMediator = null; } private boolean unmarshaledHeader; @@ -92,50 +86,48 @@ public void cancelProcessing(int requestId) { private static class InputStreamFactory { public static CDRInputStreamBase newInputStream(GIOPVersion version) { - switch(version.intValue()) { - case GIOPVersion.VERSION_1_0: - return new CDRInputStream_1_0(); - case GIOPVersion.VERSION_1_1: - return new CDRInputStream_1_1(); - case GIOPVersion.VERSION_1_2: - return new CDRInputStream_1_2(); - default: - throw wrapper.unsupportedGiopVersion( version ) ; + switch (version.intValue()) { + case GIOPVersion.VERSION_1_0: + return new CDRInputStream_1_0(); + case GIOPVersion.VERSION_1_1: + return new CDRInputStream_1_1(); + case GIOPVersion.VERSION_1_2: + return new CDRInputStream_1_2(); + default: + throw wrapper.unsupportedGiopVersion(version); } } } // Required for the case when a ClientResponseImpl is // created with a SystemException due to a dead server/closed - // connection with no warning. Note that the stream will + // connection with no warning. Note that the stream will // not be initialized in this case. - // + // // Probably also required by ServerRequestImpl. - // + // // REVISIT. public CDRInputObject() { } - public CDRInputObject(CDRInputObject is) { + public CDRInputObject(CDRInputObject is) { impl = is.impl.dup(); impl.setParent(this); } - protected CDRInputObject(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, int size, - ByteOrder byteOrder, GIOPVersion version, - BufferManagerRead bufMgr) { + protected CDRInputObject(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, int size, ByteOrder byteOrder, GIOPVersion version, + BufferManagerRead bufMgr) { - this.orb = (ORB)orb ; + this.orb = (ORB) orb; createCDRInputStream(version, byteBuffer, size, byteOrder, bufMgr); - this.corbaConnection = null ; - this.header = null ; - this.unmarshaledHeader = false ; - this.messageMediator = null ; + this.corbaConnection = null; + this.header = null; + this.unmarshaledHeader = false; + this.messageMediator = null; } - private void createCDRInputStream(GIOPVersion version, ByteBuffer byteBuffer, int size, - ByteOrder byteOrder, BufferManagerRead bufMgr) { + private void createCDRInputStream(GIOPVersion version, ByteBuffer byteBuffer, int size, ByteOrder byteOrder, BufferManagerRead bufMgr) { impl = InputStreamFactory.newInputStream(version); impl.init(orb, byteBuffer, size, byteOrder, bufMgr); impl.setParent(this); @@ -150,7 +142,7 @@ public CDRInputObject(ORB orb, Connection corbaConnection, ByteBuffer byteBuffer createBufferManagerRead(orb, header)); this.corbaConnection = corbaConnection; - this.header = header ; + this.header = header; getBufferManager().init(header); setIndex(Message.GIOPMessageHeaderLength); @@ -165,38 +157,34 @@ private static BufferManagerRead createBufferManagerRead(ORB orb, Message header // This connection normally is accessed from the message mediator. // However, giop input needs to get code set info from the connetion // *before* the message mediator is available. - public final Connection getConnection() - { + public final Connection getConnection() { return corbaConnection; } // XREVISIT - Should the header be kept in the stream or the - // message mediator? Or should we not have a header and + // message mediator? Or should we not have a header and // have the information stored in the message mediator // directly? - public Message getMessageHeader() - { + public Message getMessageHeader() { return header; } - private void unmarshalledHeader( Message msg ) { } + private void unmarshalledHeader(Message msg) { + } /** - * Unmarshal the extended GIOP header - * NOTE: May be fragmented, so should not be called by the ReaderThread. - * See CorbaResponseWaitingRoomImpl.waitForResponse. It is done - * there in the client thread. + * Unmarshal the extended GIOP header NOTE: May be fragmented, so should not be called by the ReaderThread. See + * CorbaResponseWaitingRoomImpl.waitForResponse. It is done there in the client thread. */ @Transport - public void unmarshalHeader() - { + public void unmarshalHeader() { // Unmarshal the extended GIOP message from the buffer. if (!unmarshaledHeader) { try { getMessageHeader().read(this); - unmarshalledHeader( getMessageHeader() ) ; - unmarshaledHeader= true; + unmarshalledHeader(getMessageHeader()); + unmarshaledHeader = true; } catch (RuntimeException e) { throw e; } @@ -204,13 +192,12 @@ public void unmarshalHeader() } /** - * Override the default CDR factory behavior to get the - * negotiated code sets from the connection. + * Override the default CDR factory behavior to get the negotiated code sets from the connection. * * These are only called once per message, the first time needed. * - * In the local case, there is no Connection, so use the - * local code sets. + * In the local case, there is no Connection, so use the local code sets. + * * @return The converter. */ protected CodeSetConversion.BTCConverter createCharBTCConverter() { @@ -222,9 +209,8 @@ protected CodeSetConversion.BTCConverter createCharBTCConverter() { if (codesets == null) { return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1, impl.getByteOrder()); } - - OSFCodeSetRegistry.Entry charSet - = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet()); + + OSFCodeSetRegistry.Entry charSet = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet()); if (charSet == null) { throw wrapper.unknownCodeset(codesets.getCharCodeSet()); @@ -248,20 +234,19 @@ protected CodeSetConversion.BTCConverter createWCharBTCConverter() { } } - OSFCodeSetRegistry.Entry wcharSet - = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet()); + OSFCodeSetRegistry.Entry wcharSet = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet()); if (wcharSet == null) { throw wrapper.unknownCodeset(codesets.getWCharCodeSet()); } // For GIOP 1.2 and UTF-16, use big endian if there is no byte - // order marker. (See issue 3405b) + // order marker. (See issue 3405b) // // For GIOP 1.1 and UTF-16, use the byte order the stream if // there isn't (and there shouldn't be) a byte order marker. // - // GIOP 1.0 doesn't have wchars. If we're talking to a legacy ORB, + // GIOP 1.0 doesn't have wchars. If we're talking to a legacy ORB, // we do what our old ORBs did. if (wcharSet == OSFCodeSetRegistry.UTF_16) { if (getGIOPVersion().equals(GIOPVersion.V1_2)) { @@ -283,7 +268,7 @@ private CodeSetComponentInfo.CodeSetContext getCodeSets() { } else { return getConnection().getCodeSetContext(); } - } + } public CodeBase getCodeBase() { if (getConnection() == null) { @@ -297,11 +282,10 @@ public CDRInputObject dup() { return null; } - protected void dprint(String msg) - { + protected void dprint(String msg) { ORBUtility.dprint("CDRInputObject", msg); } - + // org.omg.CORBA.portable.InputStream @MonitorRead public final boolean read_boolean() { @@ -449,7 +433,7 @@ public final Any read_any() { } @MonitorRead - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) @Override public final org.omg.CORBA.Principal read_Principal() { return impl.read_Principal(); @@ -499,8 +483,7 @@ public final java.io.Serializable read_value(java.lang.Class clz) { @MonitorRead @Override - public final java.io.Serializable read_value( - org.omg.CORBA.portable.BoxedValueHelper factory) { + public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) { return impl.read_value(factory); } @@ -542,77 +525,77 @@ public final int getPosition() { // org.omg.CORBA.DataInputStream @MonitorRead - public final java.lang.Object read_Abstract () { + public final java.lang.Object read_Abstract() { return impl.read_Abstract(); } @MonitorRead - public final java.io.Serializable read_Value () { + public final java.io.Serializable read_Value() { return impl.read_Value(); } @MonitorRead - public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) { + public final void read_any_array(org.omg.CORBA.AnySeqHolder seq, int offset, int length) { impl.read_any_array(seq, offset, length); } @MonitorRead - public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { + public final void read_boolean_array(org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { impl.read_boolean_array(seq, offset, length); } @MonitorRead - public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) { + public final void read_char_array(org.omg.CORBA.CharSeqHolder seq, int offset, int length) { impl.read_char_array(seq, offset, length); } @MonitorRead - public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { + public final void read_wchar_array(org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { impl.read_wchar_array(seq, offset, length); } @MonitorRead - public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { + public final void read_octet_array(org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { impl.read_octet_array(seq, offset, length); } @MonitorRead - public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { + public final void read_short_array(org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { impl.read_short_array(seq, offset, length); } @MonitorRead - public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { + public final void read_ushort_array(org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { impl.read_ushort_array(seq, offset, length); } @MonitorRead - public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) { + public final void read_long_array(org.omg.CORBA.LongSeqHolder seq, int offset, int length) { impl.read_long_array(seq, offset, length); } @MonitorRead - public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { + public final void read_ulong_array(org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { impl.read_ulong_array(seq, offset, length); } @MonitorRead - public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { + public final void read_ulonglong_array(org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { impl.read_ulonglong_array(seq, offset, length); } @MonitorRead - public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { + public final void read_longlong_array(org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { impl.read_longlong_array(seq, offset, length); } @MonitorRead - public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { + public final void read_float_array(org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { impl.read_float_array(seq, offset, length); } @MonitorRead - public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { + public final void read_double_array(org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { impl.read_double_array(seq, offset, length); } @@ -703,10 +686,9 @@ public final BufferManagerRead getBufferManager() { } /** - * Aligns the current position on the given octet boundary - * if there are enough bytes available to do so. Otherwise, - * it just returns. This is used for some (but not all) - * GIOP 1.2 message headers. + * Aligns the current position on the given octet boundary if there are enough bytes available to do so. Otherwise, it + * just returns. This is used for some (but not all) GIOP 1.2 message headers. + * * @param octetBoundary alignment boundary. */ @MonitorRead @@ -719,15 +701,12 @@ public void alignOnBoundary(int octetBoundary) { public void setHeaderPadding(boolean headerPadding) { impl.setHeaderPadding(headerPadding); } - + /** - * This must be called after determining the proper ORB version, - * and setting it on the stream's ORB instance. It can be called - * after reading the service contexts, since that is the only place - * we can get the ORB version info. + * This must be called after determining the proper ORB version, and setting it on the stream's ORB instance. It can be + * called after reading the service contexts, since that is the only place we can get the ORB version info. * - * Trying to unmarshal things requiring repository IDs before calling - * this will result in NullPtrExceptions. + * Trying to unmarshal things requiring repository IDs before calling this will result in NullPtrExceptions. */ public void performORBVersionSpecificInit() { // In the case of SystemExceptions, a stream is created @@ -738,22 +717,18 @@ public void performORBVersionSpecificInit() { } /** - * Resets any internal references to code set converters. - * This is useful for forcing the CDR stream to reacquire - * converters (probably from its subclasses) when state - * has changed. + * Resets any internal references to code set converters. This is useful for forcing the CDR stream to reacquire + * converters (probably from its subclasses) when state has changed. */ public void resetCodeSetConverters() { impl.resetCodeSetConverters(); } - public void setMessageMediator(MessageMediator messageMediator) - { + public void setMessageMediator(MessageMediator messageMediator) { this.messageMediator = messageMediator; } - public MessageMediator getMessageMediator() - { + public MessageMediator getMessageMediator() { return messageMediator; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStreamBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStreamBase.java index 569e95b64..9ce2b9fce 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStreamBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStreamBase.java @@ -29,97 +29,144 @@ import com.sun.org.omg.SendingContext.CodeBase; /** - * Describes CDRInputStream delegates and provides some - * implementation. Non-default constructors are avoided in - * the delegation to separate instantiation from initialization, - * so we use init methods. + * Describes CDRInputStream delegates and provides some implementation. Non-default constructors are avoided in the + * delegation to separate instantiation from initialization, so we use init methods. */ -abstract class CDRInputStreamBase extends java.io.InputStream -{ +abstract class CDRInputStreamBase extends java.io.InputStream { protected CDRInputObject parent; public void setParent(CDRInputObject parent) { this.parent = parent; } - abstract void init(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int bufferSize, - ByteOrder byteOrder, - BufferManagerRead bufferManager); + abstract void init(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, int bufferSize, ByteOrder byteOrder, BufferManagerRead bufferManager); // org.omg.CORBA.portable.InputStream public abstract boolean read_boolean(); + public abstract char read_char(); + public abstract char read_wchar(); + public abstract byte read_octet(); + public abstract short read_short(); + public abstract short read_ushort(); + public abstract int read_long(); + public abstract int read_ulong(); + public abstract long read_longlong(); + public abstract long read_ulonglong(); + public abstract float read_float(); + public abstract double read_double(); + public abstract String read_string(); + public abstract String read_wstring(); + public abstract void read_boolean_array(boolean[] value, int offset, int length); + public abstract void read_char_array(char[] value, int offset, int length); + public abstract void read_wchar_array(char[] value, int offset, int length); + public abstract void read_octet_array(byte[] value, int offset, int length); + public abstract void read_short_array(short[] value, int offset, int length); + public abstract void read_ushort_array(short[] value, int offset, int length); + public abstract void read_long_array(int[] value, int offset, int length); + public abstract void read_ulong_array(int[] value, int offset, int length); + public abstract void read_longlong_array(long[] value, int offset, int length); + public abstract void read_ulonglong_array(long[] value, int offset, int length); + public abstract void read_float_array(float[] value, int offset, int length); + public abstract void read_double_array(double[] value, int offset, int length); + public abstract org.omg.CORBA.Object read_Object(); + public abstract TypeCode read_TypeCode(); + public abstract Any read_any(); - @SuppressWarnings({"deprecation"}) + + @SuppressWarnings({ "deprecation" }) public abstract org.omg.CORBA.Principal read_Principal(); + public int read() throws java.io.IOException { throw new org.omg.CORBA.NO_IMPLEMENT(); } + public abstract java.math.BigDecimal read_fixed(); + public org.omg.CORBA.Context read_Context() { throw new org.omg.CORBA.NO_IMPLEMENT(); } + public abstract org.omg.CORBA.Object read_Object(java.lang.Class clz); public abstract org.omg.CORBA.ORB orb(); + // org.omg.CORBA_2_3.portable.InputStream public abstract java.io.Serializable read_value(); + public abstract java.io.Serializable read_value(java.lang.Class clz); + public abstract java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory); + public abstract java.io.Serializable read_value(java.lang.String rep_id); + public abstract java.io.Serializable read_value(java.io.Serializable value); + public abstract java.lang.Object read_abstract_interface(); public abstract java.lang.Object read_abstract_interface(java.lang.Class clz); + // com.sun.corba.ee.impl.encoding.MarshalInputStream public abstract void consumeEndian(); public abstract int getPosition(); + // org.omg.CORBA.DataInputStream - public abstract java.lang.Object read_Abstract (); - public abstract java.io.Serializable read_Value (); - public abstract void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length); - public abstract void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length); - public abstract void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length); - public abstract void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length); - public abstract void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length); - public abstract void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length); - public abstract void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length); - public abstract void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length); - public abstract void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length); - public abstract void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length); - public abstract void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length); - public abstract void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length); - - public abstract void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length); + public abstract java.lang.Object read_Abstract(); + + public abstract java.io.Serializable read_Value(); + + public abstract void read_any_array(org.omg.CORBA.AnySeqHolder seq, int offset, int length); + + public abstract void read_boolean_array(org.omg.CORBA.BooleanSeqHolder seq, int offset, int length); + + public abstract void read_char_array(org.omg.CORBA.CharSeqHolder seq, int offset, int length); + + public abstract void read_wchar_array(org.omg.CORBA.WCharSeqHolder seq, int offset, int length); + + public abstract void read_octet_array(org.omg.CORBA.OctetSeqHolder seq, int offset, int length); + + public abstract void read_short_array(org.omg.CORBA.ShortSeqHolder seq, int offset, int length); + + public abstract void read_ushort_array(org.omg.CORBA.UShortSeqHolder seq, int offset, int length); + + public abstract void read_long_array(org.omg.CORBA.LongSeqHolder seq, int offset, int length); + + public abstract void read_ulong_array(org.omg.CORBA.ULongSeqHolder seq, int offset, int length); + + public abstract void read_ulonglong_array(org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length); + + public abstract void read_longlong_array(org.omg.CORBA.LongLongSeqHolder seq, int offset, int length); + + public abstract void read_float_array(org.omg.CORBA.FloatSeqHolder seq, int offset, int length); + + public abstract void read_double_array(org.omg.CORBA.DoubleSeqHolder seq, int offset, int length); // org.omg.CORBA.portable.ValueBase public abstract String[] _truncatable_ids(); @@ -127,7 +174,7 @@ public org.omg.CORBA.Context read_Context() { // java.io.InputStream // REVISIT - should we make these throw UnsupportedOperationExceptions? // Right now, they'll go up to the java.io versions! - // public abstract int read(byte b[]) throws IOException; + // public abstract int read(byte b[]) throws IOException; // public abstract int read(byte b[], int off, int len) throws IOException // public abstract long skip(long n) throws IOException; // public abstract int available() throws IOException; @@ -138,7 +185,7 @@ public org.omg.CORBA.Context read_Context() { // This should return false so that outside users (people using the JDK) // don't have any guarantees that mark/reset will work in their - // custom marshaling code. This is necessary since they could do things + // custom marshaling code. This is necessary since they could do things // like expect obj1a == obj1b in the following code: // // is.mark(10000); @@ -146,7 +193,9 @@ public org.omg.CORBA.Context read_Context() { // is.reset(); // Object obj1b = is.readObject(); // - public boolean markSupported() { return false; } + public boolean markSupported() { + return false; + } // Needed by AnyImpl and ServiceContexts public abstract CDRInputStreamBase dup(); @@ -167,6 +216,7 @@ public org.omg.CORBA.Context read_Context() { public abstract void setIndex(int value); public abstract void orb(org.omg.CORBA.ORB orb); + public abstract BufferManagerRead getBufferManager(); public abstract GIOPVersion getGIOPVersion(); @@ -178,6 +228,7 @@ public org.omg.CORBA.Context read_Context() { abstract void performORBVersionSpecificInit(); public abstract void resetCodeSetConverters(); + // ValueInputStream ------------------------- public abstract void start_value(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_0.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_0.java index 66b80a6bd..12cd27d29 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_0.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_0.java @@ -72,9 +72,7 @@ @CdrRead @PrimitiveRead -public class CDRInputStream_1_0 extends CDRInputStreamBase - implements RestorableInputStream -{ +public class CDRInputStream_1_0 extends CDRInputStreamBase implements RestorableInputStream { protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private static final OMGSystemException omgWrapper = OMGSystemException.self; private static final String K_READ_METHOD = "read"; @@ -88,7 +86,7 @@ public class CDRInputStream_1_0 extends CDRInputStreamBase // Value cache private CacheTable valueCache = null; - + // Repository ID cache private CacheTable repositoryIdCache = null; @@ -106,7 +104,7 @@ public class CDRInputStream_1_0 extends CDRInputStreamBase // Beginning with the resolution to interop issue 3526 (4328?), // only enclosing chunked valuetypes are taken into account - // when computing the nesting level. However, we still need + // when computing the nesting level. However, we still need // the old computation around for interoperability with our // older ORBs. private int chunkedValueNestingLevel = 0; @@ -140,11 +138,11 @@ public class CDRInputStream_1_0 extends CDRInputStreamBase private CodeSetConversion.BTCConverter wcharConverter; // RMI-IIOP stream format version 2 case in which we know - // that there is no more optional data available. If the + // that there is no more optional data available. If the // Serializable's readObject method tries to read anything, // we must throw a MARSHAL with the special minor code // so that the ValueHandler can give the correct exception - // to readObject. The state is cleared when the ValueHandler + // to readObject. The state is cleared when the ValueHandler // calls end_value after the readObject method exits. private boolean specialNoOptionalDataState = false; @@ -154,29 +152,24 @@ public class CDRInputStream_1_0 extends CDRInputStreamBase final String newEmptyString() { return new String(""); } - + // Template method - public CDRInputStreamBase dup() - { - CDRInputStreamBase result = null ; + public CDRInputStreamBase dup() { + CDRInputStreamBase result = null; try { result = this.getClass().newInstance(); } catch (Exception e) { - throw wrapper.couldNotDuplicateCdrInputStream( e ) ; + throw wrapper.couldNotDuplicateCdrInputStream(e); } - result.init(this.orb, - byteBuffer, - byteBuffer.limit(), - byteBuffer.order(), - this.bufferManagerRead); + result.init(this.orb, byteBuffer, byteBuffer.limit(), byteBuffer.order(), this.bufferManagerRead); return result; } @Override void init(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, int bufferSize, ByteOrder byteOrder, BufferManagerRead bufferManager) { - this.orb = (ORB)orb; + this.orb = (ORB) orb; this.bufferManagerRead = bufferManager; this.byteBuffer = byteBuffer; this.byteBuffer.position(0); @@ -190,8 +183,7 @@ void performORBVersionSpecificInit() { createRepositoryIdHandlers(); } - private void createRepositoryIdHandlers() - { + private void createRepositoryIdHandlers() { repIdUtil = RepositoryIdFactory.getRepIdUtility(); repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); } @@ -199,7 +191,7 @@ private void createRepositoryIdHandlers() public GIOPVersion getGIOPVersion() { return GIOPVersion.V1_0; } - + // Called by Request and Reply message. Valid for GIOP versions >= 1.2 only. // Illegal for GIOP versions < 1.2. void setHeaderPadding(boolean headerPadding) { @@ -218,7 +210,8 @@ protected final int computeAlignment(int index, int align) { } @InfoMethod - private void notChunked() { } + private void notChunked() { + } @CdrRead protected void checkBlockLength(int align, int dataSize) { @@ -227,24 +220,24 @@ protected void checkBlockLength(int align, int dataSize) { // or indirections), // we must check here for termination of the current chunk. if (!isChunked) { - notChunked() ; + notChunked(); return; } // RMI-IIOP stream format version 2 case in which we know - // that there is no more optional data available. If the + // that there is no more optional data available. If the // Serializable's readObject method tries to read anything, // we must throw a MARSHAL exception with the special minor code // so that the ValueHandler can give the correct exception - // to readObject. The state is cleared when the ValueHandler + // to readObject. The state is cleared when the ValueHandler // calls end_value after the readObject method exits. if (specialNoOptionalDataState) { - throw omgWrapper.rmiiiopOptionalDataIncompatible1() ; + throw omgWrapper.rmiiiopOptionalDataIncompatible1(); } boolean checkForEndTag = false; - // Are we at the end of the current chunk? If so, + // Are we at the end of the current chunk? If so, // try to interpret the next long as a chunk length. // (It has to be either a chunk length, end tag, // or valuetag.) @@ -257,9 +250,9 @@ protected void checkBlockLength(int align, int dataSize) { start_block(); // What's next is either a valuetag or - // an end tag. If it's a valuetag, we're + // an end tag. If it's a valuetag, we're // probably being called as part of the process - // to read the valuetag. If it's an end tag, + // to read the valuetag. If it's an end tag, // then there isn't enough data left in // this valuetype to read! if (blockLength == MAX_BLOCK_LENGTH) { @@ -269,7 +262,7 @@ protected void checkBlockLength(int align, int dataSize) { } else if (blockLength < get_offset()) { // Are we already past the end of the current chunk? // This is always an error. - throw wrapper.chunkOverflow() ; + throw wrapper.chunkOverflow(); } // If what's next on the wire isn't a chunk length or @@ -280,14 +273,13 @@ protected void checkBlockLength(int align, int dataSize) { // IDL type is reading too much/in an incorrect order int requiredNumBytes = computeAlignment(byteBuffer.position(), align) + dataSize; - if (blockLength != MAX_BLOCK_LENGTH && - blockLength < get_offset() + requiredNumBytes) { - throw omgWrapper.rmiiiopOptionalDataIncompatible2() ; + if (blockLength != MAX_BLOCK_LENGTH && blockLength < get_offset() + requiredNumBytes) { + throw omgWrapper.rmiiiopOptionalDataIncompatible2(); } // IMPORTANT - read_long() will advance the position of the ByteBuffer. - // Hence, in the logic below, we need to reset the position - // back to its original location. + // Hence, in the logic below, we need to reset the position + // back to its original location. if (checkForEndTag) { int nextLong = read_long(); byteBuffer.position(byteBuffer.position() - 4); @@ -346,7 +338,7 @@ public final char read_char() { public char read_wchar() { // Don't allow transmission of wchar/wstring data with foreign ORBs since it's against the spec. if (ORBUtility.isForeignORB(orb)) { - throw wrapper.wcharDataInGiop10() ; + throw wrapper.wcharDataInGiop10(); } // If we're talking to one of our legacy ORBs, do what they did: @@ -406,7 +398,7 @@ protected final void checkForNegativeLength(int length) { // Note that this has the side effect of setting the value of stringIndirection. @CdrRead protected final String readStringOrIndirection(boolean allowIndirection) { - String result = "" ; + String result = ""; int len = read_long(); @@ -425,7 +417,7 @@ protected final String readStringOrIndirection(boolean allowIndirection) { result = internalReadString(len); - return result ; + return result; } @CdrRead @@ -484,7 +476,7 @@ public String read_wstring() { @CdrRead public final void read_octet_array(byte[] buffer, int offset, int length) { - if ( buffer == null ) { + if (buffer == null) { throw wrapper.nullParam(); } @@ -496,7 +488,8 @@ public final void read_octet_array(byte[] buffer, int offset, int length) { int numWritten = 0; while (numWritten < length) { - if (!byteBuffer.hasRemaining()) grow(1, 1); + if (!byteBuffer.hasRemaining()) + grow(1, 1); int count = Math.min(length - numWritten, byteBuffer.remaining()); byteBuffer.get(buffer, numWritten + offset, count); @@ -504,14 +497,14 @@ public final void read_octet_array(byte[] buffer, int offset, int length) { } } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) public org.omg.CORBA.Principal read_Principal() { int len = read_long(); byte[] pvalue = new byte[len]; - read_octet_array(pvalue,0,len); + read_octet_array(pvalue, 0, len); org.omg.CORBA.Principal p = new PrincipalImpl(); - p.name(pvalue); + p.name(pvalue); return p; } @@ -519,12 +512,12 @@ public org.omg.CORBA.Principal read_Principal() { public TypeCode read_TypeCode() { TypeCodeImpl tc = new TypeCodeImpl(orb); tc.read_value(parent); - return tc ; + return tc; } - + @CdrRead public Any read_any() { - Any any = null ; + Any any = null; any = orb.create_any(); TypeCodeImpl tc = new TypeCodeImpl(orb); @@ -532,7 +525,7 @@ public Any read_any() { // read off the typecode // REVISIT We could avoid this try-catch if we could peek the typecode - // kind off this stream and see if it is a tk_value. Looking at the + // kind off this stream and see if it is a tk_value. Looking at the // code we know that for tk_value the Any.read_value() below // ignores the tc argument anyway (except for the kind field). // But still we would need to make sure that the whole typecode, @@ -553,148 +546,138 @@ public Any read_any() { } @CdrRead - public org.omg.CORBA.Object read_Object() { + public org.omg.CORBA.Object read_Object() { return read_Object(null); } @InfoMethod - private void nullIOR() { } + private void nullIOR() { + } @InfoMethod - private void className( String name ) { } + private void className(String name) { + } @InfoMethod - private void stubFactory( PresentationManager.StubFactory fact ) { } + private void stubFactory(PresentationManager.StubFactory fact) { + } // ------------ RMI related methods -------------------------- // IDL to Java ptc-00-01-08 1.21.4.1 // // The clz argument to read_Object can be either a stub - // Class or the "Class object for the RMI/IDL interface type + // Class or the "Class object for the RMI/IDL interface type // that is statically expected." // This functions as follows: // 1. If clz==null, just use the repository ID from the stub // 2. If clz is a stub class, just use it as a static factory. - // clz is a stub class iff StubAdapter.isStubClass( clz ). - // In addition, clz is a IDL stub class iff - // IDLEntity.class.isAssignableFrom( clz ). + // clz is a stub class iff StubAdapter.isStubClass( clz ). + // In addition, clz is a IDL stub class iff + // IDLEntity.class.isAssignableFrom( clz ). // 3. If clz is an interface, use it to create the appropriate - // stub factory. + // stub factory. @CdrRead - public org.omg.CORBA.Object read_Object(Class clz) - { + public org.omg.CORBA.Object read_Object(Class clz) { // In any case, we must first read the IOR. - IOR ior = IORFactories.makeIOR( orb, (InputStream)parent) ; + IOR ior = IORFactories.makeIOR(orb, (InputStream) parent); if (ior.isNil()) { - nullIOR() ; + nullIOR(); return null; } - PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ; - String codeBase = ior.getProfile().getCodebase() ; - PresentationManager.StubFactory stubFactory = null ; + PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory(); + String codeBase = ior.getProfile().getCodebase(); + PresentationManager.StubFactory stubFactory = null; if (clz == null) { - RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ; - String className = rid.getClassName() ; - className( className ) ; - boolean isIDLInterface = rid.isIDLType() ; + RepositoryId rid = RepositoryId.cache.getId(ior.getTypeId()); + String className = rid.getClassName(); + className(className); + boolean isIDLInterface = rid.isIDLType(); - if (className == null || className.equals( "" )) { + if (className == null || className.equals("")) { stubFactory = null; } else { try { - stubFactory = sff.createStubFactory(className, - isIDLInterface, codeBase, (Class) null, - (ClassLoader) null); + stubFactory = sff.createStubFactory(className, isIDLInterface, codeBase, (Class) null, (ClassLoader) null); } catch (Exception exc) { stubFactory = null; } } - stubFactory( stubFactory ) ; - } else if (StubAdapter.isStubClass( clz )) { - stubFactory = PresentationDefaults.makeStaticStubFactory( - clz ) ; - stubFactory( stubFactory ) ; + stubFactory(stubFactory); + } else if (StubAdapter.isStubClass(clz)) { + stubFactory = PresentationDefaults.makeStaticStubFactory(clz); + stubFactory(stubFactory); } else { // clz is an interface class - boolean isIDL = ClassInfoCache.get( clz ).isAIDLEntity(clz) ; + boolean isIDL = ClassInfoCache.get(clz).isAIDLEntity(clz); - stubFactory = sff.createStubFactory( clz.getName(), - isIDL, codeBase, clz, clz.getClassLoader() ) ; - stubFactory( stubFactory ) ; + stubFactory = sff.createStubFactory(clz.getName(), isIDL, codeBase, clz, clz.getClassLoader()); + stubFactory(stubFactory); } - return internalIORToObject( ior, stubFactory, orb ); + return internalIORToObject(ior, stubFactory, orb); } /* - * This is used as a general utility (e.g., the PortableInterceptor - * implementation uses it. If stubFactory is null, the ior's - * IIOPProfile must support getServant. + * This is used as a general utility (e.g., the PortableInterceptor implementation uses it. If stubFactory is null, the + * ior's IIOPProfile must support getServant. */ @CdrRead - public static org.omg.CORBA.Object internalIORToObject( - IOR ior, PresentationManager.StubFactory stubFactory, ORB orb) - { - java.lang.Object servant = ior.getProfile().getServant() ; - if (servant != null ) { + public static org.omg.CORBA.Object internalIORToObject(IOR ior, PresentationManager.StubFactory stubFactory, ORB orb) { + java.lang.Object servant = ior.getProfile().getServant(); + if (servant != null) { if (servant instanceof Tie) { String codebase = ior.getProfile().getCodebase(); - org.omg.CORBA.Object objref = (org.omg.CORBA.Object) - Utility.loadStub( (Tie)servant, stubFactory, codebase, - false); - + org.omg.CORBA.Object objref = (org.omg.CORBA.Object) Utility.loadStub((Tie) servant, stubFactory, codebase, false); + // If we managed to load a stub, return it, otherwise we // must fail... if (objref != null) { - return objref; + return objref; } else { - throw wrapper.readObjectException() ; + throw wrapper.readObjectException(); } } else if (servant instanceof org.omg.CORBA.Object) { - if (!(servant instanceof - org.omg.CORBA.portable.InvokeHandler)) { - return (org.omg.CORBA.Object)servant; + if (!(servant instanceof org.omg.CORBA.portable.InvokeHandler)) { + return (org.omg.CORBA.Object) servant; } } else { throw wrapper.badServantReadObject(); } } - ClientDelegate del = ORBUtility.makeClientDelegate( ior ) ; + ClientDelegate del = ORBUtility.makeClientDelegate(ior); - org.omg.CORBA.Object objref = null ; + org.omg.CORBA.Object objref = null; if (stubFactory == null) { objref = new CORBAObjectImpl(); } else { try { - objref = stubFactory.makeStub() ; + objref = stubFactory.makeStub(); } catch (Throwable e) { - wrapper.stubCreateError( e ) ; + wrapper.stubCreateError(e); if (e instanceof ThreadDeath) { throw (ThreadDeath) e; } // Return the "default" stub... - objref = new CORBAObjectImpl() ; + objref = new CORBAObjectImpl(); } } - - StubAdapter.setDelegate( objref, del ) ; + + StubAdapter.setDelegate(objref, del); return objref; } - + @CdrRead - public java.lang.Object read_abstract_interface() - { + public java.lang.Object read_abstract_interface() { return read_abstract_interface(null); } - public java.lang.Object read_abstract_interface(java.lang.Class clz) - { + public java.lang.Object read_abstract_interface(java.lang.Class clz) { boolean object = read_boolean(); if (object) { @@ -705,24 +688,23 @@ public java.lang.Object read_abstract_interface(java.lang.Class clz) } @CdrRead - public Serializable read_value() - { - return read_value((Class)null); + public Serializable read_value() { + return read_value((Class) null); } @InfoMethod - private void indirectionValue( int indir ) { } + private void indirectionValue(int indir) { + } @CdrRead private Serializable handleIndirection() { int indirection = read_long() + get_offset() - 4; - indirectionValue( indirection ) ; + indirectionValue(indirection); if (valueCache != null && valueCache.containsVal(indirection)) { - java.io.Serializable cachedValue - = (java.io.Serializable)valueCache.getKey(indirection); + java.io.Serializable cachedValue = (java.io.Serializable) valueCache.getKey(indirection); return cachedValue; } else { // In RMI-IIOP the ValueHandler will recognize this @@ -733,85 +715,77 @@ private Serializable handleIndirection() { } } - private String readRepositoryIds(int valueTag, - Class expectedType, - ClassInfoCache.ClassInfo cinfo, - String expectedTypeRepId) { - return readRepositoryIds(valueTag, expectedType, - cinfo, expectedTypeRepId, null); + private String readRepositoryIds(int valueTag, Class expectedType, ClassInfoCache.ClassInfo cinfo, String expectedTypeRepId) { + return readRepositoryIds(valueTag, expectedType, cinfo, expectedTypeRepId, null); } /** - * Examines the valuetag to see how many (if any) repository IDs - * are present on the wire. If no repository ID information - * is on the wire but the expectedType or expectedTypeRepId - * is known, it will return one of those (favoring the - * expectedType's repId). Failing that, it uses the supplied - * BoxedValueHelper to obtain the repository ID, as a last resort. + * Examines the valuetag to see how many (if any) repository IDs are present on the wire. If no repository ID + * information is on the wire but the expectedType or expectedTypeRepId is known, it will return one of those (favoring + * the expectedType's repId). Failing that, it uses the supplied BoxedValueHelper to obtain the repository ID, as a last + * resort. */ - private String readRepositoryIds(int valueTag, - Class expectedType, - ClassInfoCache.ClassInfo cinfo, - String expectedTypeRepId, - BoxedValueHelper factory) { - switch(repIdUtil.getTypeInfo(valueTag)) { - case RepositoryIdUtility.NO_TYPE_INFO : - // Throw an exception if we have no repository ID info and - // no expectedType to work with. Otherwise, how would we - // know what to unmarshal? - if (expectedType == null) { - if (expectedTypeRepId != null) { - return expectedTypeRepId; - } else if (factory != null) { - return factory.get_id(); - } else { - throw wrapper.expectedTypeNullAndNoRepId( ) ; - } + private String readRepositoryIds(int valueTag, Class expectedType, ClassInfoCache.ClassInfo cinfo, String expectedTypeRepId, + BoxedValueHelper factory) { + switch (repIdUtil.getTypeInfo(valueTag)) { + case RepositoryIdUtility.NO_TYPE_INFO: + // Throw an exception if we have no repository ID info and + // no expectedType to work with. Otherwise, how would we + // know what to unmarshal? + if (expectedType == null) { + if (expectedTypeRepId != null) { + return expectedTypeRepId; + } else if (factory != null) { + return factory.get_id(); + } else { + throw wrapper.expectedTypeNullAndNoRepId(); } - return repIdStrs.createForAnyType(expectedType,cinfo); - case RepositoryIdUtility.SINGLE_REP_TYPE_INFO : - return read_repositoryId(); - case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO : - return read_repositoryIds(); - default: - throw wrapper.badValueTag( Integer.toHexString(valueTag) ) ; + } + return repIdStrs.createForAnyType(expectedType, cinfo); + case RepositoryIdUtility.SINGLE_REP_TYPE_INFO: + return read_repositoryId(); + case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO: + return read_repositoryIds(); + default: + throw wrapper.badValueTag(Integer.toHexString(valueTag)); } } @CdrRead - private Object readRMIIIOPValueType( int indirection, - Class valueClass, String repositoryIDString ) { + private Object readRMIIIOPValueType(int indirection, Class valueClass, String repositoryIDString) { try { if (valueHandler == null) { valueHandler = ORBUtility.createValueHandler(); } - return valueHandler.readValue(parent, indirection, valueClass, - repositoryIDString, getCodeBase()); - } catch(SystemException sysEx) { + return valueHandler.readValue(parent, indirection, valueClass, repositoryIDString, getCodeBase()); + } catch (SystemException sysEx) { // Just rethrow any CORBA system exceptions // that come out of the ValueHandler throw sysEx; - } catch(Exception ex) { - throw wrapper.valuehandlerReadException( ex ) ; - } catch(Error e) { - throw wrapper.valuehandlerReadError( e ) ; + } catch (Exception ex) { + throw wrapper.valuehandlerReadException(ex); + } catch (Error e) { + throw wrapper.valuehandlerReadError(e); } } @InfoMethod - private void repositoryIdString( String str ) { } + private void repositoryIdString(String str) { + } @InfoMethod - private void valueClass( Class cls ) { } + private void valueClass(Class cls) { + } @InfoMethod - private void noProxyInterfaces() { } + private void noProxyInterfaces() { + } @CdrRead public Serializable read_value(Class expectedType) { - Object value = null ; + Object value = null; int vType = readValueTag(); if (vType == 0) { return null; @@ -820,7 +794,7 @@ public Serializable read_value(Class expectedType) { if (vType == 0xffffffff) { value = handleIndirection(); } else { - ClassInfoCache.ClassInfo cinfo = null ; + ClassInfoCache.ClassInfo cinfo = null; if (expectedType != null) { cinfo = ClassInfoCache.get(expectedType); } @@ -838,9 +812,8 @@ public Serializable read_value(Class expectedType) { } // Read repository id(s) - String repositoryIDString = readRepositoryIds(vType, expectedType, - cinfo, null); - repositoryIdString( repositoryIDString ) ; + String repositoryIDString = readRepositoryIds(vType, expectedType, cinfo, null); + repositoryIdString(repositoryIDString); // If isChunked was determined to be true based // on the valuetag, this will read a chunk length @@ -862,13 +835,13 @@ public Serializable read_value(Class expectedType) { // By this point, either the expectedType or repositoryIDString // is guaranteed to be non-null. - if (valueClass == null || !repositoryIDString.equals(repIdStrs.createForAnyType(expectedType,cinfo))) { + if (valueClass == null || !repositoryIDString.equals(repIdStrs.createForAnyType(expectedType, cinfo))) { valueClass = getClassFromString(repositoryIDString, codebase_URL, expectedType); - cinfo = ClassInfoCache.get( valueClass ) ; + cinfo = ClassInfoCache.get(valueClass); } - valueClass( valueClass ) ; + valueClass(valueClass); if (valueClass == null) { // No point attempting to use value handler below, since the @@ -877,25 +850,22 @@ public Serializable read_value(Class expectedType) { // message. RepositoryIdInterface repositoryID = repIdStrs.getFromString(repositoryIDString); - throw wrapper.couldNotFindClass(repositoryID.getClassName()) ; + throw wrapper.couldNotFindClass(repositoryID.getClassName()); } if (cinfo.isEnum()) { - final Class enumClass = ClassInfoCache.getEnumClass( cinfo, - valueClass ) ; - String enumValue = read_string() ; - value = Enum.valueOf( enumClass, enumValue ) ; + final Class enumClass = ClassInfoCache.getEnumClass(cinfo, valueClass); + String enumValue = read_string(); + value = Enum.valueOf(enumClass, enumValue); } else if (valueClass != null && cinfo.isAIDLEntity(valueClass)) { - value = readIDLValue(indirection, repositoryIDString, - valueClass, cinfo, codebase_URL); + value = readIDLValue(indirection, repositoryIDString, valueClass, cinfo, codebase_URL); } else { - value = readRMIIIOPValueType( indirection, - valueClass, repositoryIDString ) ; + value = readRMIIIOPValueType(indirection, valueClass, repositoryIDString); } } // Skip any remaining chunks until we get to - // an end tag or a valuetag. If we see a valuetag, + // an end tag or a valuetag. If we see a valuetag, // that means there was another valuetype in the sender's // version of this class that we need to skip over. handleEndOfValue(); @@ -907,8 +877,7 @@ public Serializable read_value(Class expectedType) { // Cache the valuetype that we read if (valueCache == null) { - valueCache = new CacheTable("Input valueCache", orb, - false); + valueCache = new CacheTable("Input valueCache", orb, false); } valueCache.put(value, indirection); @@ -922,64 +891,59 @@ public Serializable read_value(Class expectedType) { } // Convert an EnumDesc into the enum instance it represents - if (value.getClass()==EnumDesc.class) { - EnumDesc desc = EnumDesc.class.cast( value ) ; + if (value.getClass() == EnumDesc.class) { + EnumDesc desc = EnumDesc.class.cast(value); - Class cls = null ; + Class cls = null; try { - cls = JDKBridge.loadClass( desc.className, null, null ) ; + cls = JDKBridge.loadClass(desc.className, null, null); } catch (ClassNotFoundException cnfe) { - throw wrapper.enumClassNotFound( cnfe, desc.className ) ; + throw wrapper.enumClassNotFound(cnfe, desc.className); } // Issue 11681: deal with enum with abstract methods. - Class current = cls ; + Class current = cls; while (current != null) { if (current.isEnum()) { - break ; + break; } - current = current.getSuperclass() ; + current = current.getSuperclass(); } if (current != null) { - value = Enum.valueOf( current, desc.value ) ; + value = Enum.valueOf(current, desc.value); } else { - throw wrapper.couldNotUnmarshalEnum( desc.className, - desc.value ) ; + throw wrapper.couldNotUnmarshalEnum(desc.className, desc.value); } } // Convert ProxyDesc into the proxy instance it represents - if (value.getClass()==ProxyDesc.class) { - ProxyDesc desc = ProxyDesc.class.cast( value ) ; + if (value.getClass() == ProxyDesc.class) { + ProxyDesc desc = ProxyDesc.class.cast(value); int numberOfInterfaces = desc.interfaces.length; // Write code if the number is Zero. Unusual case - if (numberOfInterfaces==0) { - noProxyInterfaces() ; + if (numberOfInterfaces == 0) { + noProxyInterfaces(); return null; } ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { - RMIClassLoader.loadProxyClass( desc.codebase, desc.interfaces, - value.getClass().getClassLoader()) ; + RMIClassLoader.loadProxyClass(desc.codebase, desc.interfaces, value.getClass().getClassLoader()); } catch (ClassNotFoundException cnfe) { - throw wrapper.proxyClassNotFound( cnfe, - getInterfacesList(desc.interfaces)) ; + throw wrapper.proxyClassNotFound(cnfe, getInterfacesList(desc.interfaces)); } catch (MalformedURLException mue) { - throw wrapper.malformedProxyUrl( mue, - getInterfacesList(desc.interfaces), desc.codebase) ; + throw wrapper.malformedProxyUrl(mue, getInterfacesList(desc.interfaces), desc.codebase); } Class[] list = new Class[desc.interfaces.length]; - for(int i=0; i < numberOfInterfaces; ++i) { + for (int i = 0; i < numberOfInterfaces; ++i) { try { - list[i] = JDKBridge.loadClass(desc.interfaces[i], - desc.codebase, cl); - } catch (ClassNotFoundException cnfe) { - throw wrapper.proxyClassNotFound(cnfe, desc.interfaces[i]); - } + list[i] = JDKBridge.loadClass(desc.interfaces[i], desc.codebase, cl); + } catch (ClassNotFoundException cnfe) { + throw wrapper.proxyClassNotFound(cnfe, desc.interfaces[i]); + } } try { @@ -991,10 +955,10 @@ public Serializable read_value(Class expectedType) { } } - return (java.io.Serializable)value; + return (java.io.Serializable) value; } - private List getInterfacesList(String [] interfaces) { + private List getInterfacesList(String[] interfaces) { return Arrays.asList(interfaces); } @@ -1010,8 +974,7 @@ public Serializable read_value(BoxedValueHelper factory) { } else if (vType == 0xffffffff) { // Indirection tag int indirection = read_long() + get_offset() - 4; if (valueCache != null && valueCache.containsVal(indirection)) { - Serializable cachedValue = - (Serializable)valueCache.getKey(indirection); + Serializable cachedValue = (Serializable) valueCache.getKey(indirection); return cachedValue; } else { throw new IndirectionException(indirection); @@ -1024,14 +987,13 @@ public Serializable read_value(BoxedValueHelper factory) { java.lang.Object value = null; - String codebase_URL = null; - if (repIdUtil.isCodeBasePresent(vType)){ + String codebase_URL = null; + if (repIdUtil.isCodeBasePresent(vType)) { codebase_URL = read_codebase_URL(); } // Read repository id - String repositoryIDString - = readRepositoryIds(vType, null, null, null, factory); + String repositoryIDString = readRepositoryIds(vType, null, null, null, factory); // Compare rep. ids to see if we should use passed helper if (!repositoryIDString.equals(factory.get_id())) { @@ -1043,12 +1005,11 @@ public Serializable read_value(BoxedValueHelper factory) { if (isChunked) { chunkedValueNestingLevel--; } - + if (factory instanceof com.sun.org.omg.CORBA.portable.ValueHelper) { - value = readIDLValueWithHelper( - (com.sun.org.omg.CORBA.portable.ValueHelper)factory, indirection); + value = readIDLValueWithHelper((com.sun.org.omg.CORBA.portable.ValueHelper) factory, indirection); } else { - valueIndirection = indirection; // for callback + valueIndirection = indirection; // for callback value = factory.read_value(parent); } @@ -1060,31 +1021,31 @@ public Serializable read_value(BoxedValueHelper factory) { valueCache = new CacheTable("Input valueCache", orb, false); } valueCache.put(value, indirection); - + // allow for possible continuation chunk isChunked = saveIsChunked; start_block(); - return (java.io.Serializable)value; + return (java.io.Serializable) value; } } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) private boolean isCustomType(@SuppressWarnings("deprecation") com.sun.org.omg.CORBA.portable.ValueHelper helper) { - try{ + try { TypeCode tc = helper.get_type(); int kind = tc.kind().value(); if (kind == TCKind._tk_value) { return (tc.type_modifier() == org.omg.CORBA.VM_CUSTOM.value); } - } catch(BadKind ex) { - throw wrapper.badKind(ex) ; + } catch (BadKind ex) { + throw wrapper.badKind(ex); } return false; } - // This method is actually called indirectly by + // This method is actually called indirectly by // read_value(String repositoryId). // Therefore, it is not a truly independent read call that handles // header information itself. @@ -1102,7 +1063,7 @@ public java.io.Serializable read_value(java.io.Serializable value) { } else if (value instanceof CustomValue) { ((CustomValue) value).unmarshal(parent); } - + return value; } @@ -1110,7 +1071,7 @@ public java.io.Serializable read_value(java.io.Serializable value) { public java.io.Serializable read_value(java.lang.String repositoryId) { // if (inBlock) - // end_block(); + // end_block(); // Read value tag int vType = readValueTag(); @@ -1119,13 +1080,10 @@ public java.io.Serializable read_value(java.lang.String repositoryId) { return null; } else if (vType == 0xffffffff) { // Indirection tag int indirection = read_long() + get_offset() - 4; - if (valueCache != null && valueCache.containsVal(indirection)) - { - java.io.Serializable cachedValue = - (java.io.Serializable)valueCache.getKey(indirection); - return cachedValue; - } - else { + if (valueCache != null && valueCache.containsVal(indirection)) { + java.io.Serializable cachedValue = (java.io.Serializable) valueCache.getKey(indirection); + return cachedValue; + } else { throw new IndirectionException(indirection); } } else { @@ -1138,17 +1096,15 @@ public java.io.Serializable read_value(java.lang.String repositoryId) { java.lang.Object value = null; - String codebase_URL = null; - if (repIdUtil.isCodeBasePresent(vType)){ + String codebase_URL = null; + if (repIdUtil.isCodeBasePresent(vType)) { codebase_URL = read_codebase_URL(); } // Read repository id - String repositoryIDString - = readRepositoryIds(vType, null, null, repositoryId); + String repositoryIDString = readRepositoryIds(vType, null, null, repositoryId); - ValueFactory factory = - Utility.getFactory(null, codebase_URL, orb, repositoryIDString); + ValueFactory factory = Utility.getFactory(null, codebase_URL, orb, repositoryIDString); start_block(); end_flag--; @@ -1156,7 +1112,7 @@ public java.io.Serializable read_value(java.lang.String repositoryId) { chunkedValueNestingLevel--; } - valueIndirection = indirection; // for callback + valueIndirection = indirection; // for callback value = factory.read_value(parent); handleEndOfValue(); @@ -1167,67 +1123,61 @@ public java.io.Serializable read_value(java.lang.String repositoryId) { valueCache = new CacheTable("Input valueCache", orb, false); } valueCache.put(value, indirection); - + // allow for possible continuation chunk isChunked = saveIsChunked; start_block(); - return (java.io.Serializable)value; - } + return (java.io.Serializable) value; + } } @InfoMethod - private void readClassCodebases( String codebases, String repoId ) { } + private void readClassCodebases(String codebases, String repoId) { + } @CdrRead private Class readClass() { String codebases, classRepId; - if (orb == null || - ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || - ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { + if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) + || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { - codebases = (String)read_value(java.lang.String.class); - classRepId = (String)read_value(java.lang.String.class); + codebases = (String) read_value(java.lang.String.class); + classRepId = (String) read_value(java.lang.String.class); } else { // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID // and codebase strings in the wrong order. - classRepId = (String)read_value(java.lang.String.class); - codebases = (String)read_value(java.lang.String.class); + classRepId = (String) read_value(java.lang.String.class); + codebases = (String) read_value(java.lang.String.class); } - readClassCodebases( codebases, classRepId ) ; + readClassCodebases(codebases, classRepId); Class cl = null; - RepositoryIdInterface repositoryID - = repIdStrs.getFromString(classRepId); - + RepositoryIdInterface repositoryID = repIdStrs.getFromString(classRepId); + try { cl = repositoryID.getClassFromType(codebases); - } catch(ClassNotFoundException cnfe) { - throw wrapper.cnfeReadClass( cnfe, repositoryID.getClassName() ) ; - } catch(MalformedURLException me) { - throw wrapper.malformedUrl( - me, repositoryID.getClassName(), codebases ) ; + } catch (ClassNotFoundException cnfe) { + throw wrapper.cnfeReadClass(cnfe, repositoryID.getClassName()); + } catch (MalformedURLException me) { + throw wrapper.malformedUrl(me, repositoryID.getClassName(), codebases); } return cl; } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) @CdrRead - private java.lang.Object readIDLValueWithHelper( - com.sun.org.omg.CORBA.portable.ValueHelper helper, int indirection) - { + private java.lang.Object readIDLValueWithHelper(com.sun.org.omg.CORBA.portable.ValueHelper helper, int indirection) { // look for two-argument static read method Method readMethod; try { - readMethod = helper.getClass().getDeclaredMethod(K_READ_METHOD, - org.omg.CORBA.portable.InputStream.class, helper.get_class()); - } - catch(NoSuchMethodException nsme) { // must be boxed value helper + readMethod = helper.getClass().getDeclaredMethod(K_READ_METHOD, org.omg.CORBA.portable.InputStream.class, helper.get_class()); + } catch (NoSuchMethodException nsme) { // must be boxed value helper java.lang.Object result = helper.read_value(parent); return result; } @@ -1237,10 +1187,9 @@ private java.lang.Object readIDLValueWithHelper( java.lang.Object val = null; try { val = helper.get_class().newInstance(); - } catch(java.lang.InstantiationException ie) { - throw wrapper.couldNotInstantiateHelper( ie, - helper.get_class() ) ; - } catch(IllegalAccessException iae){ + } catch (java.lang.InstantiationException ie) { + throw wrapper.couldNotInstantiateHelper(ie, helper.get_class()); + } catch (IllegalAccessException iae) { // Value's constructor is protected or private // // So, use the helper to read the value. @@ -1258,78 +1207,69 @@ private java.lang.Object readIDLValueWithHelper( // if custom type, call unmarshal method if (val instanceof CustomMarshal && isCustomType(helper)) { - ((CustomMarshal)val).unmarshal(parent); + ((CustomMarshal) val).unmarshal(parent); return val; } // call two-argument read method using reflection try { - readMethod.invoke(helper, parent, val ); + readMethod.invoke(helper, parent, val); return val; - } catch(IllegalAccessException iae2) { - throw wrapper.couldNotInvokeHelperReadMethod( iae2, - helper.get_class() ) ; - } catch(InvocationTargetException ite){ - throw wrapper.couldNotInvokeHelperReadMethod( ite, - helper.get_class() ) ; + } catch (IllegalAccessException iae2) { + throw wrapper.couldNotInvokeHelperReadMethod(iae2, helper.get_class()); + } catch (InvocationTargetException ite) { + throw wrapper.couldNotInvokeHelperReadMethod(ite, helper.get_class()); } } @CdrRead - private java.lang.Object readBoxedIDLEntity(Class clazz, String codebase) - { - Class cls = null ; + private java.lang.Object readBoxedIDLEntity(Class clazz, String codebase) { + Class cls = null; try { ClassLoader clazzLoader = clazz.getClassLoader(); - cls = Utility.loadClassForClass(clazz.getName()+"Helper", codebase, - clazzLoader, clazz, clazzLoader); - final Class helperClass = cls ; + cls = Utility.loadClassForClass(clazz.getName() + "Helper", codebase, clazzLoader, clazz, clazzLoader); + final Class helperClass = cls; - // getDeclaredMethod requires RuntimePermission + // getDeclaredMethod requires RuntimePermission // accessDeclaredMembers if a different class loader is used // (even though the javadoc says otherwise) Method readMethod = null; try { - readMethod = AccessController.doPrivileged( - new PrivilegedExceptionAction() { + readMethod = AccessController.doPrivileged(new PrivilegedExceptionAction() { @SuppressWarnings("unchecked") - public Method run() throws NoSuchMethodException { - return helperClass.getDeclaredMethod(K_READ_METHOD, - org.omg.CORBA.portable.InputStream.class ) ; - } + public Method run() throws NoSuchMethodException { + return helperClass.getDeclaredMethod(K_READ_METHOD, org.omg.CORBA.portable.InputStream.class); } - ); + }); } catch (PrivilegedActionException pae) { // this gets caught below - throw (NoSuchMethodException)pae.getException(); + throw (NoSuchMethodException) pae.getException(); } return readMethod.invoke(null, parent); } catch (ClassNotFoundException cnfe) { - throw wrapper.couldNotInvokeHelperReadMethod( cnfe, cls ) ; - } catch(NoSuchMethodException nsme) { - throw wrapper.couldNotInvokeHelperReadMethod( nsme, cls ) ; - } catch(IllegalAccessException iae) { - throw wrapper.couldNotInvokeHelperReadMethod( iae, cls ) ; - } catch(InvocationTargetException ite) { - throw wrapper.couldNotInvokeHelperReadMethod( ite, cls ) ; + throw wrapper.couldNotInvokeHelperReadMethod(cnfe, cls); + } catch (NoSuchMethodException nsme) { + throw wrapper.couldNotInvokeHelperReadMethod(nsme, cls); + } catch (IllegalAccessException iae) { + throw wrapper.couldNotInvokeHelperReadMethod(iae, cls); + } catch (InvocationTargetException ite) { + throw wrapper.couldNotInvokeHelperReadMethod(ite, cls); } } @CdrRead - @SuppressWarnings({"deprecation", "deprecation"}) - private java.lang.Object readIDLValue(int indirection, String repId, - Class clazz, ClassInfoCache.ClassInfo cinfo, String codebase) - { - ValueFactory factory ; + @SuppressWarnings({ "deprecation", "deprecation" }) + private java.lang.Object readIDLValue(int indirection, String repId, Class clazz, ClassInfoCache.ClassInfo cinfo, String codebase) { + ValueFactory factory; // Always try to find a ValueFactory first, as required by the spec. - // There are some complications here in the IDL 3.0 mapping + // There are some complications here in the IDL 3.0 mapping // (see 1.13.8), but basically we must always be able to override the - // DefaultFactory or Helper mappings that are also used. This appears - // to be the case even in the boxed value cases. The original code + // DefaultFactory or Helper mappings that are also used. This appears + // to be the case even in the boxed value cases. The original code // only did the lookup in the case of class implementing either // StreamableValue or CustomValue, but abstract valuetypes only // implement ValueBase, and really require the use of the repId to @@ -1338,19 +1278,15 @@ private java.lang.Object readIDLValue(int indirection, String repId, // use new-style OBV support (factory object) factory = Utility.getFactory(clazz, codebase, orb, repId); } catch (MARSHAL marshal) { - wrapper.marshalErrorInReadIDLValue( marshal ) ; + wrapper.marshalErrorInReadIDLValue(marshal); // Could not get a factory, so try alternatives - if (!cinfo.isAStreamableValue(clazz) && - !cinfo.isACustomValue(clazz) && cinfo.isAValueBase(clazz)) { + if (!cinfo.isAStreamableValue(clazz) && !cinfo.isACustomValue(clazz) && cinfo.isAValueBase(clazz)) { // use old-style OBV support (helper object) - BoxedValueHelper helper = Utility.getHelper(clazz, codebase, - repId); + BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId); if (helper instanceof com.sun.org.omg.CORBA.portable.ValueHelper) { - return readIDLValueWithHelper( - (com.sun.org.omg.CORBA.portable.ValueHelper) helper, - indirection); + return readIDLValueWithHelper((com.sun.org.omg.CORBA.portable.ValueHelper) helper, indirection); } else { return helper.read_value(parent); } @@ -1362,26 +1298,27 @@ private java.lang.Object readIDLValue(int indirection, String repId, } // If there was no error in getting the factory, use it. - valueIndirection = indirection; // for callback + valueIndirection = indirection; // for callback return factory.read_value(parent); } @InfoMethod - private void endTag( int endTag ) { } + private void endTag(int endTag) { + } @InfoMethod - private void chunkedNestingLevel( int nl ) { } + private void chunkedNestingLevel(int nl) { + } @InfoMethod - private void endFlag( int value ) { } + private void endFlag(int value) { + } /** * End tags are only written for chunked valuetypes. * - * Before Merlin, our ORBs wrote end tags which took into account - * all enclosing valuetypes. This was changed by an interop resolution - * (see details around chunkedValueNestingLevel) to only include - * enclosing chunked types. + * Before Merlin, our ORBs wrote end tags which took into account all enclosing valuetypes. This was changed by an + * interop resolution (see details around chunkedValueNestingLevel) to only include enclosing chunked types. * * ORB versioning and end tag compaction are handled here. */ @@ -1390,7 +1327,7 @@ private void readEndTag() { if (isChunked) { // Read the end tag int anEndTag = read_long(); - endTag( anEndTag ) ; + endTag(anEndTag); // End tags should always be negative, and the outermost // enclosing chunked valuetype should have a -1 end tag. @@ -1398,36 +1335,35 @@ private void readEndTag() { // handleEndOfValue should have assured that we were // at the end tag position! if (anEndTag >= 0) { - throw wrapper.positiveEndTag( anEndTag, get_offset() - 4 ) ; + throw wrapper.positiveEndTag(anEndTag, get_offset() - 4); } // If the ORB is null, or if we're sure we're talking to // a foreign ORB, Merlin, or something more recent, we // use the updated end tag computation, and are more strenuous // about the values. - if (orb == null || - ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || - ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { + if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) + || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { // If the end tag we read was less than what we were expecting, - // then the sender must think it's sent more enclosing - // chunked valuetypes than we have. Throw an exception. + // then the sender must think it's sent more enclosing + // chunked valuetypes than we have. Throw an exception. if (anEndTag < chunkedValueNestingLevel) { - throw wrapper.unexpectedEnclosingValuetype( anEndTag, chunkedValueNestingLevel ); + throw wrapper.unexpectedEnclosingValuetype(anEndTag, chunkedValueNestingLevel); } // If the end tag is bigger than what we expected, but // still negative, then the sender has done some end tag - // compaction. We back up the stream 4 bytes so that the + // compaction. We back up the stream 4 bytes so that the // next time readEndTag is called, it will get down here - // again. Even with fragmentation, we'll always be able + // again. Even with fragmentation, we'll always be able // to do this. if (anEndTag != chunkedValueNestingLevel) { byteBuffer.position(byteBuffer.position() - 4); } } else { // When talking to Kestrel (JDK 1.3) or Ladybird (JDK 1.3.1), we use our old - // end tag rules and are less strict. If the end tag + // end tag rules and are less strict. If the end tag // isn't what we expected, we back up, assuming // compaction. if (anEndTag != end_flag) { @@ -1438,12 +1374,12 @@ private void readEndTag() { // This only keeps track of the enclosing chunked // valuetypes chunkedValueNestingLevel++; - chunkedNestingLevel( chunkedValueNestingLevel ) ; + chunkedNestingLevel(chunkedValueNestingLevel); } // This keeps track of all enclosing valuetypes end_flag++; - endFlag( end_flag ) ; + endFlag(end_flag); } protected int get_offset() { @@ -1451,7 +1387,8 @@ protected int get_offset() { } @InfoMethod - private void unreadLastLong() { } + private void unreadLastLong() { + } @CdrRead private void start_block() { @@ -1467,10 +1404,10 @@ private void start_block() { blockLength = read_long(); // Must remember where we began the chunk to calculate how far - // along we are. See notes above about chunkBeginPos. + // along we are. See notes above about chunkBeginPos. if (blockLength > 0 && blockLength < MAX_BLOCK_LENGTH) { - blockLength += get_offset(); // _REVISIT_ unsafe, should use a Java long + blockLength += get_offset(); // _REVISIT_ unsafe, should use a Java long } else { blockLength = MAX_BLOCK_LENGTH; byteBuffer.position(byteBuffer.position() - 4); @@ -1478,7 +1415,8 @@ private void start_block() { } @InfoMethod - private void peekNextLong( long val ) { } + private void peekNextLong(long val) { + } // Makes sure that if we were reading a chunked value, we end up // at the right place in the stream, no matter how little the @@ -1508,12 +1446,12 @@ private void handleEndOfValue() { // // Peek next long int nextLong = read_long(); - peekNextLong( nextLong ) ; + peekNextLong(nextLong); byteBuffer.position(byteBuffer.position() - 4); - // We did find an end tag, so we're done. readEndTag + // We did find an end tag, so we're done. readEndTag // should take care of making sure it's the correct - // end tag, etc. Remember that since end tags, + // end tag, etc. Remember that since end tags, // chunk lengths, and valuetags have non overlapping // ranges, we can tell by the value what the longs are. if (nextLong < 0) { @@ -1524,12 +1462,12 @@ private void handleEndOfValue() { // A custom marshaled valuetype left extra data // on the wire, and that data had another - // nested value inside of it. We've just + // nested value inside of it. We've just // read the value tag or null of that nested value. // // In an attempt to get by it, we'll try to call // read_value() to get the nested value off of - // the wire. Afterwards, we must call handleEndOfValue + // the wire. Afterwards, we must call handleEndOfValue // recursively to read any further chunks that the containing // valuetype might still have after the nested // value. @@ -1540,7 +1478,7 @@ private void handleEndOfValue() { // an error, and ended up setting blockLength to something // other than maxBlockLength even though we weren't // starting a new chunk. - throw wrapper.couldNotSkipBytes( nextLong , get_offset() ) ; + throw wrapper.couldNotSkipBytes(nextLong, get_offset()); } } @@ -1553,49 +1491,49 @@ private void end_block() { blockLength = MAX_BLOCK_LENGTH; } else { // Skip over anything left by bad unmarshaling code (ex: - // a buggy custom unmarshaler). See handleEndOfValue. + // a buggy custom unmarshaler). See handleEndOfValue. if (blockLength > get_offset()) { skipToOffset(blockLength); } else { - throw wrapper.badChunkLength( blockLength, get_offset() ) ; + throw wrapper.badChunkLength(blockLength, get_offset()); } } } } - + @CdrRead - private int readValueTag(){ + private int readValueTag() { // outerValueDone = false; return read_long(); } public org.omg.CORBA.ORB orb() { - return orb; + return orb; } // ------------ End RMI related methods -------------------------- public final void read_boolean_array(boolean[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_boolean(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_boolean(); } } public final void read_char_array(char[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_char(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_char(); } } public final void read_wchar_array(char[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_wchar(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_wchar(); } } public final void read_short_array(short[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_short(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_short(); } } @@ -1604,8 +1542,8 @@ public final void read_ushort_array(short[] value, int offset, int length) { } public final void read_long_array(int[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_long(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_long(); } } @@ -1614,8 +1552,8 @@ public final void read_ulong_array(int[] value, int offset, int length) { } public final void read_longlong_array(long[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_longlong(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_longlong(); } } @@ -1624,31 +1562,30 @@ public final void read_ulonglong_array(long[] value, int offset, int length) { } public final void read_float_array(float[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_float(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_float(); } } public final void read_double_array(double[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_double(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_double(); } } public final void read_any_array(org.omg.CORBA.Any[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_any(); + for (int i = 0; i < length; i++) { + value[i + offset] = read_any(); } } - //--------------------------------------------------------------------// + // --------------------------------------------------------------------// // CDRInputStream state management. // - @CdrRead private String read_repositoryIds() { - + // Read # of repository ids int numRepIds = read_long(); if (numRepIds == 0xffffffff) { @@ -1660,7 +1597,7 @@ private String read_repositoryIds() { } } else { // read first array element and store it as an indirection to the whole array - int indirection = get_offset(); + int indirection = get_offset(); String repID = read_repositoryId(); if (repositoryIdCache == null) { repositoryIdCache = new CacheTable("Input repositoryIdCache", orb, false); @@ -1672,7 +1609,7 @@ private String read_repositoryIds() { for (int i = 1; i < numRepIds; i++) { read_repositoryId(); } - + return repID; } } @@ -1697,7 +1634,7 @@ private String read_repositoryId() { return result; } - throw wrapper.badRepIdIndirection(byteBuffer.position()) ; // todo test this case + throw wrapper.badRepIdIndirection(byteBuffer.position()); // todo test this case } @CdrRead @@ -1707,7 +1644,7 @@ private String read_codebase_URL() { int indirection = read_long() + get_offset() - 4; if (codebaseCache != null) { - result = codebaseCache.getKey(indirection) ; + result = codebaseCache.getKey(indirection); } } else { if (codebaseCache == null) { @@ -1720,68 +1657,68 @@ private String read_codebase_URL() { return result; } - throw wrapper.badCodebaseIndirection(byteBuffer.position()) ; // todo test this case + throw wrapper.badCodebaseIndirection(byteBuffer.position()); // todo test this case } /* DataInputStream methods */ - public java.lang.Object read_Abstract () { + public java.lang.Object read_Abstract() { return read_abstract_interface(); } - public java.io.Serializable read_Value () { + public java.io.Serializable read_Value() { return read_value(); } - public void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) { + public void read_any_array(org.omg.CORBA.AnySeqHolder seq, int offset, int length) { read_any_array(seq.value, offset, length); } - public void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { + public void read_boolean_array(org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { read_boolean_array(seq.value, offset, length); } - public void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) { + public void read_char_array(org.omg.CORBA.CharSeqHolder seq, int offset, int length) { read_char_array(seq.value, offset, length); } - public void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { + public void read_wchar_array(org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { read_wchar_array(seq.value, offset, length); } - public void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { + public void read_octet_array(org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { read_octet_array(seq.value, offset, length); } - public void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { + public void read_short_array(org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { read_short_array(seq.value, offset, length); } - public void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { + public void read_ushort_array(org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { read_ushort_array(seq.value, offset, length); } - public void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) { + public void read_long_array(org.omg.CORBA.LongSeqHolder seq, int offset, int length) { read_long_array(seq.value, offset, length); } - public void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { + public void read_ulong_array(org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { read_ulong_array(seq.value, offset, length); } - public void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { + public void read_ulonglong_array(org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { read_ulonglong_array(seq.value, offset, length); } - public void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { + public void read_longlong_array(org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { read_longlong_array(seq.value, offset, length); } - public void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { + public void read_float_array(org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { read_float_array(seq.value, offset, length); } - public void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { + public void read_double_array(org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { read_double_array(seq.value, offset, length); } @@ -1824,7 +1761,7 @@ private StringBuffer read_fixed_buffer() { } if (secondDigit == 12) { // positive number or zero - if ( ! wroteFirstDigit) { + if (!wroteFirstDigit) { // zero return new StringBuffer("0.0"); } else { @@ -1873,7 +1810,7 @@ public ByteOrder getByteOrder() { } public void orb(org.omg.CORBA.ORB orb) { - this.orb = (ORB)orb; + this.orb = (ORB) orb; } public BufferManagerRead getBufferManager() { @@ -1881,7 +1818,7 @@ public BufferManagerRead getBufferManager() { } @CdrRead - private void skipToOffset(int offset) { // todo test this + private void skipToOffset(int offset) { // todo test this // Number of bytes to skip int len = offset - get_offset(); @@ -1891,7 +1828,8 @@ private void skipToOffset(int offset) { int wanted; int bytes; - if (!byteBuffer.hasRemaining()) grow(1, 1); + if (!byteBuffer.hasRemaining()) + grow(1, 1); int avail = byteBuffer.remaining(); wanted = len - n; @@ -1901,7 +1839,6 @@ private void skipToOffset(int offset) { } } - // Mark and reset ------------------------------------------------- protected MarkAndResetHandler markAndResetHandler = null; @@ -1939,7 +1876,7 @@ public java.lang.Object createStreamMemento() { public void restoreInternalState(java.lang.Object streamMemento) { - StreamMemento mem = (StreamMemento)streamMemento; + StreamMemento mem = (StreamMemento) streamMemento; blockLength = mem.blockLength_; end_flag = mem.end_flag_; @@ -1967,7 +1904,7 @@ public void reset() { // ---------------------------------- end Mark and Reset // Provides a hook so subclasses of CDRInputStream can provide - // a CodeBase. This ultimately allows us to grab a Connection + // a CodeBase. This ultimately allows us to grab a Connection // instance in IIOPInputStream, the only subclass where this // is actually used. CodeBase getCodeBase() { @@ -1975,26 +1912,21 @@ CodeBase getCodeBase() { } /** - * Attempts to find the class described by the given - * repository ID string and expected type. The first - * attempt is to find the class locally, falling back - * on the URL that came with the value. The second - * attempt is to use a URL from the remote CodeBase. + * Attempts to find the class described by the given repository ID string and expected type. The first attempt is to + * find the class locally, falling back on the URL that came with the value. The second attempt is to use a URL from the + * remote CodeBase. */ @CdrRead - private Class getClassFromString(String repositoryIDString, - String codebaseURL, - Class expectedType) - { + private Class getClassFromString(String repositoryIDString, String codebaseURL, Class expectedType) { RepositoryIdInterface repositoryID = repIdStrs.getFromString(repositoryIDString); - ClassCodeBaseHandler ccbh = orb.classCodeBaseHandler() ; + ClassCodeBaseHandler ccbh = orb.classCodeBaseHandler(); if (ccbh != null) { - String className = repositoryID.getClassName() ; - Class result = ccbh.loadClass( codebaseURL, className ) ; + String className = repositoryID.getClassName(); + Class result = ccbh.loadClass(codebaseURL, className); if (result != null) { - return result ; + return result; } } @@ -2002,27 +1934,25 @@ private Class getClassFromString(String repositoryIDString, try { // First try to load the class locally, then use // the provided URL (if it isn't null) - return repositoryID.getClassFromType(expectedType, - codebaseURL); + return repositoryID.getClassFromType(expectedType, codebaseURL); } catch (ClassNotFoundException cnfeOuter) { - + try { - + if (getCodeBase() == null) { - return null; // class cannot be loaded remotely. + return null; // class cannot be loaded remotely. } - + // Get a URL from the remote CodeBase and retry codebaseURL = getCodeBase().implementation(repositoryIDString); - + // Don't bother trying to find it locally again if // we got a null URL if (codebaseURL == null) { return null; } - - return repositoryID.getClassFromType(expectedType, - codebaseURL); + + return repositoryID.getClassFromType(expectedType, codebaseURL); } catch (ClassNotFoundException cnfeInner) { // Failed to load the class return null; @@ -2030,15 +1960,12 @@ private Class getClassFromString(String repositoryIDString, } } catch (MalformedURLException mue) { // Always report a bad URL - throw wrapper.malformedUrl( mue, repositoryIDString, codebaseURL ) ; + throw wrapper.malformedUrl(mue, repositoryIDString, codebaseURL); } } - // Utility method used to get chars from bytes - char[] getConvertedChars(int numBytes, - CodeSetConversion.BTCConverter converter) { - + char[] getConvertedChars(int numBytes, CodeSetConversion.BTCConverter converter) { if (byteBuffer.remaining() >= numBytes) { // If the entire string is in this buffer, @@ -2049,17 +1976,17 @@ char[] getConvertedChars(int numBytes, byteBuffer.position(pos + numBytes); return result; } else { - // Stretches across buffers. Unless we provide an + // Stretches across buffers. Unless we provide an // incremental conversion interface, allocate and - // copy the bytes. + // copy the bytes. byte[] bytes = new byte[numBytes]; - // REVISIT - We should avoid getting the bytes into an array if - // possible. Extend the logic used above for the if() case , send - // the bytebuffer, as it is, for reading the strings. If any - // string is spread across multiple messages, the logic is going - // to be complex- which is, to decode strings in parts and then - // concatenate them in order. + // REVISIT - We should avoid getting the bytes into an array if + // possible. Extend the logic used above for the if() case , send + // the bytebuffer, as it is, for reading the strings. If any + // string is spread across multiple messages, the logic is going + // to be complex- which is, to decode strings in parts and then + // concatenate them in order. read_octet_array(bytes, 0, bytes.length); return converter.getChars(bytes, 0, numBytes); @@ -2070,7 +1997,7 @@ protected CodeSetConversion.BTCConverter getCharConverter() { if (charConverter == null) { charConverter = parent.createCharBTCConverter(); } - + return charConverter; } @@ -2078,22 +2005,19 @@ protected CodeSetConversion.BTCConverter getWCharConverter() { if (wcharConverter == null) { wcharConverter = parent.createWCharBTCConverter(); } - + return wcharConverter; } /** - * Aligns the current position on the given octet boundary - * if there are enough bytes available to do so. Otherwise, - * it just returns. This is used for some (but not all) - * GIOP 1.2 message headers. + * Aligns the current position on the given octet boundary if there are enough bytes available to do so. Otherwise, it + * just returns. This is used for some (but not all) GIOP 1.2 message headers. */ void alignOnBoundary(int octetBoundary) { int needed = computeAlignment(byteBuffer.position(), octetBoundary); - if (byteBuffer.position() + needed <= byteBuffer.limit()) - { + if (byteBuffer.position() + needed <= byteBuffer.limit()) { byteBuffer.position(byteBuffer.position() + needed); } } @@ -2104,19 +2028,20 @@ public void resetCodeSetConverters() { } @InfoMethod - private void valueTag( int value ) { } + private void valueTag(int value) { + } @CdrRead public void start_value() { // Read value tag int vType = readValueTag(); - valueTag( vType ) ; + valueTag(vType); if (vType == 0) { // Stream needs to go into a state where it // throws standard exception until end_value - // is called. This means the sender didn't - // send any custom data. If the reader here + // is called. This means the sender didn't + // send any custom data. If the reader here // tries to read more, we need to throw an // exception before reading beyond where // we're supposed to @@ -2127,27 +2052,25 @@ public void start_value() { if (vType == 0xffffffff) { // One should never indirect to a custom wrapper - throw wrapper.customWrapperIndirection( ); + throw wrapper.customWrapperIndirection(); } if (repIdUtil.isCodeBasePresent(vType)) { throw wrapper.customWrapperWithCodebase(); } - - if (repIdUtil.getTypeInfo(vType) - != RepositoryIdUtility.SINGLE_REP_TYPE_INFO) { - throw wrapper.customWrapperNotSingleRepid( ); - } + if (repIdUtil.getTypeInfo(vType) != RepositoryIdUtility.SINGLE_REP_TYPE_INFO) { + throw wrapper.customWrapperNotSingleRepid(); + } // REVISIT - Could verify repository ID even though // it isn't used elsewhere read_repositoryId(); - // Note: isChunked should be true here. Should have + // Note: isChunked should be true here. Should have // been set to true in the containing value's read_value // method. - + start_block(); end_flag--; chunkedValueNestingLevel--; @@ -2165,7 +2088,7 @@ public void end_value() { readEndTag(); // Note that isChunked should still be true here. - // If the containing valuetype is the highest + // If the containing valuetype is the highest // chunked value, it will get set to false // at the end of read_value. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_1.java index 305f794a8..65512dff0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_1.java @@ -21,8 +21,7 @@ import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -public class CDRInputStream_1_1 extends CDRInputStream_1_0 -{ +public class CDRInputStream_1_1 extends CDRInputStream_1_0 { // See notes in CDROutputStream protected int fragmentOffset = 0; @@ -36,7 +35,7 @@ public GIOPVersion getGIOPVersion() { public CDRInputStreamBase dup() { CDRInputStreamBase result = super.dup(); - ((CDRInputStream_1_1)result).fragmentOffset = this.fragmentOffset; + ((CDRInputStream_1_1) result).fragmentOffset = this.fragmentOffset; return result; } @@ -49,20 +48,18 @@ protected int get_offset() { @Override protected void alignAndCheck(int align, int n) { - checkBlockLength(align, n); // WARNING: Must compute real alignment after calling // checkBlockLength since it may move the position int alignment = computeAlignment(byteBuffer.position(), align); - if (byteBuffer.position() + n + alignment > byteBuffer.limit()) { + if (byteBuffer.position() + n + alignment > byteBuffer.limit()) { // Some other ORBs may have found a way to send 1.1 // fragments which put alignment bytes at the end // of a fragment - if (byteBuffer.position() + alignment == byteBuffer.limit()) - { + if (byteBuffer.position() + alignment == byteBuffer.limit()) { byteBuffer.position(byteBuffer.position() + alignment); } @@ -91,10 +88,10 @@ protected void grow(int align, int n) { byteBuffer = bufferManagerRead.underflow(byteBuffer); if (bufferManagerRead.isFragmentOnUnderflow()) { - + // By this point we should be guaranteed to have // a new fragment whose header has already been - // unmarshalled. bbwi.position() should point to the + // unmarshalled. bbwi.position() should point to the // end of the header. fragmentOffset += (oldSize - byteBuffer.position()); @@ -104,12 +101,10 @@ protected void grow(int align, int n) { // Mark/reset --------------------------------------- - private class FragmentableStreamMemento extends StreamMemento - { + private class FragmentableStreamMemento extends StreamMemento { private int fragmentOffset_; - public FragmentableStreamMemento() - { + public FragmentableStreamMemento() { super(); fragmentOffset_ = fragmentOffset; @@ -122,12 +117,10 @@ public java.lang.Object createStreamMemento() { } @Override - public void restoreInternalState(java.lang.Object streamMemento) - { + public void restoreInternalState(java.lang.Object streamMemento) { super.restoreInternalState(streamMemento); - fragmentOffset - = ((FragmentableStreamMemento)streamMemento).fragmentOffset_; + fragmentOffset = ((FragmentableStreamMemento) streamMemento).fragmentOffset_; } // -------------------------------------------------- @@ -135,8 +128,8 @@ public void restoreInternalState(java.lang.Object streamMemento) @Override public char read_wchar() { // In GIOP 1.1, interoperability with wchar is limited - // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. - // WARNING: For UTF-16, this means that there can be no + // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. + // WARNING: For UTF-16, this means that there can be no // byte order marker, so it must default to big endian! alignAndCheck(2, 2); @@ -145,11 +138,11 @@ public char read_wchar() { char[] result = getConvertedChars(2, getWCharConverter()); // Did the provided bytes convert to more than one - // character? This may come up as more unicode values are + // character? This may come up as more unicode values are // assigned, and a single 16 bit Java char isn't enough. // Better to use strings for i18n purposes. if (getWCharConverter().getNumChars() > 1) - throw wrapper.btcResultMoreThanOneChar() ; + throw wrapper.btcResultMoreThanOneChar(); return result[0]; } @@ -157,7 +150,7 @@ public char read_wchar() { @Override public String read_wstring() { // In GIOP 1.1, interoperability with wchar is limited - // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. + // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. int len = read_long(); // Workaround for ORBs which send string lengths of @@ -169,7 +162,7 @@ public String read_wstring() { checkForNegativeLength(len); // Don't include the two byte null for the - // following computations. Remember that since we're limited + // following computations. Remember that since we're limited // to a 2 byte fixed width code set, the "length" was the // number of such 2 byte code points plus a 2 byte null. len = len - 1; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_2.java index 83554e7db..e813a6e08 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDRInputStream_1_2.java @@ -24,14 +24,13 @@ import com.sun.corba.ee.spi.trace.CdrRead; @CdrRead -public class CDRInputStream_1_2 extends CDRInputStream_1_1 -{ +public class CDRInputStream_1_2 extends CDRInputStream_1_1 { // Indicates whether the header is padded. In GIOP 1.2 and above, // the body must be aligned on an 8-octet boundary, and so the header is // padded appropriately. However, if there is no body to a request or reply // message, there is no header padding, in the unfragmented case. protected boolean headerPadding; - + // used to remember headerPadding flag when mark() and restore() are used. protected boolean restoreHeaderPadding; @@ -43,7 +42,7 @@ void setHeaderPadding(boolean headerPadding) { // the mark and reset methods have been overridden to remember the // headerPadding flag. - + @Override public void mark(int readlimit) { super.mark(readlimit); @@ -63,10 +62,10 @@ public void reset() { @Override public CDRInputStreamBase dup() { CDRInputStreamBase result = super.dup(); - ((CDRInputStream_1_2)result).headerPadding = this.headerPadding; + ((CDRInputStream_1_2) result).headerPadding = this.headerPadding; return result; } - + @CdrRead @Override protected void alignAndCheck(int align, int n) { @@ -89,14 +88,14 @@ protected void alignAndCheck(int align, int n) { // In GIOP 1.2, a fragment may end with some alignment // padding (which leads to all fragments ending perfectly - // on evenly divisible 8 byte boundaries). A new fragment + // on evenly divisible 8 byte boundaries). A new fragment // never requires alignment with the header since it ends // on an 8 byte boundary. // NOTE: Change underlying ByteBuffer's position only if - // alignIncr is less than or equal to underlying - // ByteBuffer's limit. + // alignIncr is less than or equal to underlying + // ByteBuffer's limit. int savedPosition = byteBuffer.position(); - int alignIncr = computeAlignment(savedPosition,align); + int alignIncr = computeAlignment(savedPosition, align); int bytesNeeded = alignIncr + n; if (savedPosition + alignIncr <= byteBuffer.limit()) { byteBuffer.position(savedPosition + alignIncr); @@ -111,7 +110,7 @@ protected void alignAndCheck(int align, int n) { public GIOPVersion getGIOPVersion() { return GIOPVersion.V1_2; } - + @Override public char read_wchar() { // In GIOP 1.2, a wchar is encoded as an unsigned octet length @@ -121,18 +120,18 @@ public char read_wchar() { char[] result = getConvertedChars(numBytes, getWCharConverter()); // Did the provided bytes convert to more than one - // character? This may come up as more unicode values are + // character? This may come up as more unicode values are // assigned, and a single 16 bit Java char isn't enough. // Better to use strings for i18n purposes. if (getWCharConverter().getNumChars() > 1) - throw wrapper.btcResultMoreThanOneChar() ; + throw wrapper.btcResultMoreThanOneChar(); return result[0]; } @Override public String read_wstring() { - // In GIOP 1.2, wstrings are not terminated by a null. The + // In GIOP 1.2, wstrings are not terminated by a null. The // length is the number of octets in the converted format. // A zero length string is represented with the 4 byte length // value of 0. @@ -144,8 +143,6 @@ public String read_wstring() { checkForNegativeLength(len); - return new String(getConvertedChars(len, getWCharConverter()), - 0, - getWCharConverter().getNumChars()); + return new String(getConvertedChars(len, getWCharConverter()), 0, getWCharConverter().getNumChars()); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputObject.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputObject.java index 725c9cb0d..dfa977952 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputObject.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputObject.java @@ -21,7 +21,7 @@ import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.protocol.MessageMediator ; +import com.sun.corba.ee.spi.protocol.MessageMediator; import com.sun.corba.ee.spi.transport.TransportManager; import com.sun.corba.ee.spi.transport.Connection; @@ -31,7 +31,7 @@ import com.sun.corba.ee.impl.protocol.giopmsgheaders.Message; import com.sun.corba.ee.impl.transport.MessageTraceManagerImpl; -import java.io.IOException ; +import java.io.IOException; import java.io.ObjectInputStream; import java.lang.reflect.Field; import java.nio.ByteBuffer; @@ -39,7 +39,7 @@ import org.omg.CORBA.DataOutputStream; import org.omg.CORBA.TypeCode; -import com.sun.corba.ee.spi.trace.CdrWrite ; +import com.sun.corba.ee.spi.trace.CdrWrite; import org.omg.CORBA.portable.BoxedValueHelper; import org.omg.CORBA.portable.ValueOutputStream; @@ -48,11 +48,11 @@ */ @CdrWrite public class CDROutputObject extends org.omg.CORBA_2_3.portable.OutputStream - implements MarshalOutputStream, DataOutputStream, ValueOutputStream { + implements MarshalOutputStream, DataOutputStream, ValueOutputStream { private static final CDRInputObjectFactory INPUT_OBJECT_FACTORY = new CDRInputObjectFactory(); - protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self ; - private static final OMGSystemException omgWrapper = OMGSystemException.self ; + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + private static final OMGSystemException omgWrapper = OMGSystemException.self; private static final long serialVersionUID = -3801946738338642735L; private transient CDROutputStreamBase impl; @@ -78,7 +78,8 @@ protected void setPrivateFieldValue(Object obj, String fieldName, Object value) } } - private void setPrivateFieldValue(Object obj, Class theClass, String fieldName, Object value) throws NoSuchFieldException, IllegalAccessException { + private void setPrivateFieldValue(Object obj, Class theClass, String fieldName, Object value) + throws NoSuchFieldException, IllegalAccessException { try { Field field = theClass.getDeclaredField(fieldName); field.setAccessible(true); @@ -93,38 +94,33 @@ private void setPrivateFieldValue(Object obj, Class theClass, String fieldName, // This needed only to get FindBugs to shut up about transient fields. // Should never be called. - private void readObject( ObjectInputStream is ) throws IOException, - ClassNotFoundException { - impl = null ; - corbaMessageMediator = null ; - connection = null ; - throw new IllegalStateException( "Should not be called" ) ; + private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { + impl = null; + corbaMessageMediator = null; + connection = null; + throw new IllegalStateException("Should not be called"); } @CdrWrite - private void createCDROutputStream(ORB orb, GIOPVersion version, - BufferManagerWrite bufferManager, - byte streamFormatVersion, boolean usePooledByteBuffers) { + private void createCDROutputStream(ORB orb, GIOPVersion version, BufferManagerWrite bufferManager, byte streamFormatVersion, + boolean usePooledByteBuffers) { impl = OutputStreamFactory.newOutputStream(version); impl.init(orb, bufferManager, streamFormatVersion, usePooledByteBuffers); impl.setParent(this); } - public CDROutputObject(ORB orb, GIOPVersion version, - BufferManagerWrite bufferManager, - byte streamFormatVersion, boolean usePooledByteBuffers) { - createCDROutputStream( orb, version, bufferManager, streamFormatVersion, usePooledByteBuffers) ; + public CDROutputObject(ORB orb, GIOPVersion version, BufferManagerWrite bufferManager, byte streamFormatVersion, + boolean usePooledByteBuffers) { + createCDROutputStream(orb, version, bufferManager, streamFormatVersion, usePooledByteBuffers); - this.header = null ; - this.corbaMessageMediator = null ; - this.connection = null ; + this.header = null; + this.corbaMessageMediator = null; + this.connection = null; } - - private CDROutputObject( ORB orb, GIOPVersion giopVersion, - Message header, BufferManagerWrite manager, - byte streamFormatVersion, MessageMediator mediator) { - this(orb, giopVersion, manager, streamFormatVersion, usePooledBuffers(mediator)) ; + private CDROutputObject(ORB orb, GIOPVersion giopVersion, Message header, BufferManagerWrite manager, byte streamFormatVersion, + MessageMediator mediator) { + this(orb, giopVersion, manager, streamFormatVersion, usePooledBuffers(mediator)); this.header = header; this.corbaMessageMediator = mediator; @@ -142,28 +138,24 @@ public CDROutputObject(ORB orb, MessageMediator messageMediator, Message header, streamFormatVersion, messageMediator); } - // NOTE: + // NOTE: // Used in SharedCDR (i.e., must be grow). // Used in msgtypes test. - public CDROutputObject(ORB orb, MessageMediator messageMediator, - Message header, - byte streamFormatVersion, - int strategy) { + public CDROutputObject(ORB orb, MessageMediator messageMediator, Message header, byte streamFormatVersion, int strategy) { this(orb, messageMediator.getGIOPVersion(), header, - BufferManagerFactory.newBufferManagerWrite(strategy, header.getEncodingVersion(), orb), - streamFormatVersion, messageMediator); + BufferManagerFactory.newBufferManagerWrite(strategy, header.getEncodingVersion(), orb), streamFormatVersion, + messageMediator); } - // REVISIT + // REVISIT // Used on sendCancelRequest. // Used for needs addressing mode. - public CDROutputObject(ORB orb, MessageMediator mediator, GIOPVersion giopVersion, - Connection connection, Message header, byte streamFormatVersion) { + public CDROutputObject(ORB orb, MessageMediator mediator, GIOPVersion giopVersion, Connection connection, Message header, + byte streamFormatVersion) { - this( orb, giopVersion, header, - BufferManagerFactory.newBufferManagerWrite( giopVersion, header.getEncodingVersion(), orb), - streamFormatVersion, mediator ) ; - this.connection = connection ; + this(orb, giopVersion, header, BufferManagerFactory.newBufferManagerWrite(giopVersion, header.getEncodingVersion(), orb), + streamFormatVersion, mediator); + this.connection = connection; } // XREVISIT @@ -179,11 +171,10 @@ public final void finishSendingMessage() { } /* - * Write the contents of the CDROutputStream to the specified - * output stream. Has the side-effect of pushing any current + * Write the contents of the CDROutputStream to the specified output stream. Has the side-effect of pushing any current * Message onto the Message list. */ - public void writeTo(Connection connection) throws java.io.IOException { + public void writeTo(Connection connection) throws java.io.IOException { // // Update the GIOP MessageHeader size field. // @@ -192,12 +183,12 @@ public void writeTo(Connection connection) throws java.io.IOException { getMessageHeader().setSize(byteBuffer, byteBuffer.position()); - ORB lorb = (ORB)orb() ; + ORB lorb = (ORB) orb(); if (lorb != null) { - TransportManager ctm = lorb.getTransportManager() ; - MessageTraceManagerImpl mtm = (MessageTraceManagerImpl)ctm.getMessageTraceManager() ; + TransportManager ctm = lorb.getTransportManager(); + MessageTraceManagerImpl mtm = (MessageTraceManagerImpl) ctm.getMessageTraceManager(); if (mtm.isEnabled()) - mtm.recordDataSent(byteBuffer) ; + mtm.recordDataSent(byteBuffer); } byteBuffer.flip(); @@ -224,13 +215,11 @@ public final int getBufferPosition() { } /* - * Override the default CDR factory behavior to get the - * negotiated code sets from the connection. + * Override the default CDR factory behavior to get the negotiated code sets from the connection. * * These are only called once per message, the first time needed. * - * In the local case, there is no Connection, so use the - * local code sets. + * In the local case, there is no Connection, so use the local code sets. */ protected CodeSetConversion.CTBConverter createCharCTBConverter() { CodeSetComponentInfo.CodeSetContext codesets = getCodeSets(); @@ -242,8 +231,7 @@ protected CodeSetConversion.CTBConverter createCharCTBConverter() { return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1); } - OSFCodeSetRegistry.Entry charSet - = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet()); + OSFCodeSetRegistry.Entry charSet = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet()); if (charSet == null) { throw wrapper.unknownCodeset(null); @@ -267,20 +255,18 @@ protected CodeSetConversion.CTBConverter createWCharCTBConverter() { } } - OSFCodeSetRegistry.Entry wcharSet - = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet()); + OSFCodeSetRegistry.Entry wcharSet = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet()); if (wcharSet == null) { throw wrapper.unknownCodeset(null); } - boolean useByteOrderMarkers - = ((ORB)orb()).getORBData().useByteOrderMarkers(); + boolean useByteOrderMarkers = ((ORB) orb()).getORBData().useByteOrderMarkers(); // With UTF-16: // // For GIOP 1.2, we can put byte order markers if we want to, and - // use the default of big endian otherwise. (See issue 3405b) + // use the default of big endian otherwise. (See issue 3405b) // // For GIOP 1.1, we don't use BOMs and use the endianness of // the stream. @@ -311,18 +297,15 @@ private CodeSetComponentInfo.CodeSetContext getCodeSets() { } } - protected void dprint(String msg) - { + protected void dprint(String msg) { ORBUtility.dprint("CDROutputObject", msg); } - public void setMessageMediator(MessageMediator messageMediator) - { + public void setMessageMediator(MessageMediator messageMediator) { this.corbaMessageMediator = messageMediator; } - public MessageMediator getMessageMediator() - { + public MessageMediator getMessageMediator() { return corbaMessageMediator; } @@ -336,22 +319,22 @@ protected CDRInputObject createInputObject(ORB orb, InputObjectFactory factory) return inputObject; } - // We can move this out somewhere later. For now, it serves its purpose + // We can move this out somewhere later. For now, it serves its purpose // to create a concrete CDR delegate based on the GIOP version. private static class OutputStreamFactory { - + public static CDROutputStreamBase newOutputStream(GIOPVersion version) { - switch(version.intValue()) { - case GIOPVersion.VERSION_1_0: - return new CDROutputStream_1_0(); - case GIOPVersion.VERSION_1_1: - return new CDROutputStream_1_1(); + switch (version.intValue()) { + case GIOPVersion.VERSION_1_0: + return new CDROutputStream_1_0(); + case GIOPVersion.VERSION_1_1: + return new CDROutputStream_1_1(); case GIOPVersion.VERSION_1_2: return new CDROutputStream_1_2(); default: - // REVISIT - what is appropriate? INTERNAL exceptions + // REVISIT - what is appropriate? INTERNAL exceptions // are really hard to track later. - throw wrapper.unsupportedGiopVersion( version ) ; + throw wrapper.unsupportedGiopVersion(version); } } } @@ -361,42 +344,55 @@ public static CDROutputStreamBase newOutputStream(GIOPVersion version) { public final void write_boolean(boolean value) { impl.write_boolean(value); } + public final void write_char(char value) { impl.write_char(value); } + public final void write_wchar(char value) { impl.write_wchar(value); } + public final void write_octet(byte value) { impl.write_octet(value); } + public final void write_short(short value) { impl.write_short(value); } + public final void write_ushort(short value) { impl.write_ushort(value); } + public final void write_long(int value) { impl.write_long(value); } + public final void write_ulong(int value) { impl.write_ulong(value); } + public final void write_longlong(long value) { impl.write_longlong(value); } + public final void write_ulonglong(long value) { impl.write_ulonglong(value); } + public final void write_float(float value) { impl.write_float(value); } + public final void write_double(double value) { impl.write_double(value); } + public final void write_string(String value) { impl.write_string(value); } + public final void write_wstring(String value) { impl.write_wstring(value); } @@ -404,50 +400,64 @@ public final void write_wstring(String value) { public final void write_boolean_array(boolean[] value, int offset, int length) { impl.write_boolean_array(value, offset, length); } + public final void write_char_array(char[] value, int offset, int length) { impl.write_char_array(value, offset, length); } + public final void write_wchar_array(char[] value, int offset, int length) { impl.write_wchar_array(value, offset, length); } + public final void write_octet_array(byte[] value, int offset, int length) { impl.write_octet_array(value, offset, length); } + public final void write_short_array(short[] value, int offset, int length) { impl.write_short_array(value, offset, length); } - public final void write_ushort_array(short[] value, int offset, int length){ + + public final void write_ushort_array(short[] value, int offset, int length) { impl.write_ushort_array(value, offset, length); } + public final void write_long_array(int[] value, int offset, int length) { impl.write_long_array(value, offset, length); } + public final void write_ulong_array(int[] value, int offset, int length) { impl.write_ulong_array(value, offset, length); } + public final void write_longlong_array(long[] value, int offset, int length) { impl.write_longlong_array(value, offset, length); } - public final void write_ulonglong_array(long[] value, int offset,int length) { + + public final void write_ulonglong_array(long[] value, int offset, int length) { impl.write_ulonglong_array(value, offset, length); } + public final void write_float_array(float[] value, int offset, int length) { impl.write_float_array(value, offset, length); } + public final void write_double_array(double[] value, int offset, int length) { impl.write_double_array(value, offset, length); } + public final void write_Object(org.omg.CORBA.Object value) { impl.write_Object(value); } + public final void write_TypeCode(TypeCode value) { impl.write_TypeCode(value); } + public final void write_any(Any value) { impl.write_any(value); } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) public final void write_Principal(org.omg.CORBA.Principal value) { impl.write_Principal(value); } @@ -456,15 +466,14 @@ public final void write_Principal(org.omg.CORBA.Principal value) { public final void write(int b) throws java.io.IOException { impl.write(b); } - + @Override public final void write_fixed(java.math.BigDecimal value) { impl.write_fixed(value); } @Override - public final void write_Context(org.omg.CORBA.Context ctx, - org.omg.CORBA.ContextList contexts) { + public final void write_Context(org.omg.CORBA.Context ctx, org.omg.CORBA.ContextList contexts) { impl.write_Context(ctx, contexts); } @@ -480,14 +489,12 @@ public final void write_value(java.io.Serializable value) { } @Override - public final void write_value(java.io.Serializable value, - java.lang.Class clz) { + public final void write_value(java.io.Serializable value, java.lang.Class clz) { impl.write_value(value, clz); } @Override - public final void write_value(java.io.Serializable value, - String repository_id) { + public final void write_value(java.io.Serializable value, String repository_id) { impl.write_value(value, repository_id); } @@ -536,9 +543,7 @@ public final void putEndian() { impl.putEndian(); } - public void writeTo(java.io.OutputStream s) - throws IOException - { + public void writeTo(java.io.OutputStream s) throws IOException { impl.writeTo(s); } @@ -548,6 +553,7 @@ public final byte[] toByteArray() { /** * Returns the contents of this stream, from the specified start index to the current output position. + * * @param start the index at which to start copying the data. * @return a byte array representation of part of the output. */ @@ -556,11 +562,11 @@ public final byte[] toByteArray(int start) { } // org.omg.CORBA.DataOutputStream - public final void write_Abstract (java.lang.Object value) { + public final void write_Abstract(java.lang.Object value) { impl.write_Abstract(value); } - public final void write_Value (java.io.Serializable value) { + public final void write_Value(java.io.Serializable value) { impl.write_Value(value); } @@ -637,7 +643,8 @@ protected interface InputObjectFactory { private static class CDRInputObjectFactory implements InputObjectFactory { @Override - public CDRInputObject createInputObject(CDROutputObject outputObject, ORB orb, ByteBuffer byteBuffer, int size, GIOPVersion giopVersion) { + public CDRInputObject createInputObject(CDROutputObject outputObject, ORB orb, ByteBuffer byteBuffer, int size, + GIOPVersion giopVersion) { Message messageHeader = outputObject.getMessageHeader(); messageHeader.setSize(byteBuffer, size); return new CDRInputObject(orb, null, byteBuffer, messageHeader); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStreamBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStreamBase.java index d052dad59..33190b9fd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStreamBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStreamBase.java @@ -28,13 +28,10 @@ import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; /** - * Describes CDROutputObject delegates and provides some - * implementation. Non-default constructors are avoided in - * the delegation to separate instantiation from initialization, - * so we use init methods. + * Describes CDROutputObject delegates and provides some implementation. Non-default constructors are avoided in the + * delegation to separate instantiation from initialization, so we use init methods. */ -abstract class CDROutputStreamBase extends java.io.OutputStream -{ +abstract class CDROutputStreamBase extends java.io.OutputStream { protected CDROutputObject parent; // Required by parent CDROutputObject @@ -44,60 +41,91 @@ public void setParent(CDROutputObject parent) { // See EncapsOutputStream, the only one that uses the // non-pooled ByteBuffers, for additional info. - protected abstract void init(org.omg.CORBA.ORB orb, - BufferManagerWrite bufferManager, - byte streamFormatVersion, - boolean usePooledByteBuffers); + protected abstract void init(org.omg.CORBA.ORB orb, BufferManagerWrite bufferManager, byte streamFormatVersion, + boolean usePooledByteBuffers); public abstract void write_boolean(boolean value); public abstract void write_char(char value); + public abstract void write_wchar(char value); + public abstract void write_octet(byte value); + public abstract void write_short(short value); + public abstract void write_ushort(short value); + public abstract void write_long(int value); + public abstract void write_ulong(int value); + public abstract void write_longlong(long value); + public abstract void write_ulonglong(long value); + public abstract void write_float(float value); + public abstract void write_double(double value); + public abstract void write_string(String value); + public abstract void write_wstring(String value); + public abstract void write_boolean_array(boolean[] value, int offset, int length); + public abstract void write_char_array(char[] value, int offset, int length); + public abstract void write_wchar_array(char[] value, int offset, int length); + public abstract void write_octet_array(byte[] value, int offset, int length); + public abstract void write_short_array(short[] value, int offset, int length); + public abstract void write_ushort_array(short[] value, int offset, int length); + public abstract void write_long_array(int[] value, int offset, int length); + public abstract void write_ulong_array(int[] value, int offset, int length); + public abstract void write_longlong_array(long[] value, int offset, int length); + public abstract void write_ulonglong_array(long[] value, int offset, int length); + public abstract void write_float_array(float[] value, int offset, int length); + public abstract void write_double_array(double[] value, int offset, int length); + public abstract void write_Object(org.omg.CORBA.Object value); + public abstract void write_TypeCode(TypeCode value); + public abstract void write_any(Any value); - @SuppressWarnings({"deprecation"}) + + @SuppressWarnings({ "deprecation" }) public abstract void write_Principal(org.omg.CORBA.Principal value); + public void write(int b) throws java.io.IOException { throw new org.omg.CORBA.NO_IMPLEMENT(); } + public abstract void write_fixed(java.math.BigDecimal value); - public void write_Context(org.omg.CORBA.Context ctx, - org.omg.CORBA.ContextList contexts) { + + public void write_Context(org.omg.CORBA.Context ctx, org.omg.CORBA.ContextList contexts) { throw new org.omg.CORBA.NO_IMPLEMENT(); } + public abstract org.omg.CORBA.ORB orb(); // org.omg.CORBA_2_3.portable.OutputStream public abstract void write_value(java.io.Serializable value); public abstract void write_value(java.io.Serializable value, java.lang.Class clz); + public abstract void write_value(java.io.Serializable value, String repository_id); - public abstract void write_value(java.io.Serializable value, - org.omg.CORBA.portable.BoxedValueHelper factory); + + public abstract void write_value(java.io.Serializable value, org.omg.CORBA.portable.BoxedValueHelper factory); + public abstract void write_abstract_interface(java.lang.Object obj); // java.io.OutputStream @@ -105,17 +133,22 @@ public abstract void write_value(java.io.Serializable value, public abstract void start_block(); public abstract void end_block(); + public abstract void putEndian(); - public abstract void writeTo(java.io.OutputStream s) - throws IOException; + + public abstract void writeTo(java.io.OutputStream s) throws IOException; + public abstract byte[] toByteArray(); + protected abstract byte[] toByteArray(int start); // org.omg.CORBA.DataOutputStream - public abstract void write_Abstract (java.lang.Object value); + public abstract void write_Abstract(java.lang.Object value); + + public abstract void write_Value(java.io.Serializable value); - public abstract void write_Value (java.io.Serializable value); public abstract void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length); + // org.omg.CORBA.portable.ValueBase public abstract String[] _truncatable_ids(); @@ -128,17 +161,19 @@ public abstract void writeTo(java.io.OutputStream s) public abstract int getIndex(); public abstract void setIndex(int value); - // public abstract void close() throws IOException; + // public abstract void close() throws IOException; // public abstract void flush() throws IOException; // public abstract void write(byte b[], int off, int len) throws IOException; // public abstract void write(byte b[]) throws IOException; abstract void dereferenceBuffer(); + public abstract ByteBuffer getByteBuffer(); public abstract BufferManagerWrite getBufferManager(); public abstract void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale); + public abstract void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s); public abstract GIOPVersion getGIOPVersion(); @@ -155,4 +190,3 @@ public abstract void writeTo(java.io.OutputStream s) public abstract void end_value(); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_0.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_0.java index f77d8508f..a10c76817 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_0.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_0.java @@ -103,7 +103,7 @@ public class CDROutputStream_1_0 extends CDROutputStreamBase { Map> enumCache = null; // Codebase cache - // Note that a CacheTable here fails badly on read. Why? + // Note that a CacheTable here fails badly on read. Why? // This suggests that different codebase strings with the // same characters are being used, but that does not explain // the read-side failure. @@ -122,7 +122,7 @@ public class CDROutputStream_1_0 extends CDROutputStreamBase { // Beginning with the resolution to interop issue 3526, // only enclosing chunked valuetypes are taken into account - // when computing the nesting level. However, we still need + // when computing the nesting level. However, we still need // the old computation around for interoperability with our // older ORBs. private int chunkedValueNestingLevel = 0; @@ -149,11 +149,8 @@ public class CDROutputStream_1_0 extends CDROutputStreamBase { // REVISIT - This should be re-factored so that including whether // to use pool byte buffers or not doesn't need to be known. - public void init(org.omg.CORBA.ORB orb, - BufferManagerWrite bufferManager, - byte streamFormatVersion, - boolean usePooledByteBuffers) { - // ORB must not be null. See CDROutputStream constructor. + public void init(org.omg.CORBA.ORB orb, BufferManagerWrite bufferManager, byte streamFormatVersion, boolean usePooledByteBuffers) { + // ORB must not be null. See CDROutputStream constructor. this.orb = (ORB) orb; this.bufferManagerWrite = bufferManager; @@ -164,8 +161,7 @@ public void init(org.omg.CORBA.ORB orb, createRepositoryIdHandlers(); } - static ByteBuffer allocateBuffer(org.omg.CORBA.ORB orb, BufferManagerWrite bufferManager, - boolean usePooledByteBuffers) { + static ByteBuffer allocateBuffer(org.omg.CORBA.ORB orb, BufferManagerWrite bufferManager, boolean usePooledByteBuffers) { int bufferSize = bufferManager.getBufferSize(); ByteBuffer buffer; if (usePooledByteBuffers) { @@ -244,7 +240,7 @@ protected void alignAndReserve(int align, int n) { } // - // Default implementation of grow. Subclassers may override this. + // Default implementation of grow. Subclassers may override this. // Always grow the single buffer. This needs to delegate // fragmentation policy for IIOP 1.1. // @@ -418,13 +414,15 @@ public void write_wstring(String value) { // Performs no checks and doesn't tamper with chunking void internalWriteOctetArray(byte[] value, int offset, int length) { - if (length == 0) return; + if (length == 0) + return; - alignAndReserve(1, 1); // this gives the code the chance to do the eight-byte alignment, if needed + alignAndReserve(1, 1); // this gives the code the chance to do the eight-byte alignment, if needed int numWritten = 0; while (numWritten < length) { - if (!byteBuffer.hasRemaining()) alignAndReserve(1, 1); + if (!byteBuffer.hasRemaining()) + alignAndReserve(1, 1); int count = Math.min(length - numWritten, byteBuffer.remaining()); byteBuffer.put(value, offset + numWritten, count); @@ -446,7 +444,7 @@ public final void write_octet_array(byte b[], int offset, int length) { handleSpecialChunkEnd(); } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) public void write_Principal(org.omg.CORBA.Principal p) { write_long(p.name().length); write_octet_array(p.name(), 0, p.name().length); @@ -601,9 +599,8 @@ private void writeArray(Serializable array, Class clazz) { } @CdrWrite - private void writeValueBase(org.omg.CORBA.portable.ValueBase object, - Class clazz) { - // _REVISIT_ could check to see whether chunking really needed + private void writeValueBase(org.omg.CORBA.portable.ValueBase object, Class clazz) { + // _REVISIT_ could check to see whether chunking really needed mustChunk = true; int indirection = writeValueTag(true, true, getCodebase(clazz)); @@ -618,11 +615,10 @@ private void writeValueBase(org.omg.CORBA.portable.ValueBase object, endValueChunk(true); } - // We know that object is not null, because that was checked in + // We know that object is not null, because that was checked in // write_value( Serializable, String ) @CdrWrite - private void writeRMIIIOPValueType(Serializable object, Class clazz, - ClassInfoCache.ClassInfo cinfo) { + private void writeRMIIIOPValueType(Serializable object, Class clazz, ClassInfoCache.ClassInfo cinfo) { if (valueHandler == null) { valueHandler = ORBUtility.createValueHandler(); @@ -670,8 +666,7 @@ private void writeRMIIIOPValueType(Serializable object, Class clazz, } @CdrWrite - private void callWriteValue(org.omg.CORBA.portable.OutputStream parent, - java.io.Serializable object, byte streamFormatVersion) { + private void callWriteValue(org.omg.CORBA.portable.OutputStream parent, java.io.Serializable object, byte streamFormatVersion) { if (valueHandler == null) { valueHandler = ORBUtility.createValueHandler(); } @@ -807,7 +802,7 @@ public void write_value(Serializable object) { write_value(object, (String) null); } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) @CdrWrite public void write_value(Serializable object, BoxedValueHelper factory) { if (object == null) { @@ -879,7 +874,7 @@ private short getTypeModifier(ValueHelper factory) { short modifier; try { modifier = factory.get_type().type_modifier(); - } catch (BadKind ex) { // tk_value_box + } catch (BadKind ex) { // tk_value_box modifier = VM_NONE.value; } return modifier; @@ -900,7 +895,7 @@ public void start_block() { write_long(0); // Has to happen after write_long since write_long could - // trigger grow which is overridden by subclasses to + // trigger grow which is overridden by subclasses to // depend on inBlock. inBlock = true; @@ -912,7 +907,7 @@ public void start_block() { // Utility method which will hopefully decrease chunking complexity // by allowing us to end_block and update chunk lengths without - // calling alignAndReserve. Otherwise, it's possible to get into + // calling alignAndReserve. Otherwise, it's possible to get into // recursive scenarios which lose the chunking state. protected void writeLongWithoutAlign(int x) { byteBuffer.putInt(x); @@ -942,14 +937,14 @@ public void end_block() { // Test to see if the block was of zero length // If so, remove the block instead of ending it - // (This can happen if the last field written - // in a value was another value) + // (This can happen if the last field written + // in a value was another value) blockSizePosition(blockSizePosition); if (get_offset() == blockSizePosition) { removingZeroLengthBlock(); - // Need to assert that blockSizeIndex == bbwi.position()? REVISIT + // Need to assert that blockSizeIndex == bbwi.position()? REVISIT byteBuffer.position(byteBuffer.position() - 4); blockSizeIndex = -1; @@ -1128,7 +1123,7 @@ public final void write_any_array(org.omg.CORBA.Any value[], int offset, int len } } - //--------------------------------------------------------------------// + // --------------------------------------------------------------------// // CDROutputStream state management. // @@ -1165,12 +1160,10 @@ private void freeValueCache() { } } - private void updateIndirectionTable(int indirection, - java.lang.Object key) { + private void updateIndirectionTable(int indirection, java.lang.Object key) { if (valueCache == null) { - valueCache = new CacheTable("Output valueCache", - orb, true); + valueCache = new CacheTable("Output valueCache", orb, true); } valueCache.put(key, indirection); } @@ -1198,7 +1191,7 @@ private void write_repositoryId(String id) { } } - // Write it as a string. Note that we have already done the + // Write it as a string. Note that we have already done the // special case conversion of non-Latin-1 characters to escaped // Latin-1 sequences in RepositoryId. @@ -1279,7 +1272,7 @@ private int writeValueTag(boolean chunkIt, boolean useRepId, String codebase) { return indirection; } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) @CdrWrite private void writeIDLValue(Serializable object, String repID) { if (object instanceof StreamableValue) { @@ -1290,11 +1283,9 @@ private void writeIDLValue(Serializable object, String repID) { BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID); boolean isCustom = false; - if (helper instanceof com.sun.org.omg.CORBA.portable.ValueHelper && - object instanceof CustomMarshal) { + if (helper instanceof com.sun.org.omg.CORBA.portable.ValueHelper && object instanceof CustomMarshal) { try { - if (((com.sun.org.omg.CORBA.portable.ValueHelper) helper) - .get_type().type_modifier() == VM_CUSTOM.value) { + if (((com.sun.org.omg.CORBA.portable.ValueHelper) helper).get_type().type_modifier() == VM_CUSTOM.value) { isCustom = true; } } catch (BadKind ex) { @@ -1317,13 +1308,13 @@ private void writeEndTag(boolean chunked) { if (get_offset() == end_flag_position) { if (byteBuffer.position() == end_flag_index) { // We are exactly at the same position and index as the - // end of the last end tag. Thus, we can back up over it + // end of the last end tag. Thus, we can back up over it // and compact the tags. byteBuffer.position(byteBuffer.position() - 4); - } else { // reg - is this even possible any more? + } else { // reg - is this even possible any more? // Special case in which we're at the beginning of a new - // fragment, but the position is the same. We can't back up, - // so we just write the new end tag without compaction. This + // fragment, but the position is the same. We can't back up, + // so we just write the new end tag without compaction. This // occurs when a value ends and calls start_block to open a // continuation chunk, but it's called at the very end of // a fragment. @@ -1332,7 +1323,7 @@ private void writeEndTag(boolean chunked) { writeNestingLevel(); - // Remember the last index and position. + // Remember the last index and position. // These are only used when chunking. end_flag_index = byteBuffer.position(); end_flag_position = get_offset(); @@ -1345,22 +1336,18 @@ private void writeEndTag(boolean chunked) { } /** - * Handles ORB versioning of the end tag. Should only - * be called if chunking. + * Handles ORB versioning of the end tag. Should only be called if chunking. *

- * If talking to our older ORBs (Standard Extension, - * Kestrel, and Ladybird), write the end flag that takes - * into account all enclosing valuetypes. + * If talking to our older ORBs (Standard Extension, Kestrel, and Ladybird), write the end flag that takes into account + * all enclosing valuetypes. *

- * If talking a newer or foreign ORB, or if the orb - * instance is null, write the end flag that only takes - * into account the enclosing chunked valuetypes. + * If talking a newer or foreign ORB, or if the orb instance is null, write the end flag that only takes into account + * the enclosing chunked valuetypes. */ @CdrWrite private void writeNestingLevel() { - if (orb == null || - ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || - ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { + if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) + || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_long(chunkedValueNestingLevel); } else { @@ -1369,8 +1356,7 @@ private void writeNestingLevel() { } @CdrWrite - private void writeClass(String repository_id, Class clz, - ClassInfoCache.ClassInfo cinfo) { + private void writeClass(String repository_id, Class clz, ClassInfoCache.ClassInfo cinfo) { if (repository_id == null) { repository_id = repIdStrs.getClassDescValueRepId(); @@ -1388,13 +1374,12 @@ private void writeClass(String repository_id, Class clz, } // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID - // and codebase strings in the wrong order. This handles + // and codebase strings in the wrong order. This handles // backwards compatibility. @CdrWrite private void writeClassBody(Class clz, ClassInfoCache.ClassInfo cinfo) { - if (orb == null || - ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || - ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { + if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) + || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_value(getCodebase(clz)); write_value(repIdStrs.createForAnyType(clz, cinfo)); @@ -1406,7 +1391,7 @@ private void writeClassBody(Class clz, ClassInfoCache.ClassInfo cinfo) { @CdrWrite private void writeIDLEntity(IDLEntity object) { - // _REVISIT_ could check to see whether chunking really needed + // _REVISIT_ could check to see whether chunking really needed mustChunk = true; String repository_id = repIdStrs.createForJavaType(object); @@ -1420,25 +1405,20 @@ private void writeIDLEntity(IDLEntity object) { // Write Value chunk startValueChunk(true); - // Write the IDLEntity using reflection + // Write the IDLEntity using reflection try { ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader()); - final Class helperClass = Utility.loadClassForClass( - clazz.getName() + "Helper", codebase, clazzLoader, - clazz, clazzLoader); + final Class helperClass = Utility.loadClassForClass(clazz.getName() + "Helper", codebase, clazzLoader, clazz, clazzLoader); // getDeclaredMethod requires RuntimePermission accessDeclaredMembers // if a different class loader is used (even though the javadoc says otherwise) Method writeMethod; try { - writeMethod = AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Method run() throws NoSuchMethodException { - return helperClass.getDeclaredMethod(kWriteMethod, - org.omg.CORBA.portable.OutputStream.class, clazz); - } - } - ); + writeMethod = AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Method run() throws NoSuchMethodException { + return helperClass.getDeclaredMethod(kWriteMethod, org.omg.CORBA.portable.OutputStream.class, clazz); + } + }); } catch (PrivilegedActionException pae) { // this gets caught below throw (NoSuchMethodException) pae.getException(); @@ -1567,7 +1547,7 @@ public void write_fixed(String string, int signum) { } private final static String _id = "IDL:omg.org/CORBA/DataOutputStream:1.0"; - private final static String[] _ids = {_id}; + private final static String[] _ids = { _id }; public String[] _truncatable_ids() { if (_ids == null) { @@ -1579,7 +1559,7 @@ public String[] _truncatable_ids() { public void writeIndirection(int tag, int posIndirectedTo) { // Must ensure that there are no chunks between the tag - // and the actual indirection value. This isn't talked about + // and the actual indirection value. This isn't talked about // in the spec, but seems to cause headaches in our code. // At the very least, this method isolates the indirection code // that was duplicated so often. @@ -1591,11 +1571,10 @@ public void writeIndirection(int tag, int posIndirectedTo) { // write indirection // Use parent.getRealIndex() so that it can be overridden by TypeCodeOutputStreams -/* - System.out.println("CDROutputStream_1_0 writing indirection pos " + posIndirectedTo + - " - real index " + parent.getRealIndex(get_offset()) + " = " + - (posIndirectedTo - parent.getRealIndex(get_offset()))); -*/ + /* + * System.out.println("CDROutputStream_1_0 writing indirection pos " + posIndirectedTo + " - real index " + + * parent.getRealIndex(get_offset()) + " = " + (posIndirectedTo - parent.getRealIndex(get_offset()))); + */ write_long(posIndirectedTo - parent.getRealIndex(get_offset())); handleSpecialChunkEnd(); @@ -1658,14 +1637,14 @@ public void end_value() { writeEndTag(true); // Check to see if we need to start another block for a - // possible outer value. Since we're in the stream + // possible outer value. Since we're in the stream // format 2 custom type contained by another custom // type, mustChunk should always be true. // // Here's why we need to open a continuation chunk: // // We need to enclose the default data of the - // next subclass down in chunks. There won't be + // next subclass down in chunks. There won't be // an end tag separating the superclass optional // data and the subclass's default data. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_1.java index 679631998..5f47dbe94 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_1.java @@ -21,20 +21,19 @@ import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -public class CDROutputStream_1_1 extends CDROutputStream_1_0 -{ - // This is used to keep indirections working across fragments. When added +public class CDROutputStream_1_1 extends CDROutputStream_1_0 { + // This is used to keep indirections working across fragments. When added // to the current bbwi.position(), the result is the current position // in the byte stream without any fragment headers. - // + // // It is equal to the following: // // n = number of buffers (0 is original buffer, 1 is first fragment, etc) - // + // // n == 0, fragmentOffset = 0 // // n > 0, fragmentOffset - // = sum i=[1,n] { bbwi_i-1_.size - buffer i header length } + // = sum i=[1,n] { bbwi_i-1_.size - buffer i header length } // protected int fragmentOffset = 0; @@ -42,9 +41,9 @@ public class CDROutputStream_1_1 extends CDROutputStream_1_0 protected void alignAndReserve(int align, int n) { // Notice that in 1.1, we won't end a fragment with - // alignment padding. We also won't guarantee that + // alignment padding. We also won't guarantee that // our fragments end on evenly divisible 8 byte - // boundaries. There may be alignment + // boundaries. There may be alignment // necessary with the header of the next fragment // since the header isn't aligned on an 8 byte // boundary, so we have to calculate it twice. @@ -75,13 +74,13 @@ protected void grow(int align, int n) { byteBuffer = bufferManagerWrite.overflow(byteBuffer, n); // At this point, if we fragmented, we should have a ByteBuffer - // with the fragment header already marshalled. The size and length fields + // with the fragment header already marshalled. The size and length fields // should be updated accordingly, and the fragmented flag should be set. if (bufferManagerWrite.isFragmentOnOverflow()) { // Update fragmentOffset so indirections work properly. // At this point, oldSize is the entire length of the - // previous buffer. bbwi.position() is the length of the + // previous buffer. bbwi.position() is the length of the // fragment header of this buffer. fragmentOffset += (oldSize - byteBuffer.position()); } @@ -98,10 +97,9 @@ public GIOPVersion getGIOPVersion() { } @Override - public void write_wchar(char x) - { + public void write_wchar(char x) { // In GIOP 1.1, interoperability with wchar is limited - // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. + // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. // Note that the following code prohibits UTF-16 with a byte // order marker (which would result in 4 bytes). CodeSetConversion.CTBConverter converter = getWCharConverter(); @@ -111,23 +109,19 @@ public void write_wchar(char x) if (converter.getNumBytes() != 2) throw wrapper.badGiop11Ctb(); - alignAndReserve(converter.getAlignment(), - converter.getNumBytes()); + alignAndReserve(converter.getAlignment(), converter.getNumBytes()); - parent.write_octet_array(converter.getBytes(), - 0, - converter.getNumBytes()); + parent.write_octet_array(converter.getBytes(), 0, converter.getNumBytes()); } @Override - public void write_wstring(String value) - { + public void write_wstring(String value) { if (value == null) { throw wrapper.nullParam(); } // The length is the number of code points (which are 2 bytes each) - // including the 2 byte null. See CORBA formal 99-10-07 15.3.2.7. + // including the 2 byte null. See CORBA formal 99-10-07 15.3.2.7. int len = value.length() + 1; @@ -140,7 +134,6 @@ public void write_wstring(String value) internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes()); // Write the 2 byte null ending - write_short((short)0); + write_short((short) 0); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_2.java index 3ffed8168..91a71d4d0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CDROutputStream_1_2.java @@ -25,16 +25,15 @@ import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @CdrWrite -public class CDROutputStream_1_2 extends CDROutputStream_1_1 -{ +public class CDROutputStream_1_2 extends CDROutputStream_1_1 { // There's a situation with chunking with fragmentation // in which the alignment for a primitive value is needed // to fill fragment N, but the primitive won't fit so - // must go into fragment N + 1. The behavior is the same + // must go into fragment N + 1. The behavior is the same // as that for specialChunks. // // Unfortunately, given the current code, we can't reuse - // specialChunk. If you wrap each of the following + // specialChunk. If you wrap each of the following // write calls with handleSpecialChunkBegin/End, you // will lose your state because the primitive calls will // change the variables, etc. @@ -53,23 +52,23 @@ public class CDROutputStream_1_2 extends CDROutputStream_1_1 // protected boolean primitiveAcrossFragmentedChunk = false; - // Used in chunking. Here's how this works: + // Used in chunking. Here's how this works: // - // When chunking and writing an array of primitives, a string, or a - // wstring, _AND_ it won't fit in the buffer do the following. (As + // When chunking and writing an array of primitives, a string, or a + // wstring, _AND_ it won't fit in the buffer do the following. (As // you can see, this is a very "special" chunk.) // - // 1. Write the length of the chunk including the array length - // 2. Set specialChunk to true + // 1. Write the length of the chunk including the array length + // 2. Set specialChunk to true // 3 applies to ALL chunking: - // 3. In grow, if we need to fragment and specialChunk is false - // a) call end_block - // b) fragment + // 3. In grow, if we need to fragment and specialChunk is false + // a) call end_block + // b) fragment // Now back to the array only case: - // [write the data] - // 4. if specialChunk is true - // a) Close the chunk - // b) Set specialChunk to false + // [write the data] + // 4. if specialChunk is true + // a) Close the chunk + // b) Set specialChunk to false protected boolean specialChunk = false; @@ -80,22 +79,23 @@ public class CDROutputStream_1_2 extends CDROutputStream_1_1 private boolean headerPadding; @InfoMethod - private void specialChunkCase() { } + private void specialChunkCase() { + } @CdrWrite @Override protected void handleSpecialChunkBegin(int requiredSize) { // If we're chunking and the item won't fit in the buffer if (inBlock && requiredSize + byteBuffer.position() > byteBuffer.limit()) { - specialChunkCase() ; + specialChunkCase(); - // Duplicating some code from end_block. Compute + // Duplicating some code from end_block. Compute // and write the total chunk length. int oldSize = byteBuffer.position(); byteBuffer.position(blockSizeIndex - 4); - //write_long(oldSize - blockSizeIndex); + // write_long(oldSize - blockSizeIndex); writeLongWithoutAlign((oldSize - blockSizeIndex) + requiredSize); byteBuffer.position(oldSize); @@ -113,7 +113,7 @@ protected void handleSpecialChunkEnd() { specialChunkCase(); // This is unnecessary, but I just want to show that - // we're done with the current chunk. (the end_block + // we're done with the current chunk. (the end_block // call is inappropriate here) inBlock = false; blockSizeIndex = -1; @@ -129,11 +129,10 @@ protected void handleSpecialChunkEnd() { specialChunk = false; } } - + // Called after writing primitives @CdrWrite - private void checkPrimitiveAcrossFragmentedChunk() - { + private void checkPrimitiveAcrossFragmentedChunk() { if (primitiveAcrossFragmentedChunk) { primitiveAcrossFragmentedChunk = false; @@ -150,7 +149,6 @@ private void checkPrimitiveAcrossFragmentedChunk() } } - @Override public void write_octet(byte x) { super.write_octet(x); @@ -187,7 +185,7 @@ protected void alignAndReserve(int align, int n) { // headerPadding bit is set by the write operation of RequestMessage_1_2 // or ReplyMessage_1_2 classes. When set, the very first body write - // operation (from the stub code) would trigger an alignAndReserve + // operation (from the stub code) would trigger an alignAndReserve // method call, that would in turn add the appropriate header padding, // such that the body is aligned on a 8-octet boundary. The padding // is required for GIOP versions 1.2 and above, only if body is present. @@ -195,31 +193,32 @@ protected void alignAndReserve(int align, int n) { headerPadding = false; alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT); } - + // In GIOP 1.2, we always end fragments at our // fragment size, which is an "evenly divisible - // 8 byte boundary" (aka divisible by 16). A fragment can + // 8 byte boundary" (aka divisible by 16). A fragment can // end with appropriate alignment padding, but no padding // is needed with respect to the next GIOP fragment // header since it ends on an 8 byte boundary. byteBuffer.position(byteBuffer.position() + computeAlignment(align)); - if (byteBuffer.position() + n > byteBuffer.limit()) + if (byteBuffer.position() + n > byteBuffer.limit()) grow(align, n); } @InfoMethod - private void outOfSequenceWrite() { } + private void outOfSequenceWrite() { + } @InfoMethod - private void handlingFragmentCase() { } - + private void handlingFragmentCase() { + } @Override @CdrWrite protected void grow(int align, int n) { - + // Save the current size for possible post-fragmentation calculation int oldSize = byteBuffer.position(); @@ -246,13 +245,13 @@ protected void grow(int align, int n) { byteBuffer = bufferManagerWrite.overflow(byteBuffer, n); // At this point, if we fragmented, we should have a ByteBuffer - // with the fragment header already marshaled. The buflen and position + // with the fragment header already marshaled. The buflen and position // should be updated accordingly. if (bufferManagerWrite.isFragmentOnOverflow()) { // Update fragmentOffset so indirections work properly. // At this point, oldSize is the entire length of the - // previous buffer. bbwi.position() is the length of the + // previous buffer. bbwi.position() is the length of the // fragment header of this buffer. fragmentOffset += (oldSize - byteBuffer.position()); @@ -269,13 +268,12 @@ public GIOPVersion getGIOPVersion() { } @Override - public void write_wchar(char x) - { + public void write_wchar(char x) { // In GIOP 1.2, a wchar is encoded as an unsigned octet length - // followed by the octets of the converted wchar. This is good, - // but it causes problems with our chunking code. We don't + // followed by the octets of the converted wchar. This is good, + // but it causes problems with our chunking code. We don't // want that octet to get put in a different chunk at the end - // of the previous fragment. + // of the previous fragment. // // Ensure that this won't happen by overriding write_wchar_array // and doing our own handleSpecialChunkBegin/End here. @@ -285,7 +283,7 @@ public void write_wchar(char x) handleSpecialChunkBegin(1 + converter.getNumBytes()); - write_octet((byte)converter.getNumBytes()); + write_octet((byte) converter.getNumBytes()); byte[] result = converter.getBytes(); @@ -297,23 +295,22 @@ public void write_wchar(char x) } @Override - public void write_wchar_array(char[] value, int offset, int length) - { + public void write_wchar_array(char[] value, int offset, int length) { if (value == null) { throw wrapper.nullParam(); - } + } CodeSetConversion.CTBConverter converter = getWCharConverter(); // Unfortunately, because of chunking, we have to convert the // entire char[] to a byte[] array first so we can know how - // many bytes we're writing ahead of time. You can't split + // many bytes we're writing ahead of time. You can't split // an array of primitives into multiple chunks. int totalNumBytes = 0; // Remember that every wchar starts with an octet telling - // its length. The buffer size is an upper bound estimate. - int maxLength = (int)Math.ceil(converter.getMaxBytesPerChar() * length); + // its length. The buffer size is an upper bound estimate. + int maxLength = (int) Math.ceil(converter.getMaxBytesPerChar() * length); byte[] buffer = new byte[maxLength + length]; for (int i = 0; i < length; i++) { @@ -321,12 +318,10 @@ public void write_wchar_array(char[] value, int offset, int length) converter.convert(value[offset + i]); // Make sure to add the octet length - buffer[totalNumBytes++] = (byte)converter.getNumBytes(); + buffer[totalNumBytes++] = (byte) converter.getNumBytes(); // Copy it into our buffer - System.arraycopy(converter.getBytes(), 0, - buffer, totalNumBytes, - converter.getNumBytes()); + System.arraycopy(converter.getBytes(), 0, buffer, totalNumBytes, converter.getNumBytes()); totalNumBytes += converter.getNumBytes(); } @@ -341,7 +336,7 @@ public void write_wchar_array(char[] value, int offset, int length) internalWriteOctetArray(buffer, 0, totalNumBytes); handleSpecialChunkEnd(); - } + } @Override public void write_wstring(String value) { @@ -349,7 +344,7 @@ public void write_wstring(String value) { throw wrapper.nullParam(); } - // In GIOP 1.2, wstrings are not terminated by a null. The + // In GIOP 1.2, wstrings are not terminated by a null. The // length is the number of octets in the converted format. // A zero length string is represented with the 4 byte length // value of 0. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CachedCodeBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CachedCodeBase.java index ced23addb..127232cf5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CachedCodeBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CachedCodeBase.java @@ -29,49 +29,40 @@ import com.sun.corba.ee.spi.transport.Connection; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; import java.util.Hashtable; /** - * Provides the reading side with a per connection cache of - * info obtained via calls to the remote CodeBase. + * Provides the reading side with a per connection cache of info obtained via calls to the remote CodeBase. * * Previously, most of this was in IIOPConnection. * - * Features: - * Delays cache creation unless used - * Postpones remote calls until necessary - * Handles creating obj ref from IOR - * Maintains caches for the following maps: - * CodeBase IOR to obj ref (global) - * RepId to implementation URL(s) - * RepId to remote FVD - * RepId to superclass type list + * Features: Delays cache creation unless used Postpones remote calls until necessary Handles creating obj ref from IOR + * Maintains caches for the following maps: CodeBase IOR to obj ref (global) RepId to implementation URL(s) RepId to + * remote FVD RepId to superclass type list * * Needs cache management. */ -public class CachedCodeBase extends _CodeBaseImplBase -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class CachedCodeBase extends _CodeBaseImplBase { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private Hashtable implementations ; - private Hashtable fvds ; - private Hashtable bases ; + private Hashtable implementations; + private Hashtable fvds; + private Hashtable bases; private volatile CodeBase delegate; private final Connection conn; - private static final Object iorMapLock = new Object() ; - private static final Hashtable iorMap = new Hashtable<>(); + private static final Object iorMapLock = new Object(); + private static final Hashtable iorMap = new Hashtable<>(); - public static synchronized void cleanCache( ORB orb ) { + public static synchronized void cleanCache(ORB orb) { synchronized (iorMapLock) { for (IOR ior : iorMap.keySet()) { if (ior.getORB() == orb) { - iorMap.remove( ior ) ; + iorMap.remove(ior); } } } @@ -82,16 +73,16 @@ public CachedCodeBase(Connection connection) { } @Override - public com.sun.org.omg.CORBA.Repository get_ir () { + public com.sun.org.omg.CORBA.Repository get_ir() { return null; } - + @Override - public synchronized String implementation (String repId) { + public synchronized String implementation(String repId) { String urlResult = null; if (implementations == null) - implementations = new Hashtable(); + implementations = new Hashtable(); else urlResult = implementations.get(repId); @@ -106,7 +97,7 @@ public synchronized String implementation (String repId) { } @Override - public synchronized String[] implementations (String[] repIds) { + public synchronized String[] implementations(String[] repIds) { String[] urlResults = new String[repIds.length]; for (int i = 0; i < urlResults.length; i++) @@ -116,11 +107,11 @@ public synchronized String[] implementations (String[] repIds) { } @Override - public synchronized FullValueDescription meta (String repId) { + public synchronized FullValueDescription meta(String repId) { FullValueDescription result = null; if (fvds == null) - fvds = new Hashtable(); + fvds = new Hashtable(); else result = fvds.get(repId); @@ -135,9 +126,8 @@ public synchronized FullValueDescription meta (String repId) { } @Override - public synchronized FullValueDescription[] metas (String[] repIds) { - FullValueDescription[] results - = new FullValueDescription[repIds.length]; + public synchronized FullValueDescription[] metas(String[] repIds) { + FullValueDescription[] results = new FullValueDescription[repIds.length]; for (int i = 0; i < results.length; i++) results[i] = meta(repIds[i]); @@ -146,12 +136,12 @@ public synchronized FullValueDescription[] metas (String[] repIds) { } @Override - public synchronized String[] bases (String repId) { + public synchronized String[] bases(String repId) { String[] results = null; if (bases == null) - bases = new Hashtable(); + bases = new Hashtable(); else results = bases.get(repId); @@ -166,7 +156,7 @@ public synchronized String[] bases (String repId) { } // Ensures that we've used the connection's IOR to create - // a valid CodeBase delegate. If this returns false, then + // a valid CodeBase delegate. If this returns false, then // it is not valid to access the delegate. private synchronized boolean connectedCodeBase() { if (delegate != null) @@ -174,29 +164,29 @@ private synchronized boolean connectedCodeBase() { if (conn.getCodeBaseIOR() == null) { // The delegate was null, so see if the connection's - // IOR was set. If so, then we just need to connect - // it. Otherwise, there is no hope of checking the - // remote code base. That could be a bug if the + // IOR was set. If so, then we just need to connect + // it. Otherwise, there is no hope of checking the + // remote code base. That could be a bug if the // service context processing didn't occur, or it // could be that we're talking to a foreign ORB which // doesn't include this optional service context. - wrapper.codeBaseUnavailable( conn ) ; + wrapper.codeBaseUnavailable(conn); return false; } - synchronized(iorMapLock) { + synchronized (iorMapLock) { // Do we have a reference initialized by another connection? - delegate = iorMap.get( conn.getCodeBaseIOR() ); + delegate = iorMap.get(conn.getCodeBaseIOR()); if (delegate != null) return true; - + // Connect the delegate and update the cache - delegate = CodeBaseHelper.narrow( getObjectFromIOR() ); - + delegate = CodeBaseHelper.narrow(getObjectFromIOR()); + // Save it for the benefit of other connections - iorMap.put( conn.getCodeBaseIOR(), delegate ); + iorMap.put(conn.getCodeBaseIOR(), delegate); } // It's now safe to use the delegate @@ -204,10 +194,8 @@ private synchronized boolean connectedCodeBase() { } private org.omg.CORBA.Object getObjectFromIOR() { - return CDRInputStream_1_0.internalIORToObject( - conn.getCodeBaseIOR(), null /*stubFactory*/, conn.getBroker()); + return CDRInputStream_1_0.internalIORToObject(conn.getCodeBaseIOR(), null /* stubFactory */, conn.getBroker()); } } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetCache.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetCache.java index db64e8ea1..2326ccf23 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetCache.java @@ -26,57 +26,51 @@ /** * Thread local cache of sun.io code set converters for performance. * - * The thread local class contains a single reference to a Map[] - * containing two WeakHashMaps. One for CharsetEncoders and - * one for CharsetDecoders. Constants are defined for indexing. + * The thread local class contains a single reference to a Map[] containing two WeakHashMaps. One for CharsetEncoders + * and one for CharsetDecoders. Constants are defined for indexing. * * This is used internally by CodeSetConversion. */ -class CodeSetCache -{ - private ThreadLocal> ctbMapLocal = - new ThreadLocal>() { - protected WeakHashMap initialValue() { - return new WeakHashMap() ; - } - } ; +class CodeSetCache { + private ThreadLocal> ctbMapLocal = new ThreadLocal>() { + protected WeakHashMap initialValue() { + return new WeakHashMap(); + } + }; - private ThreadLocal> btcMapLocal = - new ThreadLocal>() { - protected WeakHashMap initialValue() { - return new WeakHashMap() ; - } - } ; + private ThreadLocal> btcMapLocal = new ThreadLocal>() { + protected WeakHashMap initialValue() { + return new WeakHashMap(); + } + }; /** * Retrieve a CharsetDecoder from the Map using the given key. */ CharsetDecoder getByteToCharConverter(String key) { - return btcMapLocal.get().get( key ) ; + return btcMapLocal.get().get(key); } /** * Retrieve a CharsetEncoder from the Map using the given key. */ CharsetEncoder getCharToByteConverter(String key) { - return ctbMapLocal.get().get( key ) ; + return ctbMapLocal.get().get(key); } /** - * Stores the given CharsetDecoder in the thread local cache, - * and returns the same converter. + * Stores the given CharsetDecoder in the thread local cache, and returns the same converter. */ CharsetDecoder setConverter(String key, CharsetDecoder converter) { - btcMapLocal.get().put( key, converter ) ; + btcMapLocal.get().put(key, converter); return converter; } /** - * Stores the given CharsetEncoder in the thread local cache, - * and returns the same converter. + * Stores the given CharsetEncoder in the thread local cache, and returns the same converter. */ CharsetEncoder setConverter(String key, CharsetEncoder converter) { - ctbMapLocal.get().put( key, converter ) ; + ctbMapLocal.get().put(key, converter); return converter; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetComponentInfo.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetComponentInfo.java index 4ea4574bb..464f86165 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetComponentInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetComponentInfo.java @@ -29,49 +29,45 @@ import com.sun.corba.ee.spi.logging.ORBUtilSystemException; public final class CodeSetComponentInfo { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; /** - * CodeSetComponent is part of an IOR multi-component profile. Two - * instances constitute a CodeSetComponentInfo (one for char and one - * for wchar data) + * CodeSetComponent is part of an IOR multi-component profile. Two instances constitute a CodeSetComponentInfo (one for + * char and one for wchar data) */ public static final class CodeSetComponent { int nativeCodeSet; int[] conversionCodeSets; @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (this == obj) - return true ; + return true; if (!(obj instanceof CodeSetComponent)) - return false ; + return false; - CodeSetComponent other = (CodeSetComponent)obj ; + CodeSetComponent other = (CodeSetComponent) obj; - return (nativeCodeSet == other.nativeCodeSet) && - Arrays.equals( conversionCodeSets, other.conversionCodeSets ) ; + return (nativeCodeSet == other.nativeCodeSet) && Arrays.equals(conversionCodeSets, other.conversionCodeSets); } @Override - public int hashCode() - { - int result = nativeCodeSet ; - for (int ctr=0; ctr conversionList = new ArrayList(10); // Now process the other values as part of the // conversion code set list. while (stok.hasMoreTokens()) { - + // decode allows us to specify hex, decimal, etc Integer value = Integer.decode(stok.nextToken()); if (OSFCodeSetRegistry.lookupEntry(value.intValue()) == null) - throw wrapper.unknownConversionCodeSet( value ) ; + throw wrapper.unknownConversionCodeSet(value); conversionList.add(value); } @@ -312,12 +290,12 @@ public static CodeSetComponent createFromString(String str) { conversionInts = new int[conversionList.size()]; for (int i = 0; i < conversionInts.length; i++) - conversionInts[i] = ((Integer)conversionList.get(i)).intValue(); + conversionInts[i] = ((Integer) conversionList.get(i)).intValue(); } catch (NumberFormatException nfe) { - throw wrapper.invalidCodeSetNumber( nfe ) ; + throw wrapper.invalidCodeSetNumber(nfe); } catch (NoSuchElementException nsee) { - throw wrapper.invalidCodeSetString( nsee, str ) ; + throw wrapper.invalidCodeSetString(nsee, str); } // Otherwise return the CodeSetComponent representing @@ -328,8 +306,6 @@ public static CodeSetComponent createFromString(String str) { /** * Code sets for local cases without a connection. */ - public static final CodeSetContext LOCAL_CODE_SETS - = new CodeSetContext(OSFCodeSetRegistry.ISO_8859_1.getNumber(), - OSFCodeSetRegistry.UTF_16.getNumber()); + public static final CodeSetContext LOCAL_CODE_SETS = new CodeSetContext(OSFCodeSetRegistry.ISO_8859_1.getNumber(), + OSFCodeSetRegistry.UTF_16.getNumber()); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetConversion.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetConversion.java index 2881de387..997645b35 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetConversion.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/CodeSetConversion.java @@ -38,46 +38,35 @@ import com.sun.corba.ee.spi.logging.OMGSystemException; /** - * Collection of classes, interfaces, and factory methods for - * CORBA code set conversion. + * Collection of classes, interfaces, and factory methods for CORBA code set conversion. * - * This is mainly used to shield other code from the sun.io - * converters which might change, as well as provide some basic - * translation from conversion to CORBA error exceptions. Some - * extra work is required here to facilitate the way CORBA + * This is mainly used to shield other code from the sun.io converters which might change, as well as provide some basic + * translation from conversion to CORBA error exceptions. Some extra work is required here to facilitate the way CORBA * says it uses UTF-16 as of the 00-11-03 spec. * - * REVISIT - Since the nio.Charset and nio.Charset.Encoder/Decoder - * use NIO ByteBuffer and NIO CharBuffer, the interaction - * and interface between this class and the CDR streams - * should be looked at more closely for optimizations to - * avoid unnecessary copying of data between char[] & - * CharBuffer and byte[] & ByteBuffer, especially - * DirectByteBuffers. + * REVISIT - Since the nio.Charset and nio.Charset.Encoder/Decoder use NIO ByteBuffer and NIO CharBuffer, the + * interaction and interface between this class and the CDR streams should be looked at more closely for optimizations + * to avoid unnecessary copying of data between char[] & CharBuffer and byte[] & ByteBuffer, especially + * DirectByteBuffers. * */ -public class CodeSetConversion -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - private static final OMGSystemException omgWrapper = - OMGSystemException.self ; +public class CodeSetConversion { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + private static final OMGSystemException omgWrapper = OMGSystemException.self; /** * Abstraction for char to byte conversion. * * Must be used in the proper sequence: * - * 1) convert - * 2) Optional getNumBytes and/or getAlignment (if necessary) - * 3) getBytes (see warning) + * 1) convert 2) Optional getNumBytes and/or getAlignment (if necessary) 3) getBytes (see warning) */ - public abstract static class CTBConverter - { + public abstract static class CTBConverter { // Perform the conversion of the provided char or String, // allowing the caller to query for more information // before writing. public abstract void convert(char chToConvert); + public abstract void convert(String strToConvert); // How many bytes resulted from the conversion? @@ -87,22 +76,22 @@ public abstract static class CTBConverter public abstract float getMaxBytesPerChar(); // What byte boundary should the stream align to before - // calling writeBytes? For instance, a fixed width + // calling writeBytes? For instance, a fixed width // encoding with 2 bytes per char in a stream which // doesn't encapsulate the char's bytes should align - // on a 2 byte boundary. (Ex: UTF16 in GIOP1.1) + // on a 2 byte boundary. (Ex: UTF16 in GIOP1.1) // - // Note: This has no effect on the converted bytes. It + // Note: This has no effect on the converted bytes. It // is just information available to the caller. public abstract int getAlignment(); - // Get the resulting bytes. Warning: You must use getNumBytes() + // Get the resulting bytes. Warning: You must use getNumBytes() // to determine the end of the data in the byte array instead - // of array.length! The array may be used internally, so don't + // of array.length! The array may be used internally, so don't // save references. public abstract byte[] getBytes(); } - + /** * Abstraction for byte to char conversion. */ @@ -113,33 +102,32 @@ public abstract static class BTCConverter { public abstract int getNumChars(); // Perform the conversion using length bytes from the given - // input stream. Warning: You must use getNumChars() to + // input stream. Warning: You must use getNumChars() to // determine the correct length of the resulting array. // The same array may be used internally over multiple // calls. public abstract char[] getChars(byte[] bytes, int offset, int length); + public abstract char[] getChars(ByteBuffer byteBuffer, int offset, int length); } /** - * Implementation of CTBConverter which uses a nio.Charset.CharsetEncoder - * to do the real work. Handles translation of exceptions to the - * appropriate CORBA versions. + * Implementation of CTBConverter which uses a nio.Charset.CharsetEncoder to do the real work. Handles translation of + * exceptions to the appropriate CORBA versions. */ - private class JavaCTBConverter extends CTBConverter - { + private class JavaCTBConverter extends CTBConverter { // nio.Charset.CharsetEncoder actually does the work here // have to use it directly rather than through String's interface // because we want to know when errors occur during the conversion. private CharsetEncoder ctb; - // Proper alignment for this type of converter. For instance, + // Proper alignment for this type of converter. For instance, // ASCII has alignment of 1 (1 byte per char) but UTF16 has // alignment of 2 (2 bytes per char) private int alignment; - // Char buffer to hold the input. + // Char buffer to hold the input. private char[] chars = null; // How many bytes are generated from the conversion? @@ -149,15 +137,14 @@ private class JavaCTBConverter extends CTBConverter // for cross method communication) private int numChars = 0; - // ByteBuffer holding the converted input. This is necessary + // ByteBuffer holding the converted input. This is necessary // since we have to do calculations that require the conversion // before writing the array to the stream. private ByteBuffer buffer; WeakHashMap cacheEncoder = new WeakHashMap(); - public JavaCTBConverter(OSFCodeSetRegistry.Entry codeset, - int alignmentForEncoding) { + public JavaCTBConverter(OSFCodeSetRegistry.Entry codeset, int alignmentForEncoding) { try { ctb = cache.getCharToByteConverter(codeset.getName()); @@ -166,16 +153,16 @@ public JavaCTBConverter(OSFCodeSetRegistry.Entry codeset, ctb = tmpCharset.newEncoder(); cache.setConverter(codeset.getName(), ctb); } - } catch(IllegalCharsetNameException icne) { + } catch (IllegalCharsetNameException icne) { // This can only happen if one of our Entries has // an invalid name. - throw wrapper.invalidCtbConverterName(icne,codeset.getName()); - } catch(UnsupportedCharsetException ucne) { + throw wrapper.invalidCtbConverterName(icne, codeset.getName()); + } catch (UnsupportedCharsetException ucne) { // This can only happen if one of our Entries has // an unsupported name. - throw wrapper.invalidCtbConverterName(ucne,codeset.getName()); + throw wrapper.invalidCtbConverterName(ucne, codeset.getName()); } alignment = alignmentForEncoding; @@ -188,7 +175,7 @@ public final float getMaxBytesPerChar() { public void convert(char chToConvert) { if (chars == null) chars = new char[1]; - + // The CharToByteConverter only takes a char[] chars[0] = chToConvert; numChars = 1; @@ -197,36 +184,35 @@ public void convert(char chToConvert) { } public void convert(String strToConvert) { - // Try to save a memory allocation if possible. Usual - // space/time trade off. If we could get the char[] out of + // Try to save a memory allocation if possible. Usual + // space/time trade off. If we could get the char[] out of // the String without copying, that would be great, but // it's forbidden since String is immutable. if (chars == null || chars.length < strToConvert.length()) chars = new char[strToConvert.length()]; numChars = strToConvert.length(); - + buffer = cacheEncoder.get(strToConvert); if (buffer != null) { numBytes = buffer.limit(); - //We need to set the buffer position to zero; becoz a - //previous read would have set the buffer position to its limit + // We need to set the buffer position to zero; becoz a + // previous read would have set the buffer position to its limit buffer.position(0); - } - else { + } else { strToConvert.getChars(0, numChars, chars, 0); convertCharArray(); cacheEncoder.put(strToConvert, buffer); } - //ToDo: if encoding debug is turned on call the below method - //validateCodesetCache(buffer, strToConvert); + // ToDo: if encoding debug is turned on call the below method + // validateCodesetCache(buffer, strToConvert); } public final int getNumBytes() { return numBytes; } - + public final int getAlignment() { return alignment; } @@ -244,7 +230,7 @@ public byte[] getBytes() { private void convertCharArray() { try { - + // Possible optimization of directly converting into the CDR buffer. // However, that means the CDR code would have to reserve // a 4 byte string length ahead of time, and we'd need a @@ -254,11 +240,11 @@ private void convertCharArray() { // Then there's the issue of the chunking code. // // For right now, this is less messy and basic tests don't - // show more than a 1 ms penalty worst case. Less than a + // show more than a 1 ms penalty worst case. Less than a // factor of 2 increase. // Convert the characters - buffer = ctb.encode(CharBuffer.wrap(chars,0,numChars)); + buffer = ctb.encode(CharBuffer.wrap(chars, 0, numChars)); // ByteBuffer returned by the encoder will set its limit // to byte immediately after the last written byte. @@ -266,27 +252,25 @@ private void convertCharArray() { } catch (IllegalStateException ise) { // an encoding operation is already in progress - throw wrapper.ctbConverterFailure( ise ) ; + throw wrapper.ctbConverterFailure(ise); } catch (MalformedInputException mie) { // There were illegal Unicode char pairs - throw wrapper.badUnicodePair( mie ) ; + throw wrapper.badUnicodePair(mie); } catch (UnmappableCharacterException uce) { // A character doesn't map to the desired code set // CORBA formal 00-11-03. - throw omgWrapper.charNotInCodeset( uce ) ; + throw omgWrapper.charNotInCodeset(uce); } catch (CharacterCodingException cce) { // If this happens, then some other encoding error occured - throw wrapper.ctbConverterFailure( cce ) ; + throw wrapper.ctbConverterFailure(cce); } } } /** - * Special UTF16 converter which can either always write a BOM - * or use a specified byte order without one. + * Special UTF16 converter which can either always write a BOM or use a specified byte order without one. */ - private class UTF16CTBConverter extends JavaCTBConverter - { + private class UTF16CTBConverter extends JavaCTBConverter { // Using this constructor, we will always write a BOM public UTF16CTBConverter() { super(OSFCodeSetRegistry.UTF_16, 2); @@ -299,9 +283,8 @@ public UTF16CTBConverter(boolean littleEndian) { } /** - * Implementation of BTCConverter which uses a sun.io.ByteToCharConverter - * for the real work. Handles translation of exceptions to the - * appropriate CORBA versions. + * Implementation of BTCConverter which uses a sun.io.ByteToCharConverter for the real work. Handles translation of + * exceptions to the appropriate CORBA versions. */ private class JavaBTCConverter extends BTCConverter { protected CharsetDecoder decoder; @@ -326,32 +309,31 @@ public char[] getChars(ByteBuffer byteBuffer, int offset, int numBytes) { } catch (IllegalStateException ile) { // There were a decoding operation already in progress - throw wrapper.btcConverterFailure( ile ) ; + throw wrapper.btcConverterFailure(ile); } catch (MalformedInputException mie) { // There were illegal Unicode char pairs - throw wrapper.badUnicodePair( mie ) ; + throw wrapper.badUnicodePair(mie); } catch (UnmappableCharacterException uce) { // A character doesn't map to the desired code set. // CORBA formal 00-11-03. - throw omgWrapper.charNotInCodeset( uce ) ; + throw omgWrapper.charNotInCodeset(uce); } catch (CharacterCodingException cce) { // If this happens, then a character decoding error occured. - throw wrapper.btcConverterFailure( cce ) ; + throw wrapper.btcConverterFailure(cce); } } public char[] getChars(byte[] bytes, int offset, int numBytes) { // Possible optimization of reading directly from the CDR - // byte buffer. The sun.io converter supposedly can handle + // byte buffer. The sun.io converter supposedly can handle // incremental conversions in which a char is broken across // two convert calls. // // Basic tests didn't show more than a 1 ms increase - // worst case. It's less than a factor of 2 increase. + // worst case. It's less than a factor of 2 increase. // Also makes the interface more difficult. - try { ByteBuffer byteBuf = ByteBuffer.wrap(bytes, offset, numBytes); @@ -362,11 +344,11 @@ public char[] getChars(byte[] bytes, int offset, int numBytes) { resultingNumChars = charBuf.limit(); // IMPORTANT - It's possible the underlying char[] in the - // CharBuffer returned by btc.decode(byteBuf) - // is longer in length than the number of characters - // decoded. Hence, the check below to ensure the - // char[] returned contains all the chars that have - // been decoded and no more. + // CharBuffer returned by btc.decode(byteBuf) + // is longer in length than the number of characters + // decoded. Hence, the check below to ensure the + // char[] returned contains all the chars that have + // been decoded and no more. char[] buffer; if (charBuf.limit() == charBuf.capacity()) { buffer = charBuf.array(); @@ -379,24 +361,23 @@ public char[] getChars(byte[] bytes, int offset, int numBytes) { } catch (IllegalStateException ile) { // There were a decoding operation already in progress - throw wrapper.btcConverterFailure( ile ) ; + throw wrapper.btcConverterFailure(ile); } catch (MalformedInputException mie) { // There were illegal Unicode char pairs - throw wrapper.badUnicodePair( mie ) ; + throw wrapper.badUnicodePair(mie); } catch (UnmappableCharacterException uce) { // A character doesn't map to the desired code set. // CORBA formal 00-11-03. - throw omgWrapper.charNotInCodeset( uce ) ; + throw omgWrapper.charNotInCodeset(uce); } catch (CharacterCodingException cce) { // If this happens, then a character decoding error occured. - throw wrapper.btcConverterFailure( cce ) ; + throw wrapper.btcConverterFailure(cce); } } /** - * Utility method to find a CharsetDecoder in the - * cache or create a new one if necessary. Throws an - * INTERNAL if the code set is unknown. + * Utility method to find a CharsetDecoder in the cache or create a new one if necessary. Throws an INTERNAL if the code + * set is unknown. */ protected CharsetDecoder getConverter(String javaCodeSetName) { @@ -410,10 +391,10 @@ protected CharsetDecoder getConverter(String javaCodeSetName) { cache.setConverter(javaCodeSetName, result); } - } catch(IllegalCharsetNameException icne) { + } catch (IllegalCharsetNameException icne) { // This can only happen if one of our charset entries has // an illegal name. - throw wrapper.invalidBtcConverterName( icne, javaCodeSetName ) ; + throw wrapper.invalidBtcConverterName(icne, javaCodeSetName); } return result; @@ -421,15 +402,13 @@ protected CharsetDecoder getConverter(String javaCodeSetName) { } /** - * Special converter for UTF16 since it's required to optionally - * support a byte order marker while the internal Java converters - * either require it or require that it isn't there. + * Special converter for UTF16 since it's required to optionally support a byte order marker while the internal Java + * converters either require it or require that it isn't there. * - * The solution is to check for the byte order marker, and if we - * need to do something differently, switch internal converters. + * The solution is to check for the byte order marker, and if we need to do something differently, switch internal + * converters. */ - private class UTF16BTCConverter extends JavaBTCConverter - { + private class UTF16BTCConverter extends JavaBTCConverter { private ByteOrder defaultByteOrder; private boolean converterUsesBOM = true; @@ -444,7 +423,7 @@ private class UTF16BTCConverter extends JavaBTCConverter } public char[] getChars(ByteBuffer byteBuffer, int offset, int numBytes) { - byte [] marker = {byteBuffer.get(), byteBuffer.get()}; + byte[] marker = { byteBuffer.get(), byteBuffer.get() }; byteBuffer.position(0); if (hasUTF16ByteOrderMarker(marker, 0, numBytes)) { @@ -501,18 +480,16 @@ private boolean hasUTF16ByteOrderMarker(byte[] array, int offset, int length) { int b1 = array[offset] & 0x00FF; int b2 = array[offset + 1] & 0x00FF; - char marker = (char)((b1 << 8) | (b2)); - + char marker = (char) ((b1 << 8) | (b2)); + return (marker == UTF16_BE_MARKER || marker == UTF16_LE_MARKER); } else return false; } /** - * The current solution for dealing with UTF-16 in CORBA - * is that if our sun.io converter requires byte order markers, - * and then we see a CORBA wstring/wchar without them, we - * switch to the sun.io converter that doesn't require them. + * The current solution for dealing with UTF-16 in CORBA is that if our sun.io converter requires byte order markers, + * and then we see a CORBA wstring/wchar without them, we switch to the sun.io converter that doesn't require them. */ private void switchToConverter(OSFCodeSetRegistry.Entry newCodeSet) { @@ -523,32 +500,27 @@ private void switchToConverter(OSFCodeSetRegistry.Entry newCodeSet) { /** * CTB converter factory for single byte or variable length encodings. + * * @param codeset Codeset to get converter for * @return Char-to-Byte Converter for codeset */ public CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset) { - int alignment = (!codeset.isFixedWidth() ? - 1 : - codeset.getMaxBytesPerChar()); - + int alignment = (!codeset.isFixedWidth() ? 1 : codeset.getMaxBytesPerChar()); + return new JavaCTBConverter(codeset, alignment); } /** * CTB converter factory for multibyte (mainly fixed) encodings. * - * Because of the awkwardness with byte order markers and the possibility of - * using UCS-2, you must specify both the endianness of the stream as well as - * whether or not to use byte order markers if applicable. UCS-2 has no byte - * order markers. UTF-16 has optional markers. + * Because of the awkwardness with byte order markers and the possibility of using UCS-2, you must specify both the + * endianness of the stream as well as whether or not to use byte order markers if applicable. UCS-2 has no byte order + * markers. UTF-16 has optional markers. * - * If you select useByteOrderMarkers, there is no guarantee that the encoding - * will use the endianness specified. + * If you select useByteOrderMarkers, there is no guarantee that the encoding will use the endianness specified. * */ - CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset, - boolean littleEndian, - boolean useByteOrderMarkers) { + CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset, boolean littleEndian, boolean useByteOrderMarkers) { // UCS2 doesn't have byte order markers, and we're encoding it // as UTF-16 since UCS2 isn't available in all Java platforms. @@ -569,24 +541,22 @@ CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset, // // Variable width encodings are aligned on 1 byte boundaries. // A fixed width encoding with a max. of 4 bytes/char should - // align on a 4 byte boundary. Note that UTF-16 is a special + // align on a 4 byte boundary. Note that UTF-16 is a special // case because of the optional byte order marker, so it's // handled above. // // This doesn't matter for GIOP 1.2 wchars and wstrings // since the encoded bytes are treated as an encapsulation. - int alignment = (!codeset.isFixedWidth() ? - 1 : - codeset.getMaxBytesPerChar()); + int alignment = (!codeset.isFixedWidth() ? 1 : codeset.getMaxBytesPerChar()); CTBConverter converter; - Map m = cacheCTBC.get(); + Map m = cacheCTBC.get(); converter = m.get(codeset); - if (converter == null ) { + if (converter == null) { converter = new JavaCTBConverter(codeset, alignment); m.put(codeset, converter); - } else if(converter.getAlignment() != alignment) { + } else if (converter.getAlignment() != alignment) { ((JavaCTBConverter) converter).setAlignment(alignment); } return converter; @@ -594,6 +564,7 @@ CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset, /** * BTCConverter factory for single byte or variable width encodings. + * * @param codeset Codeset to get converter for * @return new Byte-to-Char Converter */ @@ -603,7 +574,8 @@ public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset) { /** * BTCConverter factory for fixed width multibyte encodings. - * @param codeset Codeset to get converter for + * + * @param codeset Codeset to get converter for * @param defaultByteOrder Order of bytes in the codeset * @return Converter for a codeset */ @@ -612,7 +584,7 @@ public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset, ByteOrder if (codeset == OSFCodeSetRegistry.UTF_16 || codeset == OSFCodeSetRegistry.UCS_2) { return new UTF16BTCConverter(defaultByteOrder); } else { - Map m = cacheBTCC.get(); + Map m = cacheBTCC.get(); BTCConverter converter = m.get(codeset); if (converter == null) { converter = new JavaBTCConverter(codeset); @@ -622,17 +594,15 @@ public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset, ByteOrder } } - /** + /** * Follows the code set negotiation algorithm in CORBA formal 99-10-07 13.7.2. * - * Returns the proper negotiated OSF character encoding number or - * CodeSetConversion.FALLBACK_CODESET. + * Returns the proper negotiated OSF character encoding number or CodeSetConversion.FALLBACK_CODESET. */ - private int selectEncoding(CodeSetComponentInfo.CodeSetComponent client, - CodeSetComponentInfo.CodeSetComponent server) { + private int selectEncoding(CodeSetComponentInfo.CodeSetComponent client, CodeSetComponentInfo.CodeSetComponent server) { // A "null" value for the server's nativeCodeSet means that - // the server desired not to indicate one. We'll take that + // the server desired not to indicate one. We'll take that // to mean that it wants the first thing in its conversion list. // If it's conversion list is empty, too, then use the fallback // codeset. @@ -671,7 +641,7 @@ private int selectEncoding(CodeSetComponentInfo.CodeSetComponent client, } // See if there are any code sets that both the server and client - // support (giving preference to the server). The order + // support (giving preference to the server). The order // of conversion sets is from most to least desired. for (int i = 0; i < server.conversionCodeSets.length; i++) { for (int y = 0; y < client.conversionCodeSets.length; y++) { @@ -682,60 +652,56 @@ private int selectEncoding(CodeSetComponentInfo.CodeSetComponent client, } // Before using the fallback codesets, the spec calls for a - // compatibility check on the native code sets. It doesn't make + // compatibility check on the native code sets. It doesn't make // sense because loss free communication is always possible with - // UTF8 and UTF16, the fall back code sets. It's also a lot - // of work to implement. In the case of incompatibility, the + // UTF8 and UTF16, the fall back code sets. It's also a lot + // of work to implement. In the case of incompatibility, the // spec says to throw a CODESET_INCOMPATIBLE exception. - + // Use the fallback return CodeSetConversion.FALLBACK_CODESET; } /** - * Perform the code set negotiation algorithm and come up with - * the two encodings to use. + * Perform the code set negotiation algorithm and come up with the two encodings to use. + * * @param client Info from the client * @param server Info from the server * @return Resulted negotiated encoding context */ - public CodeSetComponentInfo.CodeSetContext negotiate(CodeSetComponentInfo client, - CodeSetComponentInfo server) { - int charData - = selectEncoding(client.getCharComponent(), - server.getCharComponent()); + public CodeSetComponentInfo.CodeSetContext negotiate(CodeSetComponentInfo client, CodeSetComponentInfo server) { + int charData = selectEncoding(client.getCharComponent(), server.getCharComponent()); if (charData == CodeSetConversion.FALLBACK_CODESET) { charData = OSFCodeSetRegistry.UTF_8.getNumber(); } - int wcharData - = selectEncoding(client.getWCharComponent(), - server.getWCharComponent()); + int wcharData = selectEncoding(client.getWCharComponent(), server.getWCharComponent()); if (wcharData == CodeSetConversion.FALLBACK_CODESET) { wcharData = OSFCodeSetRegistry.UTF_16.getNumber(); } - return new CodeSetComponentInfo.CodeSetContext(charData, - wcharData); + return new CodeSetComponentInfo.CodeSetContext(charData, wcharData); } // No one should instantiate a CodeSetConversion but the singleton // instance method - private CodeSetConversion() {} + private CodeSetConversion() { + } // initialize-on-demand holder private static class CodeSetConversionHolder { - static final CodeSetConversion csc = new CodeSetConversion() ; + static final CodeSetConversion csc = new CodeSetConversion(); } /** * CodeSetConversion is a singleton, and this is the access point. + * * @return A holder for {@link CodeSetConversion} */ public static CodeSetConversion impl() { - return CodeSetConversionHolder.csc ; + return CodeSetConversionHolder.csc; } // Number used internally to indicate the fallback code @@ -747,22 +713,20 @@ public static CodeSetConversion impl() { private CodeSetCache cache = new CodeSetCache(); // CodeSet converters are cached once created and are shared with multiple - // worker threads as shared objects. Each converter's - // btc/ctb object has cached string<-->byte[] cache on a per thread basis. - // Everytime a string is encoded/decoded it's result will be stored in - // the weak HashMap of the respective converters. - private ThreadLocal > - cacheBTCC = new ThreadLocal() { + // worker threads as shared objects. Each converter's + // btc/ctb object has cached string<-->byte[] cache on a per thread basis. + // Everytime a string is encoded/decoded it's result will be stored in + // the weak HashMap of the respective converters. + private ThreadLocal> cacheBTCC = new ThreadLocal() { @Override public HashMap initialValue() { - return new HashMap() ; + return new HashMap(); } }; - private ThreadLocal > - cacheCTBC = new ThreadLocal() { + private ThreadLocal> cacheCTBC = new ThreadLocal() { @Override public HashMap initialValue() { - return new HashMap() ; + return new HashMap(); } }; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsInputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsInputStream.java index 50c767fd9..213484c8f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsInputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsInputStream.java @@ -28,52 +28,37 @@ import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** - * Encapsulations are supposed to explicitly define their - * code sets and GIOP version. The original resolution to issue 2784 - * said that the defaults were UTF-8 and UTF-16, but that was not - * agreed upon. + * Encapsulations are supposed to explicitly define their code sets and GIOP version. The original resolution to issue + * 2784 said that the defaults were UTF-8 and UTF-16, but that was not agreed upon. * - * These streams currently use CDR 1.2 with ISO8859-1 for char/string and - * UTF16 for wchar/wstring. If no byte order marker is available, - * the endianness of the encapsulation is used. + * These streams currently use CDR 1.2 with ISO8859-1 for char/string and UTF16 for wchar/wstring. If no byte order + * marker is available, the endianness of the encapsulation is used. * - * When more encapsulations arise that have their own special code - * sets defined, we can make all constructors take such parameters. + * When more encapsulations arise that have their own special code sets defined, we can make all constructors take such + * parameters. */ -public class EncapsInputStream extends CDRInputObject -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - - public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] buf, - int size, ByteOrder byteOrder, - GIOPVersion version) { - super(orb, ByteBuffer.wrap(buf), size, byteOrder, version, - BufferManagerFactory.newReadEncapsulationBufferManager() - ); +public class EncapsInputStream extends CDRInputObject { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + + public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] buf, int size, ByteOrder byteOrder, GIOPVersion version) { + super(orb, ByteBuffer.wrap(buf), size, byteOrder, version, BufferManagerFactory.newReadEncapsulationBufferManager()); performORBVersionSpecificInit(); } - public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, - int size, ByteOrder byteOrder, - GIOPVersion version) { - super(orb, byteBuffer, size, byteOrder, version, - BufferManagerFactory.newReadEncapsulationBufferManager() - ); + public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, int size, ByteOrder byteOrder, GIOPVersion version) { + super(orb, byteBuffer, size, byteOrder, version, BufferManagerFactory.newReadEncapsulationBufferManager()); performORBVersionSpecificInit(); } // exported to Glassfish - DON'T change this!!! - public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size) - { + public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size) { this(orb, data, size, GIOPVersion.V1_2); } - + // corba/AnyImpl - public EncapsInputStream(EncapsInputStream eis) - { + public EncapsInputStream(EncapsInputStream eis) { super(eis); performORBVersionSpecificInit(); @@ -85,34 +70,24 @@ public EncapsInputStream(EncapsInputStream eis) // Assumes big endian (can use consumeEndian to read and set // the endianness if it is an encapsulation with a byte order // mark at the beginning) - public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size, GIOPVersion version) - { + public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size, GIOPVersion version) { this(orb, data, size, ByteOrder.BIG_ENDIAN, version); } /** - * Full constructor with a CodeBase parameter useful for - * unmarshaling RMI-IIOP valuetypes (technically against the - * intention of an encapsulation, but necessary due to OMG - * issue 4795. Used by ServiceContexts. + * Full constructor with a CodeBase parameter useful for unmarshaling RMI-IIOP valuetypes (technically against the + * intention of an encapsulation, but necessary due to OMG issue 4795. Used by ServiceContexts. + * * @param orb the ORB * @param data data to read in * @param size size of data * @param version GIOP version * @param codeBase CodeBase to use */ - public EncapsInputStream(org.omg.CORBA.ORB orb, - byte[] data, - int size, - GIOPVersion version, - CodeBase codeBase) { - super(orb, - ByteBuffer.wrap(data), - size, - ByteOrder.BIG_ENDIAN, - version, - BufferManagerFactory.newReadEncapsulationBufferManager() - ); // IDLJavaSerializationInputStream::directRead == false + public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size, GIOPVersion version, CodeBase codeBase) { + super(orb, ByteBuffer.wrap(data), size, ByteOrder.BIG_ENDIAN, version, BufferManagerFactory.newReadEncapsulationBufferManager()); // IDLJavaSerializationInputStream::directRead + // == + // false this.codeBase = codeBase; @@ -126,8 +101,7 @@ public CDRInputObject dup() { @Override protected CodeSetConversion.BTCConverter createCharBTCConverter() { - return CodeSetConversion.impl().getBTCConverter( - OSFCodeSetRegistry.ISO_8859_1); + return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1); } @Override @@ -136,7 +110,7 @@ protected CodeSetConversion.BTCConverter createWCharBTCConverter() { if (getGIOPVersion().equals(GIOPVersion.V1_0)) throw wrapper.wcharDataInGiop10(); - // In GIOP 1.1, we shouldn't have byte order markers. Take the order + // In GIOP 1.1, we shouldn't have byte order markers. Take the order // of the stream if we don't see them. if (getGIOPVersion().equals(GIOPVersion.V1_1)) return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16, getByteOrder()); @@ -146,7 +120,7 @@ protected CodeSetConversion.BTCConverter createWCharBTCConverter() { // Our UTF_16 converter will work with byte order markers, and if // they aren't present, it will use the provided endianness. // - // With no byte order marker, it's big endian in GIOP 1.2. + // With no byte order marker, it's big endian in GIOP 1.2. // formal 00-11-03 15.3.16. return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16, ByteOrder.BIG_ENDIAN); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsInputStreamFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsInputStreamFactory.java index be78bd765..05d1ecaa4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsInputStreamFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsInputStreamFactory.java @@ -32,146 +32,116 @@ * */ public class EncapsInputStreamFactory { - public static EncapsInputStream newEncapsInputStream(final EncapsInputStream eis) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public EncapsInputStream run() { - return new EncapsInputStream(eis); - } - - }); - } - - public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, - final byte[] buf, - final int size, - final ByteOrder byteOrder, - final GIOPVersion version) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, buf, size, byteOrder, version); - } - - }); - - } - - public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, - final byte[] data, - final int size, - final GIOPVersion version) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, data, size, version); - } - - }); - - } - - public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, - final byte[] data, - final int size) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, data, size); - } - - }); - - } - - public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, - final ByteBuffer byteBuffer, - final int size, - final ByteOrder byteOrder, - final GIOPVersion version) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, byteBuffer, size, byteOrder, version); - } - - }); - - } - - public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, - final byte[] data, - final int size, - final GIOPVersion version, - final CodeBase codeBase) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, data, size, version, codeBase); - } - - }); - - } - - public static TypeCodeInputStream newTypeCodeInputStream(final org.omg.CORBA.ORB orb, - final byte[] data, - final int size, - final ByteOrder byteOrder, - final GIOPVersion version) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public TypeCodeInputStream run() { - return new TypeCodeInputStream(orb, data, size, byteOrder, version); - } - - }); - - } - - public static TypeCodeInputStream newTypeCodeInputStream(final org.omg.CORBA.ORB orb, - final byte[] data, - final int size) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public TypeCodeInputStream run() { - return new TypeCodeInputStream(orb, data, size); - } - - }); - - } - - public static TypeCodeInputStream newTypeCodeInputStream(final org.omg.CORBA.ORB orb, - final ByteBuffer byteBuffer, - final int size, - final ByteOrder byteOrder, + public static EncapsInputStream newEncapsInputStream(final EncapsInputStream eis) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public EncapsInputStream run() { + return new EncapsInputStream(eis); + } + + }); + } + + public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, final byte[] buf, final int size, + final ByteOrder byteOrder, final GIOPVersion version) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, buf, size, byteOrder, version); + } + + }); + + } + + public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, final byte[] data, final int size, final GIOPVersion version) { - return AccessController. - doPrivileged(new PrivilegedAction() { - - @Override - public TypeCodeInputStream run() { - return new TypeCodeInputStream(orb, byteBuffer, size, byteOrder, version); - } - - }); - - } + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, data, size, version); + } + + }); + + } + + public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, final byte[] data, final int size) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, data, size); + } + + }); + + } + + public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer, final int size, + final ByteOrder byteOrder, final GIOPVersion version) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, byteBuffer, size, byteOrder, version); + } + + }); + + } + + public static EncapsInputStream newEncapsInputStream(final org.omg.CORBA.ORB orb, final byte[] data, final int size, + final GIOPVersion version, final CodeBase codeBase) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, data, size, version, codeBase); + } + + }); + + } + + public static TypeCodeInputStream newTypeCodeInputStream(final org.omg.CORBA.ORB orb, final byte[] data, final int size, + final ByteOrder byteOrder, final GIOPVersion version) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public TypeCodeInputStream run() { + return new TypeCodeInputStream(orb, data, size, byteOrder, version); + } + + }); + + } + + public static TypeCodeInputStream newTypeCodeInputStream(final org.omg.CORBA.ORB orb, final byte[] data, final int size) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public TypeCodeInputStream run() { + return new TypeCodeInputStream(orb, data, size); + } + + }); + + } + + public static TypeCodeInputStream newTypeCodeInputStream(final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer, final int size, + final ByteOrder byteOrder, final GIOPVersion version) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public TypeCodeInputStream run() { + return new TypeCodeInputStream(orb, byteBuffer, size, byteOrder, version); + } + + }); + + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsOutputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsOutputStream.java index 448c5abfc..9a9e35c07 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsOutputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/EncapsOutputStream.java @@ -29,20 +29,16 @@ import java.nio.ByteOrder; /** - * Encapsulations are supposed to explicitly define their - * code sets and GIOP version. The original resolution to issue 2784 - * said that the defaults were UTF-8 and UTF-16, but that was not - * agreed upon. + * Encapsulations are supposed to explicitly define their code sets and GIOP version. The original resolution to issue + * 2784 said that the defaults were UTF-8 and UTF-16, but that was not agreed upon. * - * These streams currently use CDR 1.2 with ISO8859-1 for char/string and - * UTF16 for wchar/wstring. If no byte order marker is available, - * the endianness of the encapsulation is used. + * These streams currently use CDR 1.2 with ISO8859-1 for char/string and UTF16 for wchar/wstring. If no byte order + * marker is available, the endianness of the encapsulation is used. * - * When more encapsulations arise that have their own special code - * sets defined, we can make all constructors take such parameters. + * When more encapsulations arise that have their own special code sets defined, we can make all constructors take such + * parameters. */ -public class EncapsOutputStream extends CDROutputObject -{ +public class EncapsOutputStream extends CDROutputObject { // REVISIT - Right now, EncapsOutputStream's do not use // pooled byte buffers. This is controlled by the following @@ -70,12 +66,11 @@ public EncapsOutputStream(ORB orb) { // CDREncapsCodec // - // REVISIT. A UTF-16 encoding with GIOP 1.1 will not work + // REVISIT. A UTF-16 encoding with GIOP 1.1 will not work // with byte order markers. public EncapsOutputStream(ORB orb, GIOPVersion version) { - super(orb, version, BufferManagerFactory.newWriteEncapsulationBufferManager(orb), - ORBConstants.STREAM_FORMAT_VERSION_1, usePooledByteBuffers - ); + super(orb, version, BufferManagerFactory.newWriteEncapsulationBufferManager(orb), ORBConstants.STREAM_FORMAT_VERSION_1, + usePooledByteBuffers); } @Override @@ -86,24 +81,24 @@ public org.omg.CORBA.portable.InputStream create_input_stream() { private static class EncapsInputStreamFactory implements InputObjectFactory { @Override - public CDRInputObject createInputObject(CDROutputObject outputObject, ORB orb, ByteBuffer byteBuffer, int size, GIOPVersion giopVersion) { - return com.sun.corba.ee.impl.encoding.EncapsInputStreamFactory.newEncapsInputStream(outputObject.orb(), - byteBuffer, size, ByteOrder.BIG_ENDIAN, giopVersion); + public CDRInputObject createInputObject(CDROutputObject outputObject, ORB orb, ByteBuffer byteBuffer, int size, + GIOPVersion giopVersion) { + return com.sun.corba.ee.impl.encoding.EncapsInputStreamFactory.newEncapsInputStream(outputObject.orb(), byteBuffer, size, + ByteOrder.BIG_ENDIAN, giopVersion); } } - + @Override protected CodeSetConversion.CTBConverter createCharCTBConverter() { - return CodeSetConversion.impl().getCTBConverter( - OSFCodeSetRegistry.ISO_8859_1); + return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1); } @Override protected CodeSetConversion.CTBConverter createWCharCTBConverter() { if (getGIOPVersion().equals(GIOPVersion.V1_0)) - throw wrapper.wcharDataInGiop10(); + throw wrapper.wcharDataInGiop10(); - // In the case of GIOP 1.1, we take the byte order of the stream + // In the case of GIOP 1.1, we take the byte order of the stream // and don't use byte order markers since we're limited to a 2 byte // fixed width encoding. if (getGIOPVersion().equals(GIOPVersion.V1_1)) @@ -111,10 +106,10 @@ protected CodeSetConversion.CTBConverter createWCharCTBConverter() { // Assume anything else meets GIOP 1.2 requirements // - // Use byte order markers? If not, use big endian in GIOP 1.2. + // Use byte order markers? If not, use big endian in GIOP 1.2. // (formal 00-11-03 15.3.16) - boolean useBOM = ((ORB)orb()).getORBData().useByteOrderMarkersInEncapsulations(); + boolean useBOM = ((ORB) orb()).getORBData().useByteOrderMarkersInEncapsulations(); return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16, false, useBOM); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarkAndResetHandler.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarkAndResetHandler.java index 04af40e6e..f8bc40fba 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarkAndResetHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarkAndResetHandler.java @@ -19,15 +19,12 @@ package com.sun.corba.ee.impl.encoding; - import java.nio.ByteBuffer; /** - * Defines an abstraction for a RestorableInputStream to - * implement mark/reset. + * Defines an abstraction for a RestorableInputStream to implement mark/reset. */ -interface MarkAndResetHandler -{ +interface MarkAndResetHandler { void mark(RestorableInputStream inputStream); void fragmentationOccured(ByteBuffer byteBuffer); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarshalInputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarshalInputStream.java index 33aa560d8..1a78d85cd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarshalInputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarshalInputStream.java @@ -23,47 +23,75 @@ import org.omg.CORBA.Any; public interface MarshalInputStream { - public boolean read_boolean(); - public char read_char(); - public char read_wchar(); - public byte read_octet(); - public short read_short(); - public short read_ushort(); - public int read_long(); - public int read_ulong(); - public long read_longlong(); - public long read_ulonglong(); - public float read_float(); - public double read_double(); - public String read_string(); - public String read_wstring(); + public boolean read_boolean(); + + public char read_char(); + + public char read_wchar(); + + public byte read_octet(); + + public short read_short(); + + public short read_ushort(); + + public int read_long(); + + public int read_ulong(); + + public long read_longlong(); + + public long read_ulonglong(); + + public float read_float(); + + public double read_double(); + + public String read_string(); + + public String read_wstring(); public void read_boolean_array(boolean[] value, int offset, int length); + public void read_char_array(char[] value, int offset, int length); + public void read_wchar_array(char[] value, int offset, int length); + public void read_octet_array(byte[] value, int offset, int length); + public void read_short_array(short[] value, int offset, int length); + public void read_ushort_array(short[] value, int offset, int length); + public void read_long_array(int[] value, int offset, int length); + public void read_ulong_array(int[] value, int offset, int length); + public void read_longlong_array(long[] value, int offset, int length); + public void read_ulonglong_array(long[] value, int offset, int length); + public void read_float_array(float[] value, int offset, int length); + public void read_double_array(double[] value, int offset, int length); public org.omg.CORBA.Object read_Object(); - public TypeCode read_TypeCode(); - public Any read_any(); - @SuppressWarnings({"deprecation"}) - public org.omg.CORBA.Principal read_Principal(); + + public TypeCode read_TypeCode(); + + public Any read_any(); + + @SuppressWarnings({ "deprecation" }) + public org.omg.CORBA.Principal read_Principal(); /* * The methods necessary to support RMI */ public org.omg.CORBA.Object read_Object(Class stubClass); + public java.io.Serializable read_value() throws Exception; - - /* + + /* * Additional Methods */ public void consumeEndian(); @@ -74,24 +102,20 @@ public interface MarshalInputStream { // mark/reset from java.io.InputStream public void mark(int readAheadLimit); + public void reset(); /** - * This must be called once before unmarshaling valuetypes or anything - * that uses repository IDs. The ORB's version should be set - * to the desired value prior to calling. + * This must be called once before unmarshaling valuetypes or anything that uses repository IDs. The ORB's version + * should be set to the desired value prior to calling. */ public void performORBVersionSpecificInit(); /** - * Tells the input stream to null any code set converter - * references, forcing it to reacquire them if it needs - * converters again. This is used when the server - * input stream needs to switch the connection's char code set - * converter to something different after reading the - * code set service context for the first time. Initially, - * we use ISO8859-1 to read the operation name (it can't - * be more than ASCII). + * Tells the input stream to null any code set converter references, forcing it to reacquire them if it needs converters + * again. This is used when the server input stream needs to switch the connection's char code set converter to + * something different after reading the code set service context for the first time. Initially, we use ISO8859-1 to + * read the operation name (it can't be more than ASCII). */ public void resetCodeSetConverters(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarshalOutputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarshalOutputStream.java index 02ef27baa..a74075a47 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarshalOutputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/MarshalOutputStream.java @@ -27,58 +27,86 @@ import org.omg.CORBA.portable.InputStream; public interface MarshalOutputStream { - + public InputStream create_input_stream(); - + public void write_boolean(boolean value); + public void write_char(char value); + public void write_wchar(char value); + public void write_octet(byte value); + public void write_short(short value); + public void write_ushort(short value); + public void write_long(int value); + public void write_ulong(int value); + public void write_longlong(long value); + public void write_ulonglong(long value); + public void write_float(float value); + public void write_double(double value); + public void write_string(String value); + public void write_wstring(String value); public void write_boolean_array(boolean[] value, int offset, int length); + public void write_char_array(char[] value, int offset, int length); + public void write_wchar_array(char[] value, int offset, int length); + public void write_octet_array(byte[] value, int offset, int length); + public void write_short_array(short[] value, int offset, int length); + public void write_ushort_array(short[] value, int offset, int length); + public void write_long_array(int[] value, int offset, int length); + public void write_ulong_array(int[] value, int offset, int length); + public void write_longlong_array(long[] value, int offset, int length); + public void write_ulonglong_array(long[] value, int offset, int length); + public void write_float_array(float[] value, int offset, int length); + public void write_double_array(double[] value, int offset, int length); public void write_Object(org.omg.CORBA.Object value); + public void write_TypeCode(TypeCode value); + public void write_any(Any value); - @SuppressWarnings({"deprecation"}) - public void write_Principal(org.omg.CORBA.Principal value); + @SuppressWarnings({ "deprecation" }) + public void write_Principal(org.omg.CORBA.Principal value); /* * The methods necessary to support RMI */ public void write_value(java.io.Serializable value); + public void start_block(); + public void end_block(); - /* + /* * Additional Methods */ - public void putEndian(); - public void writeTo(java.io.OutputStream s) - throws IOException; + public void putEndian(); + + public void writeTo(java.io.OutputStream s) throws IOException; public byte[] toByteArray(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/OSFCodeSetRegistry.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/OSFCodeSetRegistry.java index 531e36569..5b8c13dff 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/OSFCodeSetRegistry.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/OSFCodeSetRegistry.java @@ -27,8 +27,7 @@ * * Consider rename to CodeSetRegistry since OSF is dead. */ -public final class OSFCodeSetRegistry -{ +public final class OSFCodeSetRegistry { // Numbers from the OSF code set registry version 1.2g. // // Please see the individual Entry definitions for @@ -39,24 +38,20 @@ public final class OSFCodeSetRegistry public static final int UCS_2_VALUE = 0x00010100; public static final int ISO_646_VALUE = 0x00010020; - private OSFCodeSetRegistry() {} + private OSFCodeSetRegistry() { + } /** - * An entry in the OSF registry which allows users - * to find out the equivalent Java character encoding - * name as well as some other facts from the registry. + * An entry in the OSF registry which allows users to find out the equivalent Java character encoding name as well as + * some other facts from the registry. */ - public final static class Entry - { + public final static class Entry { private String javaName; private int encodingNum; private boolean isFixedWidth; private int maxBytesPerChar; - private Entry(String javaName, - int encodingNum, - boolean isFixedWidth, - int maxBytesPerChar) { + private Entry(String javaName, int encodingNum, boolean isFixedWidth, int maxBytesPerChar) { this.javaName = javaName; this.encodingNum = encodingNum; this.isFixedWidth = isFixedWidth; @@ -64,9 +59,9 @@ private Entry(String javaName, } /** - * Returns the Java equivalent name. If the encoding has - * an optional byte order marker, this name will map to the - * Java encoding that includes the marker. + * Returns the Java equivalent name. If the encoding has an optional byte order marker, this name will map to the Java + * encoding that includes the marker. + * * @return The Java name */ public String getName() { @@ -75,16 +70,17 @@ public String getName() { /** * Get the OSF registry number for this code set. + * * @return Encoding number */ public int getNumber() { return encodingNum; } - /** - * Is this a fixed or variable width code set? (In CORBA - * terms, "non-byte-oriented" or a "byte-oriented" - * code set, respectively) + /** + * Is this a fixed or variable width code set? (In CORBA terms, "non-byte-oriented" or a "byte-oriented" code set, + * respectively) + * * @return True if this is a fixed with code set. */ public boolean isFixedWidth() { @@ -94,10 +90,9 @@ public boolean isFixedWidth() { public int getMaxBytesPerChar() { return maxBytesPerChar; } - + /** - * First checks reference equality since it's expected - * people will use the pre-defined constant Entries. + * First checks reference equality since it's expected people will use the pre-defined constant Entries. */ public boolean equals(Object obj) { if (this == obj) @@ -106,13 +101,10 @@ public boolean equals(Object obj) { if (!(obj instanceof OSFCodeSetRegistry.Entry)) return false; - OSFCodeSetRegistry.Entry other - = (OSFCodeSetRegistry.Entry)obj; + OSFCodeSetRegistry.Entry other = (OSFCodeSetRegistry.Entry) obj; - return (javaName.equals(other.javaName) && - encodingNum == other.encodingNum && - isFixedWidth == other.isFixedWidth && - maxBytesPerChar == other.maxBytesPerChar); + return (javaName.equals(other.javaName) && encodingNum == other.encodingNum && isFixedWidth == other.isFixedWidth + && maxBytesPerChar == other.maxBytesPerChar); } /** @@ -124,107 +116,69 @@ public int hashCode() { } /** - * 8-bit encoding required for GIOP 1.0, and used as the char set - * when nothing else is specified. + * 8-bit encoding required for GIOP 1.0, and used as the char set when nothing else is specified. */ - public static final Entry ISO_8859_1 - = new Entry("ISO-8859-1", - ISO_8859_1_VALUE, - true, - 1); + public static final Entry ISO_8859_1 = new Entry("ISO-8859-1", ISO_8859_1_VALUE, true, 1); /** - * UTF-16 as specified in the OSF registry has an optional - * byte order marker. UTF-16BE and UTF-16LE are not in the OSF - * registry since it is no longer being developed. When the OMG - * switches to the IANA registry, these can be public. Right - * now, they're used internally by CodeSetConversion. + * UTF-16 as specified in the OSF registry has an optional byte order marker. UTF-16BE and UTF-16LE are not in the OSF + * registry since it is no longer being developed. When the OMG switches to the IANA registry, these can be public. + * Right now, they're used internally by CodeSetConversion. */ - static final Entry UTF_16BE - = new Entry("UTF-16BE", - -1, - true, - 2); - - static final Entry UTF_16LE - = new Entry("UTF-16LE", - -2, - true, - 2); + static final Entry UTF_16BE = new Entry("UTF-16BE", -1, true, 2); + + static final Entry UTF_16LE = new Entry("UTF-16LE", -2, true, 2); /** * Fallback wchar code set. * - * In the resolution of issue 3405b, UTF-16 defaults to big endian, so - * doesn't have to have a byte order marker. Unfortunately, this has to be - * a special case for compatibility. + * In the resolution of issue 3405b, UTF-16 defaults to big endian, so doesn't have to have a byte order marker. + * Unfortunately, this has to be a special case for compatibility. */ - public static final Entry UTF_16 - = new Entry("UTF-16", - UTF_16_VALUE, - true, - 4); + public static final Entry UTF_16 = new Entry("UTF-16", UTF_16_VALUE, true, 4); /** - * Fallback char code set. Also the code set for char data - * in encapsulations. However, since CORBA says chars are - * only one octet, it is really the same as Latin-1. + * Fallback char code set. Also the code set for char data in encapsulations. However, since CORBA says chars are only + * one octet, it is really the same as Latin-1. */ - public static final Entry UTF_8 - = new Entry("UTF-8", - UTF_8_VALUE, - false, - 6); + public static final Entry UTF_8 = new Entry("UTF-8", UTF_8_VALUE, false, 6); /* - * At least in JDK 1.3, UCS-2 isn't one of the mandatory Java character - * encodings. However, our old ORBs require what they call UCS2, even - * though they didn't necessarily do the correct encoding of it. + * At least in JDK 1.3, UCS-2 isn't one of the mandatory Java character encodings. However, our old ORBs require what + * they call UCS2, even though they didn't necessarily do the correct encoding of it. * - * This is a special case for our legacy ORBs, and put as the last thing - * in our conversion list for wchar data. + * This is a special case for our legacy ORBs, and put as the last thing in our conversion list for wchar data. * - * If a foreign ORB actually tries to speak UCS2 with us, it probably - * won't work! Beware! + * If a foreign ORB actually tries to speak UCS2 with us, it probably won't work! Beware! */ - public static final Entry UCS_2 - = new Entry("UCS-2", - UCS_2_VALUE, - true, - 2); + public static final Entry UCS_2 = new Entry("UCS-2", UCS_2_VALUE, true, 2); /** - * This is the encoding older JavaSoft ORBs advertised as their - * CORBA char code set. Actually, they took the lower byte of - * the Java char. This is a 7-bit encoding, so they - * were really sending ISO8859-1. + * This is the encoding older JavaSoft ORBs advertised as their CORBA char code set. Actually, they took the lower byte + * of the Java char. This is a 7-bit encoding, so they were really sending ISO8859-1. */ - public static final Entry ISO_646 - = new Entry("US-ASCII", - ISO_646_VALUE, - true, - 1); + public static final Entry ISO_646 = new Entry("US-ASCII", ISO_646_VALUE, true, 1); /** - * Given an OSF registry value, return the corresponding Entry. - * Returns null if an Entry for that value is unavailable. + * Given an OSF registry value, return the corresponding Entry. Returns null if an Entry for that value is unavailable. + * * @param encodingValue value to look up * @return Corresponding Entry */ public static Entry lookupEntry(int encodingValue) { - switch(encodingValue) { - case ISO_8859_1_VALUE: - return OSFCodeSetRegistry.ISO_8859_1; - case UTF_16_VALUE: - return OSFCodeSetRegistry.UTF_16; - case UTF_8_VALUE: - return OSFCodeSetRegistry.UTF_8; - case ISO_646_VALUE: - return OSFCodeSetRegistry.ISO_646; - case UCS_2_VALUE: - return OSFCodeSetRegistry.UCS_2; - default: - return null; + switch (encodingValue) { + case ISO_8859_1_VALUE: + return OSFCodeSetRegistry.ISO_8859_1; + case UTF_16_VALUE: + return OSFCodeSetRegistry.UTF_16; + case UTF_8_VALUE: + return OSFCodeSetRegistry.UTF_8; + case ISO_646_VALUE: + return OSFCodeSetRegistry.ISO_646; + case UCS_2_VALUE: + return OSFCodeSetRegistry.UCS_2; + default: + return null; } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/OutputStreamFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/OutputStreamFactory.java index 2d41e01a1..6f1631a8b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/OutputStreamFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/OutputStreamFactory.java @@ -34,82 +34,72 @@ * @author jwells */ public class OutputStreamFactory { - public static TypeCodeOutputStream newTypeCodeOutputStream(final ORB orb) { - return AccessController.doPrivileged(new PrivilegedAction() { - - @Override - public TypeCodeOutputStream run() { - return new TypeCodeOutputStream(orb); - } - - }); + public static TypeCodeOutputStream newTypeCodeOutputStream(final ORB orb) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public TypeCodeOutputStream run() { + return new TypeCodeOutputStream(orb); + } + + }); + } + + public static EncapsOutputStream newEncapsOutputStream(final ORB orb, final GIOPVersion version) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public EncapsOutputStream run() { + return new EncapsOutputStream(orb, version); + } + + }); + } + + public static EncapsOutputStream newEncapsOutputStream(final ORB orb) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public EncapsOutputStream run() { + return new EncapsOutputStream(orb); + } + + }); + } - - public static EncapsOutputStream newEncapsOutputStream(final ORB orb, - final GIOPVersion version) { - return AccessController.doPrivileged(new PrivilegedAction() { - - @Override - public EncapsOutputStream run() { - return new EncapsOutputStream(orb, version); - } - - }); - } - - public static EncapsOutputStream newEncapsOutputStream(final ORB orb) { - return AccessController.doPrivileged(new PrivilegedAction() { - - @Override - public EncapsOutputStream run() { - return new EncapsOutputStream(orb); - } - - }); - - } - - public static CDROutputObject newCDROutputObject(final ORB orb, - final MessageMediator mediator, - final GIOPVersion giopVersion, - final Connection connection, - final Message header, + + public static CDROutputObject newCDROutputObject(final ORB orb, final MessageMediator mediator, final GIOPVersion giopVersion, + final Connection connection, final Message header, final byte streamFormatVersion) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public CDROutputObject run() { + return new CDROutputObject(orb, mediator, giopVersion, connection, header, streamFormatVersion); + } + }); + } + + public static CDROutputObject newCDROutputObject(final ORB orb, final MessageMediator messageMediator, final Message header, final byte streamFormatVersion) { - return AccessController.doPrivileged(new PrivilegedAction() { - - @Override - public CDROutputObject run() { - return new CDROutputObject(orb, mediator, giopVersion, connection, header, streamFormatVersion); - } - }); - } - - public static CDROutputObject newCDROutputObject(final ORB orb, - final MessageMediator messageMediator, - final Message header, - final byte streamFormatVersion) { - return AccessController.doPrivileged(new PrivilegedAction() { - - @Override - public CDROutputObject run() { - return new CDROutputObject(orb, messageMediator, header, streamFormatVersion); - } - }); - - } - - public static CDROutputObject newCDROutputObject(final ORB orb, - final MessageMediator messageMediator, - final Message header, - final byte streamFormatVersion, - final int strategy) { - return AccessController.doPrivileged(new PrivilegedAction() { - - @Override - public CDROutputObject run() { - return new CDROutputObject(orb, messageMediator, header, streamFormatVersion, strategy); - } - }); - - } + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public CDROutputObject run() { + return new CDROutputObject(orb, messageMediator, header, streamFormatVersion); + } + }); + + } + + public static CDROutputObject newCDROutputObject(final ORB orb, final MessageMediator messageMediator, final Message header, + final byte streamFormatVersion, final int strategy) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public CDROutputObject run() { + return new CDROutputObject(orb, messageMediator, header, streamFormatVersion, strategy); + } + }); + + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/RestorableInputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/RestorableInputStream.java index 69bcd735d..54c531993 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/RestorableInputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/RestorableInputStream.java @@ -20,12 +20,10 @@ package com.sun.corba.ee.impl.encoding; /** - * Defines the methods on an input stream which provide - * a way to get and restore its internal state without - * violating encapsulation. + * Defines the methods on an input stream which provide a way to get and restore its internal state without violating + * encapsulation. */ -interface RestorableInputStream -{ +interface RestorableInputStream { Object createStreamMemento(); void restoreInternalState(Object streamMemento); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeInputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeInputStream.java index 5518f5abb..80bb13130 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeInputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeInputStream.java @@ -24,8 +24,6 @@ import java.util.Map; import java.nio.ByteBuffer; - - import org.omg.CORBA_2_3.portable.InputStream; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; @@ -33,34 +31,25 @@ import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.impl.encoding.CDRInputObject; -public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader -{ - private Map typeMap = null; +public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader { + private Map typeMap = null; private InputStream enclosure = null; public TypeCodeInputStream(org.omg.CORBA.ORB orb, byte[] data, int size) { super(orb, data, size); } - public TypeCodeInputStream(org.omg.CORBA.ORB orb, - byte[] data, - int size, - ByteOrder byteOrder, - GIOPVersion version) { + public TypeCodeInputStream(org.omg.CORBA.ORB orb, byte[] data, int size, ByteOrder byteOrder, GIOPVersion version) { super(orb, data, size, byteOrder, version); } - TypeCodeInputStream(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int size, - ByteOrder byteOrder, - GIOPVersion version) { + TypeCodeInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, int size, ByteOrder byteOrder, GIOPVersion version) { super(orb, byteBuffer, size, byteOrder, version); } public void addTypeCodeAtPosition(TypeCodeImpl tc, int position) { if (typeMap == null) { - typeMap = new HashMap(16); + typeMap = new HashMap(16); } typeMap.put(position, tc); } @@ -79,7 +68,7 @@ public TypeCodeReader getTopLevelStream() { if (enclosure == null) return this; if (enclosure instanceof TypeCodeReader) - return ((TypeCodeReader)enclosure).getTopLevelStream(); + return ((TypeCodeReader) enclosure).getTopLevelStream(); return this; } @@ -88,7 +77,7 @@ public int getTopLevelPosition() { // The enclosed stream has to consider if the enclosing stream // had to read the enclosed stream completely when creating it. // This is why the size of the enclosed stream needs to be substracted. - int topPos = ((TypeCodeReader)enclosure).getTopLevelPosition(); + int topPos = ((TypeCodeReader) enclosure).getTopLevelPosition(); // Subtract getBufferLength from the parents pos because it read this stream // from its own when creating it return topPos - getBufferLength() + getPosition(); @@ -109,8 +98,7 @@ public static TypeCodeInputStream readEncapsulation(InputStream is, org.omg.CORB // create an encapsulation using the marshal buffer if (is instanceof CDRInputObject) { encap = EncapsInputStreamFactory.newTypeCodeInputStream(_orb, encapBuffer, encapBuffer.length, - ((CDRInputObject)is).getByteOrder(), - ((CDRInputObject)is).getGIOPVersion()); + ((CDRInputObject) is).getByteOrder(), ((CDRInputObject) is).getGIOPVersion()); } else { encap = EncapsInputStreamFactory.newTypeCodeInputStream(_orb, encapBuffer, encapBuffer.length); } @@ -126,10 +114,9 @@ protected void makeEncapsulation() { public void printTypeMap() { System.out.println("typeMap = {"); - for (Integer pos : typeMap.keySet() ) { - System.out.println( " key = " + pos + ", value = " + - typeMap.get(pos).description() ) ; + for (Integer pos : typeMap.keySet()) { + System.out.println(" key = " + pos + ", value = " + typeMap.get(pos).description()); } - System.out.println("}") ; + System.out.println("}"); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeOutputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeOutputStream.java index c61a9e08c..fefe3afb9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeOutputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeOutputStream.java @@ -19,7 +19,6 @@ package com.sun.corba.ee.impl.encoding; - import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; import org.omg.CORBA_2_3.portable.OutputStream; @@ -35,7 +34,7 @@ public final class TypeCodeOutputStream extends EncapsOutputStream { private static final InputObjectFactory TYPE_CODE_INPUT_OBJECT_FACTORY = new TypeCodeInputStreamFactory(); private OutputStream enclosure = null; - private Map typeMap = null; + private Map typeMap = null; private boolean isEncapsulation = false; public TypeCodeOutputStream(ORB orb) { @@ -49,7 +48,8 @@ public org.omg.CORBA.portable.InputStream create_input_stream() { private static class TypeCodeInputStreamFactory implements InputObjectFactory { @Override - public CDRInputObject createInputObject(CDROutputObject outputObject, ORB orb, ByteBuffer byteBuffer, int size, GIOPVersion giopVersion) { + public CDRInputObject createInputObject(CDROutputObject outputObject, ORB orb, ByteBuffer byteBuffer, int size, + GIOPVersion giopVersion) { return EncapsInputStreamFactory.newTypeCodeInputStream(outputObject.orb(), byteBuffer, size, ByteOrder.BIG_ENDIAN, giopVersion); } } @@ -62,15 +62,14 @@ public TypeCodeOutputStream getTopLevelStream() { if (enclosure == null) return this; if (enclosure instanceof TypeCodeOutputStream) - return ((TypeCodeOutputStream)enclosure).getTopLevelStream(); + return ((TypeCodeOutputStream) enclosure).getTopLevelStream(); return this; } public int getTopLevelPosition() { if (enclosure != null && enclosure instanceof TypeCodeOutputStream) { - int pos = ((TypeCodeOutputStream)enclosure).getTopLevelPosition() - + getPosition(); - // Add four bytes for the encaps length, not another 4 for the + int pos = ((TypeCodeOutputStream) enclosure).getTopLevelPosition() + getPosition(); + // Add four bytes for the encaps length, not another 4 for the // byte order which is included in getPosition(). if (isEncapsulation) { pos += 4; @@ -83,19 +82,18 @@ public int getTopLevelPosition() { public void addIDAtPosition(String id, int position) { if (typeMap == null) - typeMap = new HashMap(16); + typeMap = new HashMap(16); typeMap.put(id, position); } public int getPositionForID(String id) { if (typeMap == null) - throw wrapper.refTypeIndirType() ; - return - typeMap.get(id) ; + throw wrapper.refTypeIndirType(); + return typeMap.get(id); } public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) { - TypeCodeOutputStream encap = OutputStreamFactory.newTypeCodeOutputStream((ORB)_orb); + TypeCodeOutputStream encap = OutputStreamFactory.newTypeCodeOutputStream((ORB) _orb); encap.setEnclosingOutputStream(this); encap.makeEncapsulation(); return encap; @@ -108,7 +106,7 @@ protected void makeEncapsulation() { } public static TypeCodeOutputStream wrapOutputStream(OutputStream os) { - TypeCodeOutputStream tos = OutputStreamFactory.newTypeCodeOutputStream((ORB)os.orb()); + TypeCodeOutputStream tos = OutputStreamFactory.newTypeCodeOutputStream((ORB) os.orb()); tos.setEnclosingOutputStream(os); return tos; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeReader.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeReader.java index ffb293a07..bc6c0402f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeReader.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/TypeCodeReader.java @@ -31,19 +31,19 @@ import java.math.BigDecimal; import java.math.BigInteger; -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.UnionMember ; -import org.omg.CORBA.ValueMember ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.BAD_TYPECODE ; -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA.BAD_OPERATION ; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.MARSHAL ; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.UnionMember; +import org.omg.CORBA.ValueMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_TYPECODE; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.INTERNAL; +import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.TypeCodePackage.BadKind ; +import org.omg.CORBA.TypeCodePackage.BadKind; import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; @@ -57,10 +57,16 @@ public interface TypeCodeReader extends MarshalInputStream { public void addTypeCodeAtPosition(TypeCodeImpl tc, int position); + public TypeCodeImpl getTypeCodeAtPosition(int position); + public void setEnclosingInputStream(InputStream enclosure); + public TypeCodeReader getTopLevelStream(); + public int getTopLevelPosition(); + public int getPosition(); + public void printTypeMap(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/WrapperInputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/WrapperInputStream.java index 98f46abe5..153c8df3b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/WrapperInputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/encoding/WrapperInputStream.java @@ -27,18 +27,16 @@ import java.util.ArrayList; import java.io.IOException; -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.Any ; - +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; import org.omg.CORBA_2_3.portable.InputStream; import com.sun.corba.ee.impl.corba.TypeCodeImpl; -public class WrapperInputStream extends org.omg.CORBA_2_3.portable.InputStream implements TypeCodeReader -{ +public class WrapperInputStream extends org.omg.CORBA_2_3.portable.InputStream implements TypeCodeReader { private CDRInputObject stream; - private Map typeMap = null; + private Map typeMap = null; private int startPos = 0; public WrapperInputStream(CDRInputObject s) { @@ -47,97 +45,202 @@ public WrapperInputStream(CDRInputObject s) { startPos = stream.getPosition(); } - public int read() throws IOException { return stream.read(); } - public int read(byte b[]) throws IOException { return stream.read(b); } + public int read() throws IOException { + return stream.read(); + } + + public int read(byte b[]) throws IOException { + return stream.read(b); + } + public int read(byte b[], int off, int len) throws IOException { return stream.read(b, off, len); } - public long skip(long n) throws IOException { return stream.skip(n); } - public int available() throws IOException { return stream.available(); } - public void close() throws IOException { stream.close(); } - public void mark(int readlimit) { stream.mark(readlimit); } - public void reset() { stream.reset(); } - public boolean markSupported() { return stream.markSupported(); } - public int getPosition() { return stream.getPosition(); } - public void consumeEndian() { stream.consumeEndian(); } - public boolean read_boolean() { return stream.read_boolean(); } - public char read_char() { return stream.read_char(); } - public char read_wchar() { return stream.read_wchar(); } - public byte read_octet() { return stream.read_octet(); } - public short read_short() { return stream.read_short(); } - public short read_ushort() { return stream.read_ushort(); } - public int read_long() { return stream.read_long(); } - public int read_ulong() { return stream.read_ulong(); } - public long read_longlong() { return stream.read_longlong(); } - public long read_ulonglong() { return stream.read_ulonglong(); } - public float read_float() { return stream.read_float(); } - public double read_double() { return stream.read_double(); } - public String read_string() { return stream.read_string(); } - public String read_wstring() { return stream.read_wstring(); } + + public long skip(long n) throws IOException { + return stream.skip(n); + } + + public int available() throws IOException { + return stream.available(); + } + + public void close() throws IOException { + stream.close(); + } + + public void mark(int readlimit) { + stream.mark(readlimit); + } + + public void reset() { + stream.reset(); + } + + public boolean markSupported() { + return stream.markSupported(); + } + + public int getPosition() { + return stream.getPosition(); + } + + public void consumeEndian() { + stream.consumeEndian(); + } + + public boolean read_boolean() { + return stream.read_boolean(); + } + + public char read_char() { + return stream.read_char(); + } + + public char read_wchar() { + return stream.read_wchar(); + } + + public byte read_octet() { + return stream.read_octet(); + } + + public short read_short() { + return stream.read_short(); + } + + public short read_ushort() { + return stream.read_ushort(); + } + + public int read_long() { + return stream.read_long(); + } + + public int read_ulong() { + return stream.read_ulong(); + } + + public long read_longlong() { + return stream.read_longlong(); + } + + public long read_ulonglong() { + return stream.read_ulonglong(); + } + + public float read_float() { + return stream.read_float(); + } + + public double read_double() { + return stream.read_double(); + } + + public String read_string() { + return stream.read_string(); + } + + public String read_wstring() { + return stream.read_wstring(); + } public void read_boolean_array(boolean[] value, int offset, int length) { stream.read_boolean_array(value, offset, length); } + public void read_char_array(char[] value, int offset, int length) { stream.read_char_array(value, offset, length); } + public void read_wchar_array(char[] value, int offset, int length) { stream.read_wchar_array(value, offset, length); } + public void read_octet_array(byte[] value, int offset, int length) { stream.read_octet_array(value, offset, length); } + public void read_short_array(short[] value, int offset, int length) { stream.read_short_array(value, offset, length); } + public void read_ushort_array(short[] value, int offset, int length) { stream.read_ushort_array(value, offset, length); } + public void read_long_array(int[] value, int offset, int length) { stream.read_long_array(value, offset, length); } + public void read_ulong_array(int[] value, int offset, int length) { stream.read_ulong_array(value, offset, length); } + public void read_longlong_array(long[] value, int offset, int length) { stream.read_longlong_array(value, offset, length); } + public void read_ulonglong_array(long[] value, int offset, int length) { stream.read_ulonglong_array(value, offset, length); } + public void read_float_array(float[] value, int offset, int length) { stream.read_float_array(value, offset, length); } + public void read_double_array(double[] value, int offset, int length) { stream.read_double_array(value, offset, length); } - public org.omg.CORBA.Object read_Object() { return stream.read_Object(); } - public java.io.Serializable read_value() {return stream.read_value();} - public TypeCode read_TypeCode() { return stream.read_TypeCode(); } - public Any read_any() { return stream.read_any(); } - @SuppressWarnings({"deprecation"}) - public org.omg.CORBA.Principal read_Principal() { return stream.read_Principal(); } - public java.math.BigDecimal read_fixed() { return stream.read_fixed(); } - public org.omg.CORBA.Context read_Context() { return stream.read_Context(); } + public org.omg.CORBA.Object read_Object() { + return stream.read_Object(); + } + + public java.io.Serializable read_value() { + return stream.read_value(); + } + + public TypeCode read_TypeCode() { + return stream.read_TypeCode(); + } + + public Any read_any() { + return stream.read_any(); + } - public org.omg.CORBA.ORB orb() { return stream.orb(); } + @SuppressWarnings({ "deprecation" }) + public org.omg.CORBA.Principal read_Principal() { + return stream.read_Principal(); + } + + public java.math.BigDecimal read_fixed() { + return stream.read_fixed(); + } + + public org.omg.CORBA.Context read_Context() { + return stream.read_Context(); + } + + public org.omg.CORBA.ORB orb() { + return stream.orb(); + } public void addTypeCodeAtPosition(TypeCodeImpl tc, int position) { if (typeMap == null) { - //if (TypeCodeImpl.debug) System.out.println("Creating typeMap"); - typeMap = new HashMap(16); + // if (TypeCodeImpl.debug) System.out.println("Creating typeMap"); + typeMap = new HashMap(16); } - //if (TypeCodeImpl.debug) System.out.println(this + " adding tc " - // + tc + " at position " + position); + // if (TypeCodeImpl.debug) System.out.println(this + " adding tc " + // + tc + " at position " + position); typeMap.put(position, tc); } public TypeCodeImpl getTypeCodeAtPosition(int position) { if (typeMap == null) return null; - //if (TypeCodeImpl.debug) System.out.println("Getting tc " - // + typeMap.get(position) + " at position " + position); + // if (TypeCodeImpl.debug) System.out.println("Getting tc " + // + typeMap.get(position) + " at position " + position); return typeMap.get(position); } @@ -151,9 +254,9 @@ public TypeCodeReader getTopLevelStream() { } public int getTopLevelPosition() { - //if (TypeCodeImpl.debug) System.out.println("WrapperInputStream.getTopLevelPosition " + - //"returning getPosition " + getPosition() + " - startPos " + startPos + - //" = " + (getPosition() - startPos)); + // if (TypeCodeImpl.debug) System.out.println("WrapperInputStream.getTopLevelPosition " + + // "returning getPosition " + getPosition() + " - startPos " + startPos + + // " = " + (getPosition() - startPos)); return getPosition() - startPos; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/CSIv2SSLTaggedComponentHandler.java b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/CSIv2SSLTaggedComponentHandler.java index d45253ccf..0c23e3d76 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/CSIv2SSLTaggedComponentHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/CSIv2SSLTaggedComponentHandler.java @@ -33,39 +33,31 @@ import com.sun.corba.ee.spi.transport.SocketInfo; /** - * An implementation of this interface org.omg.CORBA.LocalObject. - * An instance of this interface is plugged into the ORB via - * ORB.register_initial_reference(ORBConstants.CSIv2SSLTaggedComponentHandler, instance). + * An implementation of this interface org.omg.CORBA.LocalObject. An instance of this interface is plugged + * into the ORB via ORB.register_initial_reference(ORBConstants.CSIv2SSLTaggedComponentHandler, instance). * * @author Harold Carr */ -public interface CSIv2SSLTaggedComponentHandler -{ +public interface CSIv2SSLTaggedComponentHandler { /** * @param iorInfo - from IORInterceptor.establish_components. - * @param clusterInstanceInfo On the server-side, the FOLB system will pass all ClusterInstanceInfo - * to the CSIv2/SSL system. - * @return null or org.omg.IOP.TaggedComponent. - * The CSIv2SSL system returns null if no security - * information is to be added to IORs. Otherwise it returns the - * CSIv2SSL org.omg.IOP.TaggedComponent that will be - * added to IORs. + * @param clusterInstanceInfo On the server-side, the FOLB system will pass all ClusterInstanceInfo to the CSIv2/SSL + * system. + * @return null or org.omg.IOP.TaggedComponent. The CSIv2SSL system returns null if no security information + * is to be added to IORs. Otherwise it returns the CSIv2SSL org.omg.IOP.TaggedComponent that will be added + * to IORs. */ - public TaggedComponent insert(IORInfo iorInfo, - List clusterInstanceInfo); + public TaggedComponent insert(IORInfo iorInfo, List clusterInstanceInfo); - /** Extract is called on each invocation of the IOR, so that the security code can - * run properly. - * If the given IOR contains CSIv2SSL host/port - * info that should be used for this invocation then - * extract should return a List of SocketInfo. - * Otherwise it should return null. + /** + * Extract is called on each invocation of the IOR, so that the security code can run properly. If the given IOR + * contains CSIv2SSL host/port info that should be used for this invocation then extract should return a List of + * SocketInfo. Otherwise it should return null. + * * @param ior The target ior of the current invocation. * @return List of all SocketInfos found in the IOR. */ - public List extract(IOR ior); + public List extract(IOR ior); } // End of file. - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/ClientGroupManager.java b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/ClientGroupManager.java index 3ae94eec2..ea849e204 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/ClientGroupManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/ClientGroupManager.java @@ -73,48 +73,39 @@ * @author Harold Carr */ @Folb -public class ClientGroupManager - extends - org.omg.CORBA.LocalObject - implements - ClientRequestInterceptor, - GroupInfoService, - IIOPPrimaryToContactInfo, - IORToSocketInfo, - ORBConfigurator, - ORBInitializer -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class ClientGroupManager extends org.omg.CORBA.LocalObject + implements ClientRequestInterceptor, GroupInfoService, IIOPPrimaryToContactInfo, IORToSocketInfo, ORBConfigurator, ORBInitializer { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private static final long serialVersionUID = 7849660203226017842L; public final String baseMsg = ClientGroupManager.class.getName(); public static boolean sentMemberShipLabel = false; // For test. - public static boolean receivedIORUpdate = false; // For test. + public static boolean receivedIORUpdate = false; // For test. private ORB orb; private Codec codec; private boolean initialized = false; - private IOR lastIOR; // Initially null, thus the separate lock object. + private IOR lastIOR; // Initially null, thus the separate lock object. private final Object lastIORLock = new Object(); private CSIv2SSLTaggedComponentHandler csiv2SSLTaggedComponentHandler; private transient GIS gis = new GIS(); - public ClientGroupManager() { + public ClientGroupManager() { } @InfoMethod - private void reportException( Exception exc ) { } + private void reportException(Exception exc) { + } @InfoMethod - private void notFound( String name ) { } + private void notFound(String name) { + } @Folb - private void initialize() - { + private void initialize() { if (initialized) { return; } @@ -123,25 +114,19 @@ private void initialize() initialized = true; try { - csiv2SSLTaggedComponentHandler = - (CSIv2SSLTaggedComponentHandler) - orb.resolve_initial_references( - ORBConstants.CSI_V2_SSL_TAGGED_COMPONENT_HANDLER); + csiv2SSLTaggedComponentHandler = (CSIv2SSLTaggedComponentHandler) orb + .resolve_initial_references(ORBConstants.CSI_V2_SSL_TAGGED_COMPONENT_HANDLER); } catch (InvalidName e) { csiv2SSLTaggedComponentHandler = null; - notFound( ORBConstants.CSI_V2_SSL_TAGGED_COMPONENT_HANDLER ); + notFound(ORBConstants.CSI_V2_SSL_TAGGED_COMPONENT_HANDLER); } - CodecFactory codecFactory = - CodecFactoryHelper.narrow( - orb.resolve_initial_references( - ORBConstants.CODEC_FACTORY_NAME)); + CodecFactory codecFactory = CodecFactoryHelper.narrow(orb.resolve_initial_references(ORBConstants.CODEC_FACTORY_NAME)); - codec = codecFactory.create_codec( - new Encoding((short)0, (byte)1, (byte)2)); + codec = codecFactory.create_codec(new Encoding((short) 0, (byte) 1, (byte) 2)); } catch (InvalidName e) { - reportException( e ) ; + reportException(e); } catch (UnknownEncoding e) { - reportException( e ) ; + reportException(e); } } @@ -151,30 +136,31 @@ private void initialize() // @InfoMethod - private void nonSSLSocketInfo() { } + private void nonSSLSocketInfo() { + } @InfoMethod - private void returningPreviousSocketInfo( List lst ) { } + private void returningPreviousSocketInfo(List lst) { + } @Folb - public List getSocketInfo(IOR ior, List previous) - { + public List getSocketInfo(IOR ior, List previous) { initialize(); try { if (csiv2SSLTaggedComponentHandler != null) { - List csiv2 = - csiv2SSLTaggedComponentHandler.extract(ior); + List csiv2 = csiv2SSLTaggedComponentHandler.extract(ior); if (csiv2 != null) { - /* The contract with CSIv2 says if SSL is to be used - then ONLY try SSL addresssses. */ + /* + * The contract with CSIv2 says if SSL is to be used then ONLY try SSL addresssses. + */ return csiv2; } } nonSSLSocketInfo(); - if (! previous.isEmpty()) { + if (!previous.isEmpty()) { returningPreviousSocketInfo(previous); return previous; } @@ -192,21 +178,14 @@ public List getSocketInfo(IOR ior, List previous) // List alternate cluster addresses // - final Iterator iterator = - iiopProfileTemplate.iteratorById( - ORBConstants.FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID, - ClusterInstanceInfoComponent.class ); + final Iterator iterator = iiopProfileTemplate + .iteratorById(ORBConstants.FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID, ClusterInstanceInfoComponent.class); while (iterator.hasNext()) { - ClusterInstanceInfo clusterInstanceInfo = - iterator.next().getClusterInstanceInfo() ; - List endpoints = - clusterInstanceInfo.endpoints(); + ClusterInstanceInfo clusterInstanceInfo = iterator.next().getClusterInstanceInfo(); + List endpoints = clusterInstanceInfo.endpoints(); for (com.sun.corba.ee.spi.folb.SocketInfo socketInfo : endpoints) { - result.add( createSocketInfo( - "ClusterInstanceInfo.endpoint", - socketInfo.type(), socketInfo.host(), - socketInfo.port())); + result.add(createSocketInfo("ClusterInstanceInfo.endpoint", socketInfo.type(), socketInfo.host(), socketInfo.port())); } } @@ -214,20 +193,16 @@ public List getSocketInfo(IOR ior, List previous) // List alternate TAG_ALTERNATE_IIOP_ADDRESS (for corbaloc) // - final Iterator aiterator = - iiopProfileTemplate.iteratorById( - org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS.value, - AlternateIIOPAddressComponent.class ); + final Iterator aiterator = iiopProfileTemplate + .iteratorById(org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS.value, AlternateIIOPAddressComponent.class); while (aiterator.hasNext()) { AlternateIIOPAddressComponent alternate = aiterator.next(); - + String host = alternate.getAddress().getHost().toLowerCase(); int port = alternate.getAddress().getPort(); - - result.add(createSocketInfo( - "AlternateIIOPAddressComponent", - SocketInfo.IIOP_CLEAR_TEXT, host, port)); + + result.add(createSocketInfo("AlternateIIOPAddressComponent", SocketInfo.IIOP_CLEAR_TEXT, host, port)); } return result; @@ -242,55 +217,51 @@ public List getSocketInfo(IOR ior, List previous) } @Folb - private SocketInfo createSocketInfo(final String msg, - final String type, - final String host, - final int port) - { + private SocketInfo createSocketInfo(final String msg, final String type, final String host, final int port) { return new SocketInfo() { - public String getType() { - return type; - } + public String getType() { + return type; + } - public String getHost() { - return host; - } + public String getHost() { + return host; + } - public int getPort() { - return port; - } + public int getPort() { + return port; + } - @Override - public boolean equals(Object o) { - if (o == null) { - return false; - } - if (! (o instanceof SocketInfo)) { - return false; - } - SocketInfo other = (SocketInfo)o; - if (other.getPort() != port) { - return false; - } - if (! other.getHost().equals(host)) { - return false; - } - if (! other.getType().equals(type)) { - return false; - } - return true; + @Override + public boolean equals(Object o) { + if (o == null) { + return false; } - - @Override - public String toString() { - return "SocketInfo[" + type + " " + host + " " + port +"]"; + if (!(o instanceof SocketInfo)) { + return false; } - - @Override - public int hashCode() { - return port ^ host.hashCode() ^ type.hashCode() ; + SocketInfo other = (SocketInfo) o; + if (other.getPort() != port) { + return false; } - }; + if (!other.getHost().equals(host)) { + return false; + } + if (!other.getType().equals(type)) { + return false; + } + return true; + } + + @Override + public String toString() { + return "SocketInfo[" + type + " " + host + " " + port + "]"; + } + + @Override + public int hashCode() { + return port ^ host.hashCode() ^ type.hashCode(); + } + }; } //////////////////////////////////////////////////// @@ -301,24 +272,21 @@ public int hashCode() { private Map map = new HashMap(); @Folb - public synchronized void reset(ContactInfo primary) - { + public synchronized void reset(ContactInfo primary) { initialize(); try { map.remove(getKey(primary)); } catch (Throwable t) { - throw wrapper.exceptionInReset( t ) ; + throw wrapper.exceptionInReset(t); } } @InfoMethod - private void hasNextInfo( int previousIndex, int contactInfoSize ) { } + private void hasNextInfo(int previousIndex, int contactInfoSize) { + } @Folb - public synchronized boolean hasNext(ContactInfo primary, - ContactInfo previous, - List contactInfos) - { + public synchronized boolean hasNext(ContactInfo primary, ContactInfo previous, List contactInfos) { initialize(); try { boolean result; @@ -334,9 +302,7 @@ public synchronized boolean hasNext(ContactInfo primary, // found in the current list of contactInfos. RuntimeException rte = new RuntimeException( - - "Problem in " + baseMsg + ".hasNext: previousIndex: " - + previousIndex); + "Problem in " + baseMsg + ".hasNext: previousIndex: " + previousIndex); // REVISIT - error message throw rte; } else { @@ -348,36 +314,38 @@ public synchronized boolean hasNext(ContactInfo primary, return result; } catch (Throwable t) { // REVISIT - error msg - RuntimeException rte = - new RuntimeException(baseMsg + ".hasNext error"); + RuntimeException rte = new RuntimeException(baseMsg + ".hasNext error"); rte.initCause(t); throw rte; } } @InfoMethod - private void initializeMap() { } + private void initializeMap() { + } @InfoMethod - private void primaryMappedTo( Object obj ) { } + private void primaryMappedTo(Object obj) { + } @InfoMethod - private void cannotFindMappedEntry() { } + private void cannotFindMappedEntry() { + } @InfoMethod - private void iiopFailoverTo( Object obj ) { } + private void iiopFailoverTo(Object obj) { + } @InfoMethod - private void mappedResult( Object obj ) { } + private void mappedResult(Object obj) { + } @InfoMethod - private void mappedResultWithUpdate( Object obj, int prevIndex, int size ) { } + private void mappedResultWithUpdate(Object obj, int prevIndex, int size) { + } @Folb - public synchronized ContactInfo next(ContactInfo primary, - ContactInfo previous, - List contactInfos) - { + public synchronized ContactInfo next(ContactInfo primary, ContactInfo previous, List contactInfos) { initialize(); try { Object result = null; @@ -396,20 +364,20 @@ public synchronized ContactInfo next(ContactInfo primary, int position = contactInfos.indexOf(result); if (position == -1) { // It is possible that communication to the key - // took place on SharedCDR, then a corbaloc to + // took place on SharedCDR, then a corbaloc to // same location uses a SocketOrChannelContactInfo // and vice versa. cannotFindMappedEntry(); reset(primary); return next(primary, previous, contactInfos); } - // NOTE: This step is critical. You do NOT want to - // return contact info from the map. You want to find + // NOTE: This step is critical. You do NOT want to + // return contact info from the map. You want to find // it, as a SocketInfo, in the current list, and then - // return that ContactInfo. Otherwise you will potentially + // return that ContactInfo. Otherwise you will potentially // return a ContactInfo pointing to an incorrect IOR. result = contactInfos.get(position); - mappedResult( result ) ; + mappedResult(result); } } else { // This is a retry. @@ -422,25 +390,22 @@ public synchronized ContactInfo next(ContactInfo primary, if (orb.folbDebugFlag) { // Only compute if debugging here. - mappedResultWithUpdate(result, contactInfos.indexOf(previous), - contactInfos.size() ); + mappedResultWithUpdate(result, contactInfos.indexOf(previous), contactInfos.size()); } } return (ContactInfo) result; } catch (Throwable t) { - throw wrapper.exceptionInNext( t ) ; + throw wrapper.exceptionInNext(t); } } @Folb - private Object getKey(ContactInfo contactInfo) - { - if (((SocketInfo)contactInfo).getPort() == 0) { + private Object getKey(ContactInfo contactInfo) { + if (((SocketInfo) contactInfo).getPort() == 0) { // When CSIv2 is used the primary will have a zero port. // Therefore type/host/port will NOT be unique. // So use the entire IOR for the key in that case. - return contactInfo.getContactInfoList() - .getEffectiveTargetIOR(); + return contactInfo.getContactInfoList().getEffectiveTargetIOR(); } else { return contactInfo; } @@ -452,67 +417,57 @@ private Object getKey(ContactInfo contactInfo) // @Folb - public List getInitialClusterInstanceInfo(ORB orb, - List endpoints ) { + public List getInitialClusterInstanceInfo(ORB orb, List endpoints) { try { - org.omg.CORBA.Object ref ; - if (endpoints.isEmpty()) { - ref = orb.resolve_initial_references( "NameService"); - } else { - final StringBuilder sb = new StringBuilder() ; - sb.append( "corbaloc:" ) ; - boolean first = true ; - for (String str : endpoints ) { - if (first) { - first = false ; - } else { - sb.append( ',' ) ; - } - - sb.append( "iiop:1.2@" ).append( str ) ; - } - - sb.append( "/NameService" ) ; - ref = orb.string_to_object( sb.toString() ) ; - } - - NamingContext nctx = NamingContextHelper.narrow(ref); - NameComponent[] path = - { new NameComponent(ORBConstants.INITIAL_GROUP_INFO_SERVICE, "") }; - InitialGroupInfoService.InitialGIS initGIS = - (InitialGroupInfoService.InitialGIS)PortableRemoteObject.narrow( - nctx.resolve(path), InitialGroupInfoService.InitialGIS.class); - return initGIS.getClusterInstanceInfo(); + org.omg.CORBA.Object ref; + if (endpoints.isEmpty()) { + ref = orb.resolve_initial_references("NameService"); + } else { + final StringBuilder sb = new StringBuilder(); + sb.append("corbaloc:"); + boolean first = true; + for (String str : endpoints) { + if (first) { + first = false; + } else { + sb.append(','); + } + + sb.append("iiop:1.2@").append(str); + } + + sb.append("/NameService"); + ref = orb.string_to_object(sb.toString()); + } + + NamingContext nctx = NamingContextHelper.narrow(ref); + NameComponent[] path = { new NameComponent(ORBConstants.INITIAL_GROUP_INFO_SERVICE, "") }; + InitialGroupInfoService.InitialGIS initGIS = (InitialGroupInfoService.InitialGIS) PortableRemoteObject + .narrow(nctx.resolve(path), InitialGroupInfoService.InitialGIS.class); + return initGIS.getClusterInstanceInfo(); } catch (Exception e) { reportException(e); return null; } } - private class GIS extends GroupInfoServiceBase - { - public List internalClusterInstanceInfo( List endpoints ) - { - if (lastIOR == null) { - return getInitialClusterInstanceInfo(orb, endpoints ); + private class GIS extends GroupInfoServiceBase { + public List internalClusterInstanceInfo(List endpoints) { + if (lastIOR == null) { + return getInitialClusterInstanceInfo(orb, endpoints); } IIOPProfileTemplate iiopProfileTemplate; synchronized (lastIORLock) { - iiopProfileTemplate = (IIOPProfileTemplate) - lastIOR.getProfile().getTaggedProfileTemplate(); + iiopProfileTemplate = (IIOPProfileTemplate) lastIOR.getProfile().getTaggedProfileTemplate(); } - Iterator iterator = - iiopProfileTemplate.iteratorById( - ORBConstants.FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID, - ClusterInstanceInfoComponent.class ); + Iterator iterator = iiopProfileTemplate + .iteratorById(ORBConstants.FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID, ClusterInstanceInfoComponent.class); - LinkedList results = - new LinkedList(); + LinkedList results = new LinkedList(); while (iterator.hasNext()) { - ClusterInstanceInfo clusterInstanceInfo = - iterator.next().getClusterInstanceInfo() ; + ClusterInstanceInfo clusterInstanceInfo = iterator.next().getClusterInstanceInfo(); results.add(clusterInstanceInfo); } @@ -520,42 +475,37 @@ public List internalClusterInstanceInfo( List endpo } @Override - public boolean shouldAddAddressesToNonReferenceFactory(String[] x) - { + public boolean shouldAddAddressesToNonReferenceFactory(String[] x) { throw new RuntimeException("Should not be called in this context"); } @Override - public boolean shouldAddMembershipLabel (String[] adapterName) - { + public boolean shouldAddMembershipLabel(String[] adapterName) { throw new RuntimeException("Should not be called in this context"); } } - public boolean addObserver(GroupInfoServiceObserver x) - { + public boolean addObserver(GroupInfoServiceObserver x) { return gis.addObserver(x); } - public void notifyObservers() - { + + public void notifyObservers() { gis.notifyObservers(); } - public List getClusterInstanceInfo( - String[] adapterName) - { + + public List getClusterInstanceInfo(String[] adapterName) { return gis.getClusterInstanceInfo(adapterName); } - public List getClusterInstanceInfo( - String[] adapterName, List endpoints ) - { - return gis.getClusterInstanceInfo(adapterName,endpoints); + + public List getClusterInstanceInfo(String[] adapterName, List endpoints) { + return gis.getClusterInstanceInfo(adapterName, endpoints); } - public boolean shouldAddAddressesToNonReferenceFactory(String[] x) - { + + public boolean shouldAddAddressesToNonReferenceFactory(String[] x) { return gis.shouldAddAddressesToNonReferenceFactory(x); } - public boolean shouldAddMembershipLabel (String[] adapterName) - { + + public boolean shouldAddMembershipLabel(String[] adapterName) { return gis.shouldAddMembershipLabel(adapterName); } @@ -564,13 +514,11 @@ public boolean shouldAddMembershipLabel (String[] adapterName) // Interceptor operations // - public String name() - { - return baseMsg; + public String name() { + return baseMsg; } - public void destroy() - { + public void destroy() { } //////////////////////////////////////////////////// @@ -579,83 +527,75 @@ public void destroy() // @InfoMethod - private void sendRequestMembershipLabel( String label ) { } + private void sendRequestMembershipLabel(String label) { + } @InfoMethod - private void sendRequestNoMembershipLabel( ) { } + private void sendRequestNoMembershipLabel() { + } @Folb - public void send_request(ClientRequestInfo ri) - { + public void send_request(ClientRequestInfo ri) { try { - operation( ri.operation() ) ; + operation(ri.operation()); initialize(); // REVISIT - remove this one later? org.omg.CORBA.Object ref = ri.effective_target(); - IOR ior = orb.getIOR(ref,false); - IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) - ior.getProfile().getTaggedProfileTemplate(); - Iterator iterator = iiopProfileTemplate.iteratorById( - ORBConstants.FOLB_MEMBERSHIP_LABEL_TAGGED_COMPONENT_ID); + IOR ior = orb.getIOR(ref, false); + IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate(); + Iterator iterator = iiopProfileTemplate.iteratorById(ORBConstants.FOLB_MEMBERSHIP_LABEL_TAGGED_COMPONENT_ID); if (iterator.hasNext()) { - org.omg.IOP.TaggedComponent membershipLabelTaggedComponent = - ((com.sun.corba.ee.spi.ior.TaggedComponent)iterator.next()) + org.omg.IOP.TaggedComponent membershipLabelTaggedComponent = ((com.sun.corba.ee.spi.ior.TaggedComponent) iterator.next()) .getIOPComponent(orb); byte[] data = membershipLabelTaggedComponent.component_data; sentMemberShipLabel = true; // For test - sendRequestMembershipLabel( new String(data) ); - ServiceContext sc = new ServiceContext( - ORBConstants.FOLB_MEMBERSHIP_LABEL_SERVICE_CONTEXT_ID, - data); + sendRequestMembershipLabel(new String(data)); + ServiceContext sc = new ServiceContext(ORBConstants.FOLB_MEMBERSHIP_LABEL_SERVICE_CONTEXT_ID, data); ri.add_request_service_context(sc, false); } else { sentMemberShipLabel = false; // For test - sendRequestNoMembershipLabel() ; + sendRequestNoMembershipLabel(); } } catch (RuntimeException e) { throw e; } } - public void send_poll(ClientRequestInfo ri) - { + public void send_poll(ClientRequestInfo ri) { } - public void receive_reply(ClientRequestInfo ri) - { + public void receive_reply(ClientRequestInfo ri) { receive_star(".receive_reply", ri); } - public void receive_exception(ClientRequestInfo ri) - { + public void receive_exception(ClientRequestInfo ri) { receive_star(".receive_exception", ri); } - public void receive_other(ClientRequestInfo ri) - { + public void receive_other(ClientRequestInfo ri) { receive_star(".receive_other", ri); } @InfoMethod - private void operation( String op ) { } + private void operation(String op) { + } @InfoMethod - private void noIORUpdate() { } + private void noIORUpdate() { + } @InfoMethod - private void receivedIORUpdateInfo() { } + private void receivedIORUpdateInfo() { + } @Folb - private void receive_star(String point, ClientRequestInfo ri) - { - operation( ri.operation() ) ; + private void receive_star(String point, ClientRequestInfo ri) { + operation(ri.operation()); ServiceContext iorServiceContext = null; try { - iorServiceContext = - ri.get_reply_service_context( - ORBConstants.FOLB_IOR_UPDATE_SERVICE_CONTEXT_ID); + iorServiceContext = ri.get_reply_service_context(ORBConstants.FOLB_IOR_UPDATE_SERVICE_CONTEXT_ID); } catch (BAD_PARAM e) { - wrapper.noIORUpdateServicateContext( e ) ; + wrapper.noIORUpdateServicateContext(e); } if (iorServiceContext == null) { @@ -664,8 +604,8 @@ private void receive_star(String point, ClientRequestInfo ri) return; } - receivedIORUpdateInfo() ; - receivedIORUpdate = true ; + receivedIORUpdateInfo(); + receivedIORUpdate = true; IOR ior = extractIOR(iorServiceContext.context_data); synchronized (lastIORLock) { @@ -678,7 +618,7 @@ private void receive_star(String point, ClientRequestInfo ri) protected void reportLocatedIOR(ClientRequestInfo ri, IOR ior) { // REVISIT - interface; - ((ClientRequestInfoImpl)ri).setLocatedIOR(ior); + ((ClientRequestInfoImpl) ri).setLocatedIOR(ior); } protected IOR extractIOR(byte[] data) { @@ -686,16 +626,16 @@ protected IOR extractIOR(byte[] data) { try { any = codec.decode_value(data, ForwardRequestHelper.type()); } catch (FormatMismatch e) { - reportException( e ) ; + reportException(e); } catch (TypeMismatch e) { - reportException( e ) ; + reportException(e); } // ForwardRequest is used for convenience. - // This code has nothing to do with PortableInterceptor. + // This code has nothing to do with PortableInterceptor. ForwardRequest fr = ForwardRequestHelper.extract(any); org.omg.CORBA.Object ref = fr.forward; - return orb.getIOR(ref,false); + return orb.getIOR(ref, false); } //////////////////////////////////////////////////// @@ -703,8 +643,7 @@ protected IOR extractIOR(byte[] data) { // ORBInitializer // - public void pre_init(ORBInitInfo info) - { + public void pre_init(ORBInitInfo info) { } @Folb @@ -722,17 +661,14 @@ public void post_init(ORBInitInfo info) { // @Folb - public void configure(DataCollector collector, ORB orb) - { + public void configure(DataCollector collector, ORB orb) { this.orb = orb; orb.getORBData().addORBInitializer(this); orb.getORBData().setIIOPPrimaryToContactInfo(this); orb.getORBData().setIORToSocketInfo(this); // So the load-balancer register to get get updates. try { - orb.register_initial_reference( - ORBConstants.FOLB_CLIENT_GROUP_INFO_SERVICE, - this); + orb.register_initial_reference(ORBConstants.FOLB_CLIENT_GROUP_INFO_SERVICE, this); } catch (InvalidName e) { reportException(e); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/GroupInfoServiceBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/GroupInfoServiceBase.java index d187635bb..93f002c91 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/GroupInfoServiceBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/GroupInfoServiceBase.java @@ -30,7 +30,7 @@ import com.sun.corba.ee.spi.folb.ClusterInstanceInfo; -import com.sun.corba.ee.spi.trace.Folb ; +import com.sun.corba.ee.spi.trace.Folb; import com.sun.corba.ee.spi.folb.GroupInfoService; import com.sun.corba.ee.spi.folb.GroupInfoServiceObserver; @@ -40,12 +40,8 @@ * @author Harold Carr */ @Folb -public abstract class GroupInfoServiceBase - extends org.omg.CORBA.LocalObject - implements GroupInfoService -{ - private List observers = - new LinkedList(); +public abstract class GroupInfoServiceBase extends org.omg.CORBA.LocalObject implements GroupInfoService { + private List observers = new LinkedList(); @Folb public boolean addObserver(GroupInfoServiceObserver x) { @@ -53,48 +49,46 @@ public boolean addObserver(GroupInfoServiceObserver x) { } @InfoMethod - private void observerInfo( GroupInfoServiceObserver obs ) { } + private void observerInfo(GroupInfoServiceObserver obs) { + } @Folb public void notifyObservers() { for (GroupInfoServiceObserver observer : observers) { - observerInfo( observer ) ; + observerInfo(observer); observer.membershipChange(); } } @Folb - public List getClusterInstanceInfo( - String[] adapterName) { + public List getClusterInstanceInfo(String[] adapterName) { // Make a copy of the internal data - return new ArrayList( internalClusterInstanceInfo() ) ; + return new ArrayList(internalClusterInstanceInfo()); } - public List getClusterInstanceInfo( - String[] adapterName, List endpoints ) { + public List getClusterInstanceInfo(String[] adapterName, List endpoints) { // Make a copy of the internal data - return new ArrayList( internalClusterInstanceInfo( endpoints ) ) ; + return new ArrayList(internalClusterInstanceInfo(endpoints)); } @Folb - public boolean shouldAddAddressesToNonReferenceFactory( - String[] adapterName) { - return false ; + public boolean shouldAddAddressesToNonReferenceFactory(String[] adapterName) { + return false; } @Folb - public boolean shouldAddMembershipLabel (String[] adapterName) { - return true ; + public boolean shouldAddMembershipLabel(String[] adapterName) { + return true; } public List internalClusterInstanceInfo() { - final List endpoints = new ArrayList() ; - return internalClusterInstanceInfo( endpoints ) ; + final List endpoints = new ArrayList(); + return internalClusterInstanceInfo(endpoints); } - public abstract List internalClusterInstanceInfo( List endpoints ) ; + public abstract List internalClusterInstanceInfo(List endpoints); } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/InitialGroupInfoService.java b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/InitialGroupInfoService.java index 05837a0fd..19864ac3f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/InitialGroupInfoService.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/InitialGroupInfoService.java @@ -19,31 +19,30 @@ package com.sun.corba.ee.impl.folb; +import java.rmi.Remote; +import java.rmi.RemoteException; -import java.rmi.Remote ; -import java.rmi.RemoteException ; +import java.util.List; -import java.util.List ; +import javax.rmi.PortableRemoteObject; -import javax.rmi.PortableRemoteObject ; +import org.omg.CORBA.LocalObject; -import org.omg.CORBA.LocalObject ; - -import org.omg.CosNaming.NamingContext ; -import org.omg.CosNaming.NamingContextHelper ; -import org.omg.CosNaming.NameComponent ; +import org.omg.CosNaming.NamingContext; +import org.omg.CosNaming.NamingContextHelper; +import org.omg.CosNaming.NameComponent; //import com.sun.corba.ee.spi.orb.ORB ; import org.omg.CORBA.ORB; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.spi.folb.GroupInfoService; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.ServantLocator ; +import org.omg.PortableServer.ForwardRequest; +import org.omg.PortableServer.ServantLocator; -import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ; +import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; import com.sun.corba.ee.spi.folb.ClusterInstanceInfo; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; @@ -53,145 +52,117 @@ import org.omg.CORBA.Policy; import javax.rmi.CORBA.Tie; -import org.omg.PortableServer.RequestProcessingPolicyValue ; -import org.omg.PortableServer.ServantRetentionPolicyValue ; +import org.omg.PortableServer.RequestProcessingPolicyValue; +import org.omg.PortableServer.ServantRetentionPolicyValue; import com.sun.corba.ee.spi.trace.Folb; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; - /** - * This class consists of : - * - Remote interface - * - Impl of the Remote interface - * - ServantLocator + * This class consists of : - Remote interface - Impl of the Remote interface - ServantLocator * - * This is needed for getting the information about all the cluster endpoints - * when an appclient/standalone client enables FOLB. - * Without this feature, the client always ends up talking to only the endpoints specified - * as part of the endpoints property. But in reality, the the endpoints property only contains - * around 2 endpoints for bootstrapping purposes. + * This is needed for getting the information about all the cluster endpoints when an appclient/standalone client + * enables FOLB. Without this feature, the client always ends up talking to only the endpoints specified as part of the + * endpoints property. But in reality, the the endpoints property only contains around 2 endpoints for bootstrapping + * purposes. * - * In this design, we register the following remote object with CosNaming - * and then look it up in CosNaming to get hold of the cluster instances - * This is done only once (during the first call to new InitialContext()). + * In this design, we register the following remote object with CosNaming and then look it up in CosNaming to get hold + * of the cluster instances This is done only once (during the first call to new InitialContext()). * * @author Sheetal Vartak */ @Folb public class InitialGroupInfoService { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; public interface InitialGIS extends Remote { - public List getClusterInstanceInfo() - throws RemoteException ; + public List getClusterInstanceInfo() throws RemoteException; } @Folb - public static class InitialGISImpl extends PortableRemoteObject - implements InitialGIS { - + public static class InitialGISImpl extends PortableRemoteObject implements InitialGIS { + private ORB orb; - public InitialGISImpl(ORB orb) throws RemoteException { - super() ; - this.orb = orb; + public InitialGISImpl(ORB orb) throws RemoteException { + super(); + this.orb = orb; } - + @InfoMethod - private void exceptionReport( Exception exc ) { } + private void exceptionReport(Exception exc) { + } @Folb - public List getClusterInstanceInfo() - throws RemoteException { + public List getClusterInstanceInfo() throws RemoteException { try { - GroupInfoService gis = - (GroupInfoService)PortableRemoteObject.narrow( - orb.resolve_initial_references( - ORBConstants.FOLB_SERVER_GROUP_INFO_SERVICE), - GroupInfoService.class); + GroupInfoService gis = (GroupInfoService) PortableRemoteObject + .narrow(orb.resolve_initial_references(ORBConstants.FOLB_SERVER_GROUP_INFO_SERVICE), GroupInfoService.class); return gis.getClusterInstanceInfo(null); } catch (org.omg.CORBA.ORBPackage.InvalidName inv) { - exceptionReport( inv ) ; + exceptionReport(inv); return null; } } } - public static class InitialGISServantLocator extends LocalObject - implements ServantLocator { - private Servant servant ; - private InitialGISImpl impl = null; + public static class InitialGISServantLocator extends LocalObject implements ServantLocator { + private Servant servant; + private InitialGISImpl impl = null; public InitialGISServantLocator(ORB orb) { try { - impl = new InitialGISImpl(orb) ; + impl = new InitialGISImpl(orb); } catch (Exception exc) { - wrapper.couldNotInitializeInitialGIS( exc ) ; + wrapper.couldNotInitializeInitialGIS(exc); } - Tie tie = com.sun.corba.ee.spi.orb.ORB.class.cast( orb ) - .getPresentationManager().getTie() ; - tie.setTarget( impl ) ; - servant = Servant.class.cast( tie ) ; + Tie tie = com.sun.corba.ee.spi.orb.ORB.class.cast(orb).getPresentationManager().getTie(); + tie.setTarget(impl); + servant = Servant.class.cast(tie); } public String getType() { return servant._all_interfaces(null, null)[0]; } - public synchronized Servant preinvoke( byte[] oid, POA adapter, - String operation, CookieHolder the_cookie - ) throws ForwardRequest { - return servant ; + public synchronized Servant preinvoke(byte[] oid, POA adapter, String operation, CookieHolder the_cookie) throws ForwardRequest { + return servant; } - public void postinvoke( byte[] oid, POA adapter, - String operation, Object the_cookie, Servant the_servant ) { + public void postinvoke(byte[] oid, POA adapter, String operation, Object the_cookie, Servant the_servant) { } } - public InitialGroupInfoService(ORB orb) { + public InitialGroupInfoService(ORB orb) { bindName(orb); } + public void bindName(ORB orb) { + try { + POA rootPOA = (POA) orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME); - public void bindName (ORB orb) { - try { - POA rootPOA = (POA)orb.resolve_initial_references( - ORBConstants.ROOT_POA_NAME ) ; - - Policy[] arr = new Policy[] { - rootPOA.create_servant_retention_policy( - ServantRetentionPolicyValue.NON_RETAIN ), - rootPOA.create_request_processing_policy( - RequestProcessingPolicyValue.USE_SERVANT_MANAGER ), - rootPOA.create_lifespan_policy( - LifespanPolicyValue.TRANSIENT ) } ; - - POA poa = rootPOA.create_POA( ORBConstants.INITIAL_GROUP_INFO_SERVICE, - null, arr ) ; - - InitialGISServantLocator servantLocator = - new InitialGISServantLocator(orb); - poa.set_servant_manager(servantLocator) ; - poa.the_POAManager().activate(); - - byte[] id = new byte[]{ 1, 2, 3 } ; - org.omg.CORBA.Object provider = - poa.create_reference_with_id(id, servantLocator.getType()); - - // put object in NameService - org.omg.CORBA.Object objRef = - orb.resolve_initial_references("NameService"); - NamingContext ncRef = NamingContextHelper.narrow(objRef); - NameComponent nc = - new NameComponent(ORBConstants.INITIAL_GROUP_INFO_SERVICE, ""); - NameComponent path[] = {nc}; - ncRef.rebind(path, provider); - } catch (Exception e) { - throw wrapper.bindNameException( e ) ; - } + Policy[] arr = new Policy[] { rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.NON_RETAIN), + rootPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_SERVANT_MANAGER), + rootPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT) }; + + POA poa = rootPOA.create_POA(ORBConstants.INITIAL_GROUP_INFO_SERVICE, null, arr); + + InitialGISServantLocator servantLocator = new InitialGISServantLocator(orb); + poa.set_servant_manager(servantLocator); + poa.the_POAManager().activate(); + + byte[] id = new byte[] { 1, 2, 3 }; + org.omg.CORBA.Object provider = poa.create_reference_with_id(id, servantLocator.getType()); + + // put object in NameService + org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); + NamingContext ncRef = NamingContextHelper.narrow(objRef); + NameComponent nc = new NameComponent(ORBConstants.INITIAL_GROUP_INFO_SERVICE, ""); + NameComponent path[] = { nc }; + ncRef.rebind(path, provider); + } catch (Exception e) { + throw wrapper.bindNameException(e); + } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/ServerGroupManager.java b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/ServerGroupManager.java index 1de27c118..f33a8c165 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/folb/ServerGroupManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/folb/ServerGroupManager.java @@ -58,14 +58,14 @@ import com.sun.corba.ee.spi.folb.ClusterInstanceInfo; import com.sun.corba.ee.spi.folb.SocketInfo; -import com.sun.corba.ee.spi.ior.iiop.ClusterInstanceInfoComponent ; -import com.sun.corba.ee.spi.ior.iiop.IIOPFactories ; +import com.sun.corba.ee.spi.ior.iiop.ClusterInstanceInfoComponent; +import com.sun.corba.ee.spi.ior.iiop.IIOPFactories; import com.sun.corba.ee.spi.legacy.interceptor.ServerRequestInfoExt; import com.sun.corba.ee.spi.oa.rfm.ReferenceFactory; import com.sun.corba.ee.spi.oa.rfm.ReferenceFactoryManager; -import com.sun.corba.ee.spi.orb.ORBConfigurator ; -import com.sun.corba.ee.spi.orb.DataCollector ; +import com.sun.corba.ee.spi.orb.ORBConfigurator; +import com.sun.corba.ee.spi.orb.DataCollector; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.misc.ORBConstants; @@ -76,43 +76,36 @@ * @author Harold Carr */ @Folb -public class ServerGroupManager - extends - org.omg.CORBA.LocalObject - implements - GroupInfoServiceObserver, - IORInterceptor, - ORBConfigurator, - ORBInitializer, - ServerRequestInterceptor -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class ServerGroupManager extends org.omg.CORBA.LocalObject + implements GroupInfoServiceObserver, IORInterceptor, ORBConfigurator, ORBInitializer, ServerRequestInterceptor { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private static final String baseMsg = ServerGroupManager.class.getName(); private static final long serialVersionUID = -3197578705750630503L; private transient ORB orb; private transient GroupInfoService gis; - private transient CSIv2SSLTaggedComponentHandler - csiv2SSLTaggedComponentHandler; + private transient CSIv2SSLTaggedComponentHandler csiv2SSLTaggedComponentHandler; private String membershipLabel; - private enum MembershipChangeState { IDLE, DOING_WORK, RETRY_REQUIRED }; - private MembershipChangeState membershipChangeState = - MembershipChangeState.IDLE; + private enum MembershipChangeState { + IDLE, DOING_WORK, RETRY_REQUIRED + }; + + private MembershipChangeState membershipChangeState = MembershipChangeState.IDLE; private ReferenceFactoryManager referenceFactoryManager; private Codec codec; private boolean initialized = false; // REVISIT - the app server identifies socket "types" with - // these strings. Should be an official API. - private static final String SSL = com.sun.corba.ee.spi.transport.SocketInfo.SSL_PREFIX ; - private static final String CLEAR = com.sun.corba.ee.spi.transport.SocketInfo.IIOP_CLEAR_TEXT ; + // these strings. Should be an official API. + private static final String SSL = com.sun.corba.ee.spi.transport.SocketInfo.SSL_PREFIX; + private static final String CLEAR = com.sun.corba.ee.spi.transport.SocketInfo.IIOP_CLEAR_TEXT; @InfoMethod - private void alreadyInitialized() { } + private void alreadyInitialized() { + } @Folb private void initialize() { @@ -127,38 +120,28 @@ private void initialize() { updateMembershipLabel(); - CodecFactory codecFactory = - CodecFactoryHelper.narrow( - orb.resolve_initial_references( - ORBConstants.CODEC_FACTORY_NAME)); + CodecFactory codecFactory = CodecFactoryHelper.narrow(orb.resolve_initial_references(ORBConstants.CODEC_FACTORY_NAME)); - codec = codecFactory.create_codec( - new Encoding((short)0, (byte)1, (byte)2)); + codec = codecFactory.create_codec(new Encoding((short) 0, (byte) 1, (byte) 2)); - referenceFactoryManager = (ReferenceFactoryManager) - orb.resolve_initial_references( - ORBConstants.REFERENCE_FACTORY_MANAGER); + referenceFactoryManager = (ReferenceFactoryManager) orb.resolve_initial_references(ORBConstants.REFERENCE_FACTORY_MANAGER); - gis = (GroupInfoService) PortableRemoteObject.narrow( - orb.resolve_initial_references( - ORBConstants.FOLB_SERVER_GROUP_INFO_SERVICE), - GroupInfoService.class); + gis = (GroupInfoService) PortableRemoteObject + .narrow(orb.resolve_initial_references(ORBConstants.FOLB_SERVER_GROUP_INFO_SERVICE), GroupInfoService.class); gis.addObserver(this); try { - csiv2SSLTaggedComponentHandler = - (CSIv2SSLTaggedComponentHandler) - orb.resolve_initial_references( - ORBConstants.CSI_V2_SSL_TAGGED_COMPONENT_HANDLER); + csiv2SSLTaggedComponentHandler = (CSIv2SSLTaggedComponentHandler) orb + .resolve_initial_references(ORBConstants.CSI_V2_SSL_TAGGED_COMPONENT_HANDLER); } catch (InvalidName e) { csiv2SSLTaggedComponentHandler = null; - wrapper.noCSIV2Handler( e ) ; + wrapper.noCSIV2Handler(e); } } catch (InvalidName e) { - wrapper.serverGroupManagerException( e ) ; + wrapper.serverGroupManagerException(e); } catch (UnknownEncoding e) { - wrapper.serverGroupManagerException( e ) ; + wrapper.serverGroupManagerException(e); } } @@ -168,7 +151,7 @@ private void initialize() { // public String name() { - return baseMsg; + return baseMsg; } public void destroy() { @@ -180,28 +163,36 @@ public void destroy() { // @InfoMethod - private void adapterName( String[] arr ) { } + private void adapterName(String[] arr) { + } @InfoMethod - private void addingAddresses() { } + private void addingAddresses() { + } @InfoMethod - private void notAddingAddress() { } + private void notAddingAddress() { + } @InfoMethod - private void addingMembershipLabel( String ml ) { } + private void addingMembershipLabel(String ml) { + } @InfoMethod - private void notAddingMembershipLabel( ) { } + private void notAddingMembershipLabel() { + } @InfoMethod - private void skippingEndpoint( SocketInfo si ) {} + private void skippingEndpoint(SocketInfo si) { + } @InfoMethod - private void includingEndpoint( SocketInfo si ) {} + private void includingEndpoint(SocketInfo si) { + } @InfoMethod - private void addingInstanceInfoFor( String name, int weight ) {} + private void addingInstanceInfoFor(String name, int weight) { + } @Folb public void establish_components(IORInfo iorInfo) { @@ -209,16 +200,15 @@ public void establish_components(IORInfo iorInfo) { initialize(); // Only handle ReferenceFactory adapters. - String[] adapterName = - ((com.sun.corba.ee.impl.interceptors.IORInfoImpl)iorInfo) - .getObjectAdapter().getAdapterTemplate().adapter_name(); + String[] adapterName = ((com.sun.corba.ee.impl.interceptors.IORInfoImpl) iorInfo).getObjectAdapter().getAdapterTemplate() + .adapter_name(); - adapterName( adapterName ) ; + adapterName(adapterName); ReferenceFactory rf = referenceFactoryManager.find(adapterName); if (rf == null) { if (gis.shouldAddAddressesToNonReferenceFactory(adapterName)) { - addingAddresses() ; + addingAddresses(); } else { notAddingAddress(); return; @@ -228,13 +218,11 @@ public void establish_components(IORInfo iorInfo) { // Get all addressing information. // both CLEAR and SSL - List info = - gis.getClusterInstanceInfo(adapterName); + List info = gis.getClusterInstanceInfo(adapterName); // Let security handle SSL infomation. if (csiv2SSLTaggedComponentHandler != null) { - TaggedComponent csiv2 = - csiv2SSLTaggedComponentHandler.insert(iorInfo, info); + TaggedComponent csiv2 = csiv2SSLTaggedComponentHandler.insert(iorInfo, info); if (csiv2 != null) { iorInfo.add_ior_component(csiv2); } @@ -242,42 +230,35 @@ public void establish_components(IORInfo iorInfo) { // Handle CLEAR_TEXT addresses. for (ClusterInstanceInfo clusterInstanceInfo : info) { - addingInstanceInfoFor( clusterInstanceInfo.name(), - clusterInstanceInfo.weight() ) ; + addingInstanceInfoFor(clusterInstanceInfo.name(), clusterInstanceInfo.weight()); - List listOfSocketInfo = - new LinkedList(); + List listOfSocketInfo = new LinkedList(); for (SocketInfo sinfo : clusterInstanceInfo.endpoints()) { - if (sinfo.type().startsWith( SSL )) { + if (sinfo.type().startsWith(SSL)) { skippingEndpoint(sinfo); } else { includingEndpoint(sinfo); // Don't want identifier like orb-listener-1 from GlassFish here - final SocketInfo si = new SocketInfo( CLEAR, sinfo.host(), sinfo.port() ) ; - listOfSocketInfo.add( si ) ; + final SocketInfo si = new SocketInfo(CLEAR, sinfo.host(), sinfo.port()); + listOfSocketInfo.add(si); } } - final ClusterInstanceInfo ninfo = new ClusterInstanceInfo( - clusterInstanceInfo.name(), - clusterInstanceInfo.weight(), - listOfSocketInfo ) ; + final ClusterInstanceInfo ninfo = new ClusterInstanceInfo(clusterInstanceInfo.name(), clusterInstanceInfo.weight(), + listOfSocketInfo); - ClusterInstanceInfoComponent comp = - IIOPFactories.makeClusterInstanceInfoComponent( - ninfo ) ; + ClusterInstanceInfoComponent comp = IIOPFactories.makeClusterInstanceInfoComponent(ninfo); - iorInfo.add_ior_component( comp.getIOPComponent(orb) ) ; + iorInfo.add_ior_component(comp.getIOPComponent(orb)); } // Handle membership label. if (gis.shouldAddMembershipLabel(adapterName)) { - TaggedComponent tc = new TaggedComponent( - ORBConstants.FOLB_MEMBERSHIP_LABEL_TAGGED_COMPONENT_ID, - membershipLabel.getBytes()); + TaggedComponent tc = new TaggedComponent(ORBConstants.FOLB_MEMBERSHIP_LABEL_TAGGED_COMPONENT_ID, + membershipLabel.getBytes()); - addingMembershipLabel( membershipLabel ); + addingMembershipLabel(membershipLabel); iorInfo.add_ior_component(tc); } else { notAddingMembershipLabel(); @@ -287,14 +268,13 @@ public void establish_components(IORInfo iorInfo) { } } - public void components_established( IORInfo iorInfo ) { + public void components_established(IORInfo iorInfo) { } - public void adapter_manager_state_changed( int managerId, short state ) { + public void adapter_manager_state_changed(int managerId, short state) { } - public void adapter_state_changed( ObjectReferenceTemplate[] templates, - short state ) { + public void adapter_state_changed(ObjectReferenceTemplate[] templates, short state) { } //////////////////////////////////////////////////// @@ -303,13 +283,16 @@ public void adapter_state_changed( ObjectReferenceTemplate[] templates, // @InfoMethod - private void alreadyChangingMembership() { } + private void alreadyChangingMembership() { + } @InfoMethod - private void loopingForMembershipChange() { } + private void loopingForMembershipChange() { + } @InfoMethod - private void unexpectedStateForMembershipChange() { } + private void unexpectedStateForMembershipChange() { + } @Folb public void membershipChange() { @@ -336,7 +319,7 @@ public void membershipChange() { if (membershipChangeState == MembershipChangeState.RETRY_REQUIRED) { membershipChangeState = MembershipChangeState.DOING_WORK; // One or more notifies arrived while processing - // this notify. Therefore do the restart again. + // this notify. Therefore do the restart again. loop = true; loopingForMembershipChange(); } else if (membershipChangeState == MembershipChangeState.DOING_WORK) { @@ -346,7 +329,7 @@ public void membershipChange() { } } } while (loop); - + } catch (RuntimeException e) { wrapper.serverGroupManagerException(e); @@ -358,31 +341,34 @@ public void membershipChange() { } } - @Folb public class WorkerThread extends Thread { @InfoMethod - private void suspendRFM() { } + private void suspendRFM() { + } @InfoMethod - private void updateMembershipLabelInfo() { } + private void updateMembershipLabelInfo() { + } @InfoMethod - private void restartFactories() { } + private void restartFactories() { + } @InfoMethod - private void resumeRFM() { } + private void resumeRFM() { + } @Folb @Override public void run() { try { - suspendRFM() ; + suspendRFM(); referenceFactoryManager.suspend(); // Requests have drained so update label. // IMPORTANT: do not update label until requests - // have drained. Otherwise responses will compare + // have drained. Otherwise responses will compare // against wrong label. updateMembershipLabelInfo(); updateMembershipLabel(); @@ -397,7 +383,8 @@ public void run() { } @InfoMethod - private void waitingForWorkerTermination() { } + private void waitingForWorkerTermination() { + } @Folb private void restartFactories() { @@ -405,7 +392,7 @@ private void restartFactories() { // REVISIT // // restart gets exception since a remote call is coming - // in on a non-ReferenceFactory POA. The ORB does not + // in on a non-ReferenceFactory POA. The ORB does not // discriminate the granularity of restart. // See ORBImpl.isDuringDispatch // @@ -414,48 +401,49 @@ private void restartFactories() { // Note: this is only a problem in the test because // the test client sends an "add" message that // is serviced by a server worker thread that calls - // membershipChange. This method calls restartFactories + // membershipChange. This method calls restartFactories // that calls destory POA that calls isDuringDispatch. // isDuringDispatch uses a thread local to determine - // it is a dispatch. Using another thread fools + // it is a dispatch. Using another thread fools // isDuringDispatch into letting this chain proceed. // - + final ReferenceFactoryManager rfm = referenceFactoryManager; - Thread worker = new WorkerThread() ; - + Thread worker = new WorkerThread(); + worker.start(); - + // Make sure the worker terminates before we continue waitingForWorkerTermination(); boolean tryAgain; do { tryAgain = false; - try { - worker.join(); - } catch (InterruptedException e) { - Thread.interrupted() ; - tryAgain = true; + try { + worker.join(); + } catch (InterruptedException e) { + Thread.interrupted(); + tryAgain = true; } } while (tryAgain); } @InfoMethod - private void newMembershipLabel( String ml ) { } + private void newMembershipLabel(String ml) { + } @Folb private void updateMembershipLabel() { UID uid = new UID(); String hostAddress = null; try { - // REVISIT + // REVISIT // name could match GroupInfoService's idea of instance id/name. // Not necessary but easier to debug. hostAddress = InetAddress.getLocalHost().getHostAddress(); membershipLabel = hostAddress + ":::" + uid; - newMembershipLabel( membershipLabel ); + newMembershipLabel(membershipLabel); } catch (UnknownHostException e) { wrapper.serverGroupManagerException(e); } @@ -467,83 +455,78 @@ private void updateMembershipLabel() { // @Folb - public void receive_request_service_contexts(ServerRequestInfo ri) - { + public void receive_request_service_contexts(ServerRequestInfo ri) { initialize(); } @Folb - public void receive_request(ServerRequestInfo ri) - { + public void receive_request(ServerRequestInfo ri) { initialize(); } - public void send_reply(ServerRequestInfo ri) - { + public void send_reply(ServerRequestInfo ri) { send_star(".send_reply", ri); } - public void send_exception(ServerRequestInfo ri) - { + public void send_exception(ServerRequestInfo ri) { send_star(".send_exception", ri); } - public void send_other(ServerRequestInfo ri) - { + public void send_other(ServerRequestInfo ri) { send_star(".send_other", ri); } @InfoMethod - private void rfmIsHolding() { } + private void rfmIsHolding() { + } + + @InfoMethod + private void notManagedByReferenceFactory(String[] adapterName) { + } + + @InfoMethod + private void membershipLabelsEqual() { + } + + @InfoMethod + private void membershipLabelsNotEqual() { + } @InfoMethod - private void notManagedByReferenceFactory( String[] adapterName ) { } - - @InfoMethod - private void membershipLabelsEqual() { } - - @InfoMethod - private void membershipLabelsNotEqual() { } - - @InfoMethod - private void membershipLabelsNotPresent() { } - + private void membershipLabelsNotPresent() { + } + @InfoMethod - private void sendingUpdatedIOR( String[] adapterName ) { } + private void sendingUpdatedIOR(String[] adapterName) { + } /** - * If the request membership label is out-of-date or missing - * then return an updated IOR. + * If the request membership label is out-of-date or missing then return an updated IOR. */ @Folb - private void send_star(String point, ServerRequestInfo ri) - { + private void send_star(String point, ServerRequestInfo ri) { String[] adapterName = null; try { adapterName = ri.adapter_name(); - if (referenceFactoryManager.getState() == - ReferenceFactoryManager.RFMState.SUSPENDED) { + if (referenceFactoryManager.getState() == ReferenceFactoryManager.RFMState.SUSPENDED) { rfmIsHolding(); return; } - ReferenceFactory referenceFactory = - referenceFactoryManager.find(adapterName); + ReferenceFactory referenceFactory = referenceFactoryManager.find(adapterName); // Only handle RefenceFactory adapters. - if (referenceFactory == null && - !((ServerRequestInfoExt)ri).isNameService()) { - notManagedByReferenceFactory( adapterName ) ; + if (referenceFactory == null && !((ServerRequestInfoExt) ri).isNameService()) { + notManagedByReferenceFactory(adapterName); return; } // Handle membership label from request. String requestMembershipLabel = null; try { - ServiceContext sc = ri.get_request_service_context( - ORBConstants.FOLB_MEMBERSHIP_LABEL_SERVICE_CONTEXT_ID); + ServiceContext sc = ri.get_request_service_context(ORBConstants.FOLB_MEMBERSHIP_LABEL_SERVICE_CONTEXT_ID); // REVISIT - internationalization if (sc != null) { byte[] data = sc.context_data; @@ -557,7 +540,7 @@ private void send_star(String point, ServerRequestInfo ri) } } catch (BAD_PARAM e) { membershipLabelsNotPresent(); - // REVISIT: CHECK: if not our ORB then return. -- + // REVISIT: CHECK: if not our ORB then return. -- } // Send IOR UPDATE @@ -565,11 +548,10 @@ private void send_star(String point, ServerRequestInfo ri) // At this point either the labels do not match // or our ORB has sent a request without a label (e.g., bootstrap). // Therefore send an updated IOR. - sendingUpdatedIOR( adapterName ) ; - + sendingUpdatedIOR(adapterName); + byte[] objectId = ri.object_id(); - org.omg.CORBA.Object ref = - referenceFactory.createReference(objectId); + org.omg.CORBA.Object ref = referenceFactory.createReference(objectId); Any any = orb.create_any(); // ForwardRequest is used for convenience. // This code has nothing to do with PortableInterceptor. @@ -581,8 +563,7 @@ private void send_star(String point, ServerRequestInfo ri) } catch (InvalidTypeForEncoding e) { wrapper.serverGroupManagerException(e); } - ServiceContext sc = new ServiceContext( - ORBConstants.FOLB_IOR_UPDATE_SERVICE_CONTEXT_ID, data); + ServiceContext sc = new ServiceContext(ORBConstants.FOLB_IOR_UPDATE_SERVICE_CONTEXT_ID, data); ri.add_reply_service_context(sc, false); } catch (RuntimeException e) { wrapper.serverGroupManagerException(e); @@ -594,8 +575,7 @@ private void send_star(String point, ServerRequestInfo ri) // ORBInitializer // - public void pre_init(ORBInitInfo info) - { + public void pre_init(ORBInitInfo info) { } @Folb @@ -614,8 +594,7 @@ public void post_init(ORBInitInfo info) { // @Folb - public void configure(DataCollector collector, ORB orb) - { + public void configure(DataCollector collector, ORB orb) { this.orb = orb; // Setup for IOR and ServerRequest Interceptors diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/CDREncapsCodec.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/CDREncapsCodec.java index 1532697fa..4e57b1c1d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/CDREncapsCodec.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/CDREncapsCodec.java @@ -41,114 +41,93 @@ import org.omg.IOP.CodecPackage.TypeMismatch; /** - * CDREncapsCodec is an implementation of Codec, as described - * in orbos/99-12-02, that supports CDR encapsulation version 1.0, 1.1, and - * 1.2. + * CDREncapsCodec is an implementation of Codec, as described in orbos/99-12-02, that supports CDR encapsulation version + * 1.0, 1.1, and 1.2. */ -public final class CDREncapsCodec - extends org.omg.CORBA.LocalObject - implements Codec -{ +public final class CDREncapsCodec extends org.omg.CORBA.LocalObject implements Codec { // The ORB that created the factory this codec was created from private transient ORB orb; - static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // The GIOP version we are encoding for private transient GIOPVersion giopVersion; /* ******************************************************************* - * NOTE: CDREncapsCodec must remain immutable! This is so that we - * can pre-create CDREncapsCodecs for each version of GIOP in - * CodecFactoryImpl. + * NOTE: CDREncapsCodec must remain immutable! This is so that we can pre-create CDREncapsCodecs for each version of + * GIOP in CodecFactoryImpl. *******************************************************************/ /** - * Creates a new codec implementation. Uses the given ORB to create - * CDRInputStreams when necessary. + * Creates a new codec implementation. Uses the given ORB to create CDRInputStreams when necessary. * * @param orb The ORB to use to create a CDRInputStream or CDROutputStream * @param major The major version of GIOP we are encoding for * @param minor The minor version of GIOP we are encoding for */ - public CDREncapsCodec( ORB orb, int major, int minor ) { + public CDREncapsCodec(ORB orb, int major, int minor) { this.orb = orb; - giopVersion = GIOPVersion.getInstance( (byte)major, (byte)minor ); + giopVersion = GIOPVersion.getInstance((byte) major, (byte) minor); } /** - * Convert the given any into a CDR encapsulated octet sequence + * Convert the given any into a CDR encapsulated octet sequence */ - public byte[] encode( Any data ) - throws InvalidTypeForEncoding - { - if ( data == null ) - throw wrapper.nullParamNoComplete() ; - return encodeImpl( data, true ); + public byte[] encode(Any data) throws InvalidTypeForEncoding { + if (data == null) + throw wrapper.nullParamNoComplete(); + return encodeImpl(data, true); } /** - * Decode the given octet sequence into an any based on a CDR - * encapsulated octet sequence. + * Decode the given octet sequence into an any based on a CDR encapsulated octet sequence. */ - public Any decode ( byte[] data ) - throws FormatMismatch - { - if( data == null ) - throw wrapper.nullParamNoComplete() ; - return decodeImpl( data, null ); + public Any decode(byte[] data) throws FormatMismatch { + if (data == null) + throw wrapper.nullParamNoComplete(); + return decodeImpl(data, null); } /** - * Convert the given any into a CDR encapsulated octet sequence. Only - * the data is stored. The type code is not. + * Convert the given any into a CDR encapsulated octet sequence. Only the data is stored. The type code is not. */ - public byte[] encode_value( Any data ) - throws InvalidTypeForEncoding - { - if( data == null ) - throw wrapper.nullParamNoComplete() ; - return encodeImpl( data, false ); + public byte[] encode_value(Any data) throws InvalidTypeForEncoding { + if (data == null) + throw wrapper.nullParamNoComplete(); + return encodeImpl(data, false); } /** - * Decode the given octet sequence into an any based on a CDR - * encapsulated octet sequence. The type code is expected not to appear - * in the octet sequence, and the given type code is used instead. + * Decode the given octet sequence into an any based on a CDR encapsulated octet sequence. The type code is expected not + * to appear in the octet sequence, and the given type code is used instead. */ - public Any decode_value( byte[] data, TypeCode tc ) - throws FormatMismatch, TypeMismatch - { - if( data == null ) - throw wrapper.nullParamNoComplete() ; - if( tc == null ) - throw wrapper.nullParamNoComplete() ; - return decodeImpl( data, tc ); + public Any decode_value(byte[] data, TypeCode tc) throws FormatMismatch, TypeMismatch { + if (data == null) + throw wrapper.nullParamNoComplete(); + if (tc == null) + throw wrapper.nullParamNoComplete(); + return decodeImpl(data, tc); } /** - * Convert the given any into a CDR encapsulated octet sequence. - * If sendTypeCode is true, the type code is sent with the message, as in - * a standard encapsulation. If it is false, only the data is sent. - * Either way, the endian type is sent as the first part of the message. + * Convert the given any into a CDR encapsulated octet sequence. If sendTypeCode is true, the type code is sent with the + * message, as in a standard encapsulation. If it is false, only the data is sent. Either way, the endian type is sent + * as the first part of the message. */ - private byte[] encodeImpl( Any data, boolean sendTypeCode ) - throws InvalidTypeForEncoding - { - if( data == null ) - throw wrapper.nullParamNoComplete() ; + private byte[] encodeImpl(Any data, boolean sendTypeCode) throws InvalidTypeForEncoding { + if (data == null) + throw wrapper.nullParamNoComplete(); // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in - // the body of this method. This is due to the fact that CDR*Stream - // will never throw an exception if the encoding is invalid. To + // the body of this method. This is due to the fact that CDR*Stream + // will never throw an exception if the encoding is invalid. To // fix this, the CDROutputStream must know the version of GIOP it // is encoding for and it must check to ensure that, for example, // wstring cannot be encoded in GIOP 1.0. // // As part of the GIOP 1.2 work, the CDRInput and OutputStream will - // be versioned. This can be handled once this work is complete. + // be versioned. This can be handled once this work is complete. byte[] retValue; @@ -157,8 +136,7 @@ private byte[] encodeImpl( Any data, boolean sendTypeCode ) // local state, and pop it at the end of this method. boolean pop = false; - if (ORBUtility.getEncodingVersion() != - ORBConstants.CDR_ENC_VERSION) { + if (ORBUtility.getEncodingVersion() != ORBConstants.CDR_ENC_VERSION) { ORBUtility.pushEncVersionToThreadLocalState(ORBConstants.CDR_ENC_VERSION); pop = true; } @@ -166,20 +144,18 @@ private byte[] encodeImpl( Any data, boolean sendTypeCode ) try { // Create output stream with default endianness. - EncapsOutputStream cdrOut = - OutputStreamFactory.newEncapsOutputStream((com.sun.corba.ee.spi.orb.ORB)orb, - giopVersion); + EncapsOutputStream cdrOut = OutputStreamFactory.newEncapsOutputStream((com.sun.corba.ee.spi.orb.ORB) orb, giopVersion); // This is an encapsulation, so put out the endian: cdrOut.putEndian(); // Sometimes encode type code: - if( sendTypeCode ) { - cdrOut.write_TypeCode( data.type() ); + if (sendTypeCode) { + cdrOut.write_TypeCode(data.type()); } // Encode value and return. - data.write_value( cdrOut ); + data.write_value(cdrOut); retValue = cdrOut.toByteArray(); @@ -188,27 +164,23 @@ private byte[] encodeImpl( Any data, boolean sendTypeCode ) ORBUtility.popEncVersionFromThreadLocalState(); } } - + return retValue; } /** - * Decode the given octet sequence into an any based on a CDR - * encapsulated octet sequence. If the type code is null, it is - * expected to appear in the octet sequence. Otherwise, the given - * type code is used. + * Decode the given octet sequence into an any based on a CDR encapsulated octet sequence. If the type code is null, it + * is expected to appear in the octet sequence. Otherwise, the given type code is used. */ - private Any decodeImpl( byte[] data, TypeCode tc ) - throws FormatMismatch - { - if( data == null ) - throw wrapper.nullParamNoComplete() ; + private Any decodeImpl(byte[] data, TypeCode tc) throws FormatMismatch { + if (data == null) + throw wrapper.nullParamNoComplete(); - AnyImpl any = null; // return value + AnyImpl any = null; // return value // _REVISIT_ Currently there is no way for us to distinguish between // a FormatMismatch and a TypeMismatch because we cannot get this - // information from the CDRInputStream. If a RuntimeException occurs, + // information from the CDRInputStream. If a RuntimeException occurs, // it is turned into a FormatMismatch exception. // Always use CDR encoding for codec streams. If the thread local @@ -216,30 +188,28 @@ private Any decodeImpl( byte[] data, TypeCode tc ) // local state, and pop it at the end of this method. boolean pop = false; - if (ORBUtility.getEncodingVersion() != - ORBConstants.CDR_ENC_VERSION) { + if (ORBUtility.getEncodingVersion() != ORBConstants.CDR_ENC_VERSION) { ORBUtility.pushEncVersionToThreadLocalState(ORBConstants.CDR_ENC_VERSION); pop = true; } try { - EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data, - data.length, giopVersion ); + EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream(orb, data, data.length, giopVersion); cdrIn.consumeEndian(); // If type code not specified, read it from octet stream: - if( tc == null ) { + if (tc == null) { tc = cdrIn.read_TypeCode(); } // Create a new Any object: - any = new AnyImpl( (com.sun.corba.ee.spi.orb.ORB)orb ); - any.read_value( cdrIn, tc ); + any = new AnyImpl((com.sun.corba.ee.spi.orb.ORB) orb); + any.read_value(cdrIn, tc); - } catch( RuntimeException e ) { - // See above note. + } catch (RuntimeException e) { + // See above note. throw new FormatMismatch(); } finally { if (pop) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ClientRequestInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ClientRequestInfoImpl.java index 20c82a635..4b4215aa5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ClientRequestInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ClientRequestInfoImpl.java @@ -19,8 +19,8 @@ package com.sun.corba.ee.impl.interceptors; -import java.util.Map ; -import java.util.HashMap ; +import java.util.Map; +import java.util.HashMap; import org.omg.CORBA.Any; import org.omg.CORBA.BAD_INV_ORDER; @@ -48,7 +48,6 @@ import org.omg.PortableInterceptor.TRANSPORT_RETRY; import org.omg.PortableInterceptor.USER_EXCEPTION; - import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; import com.sun.corba.ee.spi.orb.ORB; @@ -65,19 +64,15 @@ import org.glassfish.pfl.tf.spi.annotation.InfoMethod; /** - * Implementation of the ClientRequestInfo interface as specified in - * orbos/99-12-02 section 5.4.2. + * Implementation of the ClientRequestInfo interface as specified in orbos/99-12-02 section 5.4.2. */ @TraceInterceptor -public final class ClientRequestInfoImpl - extends RequestInfoImpl - implements ClientRequestInfo -{ +public final class ClientRequestInfoImpl extends RequestInfoImpl implements ClientRequestInfo { // The available constants for startingPointCall static final int CALL_SEND_REQUEST = 0; static final int CALL_SEND_POLL = 1; - + // The available constants for endingPointCall static final int CALL_RECEIVE_REPLY = 0; static final int CALL_RECEIVE_EXCEPTION = 1; @@ -88,14 +83,14 @@ public final class ClientRequestInfoImpl // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); // ////////////////////////////////////////////////////////////////////// - - // The current retry request status. True if this request is being + + // The current retry request status. True if this request is being // retried and this info object is to be reused, or false otherwise. private RetryType retryRequest; - - // The number of times this info object has been (re)used. This is + + // The number of times this info object has been (re)used. This is // incremented every time a request is retried, and decremented every - // time a request is complete. When this reaches zero, the info object + // time a request is complete. When this reaches zero, the info object // is popped from the ClientRequestInfoImpl ThreadLocal stack in the ORB. private int entryCount = 0; @@ -121,21 +116,19 @@ public final class ClientRequestInfoImpl private TaggedProfile cachedEffectiveProfile; // key = Integer, value = IOP.ServiceContext. private Map cachedRequestServiceContexts; - private Map cachedReplyServiceContexts; - private Map cachedEffectiveComponents; - + private Map cachedReplyServiceContexts; + private Map cachedEffectiveComponents; private boolean piCurrentPushed; - + ////////////////////////////////////////////////////////////////////// // // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); // ////////////////////////////////////////////////////////////////////// - + /** - * Reset the info object so that it can be reused for a retry, - * for example. + * Reset the info object so that it can be reused for a retry, for example. */ @TraceInterceptor @Override @@ -174,112 +167,97 @@ void reset() { startingPointCall = CALL_SEND_REQUEST; endingPointCall = CALL_RECEIVE_REPLY; } - + /* ********************************************************************** * Access protection **********************************************************************/ - - // Method IDs for all methods in ClientRequestInfo. This allows for a + + // Method IDs for all methods in ClientRequestInfo. This allows for a // convenient O(1) lookup for checkAccess(). - private static final int MID_TARGET = MID_RI_LAST + 1; - private static final int MID_EFFECTIVE_TARGET = MID_RI_LAST + 2; - private static final int MID_EFFECTIVE_PROFILE = MID_RI_LAST + 3; - private static final int MID_RECEIVED_EXCEPTION = MID_RI_LAST + 4; - private static final int MID_RECEIVED_EXCEPTION_ID = MID_RI_LAST + 5; - private static final int MID_GET_EFFECTIVE_COMPONENT = MID_RI_LAST + 6; - private static final int MID_GET_EFFECTIVE_COMPONENTS = MID_RI_LAST + 7; - private static final int MID_GET_REQUEST_POLICY = MID_RI_LAST + 8; + private static final int MID_TARGET = MID_RI_LAST + 1; + private static final int MID_EFFECTIVE_TARGET = MID_RI_LAST + 2; + private static final int MID_EFFECTIVE_PROFILE = MID_RI_LAST + 3; + private static final int MID_RECEIVED_EXCEPTION = MID_RI_LAST + 4; + private static final int MID_RECEIVED_EXCEPTION_ID = MID_RI_LAST + 5; + private static final int MID_GET_EFFECTIVE_COMPONENT = MID_RI_LAST + 6; + private static final int MID_GET_EFFECTIVE_COMPONENTS = MID_RI_LAST + 7; + private static final int MID_GET_REQUEST_POLICY = MID_RI_LAST + 8; private static final int MID_ADD_REQUEST_SERVICE_CONTEXT = MID_RI_LAST + 9; - + // ClientRequestInfo validity table (see ptc/00-08-06 table 21-1). // Note: These must be in the same order as specified in contants. private static final boolean validCall[][] = { - // LEGEND: - // s_req = send_request r_rep = receive_reply - // s_pol = send_poll r_exc = receive_exception - // r_oth = receive_other - // - // A true value indicates call is valid at specified point. - // A false value indicates the call is invalid. - // - // - // NOTE: If the order or number of columns change, update - // checkAccess() accordingly. - // - // { s_req, s_pol, r_rep, r_exc, r_oth } - // RequestInfo methods: - /*request_id*/ { true , true , true , true , true }, - /*operation*/ { true , true , true , true , true }, - /*arguments*/ { true , false, true , false, false }, - /*exceptions*/ { true , false, true , true , true }, - /*contexts*/ { true , false, true , true , true }, - /*operation_context*/ { true , false, true , true , true }, - /*result*/ { false, false, true , false, false }, - /*response_expected*/ { true , true , true , true , true }, - /*sync_scope*/ { true , false, true , true , true }, - /*reply_status*/ { false, false, true , true , true }, - /*forward_reference*/ { false, false, false, false, true }, - /*get_slot*/ { true , true , true , true , true }, - /*get_request_service_context*/ { true , false, true , true , true }, - /*get_reply_service_context*/ { false, false, true , true , true }, - // - // ClientRequestInfo methods:: - /*target*/ { true , true , true , true , true }, - /*effective_target*/ { true , true , true , true , true }, - /*effective_profile*/ { true , true , true , true , true }, - /*received_exception*/ { false, false, false, true , false }, - /*received_exception_id*/ { false, false, false, true , false }, - /*get_effective_component*/ { true , false, true , true , true }, - /*get_effective_components*/ { true , false, true , true , true }, - /*get_request_policy*/ { true , false, true , true , true }, - /*add_request_service_context*/ { true , false, false, false, false } - }; - + // LEGEND: + // s_req = send_request r_rep = receive_reply + // s_pol = send_poll r_exc = receive_exception + // r_oth = receive_other + // + // A true value indicates call is valid at specified point. + // A false value indicates the call is invalid. + // + // + // NOTE: If the order or number of columns change, update + // checkAccess() accordingly. + // + // { s_req, s_pol, r_rep, r_exc, r_oth } + // RequestInfo methods: + /* request_id */ { true, true, true, true, true }, /* operation */ { true, true, true, true, true }, + /* arguments */ { true, false, true, false, false }, /* exceptions */ { true, false, true, true, true }, + /* contexts */ { true, false, true, true, true }, /* operation_context */ { true, false, true, true, true }, + /* result */ { false, false, true, false, false }, /* response_expected */ { true, true, true, true, true }, + /* sync_scope */ { true, false, true, true, true }, /* reply_status */ { false, false, true, true, true }, + /* forward_reference */ { false, false, false, false, true }, /* get_slot */ { true, true, true, true, true }, + /* get_request_service_context */ { true, false, true, true, true }, + /* get_reply_service_context */ { false, false, true, true, true }, + // + // ClientRequestInfo methods:: + /* target */ { true, true, true, true, true }, /* effective_target */ { true, true, true, true, true }, + /* effective_profile */ { true, true, true, true, true }, /* received_exception */ { false, false, false, true, false }, + /* received_exception_id */ { false, false, false, true, false }, + /* get_effective_component */ { true, false, true, true, true }, + /* get_effective_components */ { true, false, true, true, true }, /* get_request_policy */ { true, false, true, true, true }, + /* add_request_service_context */ { true, false, false, false, false } }; /* ********************************************************************** * Public ClientRequestInfo interfaces **********************************************************************/ - + /** - * Creates a new ClientRequestInfo implementation. - * The constructor is package scope since no other package need create + * Creates a new ClientRequestInfo implementation. The constructor is package scope since no other package need create * an instance of this class. + * * @param myORB ORB to use */ - protected ClientRequestInfoImpl( ORB myORB ) { - super( myORB ); + protected ClientRequestInfoImpl(ORB myORB) { + super(myORB); startingPointCall = CALL_SEND_REQUEST; endingPointCall = CALL_RECEIVE_REPLY; } - + /** * The object which the client called to perform the operation. */ @TraceInterceptor - public org.omg.CORBA.Object target (){ + public org.omg.CORBA.Object target() { // access is currently valid for all states: - //checkAccess( MID_TARGET ); + // checkAccess( MID_TARGET ); if (messageMediator != null && cachedTargetObject == null) { - ContactInfo corbaContactInfo = (ContactInfo) - messageMediator.getContactInfo(); - cachedTargetObject = - iorToObject(corbaContactInfo.getTargetIOR()); + ContactInfo corbaContactInfo = (ContactInfo) messageMediator.getContactInfo(); + cachedTargetObject = iorToObject(corbaContactInfo.getTargetIOR()); } return cachedTargetObject; } - + /** - * The actual object on which the operation will be invoked. If the - * reply_status is LOCATION_FORWARD, then on subsequent requests, - * effective_target will contain the forwarded IOR while target will - * remain unchanged. + * The actual object on which the operation will be invoked. If the reply_status is LOCATION_FORWARD, then on subsequent + * requests, effective_target will contain the forwarded IOR while target will remain unchanged. */ @TraceInterceptor public org.omg.CORBA.Object effective_target() { // access is currently valid for all states: - //checkAccess( MID_EFFECTIVE_TARGET ); + // checkAccess( MID_EFFECTIVE_TARGET ); // Note: This is not necessarily the same as locatedIOR. // Reason: See the way we handle COMM_FAILURES in @@ -288,27 +266,23 @@ public org.omg.CORBA.Object effective_target() { if (messageMediator != null && cachedEffectiveTargetObject == null) { ContactInfo corbaContactInfo = messageMediator.getContactInfo(); // REVISIT - get through chain like getLocatedIOR helper below. - cachedEffectiveTargetObject = - iorToObject(corbaContactInfo.getEffectiveTargetIOR()); + cachedEffectiveTargetObject = iorToObject(corbaContactInfo.getEffectiveTargetIOR()); } return cachedEffectiveTargetObject; } - + /** - * The profile that will be used to send the request. If a location - * forward has occurred for this operation's object and that object's - * profile change accordingly, then this profile will be that located - * profile. + * The profile that will be used to send the request. If a location forward has occurred for this operation's object and + * that object's profile change accordingly, then this profile will be that located profile. */ @TraceInterceptor - public TaggedProfile effective_profile (){ + public TaggedProfile effective_profile() { // access is currently valid for all states: - //checkAccess( MID_EFFECTIVE_PROFILE ); + // checkAccess( MID_EFFECTIVE_PROFILE ); - if(messageMediator != null && cachedEffectiveProfile == null ) { + if (messageMediator != null && cachedEffectiveProfile == null) { ContactInfo corbaContactInfo = messageMediator.getContactInfo(); - cachedEffectiveProfile = - corbaContactInfo.getEffectiveProfile().getIOPProfile(); + cachedEffectiveProfile = corbaContactInfo.getEffectiveProfile().getIOPProfile(); } // Good citizen: In the interest of efficiency, we assume interceptors @@ -317,16 +291,16 @@ public TaggedProfile effective_profile (){ return cachedEffectiveProfile; } - + /** * Contains the exception to be returned to the client. */ @TraceInterceptor - public Any received_exception (){ - checkAccess( MID_RECEIVED_EXCEPTION ); + public Any received_exception() { + checkAccess(MID_RECEIVED_EXCEPTION); - if( cachedReceivedException == null ) { - cachedReceivedException = exceptionToAny( exception ); + if (cachedReceivedException == null) { + cachedReceivedException = exceptionToAny(exception); } // Good citizen: In the interest of efficiency, we assume interceptors @@ -335,143 +309,129 @@ public Any received_exception (){ return cachedReceivedException; } - + /** * The CORBA::RepositoryId of the exception to be returned to the client. */ @TraceInterceptor - public String received_exception_id (){ - checkAccess( MID_RECEIVED_EXCEPTION_ID ); + public String received_exception_id() { + checkAccess(MID_RECEIVED_EXCEPTION_ID); - if( cachedReceivedExceptionId == null ) { + if (cachedReceivedExceptionId == null) { String result = null; - if( exception == null ) { + if (exception == null) { // Note: exception should never be null here since we will // throw a BAD_INV_ORDER if this is not called from // receive_exception. - throw wrapper.exceptionWasNull() ; - } else if( exception instanceof SystemException ) { + throw wrapper.exceptionWasNull(); + } else if (exception instanceof SystemException) { String name = exception.getClass().getName(); result = ORBUtility.repositoryIdOf(name); - } else if( exception instanceof ApplicationException ) { - result = ((ApplicationException)exception).getId(); + } else if (exception instanceof ApplicationException) { + result = ((ApplicationException) exception).getId(); } // _REVISIT_ We need to be able to handle a UserException in the - // DII case. How do we extract the ID from a UserException? + // DII case. How do we extract the ID from a UserException? cachedReceivedExceptionId = result; } return cachedReceivedExceptionId; } - + /** - * Returns the IOP::TaggedComponent with the given ID from the profile - * selected for this request. IF there is more than one component for a - * given component ID, it is undefined which component this operation - * returns (get_effective_component should be called instead). + * Returns the IOP::TaggedComponent with the given ID from the profile selected for this request. IF there is more than + * one component for a given component ID, it is undefined which component this operation returns + * (get_effective_component should be called instead). */ @TraceInterceptor - public TaggedComponent get_effective_component (int id){ - checkAccess( MID_GET_EFFECTIVE_COMPONENT ); - - TaggedComponent[] comps = get_effective_components( id ) ; + public TaggedComponent get_effective_component(int id) { + checkAccess(MID_GET_EFFECTIVE_COMPONENT); + + TaggedComponent[] comps = get_effective_components(id); if ((comps != null) && (comps.length > 0)) { return comps[0]; } else { - return null ; + return null; } } - + /** - * Returns all the tagged components with the given ID from the profile - * selected for this request. + * Returns all the tagged components with the given ID from the profile selected for this request. */ @TraceInterceptor - public TaggedComponent[] get_effective_components (int id){ - checkAccess( MID_GET_EFFECTIVE_COMPONENTS ); + public TaggedComponent[] get_effective_components(int id) { + checkAccess(MID_GET_EFFECTIVE_COMPONENTS); TaggedComponent[] result = null; boolean justCreatedCache = false; - if( cachedEffectiveComponents == null ) { - cachedEffectiveComponents = new HashMap(); + if (cachedEffectiveComponents == null) { + cachedEffectiveComponents = new HashMap(); justCreatedCache = true; } else { // Look in cache: - result = cachedEffectiveComponents.get( id ); + result = cachedEffectiveComponents.get(id); } // null could mean we cached null or not in cache. - if( (messageMediator != null) && (result == null) && - (justCreatedCache || - !cachedEffectiveComponents.containsKey( id ) ) ) - { - // Not in cache. Get it from the profile: + if ((messageMediator != null) && (result == null) && (justCreatedCache || !cachedEffectiveComponents.containsKey(id))) { + // Not in cache. Get it from the profile: ContactInfo corbaContactInfo = messageMediator.getContactInfo(); - IIOPProfileTemplate ptemp = - (IIOPProfileTemplate)corbaContactInfo.getEffectiveProfile(). - getTaggedProfileTemplate(); + IIOPProfileTemplate ptemp = (IIOPProfileTemplate) corbaContactInfo.getEffectiveProfile().getTaggedProfileTemplate(); result = ptemp.getIOPComponents(myORB, id); - cachedEffectiveComponents.put( id, result ); + cachedEffectiveComponents.put(id, result); } // As per ptc/00-08-06, section 21.3.13.6., If not found, raise // BAD_PARAM with minor code INVALID_COMPONENT_ID. - if( (result == null) || (result.length == 0) ) { + if ((result == null) || (result.length == 0)) { if (!myORB.getORBData().isAppServerMode()) { - /** Issue 15931: the new wrapper mechanism is currently - * a lot slower than the old, and this is taking too - * long. We shouldn't indicate a normal condition with - * an exception in any case, but that's a flaw in the - * standard. So, if we are running in the app server, - * don't do this: just return null. + /** + * Issue 15931: the new wrapper mechanism is currently a lot slower than the old, and this is taking too long. We + * shouldn't indicate a normal condition with an exception in any case, but that's a flaw in the standard. So, if we are + * running in the app server, don't do this: just return null. */ - throw stdWrapper.invalidComponentId( id ) ; + throw stdWrapper.invalidComponentId(id); } } // Good citizen: In the interest of efficiency, we will assume // interceptors will not modify the returned TaggedCompoent[], or - // the TaggedComponents inside of it. Otherwise, we would need to + // the TaggedComponents inside of it. Otherwise, we would need to // clone the array and make a deep copy of its contents. return result; } - + /** * Returns the given policy in effect for this operation. */ @TraceInterceptor - public Policy get_request_policy (int type){ - checkAccess( MID_GET_REQUEST_POLICY ); + public Policy get_request_policy(int type) { + checkAccess(MID_GET_REQUEST_POLICY); // _REVISIT_ Our ORB is not policy-based at this time. - throw wrapper.piOrbNotPolicyBased() ; + throw wrapper.piOrbNotPolicyBased(); } - + /** * Allows interceptors to add service contexts to the request. *

- * There is no declaration of the order of the service contexts. They - * may or may not appear in the order they are added. + * There is no declaration of the order of the service contexts. They may or may not appear in the order they are added. */ @TraceInterceptor - public void add_request_service_context (ServiceContext service_context, - boolean replace) { + public void add_request_service_context(ServiceContext service_context, boolean replace) { - checkAccess( MID_ADD_REQUEST_SERVICE_CONTEXT ); + checkAccess(MID_ADD_REQUEST_SERVICE_CONTEXT); - if( cachedRequestServiceContexts == null ) { - cachedRequestServiceContexts = - new HashMap(); + if (cachedRequestServiceContexts == null) { + cachedRequestServiceContexts = new HashMap(); } - addServiceContext( cachedRequestServiceContexts, - messageMediator.getRequestServiceContexts(), - service_context, replace ); + addServiceContext(cachedRequestServiceContexts, messageMediator.getRequestServiceContexts(), service_context, replace); } - + // NOTE: When adding a method, be sure to: // 1. Add a MID_* constant for that method // 2. Call checkAccess at the start of the method @@ -481,21 +441,19 @@ public void add_request_service_context (ServiceContext service_context, ********************************************************************** * Public RequestInfo interfaces * - * These are implemented here because they have differing - * implementations depending on whether this is a client or a server - * request info object. + * These are implemented here because they have differing implementations depending on whether this is a client or a + * server request info object. **********************************************************************/ - + /** * See RequestInfoImpl for javadoc. */ - public int request_id (){ + public int request_id() { // access is currently valid for all states: - //checkAccess( MID_REQUEST_ID ); - /* - * NOTE: The requestId in client interceptors is the same as the - * GIOP request id. This works because both interceptors and - * request ids are scoped by the ORB on the client side. + // checkAccess( MID_REQUEST_ID ); + /* + * NOTE: The requestId in client interceptors is the same as the GIOP request id. This works because both interceptors + * and request ids are scoped by the ORB on the client side. */ return messageMediator.getRequestId(); } @@ -503,9 +461,9 @@ public int request_id (){ /** * See RequestInfoImpl for javadoc. */ - public String operation(){ + public String operation() { // access is currently valid for all states: - //checkAccess( MID_OPERATION ); + // checkAccess( MID_OPERATION ); if (messageMediator != null) { return messageMediator.getOperationName(); } else { @@ -515,30 +473,29 @@ public String operation(){ @Override public String toString() { - return "ClientRequestInfoImpl[operation=" - + operation() + "]" ; + return "ClientRequestInfoImpl[operation=" + operation() + "]"; } /** * See RequestInfoImpl for javadoc. */ @TraceInterceptor - public Parameter[] arguments (){ - checkAccess( MID_ARGUMENTS ); + public Parameter[] arguments() { + checkAccess(MID_ARGUMENTS); - if( cachedArguments == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported1() ; + if (cachedArguments == null) { + if (request == null) { + throw stdWrapper.piOperationNotSupported1(); } // If it is DII request then get the arguments from the DII req // and convert that into parameters. - cachedArguments = nvListToParameterArray( request.arguments() ); + cachedArguments = nvListToParameterArray(request.arguments()); } // Good citizen: In the interest of efficiency, we assume // interceptors will be "good citizens" in that they will not - // modify the contents of the Parameter[] array. We also assume + // modify the contents of the Parameter[] array. We also assume // they will not change the values of the containing Anys. return cachedArguments; @@ -548,25 +505,25 @@ public Parameter[] arguments (){ * See RequestInfoImpl for javadoc. */ @TraceInterceptor - public TypeCode[] exceptions (){ - checkAccess( MID_EXCEPTIONS ); + public TypeCode[] exceptions() { + checkAccess(MID_EXCEPTIONS); - if( cachedExceptions == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported2() ; + if (cachedExceptions == null) { + if (request == null) { + throw stdWrapper.piOperationNotSupported2(); } // Get the list of exceptions from DII request data, If there are // no exceptions raised then this method will return null. - ExceptionList excList = request.exceptions( ); + ExceptionList excList = request.exceptions(); int count = excList.count(); TypeCode[] excTCList = new TypeCode[count]; try { - for( int i = 0; i < count; i++ ) { - excTCList[i] = excList.item( i ); + for (int i = 0; i < count; i++) { + excTCList[i] = excList.item(i); } - } catch( Exception e ) { - throw wrapper.exceptionInExceptions( e ) ; + } catch (Exception e) { + throw wrapper.exceptionInExceptions(e); } cachedExceptions = excTCList; @@ -574,7 +531,7 @@ public TypeCode[] exceptions (){ // Good citizen: In the interest of efficiency, we assume // interceptors will be "good citizens" in that they will not - // modify the contents of the TypeCode[] array. We also assume + // modify the contents of the TypeCode[] array. We also assume // they will not change the values of the containing TypeCodes. return cachedExceptions; @@ -584,25 +541,25 @@ public TypeCode[] exceptions (){ * See RequestInfoImpl for javadoc. */ @TraceInterceptor - public String[] contexts (){ - checkAccess( MID_CONTEXTS ); + public String[] contexts() { + checkAccess(MID_CONTEXTS); - if( cachedContexts == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported3() ; + if (cachedContexts == null) { + if (request == null) { + throw stdWrapper.piOperationNotSupported3(); } // Get the list of contexts from DII request data, If there are // no contexts then this method will return null. - ContextList ctxList = request.contexts( ); + ContextList ctxList = request.contexts(); int count = ctxList.count(); String[] ctxListToReturn = new String[count]; try { - for( int i = 0; i < count; i++ ) { - ctxListToReturn[i] = ctxList.item( i ); + for (int i = 0; i < count; i++) { + ctxListToReturn[i] = ctxList.item(i); } - } catch( Exception e ) { - throw wrapper.exceptionInContexts( e ) ; + } catch (Exception e) { + throw wrapper.exceptionInContexts(e); } cachedContexts = ctxListToReturn; @@ -619,35 +576,34 @@ public String[] contexts (){ * See RequestInfoImpl for javadoc. */ @TraceInterceptor - public String[] operation_context (){ - checkAccess( MID_OPERATION_CONTEXT ); + public String[] operation_context() { + checkAccess(MID_OPERATION_CONTEXT); - if( cachedOperationContext == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported4() ; + if (cachedOperationContext == null) { + if (request == null) { + throw stdWrapper.piOperationNotSupported4(); } // Get the list of contexts from DII request data, If there are // no contexts then this method will return null. - Context ctx = request.ctx( ); + Context ctx = request.ctx(); // The first parameter in get_values is the start_scope which // if blank makes it as a global scope. // The second parameter is op_flags which is set to RESTRICT_SCOPE // As there is only one defined in the spec. // The Third param is the pattern which is '*' requiring it to // get all the contexts. - NVList nvList = ctx.get_values( "", CTX_RESTRICT_SCOPE.value,"*" ); - String[] context = new String[(nvList.count() * 2) ]; - if( nvList.count() != 0 ) { + NVList nvList = ctx.get_values("", CTX_RESTRICT_SCOPE.value, "*"); + String[] context = new String[(nvList.count() * 2)]; + if (nvList.count() != 0) { // The String[] array will contain Name and Value for each // context and hence double the size in the array. int index = 0; - for( int i = 0; i < nvList.count(); i++ ) { + for (int i = 0; i < nvList.count(); i++) { NamedValue nv; try { - nv = nvList.item( i ); - } - catch (Exception e ) { + nv = nvList.item(i); + } catch (Exception e) { return (String[]) null; } context[index] = nv.name(); @@ -671,18 +627,18 @@ public String[] operation_context (){ * See RequestInfoImpl for javadoc. */ @TraceInterceptor - public Any result (){ - checkAccess( MID_RESULT ); + public Any result() { + checkAccess(MID_RESULT); - if( cachedResult == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported5() ; + if (cachedResult == null) { + if (request == null) { + throw stdWrapper.piOperationNotSupported5(); } // Get the result from the DII request data. - NamedValue nvResult = request.result( ); + NamedValue nvResult = request.result(); - if( nvResult == null ) { - throw wrapper.piDiiResultIsNull() ; + if (nvResult == null) { + throw wrapper.piDiiResultIsNull(); } cachedResult = nvResult.value(); @@ -698,23 +654,23 @@ public Any result (){ /** * See RequestInfoImpl for javadoc. */ - public boolean response_expected (){ + public boolean response_expected() { // access is currently valid for all states: - //checkAccess( MID_RESPONSE_EXPECTED ); - return ! messageMediator.isOneWay(); + // checkAccess( MID_RESPONSE_EXPECTED ); + return !messageMediator.isOneWay(); } /** * See RequestInfoImpl for javadoc. */ @TraceInterceptor - public Object forward_reference (){ - checkAccess( MID_FORWARD_REFERENCE ); + public Object forward_reference() { + checkAccess(MID_FORWARD_REFERENCE); // Check to make sure we are in LOCATION_FORWARD // state as per ptc/00-08-06, table 21-1 // footnote 2. - if( replyStatus != LOCATION_FORWARD.value ) { - throw stdWrapper.invalidPiCall1() ; + if (replyStatus != LOCATION_FORWARD.value) { + throw stdWrapper.invalidPiCall1(); } // Do not cache this value since if an interceptor raises @@ -727,8 +683,7 @@ public Object forward_reference (){ @TraceInterceptor private IOR getLocatedIOR() { IOR ior; - ContactInfoList contactInfoList = messageMediator.getContactInfo(). - getContactInfoList(); + ContactInfoList contactInfoList = messageMediator.getContactInfo().getContactInfoList(); ior = contactInfoList.getEffectiveTargetIOR(); return ior; } @@ -738,43 +693,37 @@ private IOR getLocatedIOR() { public void setLocatedIOR(IOR ior) { ORB orb = messageMediator.getBroker(); - ContactInfoListIterator iterator = (ContactInfoListIterator) - ((InvocationInfo)orb.getInvocationInfo()) - .getContactInfoListIterator(); + ContactInfoListIterator iterator = (ContactInfoListIterator) ((InvocationInfo) orb.getInvocationInfo()) + .getContactInfoListIterator(); // REVISIT - this most likely causes reportRedirect to happen twice. // Once here and once inside the request dispatcher. - iterator.reportRedirect( messageMediator.getContactInfo(), ior); + iterator.reportRedirect(messageMediator.getContactInfo(), ior); } /** * See RequestInfoImpl for javadoc. */ @TraceInterceptor - public org.omg.IOP.ServiceContext get_request_service_context( int id ) { - checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT ); + public org.omg.IOP.ServiceContext get_request_service_context(int id) { + checkAccess(MID_GET_REQUEST_SERVICE_CONTEXT); - if( cachedRequestServiceContexts == null ) { - cachedRequestServiceContexts = - new HashMap(); + if (cachedRequestServiceContexts == null) { + cachedRequestServiceContexts = new HashMap(); } - return getServiceContext(cachedRequestServiceContexts, - messageMediator.getRequestServiceContexts(), - id); + return getServiceContext(cachedRequestServiceContexts, messageMediator.getRequestServiceContexts(), id); } /** - * does not contain an etry for that ID, BAD_PARAM with a minor code of - * TBD_BP is raised. + * does not contain an etry for that ID, BAD_PARAM with a minor code of TBD_BP is raised. */ @TraceInterceptor - public org.omg.IOP.ServiceContext get_reply_service_context( int id ) { - checkAccess( MID_GET_REPLY_SERVICE_CONTEXT ); + public org.omg.IOP.ServiceContext get_reply_service_context(int id) { + checkAccess(MID_GET_REPLY_SERVICE_CONTEXT); - if( cachedReplyServiceContexts == null ) { - cachedReplyServiceContexts = - new HashMap(); + if (cachedReplyServiceContexts == null) { + cachedReplyServiceContexts = new HashMap(); } // In the event this is called from a oneway, we will have no @@ -783,22 +732,20 @@ public org.omg.IOP.ServiceContext get_reply_service_context( int id ) { // In the event this is called after a IIOPConnection.purgeCalls, // we will have a response object, but that object will // not contain a header (which would hold the service context - // container). See bug 4624102. + // container). See bug 4624102. // // REVISIT: getReplyHeader should not be visible here. if (messageMediator.getReplyHeader() != null) { - ServiceContexts sctxs = - messageMediator.getReplyServiceContexts(); + ServiceContexts sctxs = messageMediator.getReplyServiceContexts(); if (sctxs != null) { - return getServiceContext(cachedReplyServiceContexts, - sctxs, id); + return getServiceContext(cachedReplyServiceContexts, sctxs, id); } } - // See purge calls test. The waiter is woken up by the + // See purge calls test. The waiter is woken up by the // call to purge calls - but there is no reply containing // service contexts. - throw stdWrapper.invalidServiceContextId() ; + throw stdWrapper.invalidServiceContextId(); } // @@ -807,34 +754,29 @@ public org.omg.IOP.ServiceContext get_reply_service_context( int id ) { // @Override - public com.sun.corba.ee.spi.legacy.connection.Connection connection() - { - return (com.sun.corba.ee.spi.legacy.connection.Connection) - messageMediator.getConnection(); + public com.sun.corba.ee.spi.legacy.connection.Connection connection() { + return (com.sun.corba.ee.spi.legacy.connection.Connection) messageMediator.getConnection(); } - - /* ********************************************************************** * Package-scope interfaces **********************************************************************/ - protected void setInfo(MessageMediator messageMediator) - { + protected void setInfo(MessageMediator messageMediator) { this.messageMediator = messageMediator; // REVISIT - so mediator can handle DII in subcontract. this.messageMediator.setDIIInfo(request); } - + /** - * Set or reset the retry request flag. + * Set or reset the retry request flag. */ - void setRetryRequest( RetryType retryRequest ) { + void setRetryRequest(RetryType retryRequest) { // 6763340 this.retryRequest = retryRequest; } - + /** * Retrieve the current retry request status. */ @@ -842,28 +784,29 @@ RetryType getRetryRequest() { // 6763340 return this.retryRequest; } - + /** * Increases the entry count by 1. */ @TraceInterceptor void incrementEntryCount() { this.entryCount++; - entryCount( this.entryCount ) ; + entryCount(this.entryCount); } @InfoMethod - private void entryCount( int count ) { } - + private void entryCount(int count) { + } + /** * Decreases the entry count by 1. */ @TraceInterceptor void decrementEntryCount() { this.entryCount--; - entryCount( this.entryCount ) ; + entryCount(this.entryCount); } - + /** * Retrieve the current entry count */ @@ -871,70 +814,71 @@ void decrementEntryCount() { int getEntryCount() { return this.entryCount; } - + /** - * Overridden from RequestInfoImpl. Calls the super class, then - * sets the ending point call depending on the reply status. + * Overridden from RequestInfoImpl. Calls the super class, then sets the ending point call depending on the reply + * status. */ @TraceInterceptor @Override - protected void setReplyStatus( short replyStatus ) { - super.setReplyStatus( replyStatus ); - switch( replyStatus ) { - case SUCCESSFUL.value: - endingPointCall = CALL_RECEIVE_REPLY; - break; - case SYSTEM_EXCEPTION.value: - case USER_EXCEPTION.value: - endingPointCall = CALL_RECEIVE_EXCEPTION; - break; - case LOCATION_FORWARD.value: - case TRANSPORT_RETRY.value: - endingPointCall = CALL_RECEIVE_OTHER; - break; + protected void setReplyStatus(short replyStatus) { + super.setReplyStatus(replyStatus); + switch (replyStatus) { + case SUCCESSFUL.value: + endingPointCall = CALL_RECEIVE_REPLY; + break; + case SYSTEM_EXCEPTION.value: + case USER_EXCEPTION.value: + endingPointCall = CALL_RECEIVE_EXCEPTION; + break; + case LOCATION_FORWARD.value: + case TRANSPORT_RETRY.value: + endingPointCall = CALL_RECEIVE_OTHER; + break; } } @TraceInterceptor @Override protected short getReplyStatus() { - return super.getReplyStatus() ; + return super.getReplyStatus(); } /** * Sets DII request object in the RequestInfoObject. + * * @param req The DII request object */ protected void setDIIRequest(org.omg.CORBA.Request req) { - request = req; + request = req; } /** - * Keeps track of whether initiate was called for a DII request. The ORB - * needs to know this so it knows whether to ignore a second call to - * initiateClientPIRequest or not. + * Keeps track of whether initiate was called for a DII request. The ORB needs to know this so it knows whether to + * ignore a second call to initiateClientPIRequest or not. + * * @param diiInitiate If initiate was called */ - protected void setDIIInitiate( boolean diiInitiate ) { + protected void setDIIInitiate(boolean diiInitiate) { this.diiInitiate = diiInitiate; } /** * @return If initiate was called for a DII request - * @see #setDIIInitiate(boolean) + * @see #setDIIInitiate(boolean) */ protected boolean isDIIInitiate() { return this.diiInitiate; } /** - * The PICurrent stack should only be popped if it was pushed. - * This is generally the case. But exceptions which occur - * after the stub's entry to _request but before the push - * end up in _releaseReply which will try to pop unless told not to. + * The PICurrent stack should only be popped if it was pushed. This is generally the case. But exceptions which occur + * after the stub's entry to _request but before the push end up in _releaseReply which will try to pop unless told not + * to. + * * @param piCurrentPushed If the stack should be pushed */ - protected void setPICurrentPushed( boolean piCurrentPushed ) { + protected void setPICurrentPushed(boolean piCurrentPushed) { this.piCurrentPushed = piCurrentPushed; } @@ -946,8 +890,8 @@ protected boolean isPICurrentPushed() { * Overridden from RequestInfoImpl. */ @Override - protected void setException( Exception exception ) { - super.setException( exception ); + protected void setException(Exception exception) { + super.setException(exception); // Clear cached values: cachedReceivedException = null; @@ -955,21 +899,19 @@ protected void setException( Exception exception ) { } protected boolean getIsOneWay() { - return ! response_expected(); + return !response_expected(); } /** * See description for RequestInfoImpl.checkAccess */ - protected void checkAccess( int methodID ) - throws BAD_INV_ORDER - { + protected void checkAccess(int methodID) throws BAD_INV_ORDER { // Make sure currentPoint matches the appropriate index in the // validCall table: int validCallIndex = 0; - switch( currentExecutionPoint ) { + switch (currentExecutionPoint) { case EXECUTION_POINT_STARTING: - switch( startingPointCall ) { + switch (startingPointCall) { case CALL_SEND_REQUEST: validCallIndex = 0; break; @@ -979,7 +921,7 @@ protected void checkAccess( int methodID ) } break; case EXECUTION_POINT_ENDING: - switch( endingPointCall ) { + switch (endingPointCall) { case CALL_RECEIVE_REPLY: validCallIndex = 2; break; @@ -992,13 +934,13 @@ protected void checkAccess( int methodID ) } break; } - + // Check the validCall table: - if( !validCall[methodID][validCallIndex] ) { - throw stdWrapper.invalidPiCall2() ; + if (!validCall[methodID][validCallIndex]) { + throw stdWrapper.invalidPiCall2(); } } - + } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/CodecFactoryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/CodecFactoryImpl.java index 39d750805..37606c400 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/CodecFactoryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/CodecFactoryImpl.java @@ -30,17 +30,12 @@ import org.omg.CORBA.ORB; /** - * CodecFactoryImpl is the implementation of the Codec Factory, as described - * in orbos/99-12-02. + * CodecFactoryImpl is the implementation of the Codec Factory, as described in orbos/99-12-02. */ -public final class CodecFactoryImpl - extends org.omg.CORBA.LocalObject - implements CodecFactory -{ +public final class CodecFactoryImpl extends org.omg.CORBA.LocalObject implements CodecFactory { // The ORB that created this Codec Factory private transient ORB orb; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // The maximum minor version of GIOP supported by this codec factory. // Currently, this is 1.2. @@ -51,50 +46,43 @@ public final class CodecFactoryImpl private Codec codecs[] = new Codec[MAX_MINOR_VERSION_SUPPORTED + 1]; /** - * Creates a new CodecFactory implementation. Stores the ORB that - * created this factory, for later use by the Codec. + * Creates a new CodecFactory implementation. Stores the ORB that created this factory, for later use by the Codec. + * * @param orb ORB that created this factory */ - public CodecFactoryImpl( ORB orb ) { + public CodecFactoryImpl(ORB orb) { this.orb = orb; - // Precreate a codec for version 1.0 through - // 1.(MAX_MINOR_VERSION_SUPPORTED). This can be + // Precreate a codec for version 1.0 through + // 1.(MAX_MINOR_VERSION_SUPPORTED). This can be // done since Codecs are immutable in their current implementation. // This is an optimization that eliminates the overhead of creating // a new Codec each time create_codec is called. - for( int minor = 0; minor <= MAX_MINOR_VERSION_SUPPORTED; minor++ ) { - codecs[minor] = new CDREncapsCodec( orb, 1, minor ); + for (int minor = 0; minor <= MAX_MINOR_VERSION_SUPPORTED; minor++) { + codecs[minor] = new CDREncapsCodec(orb, 1, minor); } } /** - * Creates a codec of the given encoding. The only format recognized - * by this factory is ENCODING_CDR_ENCAPS, versions 1.0 through - * 1.(MAX_MINOR_VERSION_SUPPORTED). + * Creates a codec of the given encoding. The only format recognized by this factory is ENCODING_CDR_ENCAPS, versions + * 1.0 through 1.(MAX_MINOR_VERSION_SUPPORTED). * - * @exception UnknownEncoding Thrown if this factory cannot create a - * Codec of the given encoding. + * @exception UnknownEncoding Thrown if this factory cannot create a Codec of the given encoding. */ - public Codec create_codec ( Encoding enc ) - throws UnknownEncoding - { - if( enc == null ) nullParam(); + public Codec create_codec(Encoding enc) throws UnknownEncoding { + if (enc == null) + nullParam(); Codec result = null; // This is the only format we can currently create codecs for: - if( (enc.format == ENCODING_CDR_ENCAPS.value) && - (enc.major_version == 1) ) - { - if( (enc.minor_version >= 0) && - (enc.minor_version <= MAX_MINOR_VERSION_SUPPORTED) ) - { + if ((enc.format == ENCODING_CDR_ENCAPS.value) && (enc.major_version == 1)) { + if ((enc.minor_version >= 0) && (enc.minor_version <= MAX_MINOR_VERSION_SUPPORTED)) { result = codecs[enc.minor_version]; } } - if( result == null ) { + if (result == null) { throw new UnknownEncoding(); } @@ -102,11 +90,9 @@ public Codec create_codec ( Encoding enc ) } /** - * Called when an invalid null parameter was passed. Throws a - * BAD_PARAM with a minor code of 1 + * Called when an invalid null parameter was passed. Throws a BAD_PARAM with a minor code of 1 */ - private void nullParam() - { - throw wrapper.nullParamNoComplete() ; + private void nullParam() { + throw wrapper.nullParamNoComplete(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/IORInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/IORInfoImpl.java index 924692a33..4ab7fac37 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/IORInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/IORInfoImpl.java @@ -19,7 +19,7 @@ package com.sun.corba.ee.impl.interceptors; -import java.util.Iterator ; +import java.util.Iterator; import org.omg.IOP.TaggedComponent; @@ -30,7 +30,7 @@ import org.omg.PortableInterceptor.ObjectReferenceTemplate; import org.omg.PortableInterceptor.ObjectReferenceFactory; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.oa.ObjectAdapter; @@ -38,261 +38,220 @@ import com.sun.corba.ee.spi.legacy.interceptor.UnknownType; import com.sun.corba.ee.spi.ior.TaggedProfileTemplate; -import com.sun.corba.ee.spi.ior.TaggedComponentFactoryFinder ; +import com.sun.corba.ee.spi.ior.TaggedComponentFactoryFinder; -import com.sun.corba.ee.spi.logging.InterceptorsSystemException ; -import com.sun.corba.ee.spi.logging.OMGSystemException ; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.InterceptorsSystemException; +import com.sun.corba.ee.spi.logging.OMGSystemException; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** - * IORInfoImpl is the implementation of the IORInfo class, as described - * in orbos/99-12-02, section 7. + * IORInfoImpl is the implementation of the IORInfo class, as described in orbos/99-12-02, section 7. */ -public final class IORInfoImpl - extends LocalObject - implements IORInfo, IORInfoExt -{ +public final class IORInfoImpl extends LocalObject implements IORInfo, IORInfoExt { // State values that determine which methods are allowed. // get_effective_policy, manager_id, and adapter_state are valid unless STATE_DONE // add_component, and add_component_to_profile are valid. - private static final int STATE_INITIAL = 0 ; + private static final int STATE_INITIAL = 0; // adapter_template, and R/W to current_factory are valid - private static final int STATE_ESTABLISHED = 1 ; + private static final int STATE_ESTABLISHED = 1; // No methods are valid in this state - private static final int STATE_DONE = 2 ; + private static final int STATE_DONE = 2; // The current state of this object - private int state = STATE_INITIAL ; + private int state = STATE_INITIAL; // The ObjectAdapter associated with this IORInfo object. private transient ObjectAdapter adapter; - private transient ORB orb ; + private transient ORB orb; - private static final ORBUtilSystemException orbutilWrapper = - ORBUtilSystemException.self ; - private static final InterceptorsSystemException wrapper = - InterceptorsSystemException.self ; - private static final OMGSystemException omgWrapper = - OMGSystemException.self ; + private static final ORBUtilSystemException orbutilWrapper = ORBUtilSystemException.self; + private static final InterceptorsSystemException wrapper = InterceptorsSystemException.self; + private static final OMGSystemException omgWrapper = OMGSystemException.self; /** - * Creates a new IORInfo implementation. This info object will establish - * tagged components with the template for the provided IOR Template. + * Creates a new IORInfo implementation. This info object will establish tagged components with the template for the + * provided IOR Template. */ - IORInfoImpl( ObjectAdapter adapter ) { - this.orb = adapter.getORB() ; + IORInfoImpl(ObjectAdapter adapter) { + this.orb = adapter.getORB(); this.adapter = adapter; } /** - * An ORB service implementation may determine what server side policy - * of a particular type is in effect for an IOR being constructed by - * calling the get_effective_policy operation. When the IOR being - * constructed is for an object implemented using a POA, all Policy - * objects passed to the PortableServer::POA::create_POA call that - * created that POA are accessible via get_effective_policy. + * An ORB service implementation may determine what server side policy of a particular type is in effect for an IOR + * being constructed by calling the get_effective_policy operation. When the IOR being constructed is for an object + * implemented using a POA, all Policy objects passed to the PortableServer::POA::create_POA call that created that POA + * are accessible via get_effective_policy. *

- * If a policy for the given type is not known to the ORB, then this - * operation will raise INV_POLICY with a standard minor code of 2. + * If a policy for the given type is not known to the ORB, then this operation will raise INV_POLICY with a standard + * minor code of 2. * - * @param type The CORBA::PolicyType specifying the type of policy to - * return. - * @return The effective CORBA::Policy object of the requested type. - * If the given policy type is known, but no policy of that type is - * in effect, then this operation will return a nil object reference. + * @param type The CORBA::PolicyType specifying the type of policy to return. + * @return The effective CORBA::Policy object of the requested type. If the given policy type is known, but no policy of + * that type is in effect, then this operation will return a nil object reference. */ - public Policy get_effective_policy (int type) { - checkState( STATE_INITIAL, STATE_ESTABLISHED ) ; + public Policy get_effective_policy(int type) { + checkState(STATE_INITIAL, STATE_ESTABLISHED); - return adapter.getEffectivePolicy( type ); + return adapter.getEffectivePolicy(type); } /** - * A portable ORB service implementation calls this method from its - * implementation of establish_components to add a tagged component to - * the set which will be included when constructing IORs. The - * components in this set will be included in all profiles. + * A portable ORB service implementation calls this method from its implementation of establish_components to add a + * tagged component to the set which will be included when constructing IORs. The components in this set will be + * included in all profiles. *

* Any number of components may exist with the same component ID. * * @param tagged_component The IOP::TaggedComponent to add */ - public void add_ior_component (TaggedComponent tagged_component) { - checkState( STATE_INITIAL ) ; + public void add_ior_component(TaggedComponent tagged_component) { + checkState(STATE_INITIAL); - if( tagged_component == null ) nullParam(); - addIORComponentToProfileInternal( tagged_component, - adapter.getIORTemplate().iterator()); + if (tagged_component == null) + nullParam(); + addIORComponentToProfileInternal(tagged_component, adapter.getIORTemplate().iterator()); } /** - * A portable ORB service implementation calls this method from its - * implementation of establish_components to add a tagged component to - * the set which will be included when constructing IORs. The - * components in this set will be included in the specified profile. + * A portable ORB service implementation calls this method from its implementation of establish_components to add a + * tagged component to the set which will be included when constructing IORs. The components in this set will be + * included in the specified profile. *

* Any number of components may exist with the same component ID. *

- * If the given profile ID does not define a known profile or it is - * impossible to add components to thgat profile, BAD_PARAM is raised - * with a minor code of TBD_BP + 3. + * If the given profile ID does not define a known profile or it is impossible to add components to thgat profile, + * BAD_PARAM is raised with a minor code of TBD_BP + 3. * * @param tagged_component The IOP::TaggedComponent to add. - * @param profile_id The IOP::ProfileId tof the profile to which this - * component will be added. + * @param profile_id The IOP::ProfileId tof the profile to which this component will be added. */ - public void add_ior_component_to_profile ( - TaggedComponent tagged_component, int profile_id ) - { - checkState( STATE_INITIAL ) ; - - if( tagged_component == null ) nullParam(); - addIORComponentToProfileInternal( - tagged_component, adapter.getIORTemplate().iteratorById( - profile_id ) ); + public void add_ior_component_to_profile(TaggedComponent tagged_component, int profile_id) { + checkState(STATE_INITIAL); + + if (tagged_component == null) + nullParam(); + addIORComponentToProfileInternal(tagged_component, adapter.getIORTemplate().iteratorById(profile_id)); } /** - * @param type The type of the server port - * (see connection.ORBSocketFactory for discussion). + * @param type The type of the server port (see connection.ORBSocketFactory for discussion). * @return The listen port number for that type. * @throws UnknownType if no port of the given type is found. */ - public int getServerPort(String type) - throws UnknownType - { - checkState( STATE_INITIAL, STATE_ESTABLISHED ) ; - - int port = - orb.getLegacyServerSocketManager() - .legacyGetTransientOrPersistentServerPort(type); + public int getServerPort(String type) throws UnknownType { + checkState(STATE_INITIAL, STATE_ESTABLISHED); + + int port = orb.getLegacyServerSocketManager().legacyGetTransientOrPersistentServerPort(type); if (port == -1) { throw new UnknownType(); } return port; } - public ObjectAdapter getObjectAdapter() - { + public ObjectAdapter getObjectAdapter() { return adapter; } - - public int manager_id() - { - checkState( STATE_INITIAL, STATE_ESTABLISHED) ; - return adapter.getManagerId() ; + public int manager_id() { + checkState(STATE_INITIAL, STATE_ESTABLISHED); + + return adapter.getManagerId(); } - public short state() - { - checkState( STATE_INITIAL, STATE_ESTABLISHED) ; + public short state() { + checkState(STATE_INITIAL, STATE_ESTABLISHED); - return adapter.getState() ; + return adapter.getState(); } - public ObjectReferenceTemplate adapter_template() - { - checkState( STATE_ESTABLISHED) ; + public ObjectReferenceTemplate adapter_template() { + checkState(STATE_ESTABLISHED); // At this point, the iortemp must contain only a single - // IIOPProfileTemplate. This is a restriction of our - // implementation. Also, note the the ObjectReferenceTemplate + // IIOPProfileTemplate. This is a restriction of our + // implementation. Also, note the the ObjectReferenceTemplate // is called when a certain POA is created in a certain ORB - // in a certain server, so the server_id, orb_id, and + // in a certain server, so the server_id, orb_id, and // poa_id operations must be well-defined no matter what // kind of implementation is used: e.g., if a POA creates // IORs with multiple profiles, they must still all agree - // about this information. Thus, we are justified in - // extracting the single IIOPProfileTemplate to create + // about this information. Thus, we are justified in + // extracting the single IIOPProfileTemplate to create // an ObjectReferenceTemplate here. - return adapter.getAdapterTemplate() ; + return adapter.getAdapterTemplate(); } - public ObjectReferenceFactory current_factory() - { - checkState( STATE_ESTABLISHED) ; + public ObjectReferenceFactory current_factory() { + checkState(STATE_ESTABLISHED); - return adapter.getCurrentFactory() ; + return adapter.getCurrentFactory(); } - public void current_factory( ObjectReferenceFactory factory ) - { - checkState( STATE_ESTABLISHED) ; + public void current_factory(ObjectReferenceFactory factory) { + checkState(STATE_ESTABLISHED); - adapter.setCurrentFactory( factory ) ; + adapter.setCurrentFactory(factory); } /** - * Internal utility method to add an IOR component to the set of profiles - * present in the iterator. + * Internal utility method to add an IOR component to the set of profiles present in the iterator. */ - private void addIORComponentToProfileInternal( - TaggedComponent tagged_component, Iterator iterator ) - { + private void addIORComponentToProfileInternal(TaggedComponent tagged_component, Iterator iterator) { // Convert the given IOP::TaggedComponent into the appropriate // type for the TaggedProfileTemplate - TaggedComponentFactoryFinder finder = - orb.getTaggedComponentFactoryFinder(); - com.sun.corba.ee.spi.ior.TaggedComponent newTaggedComponent = - finder.create( orb, tagged_component ); - + TaggedComponentFactoryFinder finder = orb.getTaggedComponentFactoryFinder(); + com.sun.corba.ee.spi.ior.TaggedComponent newTaggedComponent = finder.create(orb, tagged_component); + // Iterate through TaggedProfileTemplates and add the given tagged // component to the appropriate one(s). boolean found = false; - while( iterator.hasNext() ) { + while (iterator.hasNext()) { found = true; - TaggedProfileTemplate taggedProfileTemplate = - (TaggedProfileTemplate)iterator.next(); - taggedProfileTemplate.add( newTaggedComponent ); + TaggedProfileTemplate taggedProfileTemplate = (TaggedProfileTemplate) iterator.next(); + taggedProfileTemplate.add(newTaggedComponent); } // If no profile was found with the given id, throw a BAD_PARAM: // (See orbos/00-08-06, section 21.5.3.3.) - if( !found ) { - throw omgWrapper.invalidProfileId() ; + if (!found) { + throw omgWrapper.invalidProfileId(); } } - + /** - * Called when an invalid null parameter was passed. Throws a - * BAD_PARAM with a minor code of 1 + * Called when an invalid null parameter was passed. Throws a BAD_PARAM with a minor code of 1 */ - private void nullParam() - { - throw orbutilWrapper.nullParamNoComplete() ; + private void nullParam() { + throw orbutilWrapper.nullParamNoComplete(); } // REVISIT: add minor codes! - private void checkState( int expectedState ) - { + private void checkState(int expectedState) { if (expectedState != state) - throw wrapper.badState1( expectedState, state ) ; + throw wrapper.badState1(expectedState, state); } - private void checkState( int expectedState1, int expectedState2 ) - { + private void checkState(int expectedState1, int expectedState2) { if ((expectedState1 != state) && (expectedState2 != state)) - throw wrapper.badState2( expectedState1, expectedState2, state ) ; + throw wrapper.badState2(expectedState1, expectedState2, state); } - void makeStateEstablished() - { - checkState( STATE_INITIAL ) ; + void makeStateEstablished() { + checkState(STATE_INITIAL); - state = STATE_ESTABLISHED ; + state = STATE_ESTABLISHED; } - void makeStateDone() - { - checkState( STATE_ESTABLISHED ) ; + void makeStateDone() { + checkState(STATE_ESTABLISHED); - state = STATE_DONE ; + state = STATE_DONE; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/InterceptorInvoker.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/InterceptorInvoker.java index 8077bb477..767001d99 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/InterceptorInvoker.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/InterceptorInvoker.java @@ -33,24 +33,21 @@ import com.sun.corba.ee.spi.oa.ObjectAdapter; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.trace.TraceInterceptor; - + import com.sun.corba.ee.spi.logging.InterceptorsSystemException; import java.util.Arrays; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; -/** - * Handles invocation of interceptors. Has specific knowledge of how to - * invoke IOR, ClientRequest, and ServerRequest interceptors. - * Makes use of the InterceptorList to retrieve the list of interceptors to - * be invoked. Most methods in this class are package scope so that they - * may only be called from the PIHandlerImpl. +/** + * Handles invocation of interceptors. Has specific knowledge of how to invoke IOR, ClientRequest, and ServerRequest + * interceptors. Makes use of the InterceptorList to retrieve the list of interceptors to be invoked. Most methods in + * this class are package scope so that they may only be called from the PIHandlerImpl. */ @TraceInterceptor public class InterceptorInvoker { private ORB orb; - private static final InterceptorsSystemException wrapper = - InterceptorsSystemException.self ; + private static final InterceptorsSystemException wrapper = InterceptorsSystemException.self; // The list of interceptors to be invoked private InterceptorList interceptorList; @@ -63,18 +60,15 @@ public class InterceptorInvoker { // PICurrent variable. private PICurrent current; - // NOTE: Be careful about adding additional attributes to this class. - // Multiple threads may be calling methods on this invoker at the same + // NOTE: Be careful about adding additional attributes to this class. + // Multiple threads may be calling methods on this invoker at the same // time. /** - * Creates a new Interceptor Invoker. Constructor is package scope so - * only the ORB can create it. The invoker is initially disabled, and - * must be explicitly enabled using setEnabled(). + * Creates a new Interceptor Invoker. Constructor is package scope so only the ORB can create it. The invoker is + * initially disabled, and must be explicitly enabled using setEnabled(). */ - InterceptorInvoker( ORB orb, InterceptorList interceptorList, - PICurrent piCurrent ) - { + InterceptorInvoker(ORB orb, InterceptorList interceptorList, PICurrent piCurrent) { this.orb = orb; this.interceptorList = interceptorList; this.enabled = false; @@ -84,14 +78,14 @@ public class InterceptorInvoker { /** * Enables or disables the interceptor invoker */ - synchronized void setEnabled( boolean enabled ) { + synchronized void setEnabled(boolean enabled) { this.enabled = enabled; } synchronized boolean getEnabled() { - return this.enabled ; + return this.enabled; } - + /* ********************************************************************** * IOR Interceptor invocation @@ -103,50 +97,48 @@ synchronized boolean getEnabled() { * @param oa The Object Adapter associated with the IOR interceptor. */ @TraceInterceptor - void objectAdapterCreated( ObjectAdapter oa ) { + void objectAdapterCreated(ObjectAdapter oa) { // If invocation is not yet enabled, don't do anything. - if( getEnabled() ) { + if (getEnabled()) { // Create IORInfo object to pass to IORInterceptors: - IORInfoImpl info = new IORInfoImpl( oa ); + IORInfoImpl info = new IORInfoImpl(oa); // Call each IORInterceptor: - IORInterceptor[] iorInterceptors = - (IORInterceptor[])interceptorList.getInterceptors( - InterceptorList.INTERCEPTOR_TYPE_IOR ); + IORInterceptor[] iorInterceptors = (IORInterceptor[]) interceptorList.getInterceptors(InterceptorList.INTERCEPTOR_TYPE_IOR); int size = iorInterceptors.length; // Implementation note: // This loop counts backwards for greater efficiency. // Benchmarks have shown that counting down is more efficient // than counting up in Java for loops, as a compare to zero is - // faster than a subtract and compare to zero. In this case, + // faster than a subtract and compare to zero. In this case, // it doesn't really matter much, but it's simply a force of habit. - for( int i = (size - 1); i >= 0; i-- ) { + for (int i = (size - 1); i >= 0; i--) { IORInterceptor interceptor = iorInterceptors[i]; try { - interceptor.establish_components( info ); - } catch( Exception e ) { + interceptor.establish_components(info); + } catch (Exception e) { // as per PI spec (orbos/99-12-02 sec 7.2.1), if // establish_components throws an exception, ignore it. // But do log something for debugging. - wrapper.ignoredExceptionInEstablishComponents( e, oa ) ; + wrapper.ignoredExceptionInEstablishComponents(e, oa); } } // Change the state so that only template operations are valid - info.makeStateEstablished() ; + info.makeStateEstablished(); - for( int i = (size - 1); i >= 0; i-- ) { + for (int i = (size - 1); i >= 0; i--) { IORInterceptor interceptor = iorInterceptors[i]; if (interceptor instanceof IORInterceptor_3_0) { - IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ; + IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0) interceptor; // Note that exceptions here are NOT ignored, as per the // ORT spec (orbos/01-01-04) try { - interceptor30.components_established( info ); + interceptor30.components_established(info); } catch (Exception exc) { - wrapper.exceptionInComponentsEstablished( exc, oa ) ; + wrapper.exceptionInComponentsEstablished(exc, oa); } } } @@ -155,58 +147,50 @@ void objectAdapterCreated( ObjectAdapter oa ) { // in case a reference to info escapes this scope. // This also completes the actions associated with the // template interceptors on this POA. - info.makeStateDone() ; + info.makeStateDone(); } } @TraceInterceptor - void adapterManagerStateChanged( int managerId, short newState ) { + void adapterManagerStateChanged(int managerId, short newState) { if (getEnabled()) { - IORInterceptor[] interceptors = - (IORInterceptor[])interceptorList.getInterceptors( - InterceptorList.INTERCEPTOR_TYPE_IOR ); + IORInterceptor[] interceptors = (IORInterceptor[]) interceptorList.getInterceptors(InterceptorList.INTERCEPTOR_TYPE_IOR); int size = interceptors.length; - for( int i = (size - 1); i >= 0; i-- ) { + for (int i = (size - 1); i >= 0; i--) { try { IORInterceptor interceptor = interceptors[i]; if (interceptor instanceof IORInterceptor_3_0) { - IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ; - interceptor30.adapter_manager_state_changed( managerId, - newState ); + IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0) interceptor; + interceptor30.adapter_manager_state_changed(managerId, newState); } } catch (Exception exc) { // No-op: ignore exception in this case // But do log something for debugging. - wrapper.ignoredExceptionInAdapterManagerStateChanged( - exc, managerId, newState ) ; + wrapper.ignoredExceptionInAdapterManagerStateChanged(exc, managerId, newState); } } } } @TraceInterceptor - void adapterStateChanged( ObjectReferenceTemplate[] templates, - short newState ) { + void adapterStateChanged(ObjectReferenceTemplate[] templates, short newState) { if (getEnabled()) { - IORInterceptor[] interceptors = - (IORInterceptor[])interceptorList.getInterceptors( - InterceptorList.INTERCEPTOR_TYPE_IOR ); + IORInterceptor[] interceptors = (IORInterceptor[]) interceptorList.getInterceptors(InterceptorList.INTERCEPTOR_TYPE_IOR); int size = interceptors.length; - for( int i = (size - 1); i >= 0; i-- ) { + for (int i = (size - 1); i >= 0; i--) { try { IORInterceptor interceptor = interceptors[i]; if (interceptor instanceof IORInterceptor_3_0) { - IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ; - interceptor30.adapter_state_changed( templates, newState ); + IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0) interceptor; + interceptor30.adapter_state_changed(templates, newState); } } catch (Exception exc) { // No-op: ignore exception in this case // But do log something for debugging. - wrapper.ignoredExceptionInAdapterStateChanged( exc, - Arrays.asList( templates ), newState ) ; + wrapper.ignoredExceptionInAdapterStateChanged(exc, Arrays.asList(templates), newState); } } } @@ -218,39 +202,37 @@ void adapterStateChanged( ObjectReferenceTemplate[] templates, **********************************************************************/ @InfoMethod - private void invokeClientStartingCall( String name ) { } + private void invokeClientStartingCall(String name) { + } @InfoMethod - private void invokeClientStartingForwardRequest( String name ) { } + private void invokeClientStartingForwardRequest(String name) { + } @InfoMethod - private void invokeClientStartingSystemException( String name, - SystemException exc ) { } - + private void invokeClientStartingSystemException(String name, SystemException exc) { + } /** - * Invokes either send_request, or send_poll, depending on the value - * of info.getStartingPointCall() + * Invokes either send_request, or send_poll, depending on the value of info.getStartingPointCall() */ @TraceInterceptor - void invokeClientInterceptorStartingPoint( ClientRequestInfoImpl info ) { - info.interceptorsEnabledForThisRequest = getEnabled() ; + void invokeClientInterceptorStartingPoint(ClientRequestInfoImpl info) { + info.interceptorsEnabledForThisRequest = getEnabled(); // If invocation is not yet enabled, don't do anything. - if( info.interceptorsEnabledForThisRequest ) { + if (info.interceptorsEnabledForThisRequest) { try { // Make a a fresh slot table available to TSC in case // interceptors need to make out calls. // Client's TSC is now RSC via RequestInfo. - current.pushSlotTable( ); - info.setPICurrentPushed( true ); - info.setCurrentExecutionPoint( - ClientRequestInfoImpl.EXECUTION_POINT_STARTING ); + current.pushSlotTable(); + info.setPICurrentPushed(true); + info.setCurrentExecutionPoint(ClientRequestInfoImpl.EXECUTION_POINT_STARTING); // Get all ClientRequestInterceptors: - ClientRequestInterceptor[] clientInterceptors = - (ClientRequestInterceptor[])interceptorList. - getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT ); + ClientRequestInterceptor[] clientInterceptors = (ClientRequestInterceptor[]) interceptorList + .getInterceptors(InterceptorList.INTERCEPTOR_TYPE_CLIENT); int size = clientInterceptors.length; // We will assume that all interceptors returned successfully, @@ -259,52 +241,50 @@ void invokeClientInterceptorStartingPoint( ClientRequestInfoImpl info ) { int flowStackIndex = size; boolean continueProcessing = true; - // This ORB only supports send_request. It does not implement - // the CORBA messaging specification, so send_poll is not + // This ORB only supports send_request. It does not implement + // the CORBA messaging specification, so send_poll is not // needed. - for( int i = 0; continueProcessing && (i < size); i++ ) { - ClientRequestInterceptor cri = clientInterceptors[i] ; + for (int i = 0; continueProcessing && (i < size); i++) { + ClientRequestInterceptor cri = clientInterceptors[i]; try { - invokeClientStartingCall( cri.name() ); - cri.send_request( info ); - } catch( ForwardRequest e ) { - invokeClientStartingForwardRequest( cri.name() ); + invokeClientStartingCall(cri.name()); + cri.send_request(info); + } catch (ForwardRequest e) { + invokeClientStartingForwardRequest(cri.name()); // as per PI spec (orbos/99-12-02 sec 5.2.1.), if // interception point throws a ForwardRequest, // no other Interceptors' send_request operations are // called. flowStackIndex = i; - info.setForwardRequest( e ); - info.setEndingPointCall( - ClientRequestInfoImpl.CALL_RECEIVE_OTHER ); - info.setReplyStatus( LOCATION_FORWARD.value ); + info.setForwardRequest(e); + info.setEndingPointCall(ClientRequestInfoImpl.CALL_RECEIVE_OTHER); + info.setReplyStatus(LOCATION_FORWARD.value); - updateClientRequestDispatcherForward( info ); + updateClientRequestDispatcherForward(info); // For some reason, using break here causes the VM on // NT to lose track of the value of flowStackIndex - // after exiting the for loop. I changed this to + // after exiting the for loop. I changed this to // check a boolean value instead and it seems to work // fine. continueProcessing = false; - } catch( SystemException e ) { - invokeClientStartingSystemException( cri.name(), e); + } catch (SystemException e) { + invokeClientStartingSystemException(cri.name(), e); // as per PI spec (orbos/99-12-02 sec 5.2.1.), if // interception point throws a SystemException, // no other Interceptors' send_request operations are // called. flowStackIndex = i; - info.setEndingPointCall( - ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); - info.setException( e ); + info.setEndingPointCall(ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION); + info.setReplyStatus(SYSTEM_EXCEPTION.value); + info.setException(e); // For some reason, using break here causes the VM on // NT to lose track of the value of flowStackIndex - // after exiting the for loop. I changed this to + // after exiting the for loop. I changed this to // check a boolean value instead and it seems to // work fine. continueProcessing = false; @@ -312,55 +292,55 @@ void invokeClientInterceptorStartingPoint( ClientRequestInfoImpl info ) { } // Remember where we left off in the flow stack: - info.setFlowStackIndex( flowStackIndex ); + info.setFlowStackIndex(flowStackIndex); } finally { // Make the SlotTable fresh for the next interception point. - current.resetSlotTable( ); + current.resetSlotTable(); } } // end enabled check } - private String getClientEndMethodName( int endingPointCall ) { - switch( endingPointCall ) { + private String getClientEndMethodName(int endingPointCall) { + switch (endingPointCall) { case ClientRequestInfoImpl.CALL_RECEIVE_REPLY: - return "receive_reply" ; + return "receive_reply"; case ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION: - return "receive_exception" ; + return "receive_exception"; case ClientRequestInfoImpl.CALL_RECEIVE_OTHER: - return "receive_other" ; + return "receive_other"; } - return "" ; + return ""; } @InfoMethod - private void invokeClientEndingCall( String name, String call ) { } + private void invokeClientEndingCall(String name, String call) { + } @InfoMethod - private void invokeClientEndingForwardRequest( String name ) { } + private void invokeClientEndingForwardRequest(String name) { + } @InfoMethod - private void invokeClientEndingSystemException( String name, - SystemException exc ) { } + private void invokeClientEndingSystemException(String name, SystemException exc) { + } /** - * Invokes either receive_reply, receive_exception, or receive_other, - * depending on the value of info.getEndingPointCall() + * Invokes either receive_reply, receive_exception, or receive_other, depending on the value of + * info.getEndingPointCall() */ @TraceInterceptor - void invokeClientInterceptorEndingPoint( ClientRequestInfoImpl info ) { + void invokeClientInterceptorEndingPoint(ClientRequestInfoImpl info) { // If invocation is not yet enabled, don't do anything. - if( info.interceptorsEnabledForThisRequest ) { + if (info.interceptorsEnabledForThisRequest) { try { // NOTE: It is assumed someplace else prepared a // fresh TSC slot table. - info.setCurrentExecutionPoint( - ClientRequestInfoImpl.EXECUTION_POINT_ENDING ); + info.setCurrentExecutionPoint(ClientRequestInfoImpl.EXECUTION_POINT_ENDING); // Get all ClientRequestInterceptors: - ClientRequestInterceptor[] clientInterceptors = - (ClientRequestInterceptor[])interceptorList. - getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT ); + ClientRequestInterceptor[] clientInterceptors = (ClientRequestInterceptor[]) interceptorList + .getInterceptors(InterceptorList.INTERCEPTOR_TYPE_CLIENT); int flowStackIndex = info.getFlowStackIndex(); // Determine whether we are calling receive_reply, @@ -369,12 +349,9 @@ void invokeClientInterceptorEndingPoint( ClientRequestInfoImpl info ) { // If we would be calling RECEIVE_REPLY, but this is a // one-way call, override this and call receive_other: - if( ( endingPointCall == - ClientRequestInfoImpl.CALL_RECEIVE_REPLY ) && - info.getIsOneWay() ) - { + if ((endingPointCall == ClientRequestInfoImpl.CALL_RECEIVE_REPLY) && info.getIsOneWay()) { endingPointCall = ClientRequestInfoImpl.CALL_RECEIVE_OTHER; - info.setEndingPointCall( endingPointCall ); + info.setEndingPointCall(endingPointCall); } // Only step through the interceptors whose starting points @@ -382,54 +359,51 @@ void invokeClientInterceptorEndingPoint( ClientRequestInfoImpl info ) { // Unlike the previous loop, this one counts backwards for a // reason - we must execute these in the reverse order of the // starting points. - for( int i = (flowStackIndex - 1); i >= 0; i-- ) { - ClientRequestInterceptor cri = clientInterceptors[i] ; + for (int i = (flowStackIndex - 1); i >= 0; i--) { + ClientRequestInterceptor cri = clientInterceptors[i]; try { - invokeClientEndingCall( cri.name(), - getClientEndMethodName( endingPointCall ) ) ; + invokeClientEndingCall(cri.name(), getClientEndMethodName(endingPointCall)); - switch( endingPointCall ) { + switch (endingPointCall) { case ClientRequestInfoImpl.CALL_RECEIVE_REPLY: - cri.receive_reply( info ); + cri.receive_reply(info); break; case ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION: - cri.receive_exception( info ); + cri.receive_exception(info); break; case ClientRequestInfoImpl.CALL_RECEIVE_OTHER: - cri.receive_other( info ); + cri.receive_other(info); break; } - } catch( ForwardRequest e ) { - invokeClientEndingForwardRequest( cri.name() ); + } catch (ForwardRequest e) { + invokeClientEndingForwardRequest(cri.name()); // as per PI spec (orbos/99-12-02 sec 5.2.1.), if // interception point throws a ForwardException, // ending point call changes to receive_other. - endingPointCall = - ClientRequestInfoImpl.CALL_RECEIVE_OTHER; - info.setEndingPointCall( endingPointCall ); - info.setReplyStatus( LOCATION_FORWARD.value ); - info.setForwardRequest( e ); - updateClientRequestDispatcherForward( info ); - } catch( SystemException e ) { - invokeClientEndingSystemException( cri.name(), e); + endingPointCall = ClientRequestInfoImpl.CALL_RECEIVE_OTHER; + info.setEndingPointCall(endingPointCall); + info.setReplyStatus(LOCATION_FORWARD.value); + info.setForwardRequest(e); + updateClientRequestDispatcherForward(info); + } catch (SystemException e) { + invokeClientEndingSystemException(cri.name(), e); // as per PI spec (orbos/99-12-02 sec 5.2.1.), if // interception point throws a SystemException, // ending point call changes to receive_exception. - endingPointCall = - ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION; - info.setEndingPointCall( endingPointCall ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); - info.setException( e ); + endingPointCall = ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION; + info.setEndingPointCall(endingPointCall); + info.setReplyStatus(SYSTEM_EXCEPTION.value); + info.setException(e); } } } finally { // See doc for setPICurrentPushed as to why this is necessary. // Check info for null in case errors happen before initiate. if (info.isPICurrentPushed()) { - current.popSlotTable( ); + current.popSlotTable(); // After the pop, original client's TSC slot table // remains avaiable via PICurrent. } @@ -443,24 +417,26 @@ void invokeClientInterceptorEndingPoint( ClientRequestInfoImpl info ) { **********************************************************************/ @InfoMethod - private void invokeServerStartingCall( String name ) { } + private void invokeServerStartingCall(String name) { + } @InfoMethod - private void invokeServerStartingForwardRequest( String name ) { } + private void invokeServerStartingForwardRequest(String name) { + } @InfoMethod - private void invokeServerStartingSystemException( String name, - SystemException exc ) { } + private void invokeServerStartingSystemException(String name, SystemException exc) { + } /** * Invokes receive_request_service_context interception points. */ @TraceInterceptor - void invokeServerInterceptorStartingPoint( ServerRequestInfoImpl info ) { - info.interceptorsEnabledForThisRequest = getEnabled() ; + void invokeServerInterceptorStartingPoint(ServerRequestInfoImpl info) { + info.interceptorsEnabledForThisRequest = getEnabled(); // If invocation is not yet enabled, don't do anything. - if( info.interceptorsEnabledForThisRequest ) { + if (info.interceptorsEnabledForThisRequest) { try { // Make a fresh slot table for RSC. current.pushSlotTable(); @@ -468,15 +444,13 @@ void invokeServerInterceptorStartingPoint( ServerRequestInfoImpl info ) { // Make a fresh slot table for TSC in case // interceptors need to make out calls. - current.pushSlotTable( ); + current.pushSlotTable(); - info.setCurrentExecutionPoint( - ServerRequestInfoImpl.EXECUTION_POINT_STARTING ); + info.setCurrentExecutionPoint(ServerRequestInfoImpl.EXECUTION_POINT_STARTING); // Get all ServerRequestInterceptors: - ServerRequestInterceptor[] serverInterceptors = - (ServerRequestInterceptor[])interceptorList. - getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER ); + ServerRequestInterceptor[] serverInterceptors = (ServerRequestInterceptor[]) interceptorList + .getInterceptors(InterceptorList.INTERCEPTOR_TYPE_SERVER); int size = serverInterceptors.length; // We will assume that all interceptors returned successfully, @@ -487,50 +461,46 @@ void invokeServerInterceptorStartingPoint( ServerRequestInfoImpl info ) { // Currently, there is only one server-side starting point // interceptor called receive_request_service_contexts. - for( int i = 0; continueProcessing && (i < size); i++ ) { - ServerRequestInterceptor sri = serverInterceptors[i] ; + for (int i = 0; continueProcessing && (i < size); i++) { + ServerRequestInterceptor sri = serverInterceptors[i]; try { - invokeServerStartingCall( sri.name() ); - sri.receive_request_service_contexts( info ); - } catch( ForwardRequest e ) { - invokeServerStartingForwardRequest( sri.name() ); + invokeServerStartingCall(sri.name()); + sri.receive_request_service_contexts(info); + } catch (ForwardRequest e) { + invokeServerStartingForwardRequest(sri.name()); // as per PI spec (orbos/99-12-02 sec 5.3.1.), if // interception point throws a ForwardRequest, // no other Interceptors' starting points are // called and send_other is called. flowStackIndex = i; - info.setForwardRequest( e ); - info.setIntermediatePointCall( - ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ); - info.setEndingPointCall( - ServerRequestInfoImpl.CALL_SEND_OTHER ); - info.setReplyStatus( LOCATION_FORWARD.value ); + info.setForwardRequest(e); + info.setIntermediatePointCall(ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE); + info.setEndingPointCall(ServerRequestInfoImpl.CALL_SEND_OTHER); + info.setReplyStatus(LOCATION_FORWARD.value); // For some reason, using break here causes the VM on // NT to lose track of the value of flowStackIndex - // after exiting the for loop. I changed this to + // after exiting the for loop. I changed this to // check a boolean value instead and it seems to work // fine. continueProcessing = false; - } catch( SystemException e ) { - invokeServerStartingSystemException( sri.name(), e); + } catch (SystemException e) { + invokeServerStartingSystemException(sri.name(), e); // as per PI spec (orbos/99-12-02 sec 5.3.1.), if // interception point throws a SystemException, // no other Interceptors' starting points are // called. flowStackIndex = i; - info.setException( e ); - info.setIntermediatePointCall( - ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ); - info.setEndingPointCall( - ServerRequestInfoImpl.CALL_SEND_EXCEPTION ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); + info.setException(e); + info.setIntermediatePointCall(ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE); + info.setEndingPointCall(ServerRequestInfoImpl.CALL_SEND_EXCEPTION); + info.setReplyStatus(SYSTEM_EXCEPTION.value); // For some reason, using break here causes the VM on // NT to lose track of the value of flowStackIndex - // after exiting the for loop. I changed this to + // after exiting the for loop. I changed this to // check a boolean value instead and it seems to // work fine. continueProcessing = false; @@ -538,130 +508,126 @@ void invokeServerInterceptorStartingPoint( ServerRequestInfoImpl info ) { } // Remember where we left off in the flow stack: - info.setFlowStackIndex( flowStackIndex ); + info.setFlowStackIndex(flowStackIndex); } finally { // The remaining points, ServantManager and Servant // all run in the same logical thread. - current.popSlotTable( ); + current.popSlotTable(); // Now TSC and RSC are equivalent. } } // end enabled check } @InfoMethod - private void invokeServerIntermediateCall( String name ) { } + private void invokeServerIntermediateCall(String name) { + } @InfoMethod - private void invokeServerIntermediateForwardRequest( String name ) { } + private void invokeServerIntermediateForwardRequest(String name) { + } @InfoMethod - private void invokeServerIntermediateSystemException( String name, - SystemException exc ) { } + private void invokeServerIntermediateSystemException(String name, SystemException exc) { + } /** * Invokes receive_request interception points */ @TraceInterceptor - void invokeServerInterceptorIntermediatePoint( - ServerRequestInfoImpl info ) { + void invokeServerInterceptorIntermediatePoint(ServerRequestInfoImpl info) { int intermediatePointCall = info.getIntermediatePointCall(); // If invocation is not yet enabled, don't do anything. - if( info.interceptorsEnabledForThisRequest && ( intermediatePointCall != - ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ) ) { + if (info.interceptorsEnabledForThisRequest && (intermediatePointCall != ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE)) { - // NOTE: do not touch the slotStack. The RSC and TSC are + // NOTE: do not touch the slotStack. The RSC and TSC are // equivalent at this point. - info.setCurrentExecutionPoint( - ServerRequestInfoImpl.EXECUTION_POINT_INTERMEDIATE ); + info.setCurrentExecutionPoint(ServerRequestInfoImpl.EXECUTION_POINT_INTERMEDIATE); // Get all ServerRequestInterceptors: - ServerRequestInterceptor[] serverInterceptors = - (ServerRequestInterceptor[]) - interceptorList.getInterceptors( - InterceptorList.INTERCEPTOR_TYPE_SERVER ); + ServerRequestInterceptor[] serverInterceptors = (ServerRequestInterceptor[]) interceptorList + .getInterceptors(InterceptorList.INTERCEPTOR_TYPE_SERVER); int size = serverInterceptors.length; // Currently, there is only one server-side intermediate point // interceptor called receive_request. - for( int i = 0; i < size; i++ ) { - ServerRequestInterceptor sri = serverInterceptors[i] ; + for (int i = 0; i < size; i++) { + ServerRequestInterceptor sri = serverInterceptors[i]; try { - invokeServerIntermediateCall( sri.name() ); - sri.receive_request( info ); - } catch( ForwardRequest e ) { - invokeServerIntermediateForwardRequest( sri.name() ); + invokeServerIntermediateCall(sri.name()); + sri.receive_request(info); + } catch (ForwardRequest e) { + invokeServerIntermediateForwardRequest(sri.name()); // as per PI spec (orbos/99-12-02 sec 5.3.1.), if // interception point throws a ForwardRequest, // no other Interceptors' intermediate points are // called and send_other is called. - info.setForwardRequest( e ); - info.setEndingPointCall( - ServerRequestInfoImpl.CALL_SEND_OTHER ); - info.setReplyStatus( LOCATION_FORWARD.value ); + info.setForwardRequest(e); + info.setEndingPointCall(ServerRequestInfoImpl.CALL_SEND_OTHER); + info.setReplyStatus(LOCATION_FORWARD.value); break; - } catch( SystemException e ) { - invokeServerIntermediateSystemException( sri.name(), e); + } catch (SystemException e) { + invokeServerIntermediateSystemException(sri.name(), e); // as per PI spec (orbos/99-12-02 sec 5.3.1.), if // interception point throws a SystemException, // no other Interceptors' starting points are // called. - info.setException( e ); - info.setEndingPointCall( - ServerRequestInfoImpl.CALL_SEND_EXCEPTION ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); + info.setException(e); + info.setEndingPointCall(ServerRequestInfoImpl.CALL_SEND_EXCEPTION); + info.setReplyStatus(SYSTEM_EXCEPTION.value); break; } } } // end enabled check } - private String getServerEndMethodName( int endingPointCall ) { - switch( endingPointCall ) { + private String getServerEndMethodName(int endingPointCall) { + switch (endingPointCall) { case ServerRequestInfoImpl.CALL_SEND_REPLY: - return "send_reply" ; + return "send_reply"; case ServerRequestInfoImpl.CALL_SEND_EXCEPTION: - return "send_exception" ; + return "send_exception"; case ServerRequestInfoImpl.CALL_SEND_OTHER: - return "send_other" ; + return "send_other"; } - return "" ; + return ""; } @InfoMethod - private void serverInvokeEndingPoint( String name, String call ) { } + private void serverInvokeEndingPoint(String name, String call) { + } @InfoMethod - private void caughtForwardRequest( String name ) { } + private void caughtForwardRequest(String name) { + } @InfoMethod - private void caughtSystemException( String name, SystemException ex ) { } + private void caughtSystemException(String name, SystemException ex) { + } /** - * Invokes either send_reply, send_exception, or send_other, - * depending on the value of info.getEndingPointCall() + * Invokes either send_reply, send_exception, or send_other, depending on the value of info.getEndingPointCall() */ @TraceInterceptor - void invokeServerInterceptorEndingPoint( ServerRequestInfoImpl info ) { + void invokeServerInterceptorEndingPoint(ServerRequestInfoImpl info) { // If invocation is not yet enabled, don't do anything. - if( info.interceptorsEnabledForThisRequest ) { + if (info.interceptorsEnabledForThisRequest) { try { - // NOTE: do not touch the slotStack. The RSC and TSC are + // NOTE: do not touch the slotStack. The RSC and TSC are // equivalent at this point. // REVISIT: This is moved out to PIHandlerImpl until dispatch - // path is rearchitected. It must be there so that + // path is rearchitected. It must be there so that // it always gets executed so if an interceptor raises // an exception any service contexts added in earlier points // this point get put in the exception reply (via the SC Q). // Get all ServerRequestInterceptors: - ServerRequestInterceptor[] serverInterceptors = - (ServerRequestInterceptor[])interceptorList. - getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER ); + ServerRequestInterceptor[] serverInterceptors = (ServerRequestInterceptor[]) interceptorList + .getInterceptors(InterceptorList.INTERCEPTOR_TYPE_SERVER); int flowStackIndex = info.getFlowStackIndex(); // Determine whether we are calling @@ -670,86 +636,81 @@ void invokeServerInterceptorEndingPoint( ServerRequestInfoImpl info ) { // Only step through the interceptors whose starting points // have successfully returned. - for( int i = (flowStackIndex - 1); i >= 0; i-- ) { - ServerRequestInterceptor sri = serverInterceptors[i] ; + for (int i = (flowStackIndex - 1); i >= 0; i--) { + ServerRequestInterceptor sri = serverInterceptors[i]; try { - serverInvokeEndingPoint( sri.name(), - getServerEndMethodName( endingPointCall ) ) ; + serverInvokeEndingPoint(sri.name(), getServerEndMethodName(endingPointCall)); - switch( endingPointCall ) { + switch (endingPointCall) { case ServerRequestInfoImpl.CALL_SEND_REPLY: - sri.send_reply( info ); + sri.send_reply(info); break; case ServerRequestInfoImpl.CALL_SEND_EXCEPTION: - sri.send_exception( info ); + sri.send_exception(info); break; case ServerRequestInfoImpl.CALL_SEND_OTHER: - sri.send_other( info ); + sri.send_other(info); break; } - } catch( ForwardRequest e ) { - caughtForwardRequest( sri.name() ) ; + } catch (ForwardRequest e) { + caughtForwardRequest(sri.name()); // as per PI spec (orbos/99-12-02 sec 5.3.1.), if // interception point throws a ForwardException, // ending point call changes to receive_other. - endingPointCall = - ServerRequestInfoImpl.CALL_SEND_OTHER; - info.setEndingPointCall( endingPointCall ); - info.setForwardRequest( e ); - info.setReplyStatus( LOCATION_FORWARD.value ); + endingPointCall = ServerRequestInfoImpl.CALL_SEND_OTHER; + info.setEndingPointCall(endingPointCall); + info.setForwardRequest(e); + info.setReplyStatus(LOCATION_FORWARD.value); info.setForwardRequestRaisedInEnding(); - } catch( SystemException e ) { - caughtSystemException( sri.name(), e ) ; + } catch (SystemException e) { + caughtSystemException(sri.name(), e); // as per PI spec (orbos/99-12-02 sec 5.3.1.), if // interception point throws a SystemException, // ending point call changes to send_exception. - endingPointCall = - ServerRequestInfoImpl.CALL_SEND_EXCEPTION; - info.setEndingPointCall( endingPointCall ); - info.setException( e ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); + endingPointCall = ServerRequestInfoImpl.CALL_SEND_EXCEPTION; + info.setEndingPointCall(endingPointCall); + info.setException(e); + info.setReplyStatus(SYSTEM_EXCEPTION.value); } } // Remember that all interceptors' starting and ending points // have already been executed so we need not do anything. - info.setAlreadyExecuted( true ); + info.setAlreadyExecuted(true); } finally { // Get rid of the Server side RSC. current.popSlotTable(); } } // end enabled check } - + /* ********************************************************************** * Private utility methods **********************************************************************/ - + /** - * Update the client delegate in the event of a ForwardRequest, given the - * information in the passed-in info object. + * Update the client delegate in the event of a ForwardRequest, given the information in the passed-in info object. */ @TraceInterceptor - private void updateClientRequestDispatcherForward( - ClientRequestInfoImpl info ) { + private void updateClientRequestDispatcherForward(ClientRequestInfoImpl info) { ForwardRequest forwardRequest = info.getForwardRequestException(); // ForwardRequest may be null if the forwarded IOR is set internal // to the ClientRequestDispatcher rather than explicitly through Portable - // Interceptors. In this case, we need not update the client + // Interceptors. In this case, we need not update the client // delegate ForwardRequest object. - if( forwardRequest != null ) { + if (forwardRequest != null) { org.omg.CORBA.Object object = forwardRequest.forward; // Convert the forward object into an IOR: - IOR ior = orb.getIOR( object, false ) ; - info.setLocatedIOR( ior ); + IOR ior = orb.getIOR(object, false); + info.setLocatedIOR(ior); } } - + } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/InterceptorList.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/InterceptorList.java index de7b834aa..bb24c9d32 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/InterceptorList.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/InterceptorList.java @@ -28,52 +28,44 @@ import java.util.List; import java.lang.reflect.Array; -import com.sun.corba.ee.spi.logging.InterceptorsSystemException ; +import com.sun.corba.ee.spi.logging.InterceptorsSystemException; -/** - * Provides a repository of registered Portable Interceptors, organized - * by type. This list is designed to be accessed as efficiently as - * possible during runtime, with the expense of added complexity during - * initialization and interceptor registration. The class is designed - * to easily allow for the addition of new interceptor types. +/** + * Provides a repository of registered Portable Interceptors, organized by type. This list is designed to be accessed as + * efficiently as possible during runtime, with the expense of added complexity during initialization and interceptor + * registration. The class is designed to easily allow for the addition of new interceptor types. */ public class InterceptorList { - private static final InterceptorsSystemException wrapper = - InterceptorsSystemException.self ; + private static final InterceptorsSystemException wrapper = InterceptorsSystemException.self; - // Interceptor type list. If additional interceptors are needed, + // Interceptor type list. If additional interceptors are needed, // add additional types in numerical order (do not skip numbers), // and update NUM_INTERCEPTOR_TYPES and classTypes accordingly. - // NUM_INTERCEPTOR_TYPES represents the number of interceptor + // NUM_INTERCEPTOR_TYPES represents the number of interceptor // types, so we know how many lists to maintain. - static final int INTERCEPTOR_TYPE_CLIENT = 0; - static final int INTERCEPTOR_TYPE_SERVER = 1; - static final int INTERCEPTOR_TYPE_IOR = 2; - - static final int NUM_INTERCEPTOR_TYPES = 3; - - // Array of class types for interceptors. This is used to create the - // appropriate array type for each interceptor type. These must + static final int INTERCEPTOR_TYPE_CLIENT = 0; + static final int INTERCEPTOR_TYPE_SERVER = 1; + static final int INTERCEPTOR_TYPE_IOR = 2; + + static final int NUM_INTERCEPTOR_TYPES = 3; + + // Array of class types for interceptors. This is used to create the + // appropriate array type for each interceptor type. These must // match the indices of the constants declared above. - static final Class[] classTypes = { - org.omg.PortableInterceptor.ClientRequestInterceptor.class, - org.omg.PortableInterceptor.ServerRequestInterceptor.class, - org.omg.PortableInterceptor.IORInterceptor.class - }; - + static final Class[] classTypes = { org.omg.PortableInterceptor.ClientRequestInterceptor.class, + org.omg.PortableInterceptor.ServerRequestInterceptor.class, org.omg.PortableInterceptor.IORInterceptor.class }; + // True if no further interceptors may be registered with this list. private boolean locked = false; - // List of interceptors currently registered. There are + // List of interceptors currently registered. There are // NUM_INTERCEPTOR_TYPES lists of registered interceptors. // For example, interceptors[INTERCEPTOR_TYPE_CLIENT] contains an array // of objects of type ClientRequestInterceptor. - private Interceptor[][] interceptors = - new Interceptor[NUM_INTERCEPTOR_TYPES][]; - + private Interceptor[][] interceptors = new Interceptor[NUM_INTERCEPTOR_TYPES][]; + /** - * Creates a new Interceptor List. Constructor is package scope so - * only the ORB can create it. + * Creates a new Interceptor List. Constructor is package scope so only the ORB can create it. */ InterceptorList() { // Create empty interceptors arrays for each type: @@ -81,122 +73,109 @@ public class InterceptorList { } /** - * Registers an interceptor of the given type into the interceptor list. - * The type is one of: + * Registers an interceptor of the given type into the interceptor list. The type is one of: *

    - *
  • INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor - *
  • INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor - *
  • INTERCEPTOR_TYPE_IOR - IORInterceptor + *
  • INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor + *
  • INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor + *
  • INTERCEPTOR_TYPE_IOR - IORInterceptor *
* - * @exception DuplicateName Thrown if an interceptor of the given - * name already exists for the given type. + * @exception DuplicateName Thrown if an interceptor of the given name already exists for the given type. */ - void register_interceptor( Interceptor interceptor, int type ) - throws DuplicateName - { + void register_interceptor(Interceptor interceptor, int type) throws DuplicateName { // If locked, deny any further addition of interceptors. - if( locked ) { - throw wrapper.interceptorListLocked() ; + if (locked) { + throw wrapper.interceptorListLocked(); } - + // Cache interceptor name: String interceptorName = interceptor.name(); - boolean anonymous = interceptorName.equals( "" ); + boolean anonymous = interceptorName.equals(""); boolean foundDuplicate = false; Interceptor[] interceptorList = interceptors[type]; - // If this is not an anonymous interceptor, + // If this is not an anonymous interceptor, // search for an interceptor of the same name in this category: - if( !anonymous ) { + if (!anonymous) { int size = interceptorList.length; // An O(n) search will suffice because register_interceptor is not // likely to be called often. - for( int i = 0; i < size; i++ ) { - Interceptor in = (Interceptor)interceptorList[i]; - if( in.name().equals( interceptorName ) ) { + for (int i = 0; i < size; i++) { + Interceptor in = (Interceptor) interceptorList[i]; + if (in.name().equals(interceptorName)) { foundDuplicate = true; break; } } } - if( !foundDuplicate ) { - growInterceptorArray( type ); - interceptors[type][interceptors[type].length-1] = interceptor; - } - else { - throw new DuplicateName( interceptorName ); + if (!foundDuplicate) { + growInterceptorArray(type); + interceptors[type][interceptors[type].length - 1] = interceptor; + } else { + throw new DuplicateName(interceptorName); } } /** - * Locks this interceptor list so that no more interceptors may be - * registered. This method is called after all interceptors are - * registered for security reasons. + * Locks this interceptor list so that no more interceptors may be registered. This method is called after all + * interceptors are registered for security reasons. */ void lock() { locked = true; } - + /** - * Retrieves an array of interceptors of the given type. For efficiency, - * the type parameter is assumed to be valid. + * Retrieves an array of interceptors of the given type. For efficiency, the type parameter is assumed to be valid. */ - Interceptor[] getInterceptors( int type ) { + Interceptor[] getInterceptors(int type) { return interceptors[type]; } /** - * Returns true if there is at least one interceptor of the given type, - * or false if not. + * Returns true if there is at least one interceptor of the given type, or false if not. */ - boolean hasInterceptorsOfType( int type ) { + boolean hasInterceptorsOfType(int type) { return interceptors[type].length > 0; } - + /** - * Initializes all interceptors arrays to zero-length arrays of the - * correct type, based on the classTypes list. + * Initializes all interceptors arrays to zero-length arrays of the correct type, based on the classTypes list. */ private void initInterceptorArrays() { - for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) { + for (int type = 0; type < NUM_INTERCEPTOR_TYPES; type++) { Class classType = classTypes[type]; - + // Create a zero-length array for each type: - interceptors[type] = - (Interceptor[])Array.newInstance( classType, 0 ); + interceptors[type] = (Interceptor[]) Array.newInstance(classType, 0); } } - + /** * Grows the given interceptor array by one: */ - private void growInterceptorArray( int type ) { + private void growInterceptorArray(int type) { Class classType = classTypes[type]; int currentLength = interceptors[type].length; Interceptor[] replacementArray; - - // Create new array to replace the old one. The new array will be + + // Create new array to replace the old one. The new array will be // one element larger but have the same type as the old one. - replacementArray = (Interceptor[]) - Array.newInstance( classType, currentLength + 1 ); - System.arraycopy( interceptors[type], 0, - replacementArray, 0, currentLength ); + replacementArray = (Interceptor[]) Array.newInstance(classType, currentLength + 1); + System.arraycopy(interceptors[type], 0, replacementArray, 0, currentLength); interceptors[type] = replacementArray; } /** - * Destroys all interceptors in this list by invoking their destroy() - * method. + * Destroys all interceptors in this list by invoking their destroy() method. */ void destroyAll() { int numTypes = interceptors.length; - for( int i = 0; i < numTypes; i++ ) { + for (int i = 0; i < numTypes; i++) { int numInterceptors = interceptors[i].length; - for( int j = 0; j < numInterceptors; j++ ) { + for (int j = 0; j < numInterceptors; j++) { interceptors[i][j].destroy(); } } @@ -211,14 +190,14 @@ void sortInterceptors() { int numTypes = interceptors.length; - for( int i = 0; i < numTypes; i++ ) { + for (int i = 0; i < numTypes; i++) { int numInterceptors = interceptors[i].length; if (numInterceptors > 0) { // Get fresh sorting bins for each non empty type. sorted = new ArrayList(); // not synchronized like we want. unsorted = new ArrayList(); } - for( int j = 0; j < numInterceptors; j++ ) { + for (int j = 0; j < numInterceptors; j++) { Interceptor interceptor = interceptors[i][j]; if (interceptor instanceof Comparable) { sorted.add(interceptor); @@ -231,26 +210,23 @@ void sortInterceptors() { // (i.e., ClassCastException and UnsupportedOperationException) // flow back to the user. // Note that this will cause an unchecked conversion warning - // because Interceptor is not Comparable. We rely on dynamic + // because Interceptor is not Comparable. We rely on dynamic // typing here: if an Interceptor is in the sorted list, - // it IS comparable by construction. I don't think there + // it IS comparable by construction. I don't think there // is any way to capture this in a Java type. - Collections.sort(List.class.cast( sorted )); + Collections.sort(List.class.cast(sorted)); Iterator sortedIterator = sorted.iterator(); Iterator unsortedIterator = unsorted.iterator(); - for( int j = 0; j < numInterceptors; j++ ) { + for (int j = 0; j < numInterceptors; j++) { if (sortedIterator.hasNext()) { - interceptors[i][j] = - sortedIterator.next(); + interceptors[i][j] = sortedIterator.next(); } else if (unsortedIterator.hasNext()) { - interceptors[i][j] = - unsortedIterator.next(); + interceptors[i][j] = unsortedIterator.next(); } else { - throw wrapper.sortSizeMismatch() ; + throw wrapper.sortSizeMismatch(); } } } } } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ORBInitInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ORBInitInfoImpl.java index 55f44bb6a..386139645 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ORBInitInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ORBInitInfoImpl.java @@ -32,29 +32,23 @@ import org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName; import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.legacy.interceptor.ORBInitInfoExt ; +import com.sun.corba.ee.spi.legacy.interceptor.ORBInitInfoExt; import com.sun.corba.ee.spi.logging.InterceptorsSystemException; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.spi.logging.OMGSystemException; /** - * ORBInitInfoImpl is the implementation of the ORBInitInfo class to be - * passed to ORBInitializers, as described in orbos/99-12-02. + * ORBInitInfoImpl is the implementation of the ORBInitInfo class to be passed to ORBInitializers, as described in + * orbos/99-12-02. */ -public final class ORBInitInfoImpl - extends org.omg.CORBA.LocalObject - implements ORBInitInfo, ORBInitInfoExt -{ +public final class ORBInitInfoImpl extends org.omg.CORBA.LocalObject implements ORBInitInfo, ORBInitInfoExt { // The ORB we are initializing private transient ORB orb; - - private static final InterceptorsSystemException wrapper = - InterceptorsSystemException.self ; - private static final ORBUtilSystemException orbutilWrapper = - ORBUtilSystemException.self ; - private static final OMGSystemException omgWrapper = - OMGSystemException.self ; + + private static final InterceptorsSystemException wrapper = InterceptorsSystemException.self; + private static final ORBUtilSystemException orbutilWrapper = ORBUtilSystemException.self; + private static final OMGSystemException omgWrapper = OMGSystemException.self; // The arguments passed to ORB_init private String[] args; @@ -62,7 +56,7 @@ public final class ORBInitInfoImpl // The ID of the ORB being initialized private String orbId; - // The CodecFactory + // The CodecFactory private CodecFactory codecFactory; // The current stage of initialization @@ -78,48 +72,41 @@ public final class ORBInitInfoImpl public static final int STAGE_CLOSED = 2; // The description for the OBJECT_NOT_EXIST exception in STAGE_CLOSED - private static final String MESSAGE_ORBINITINFO_INVALID = - "ORBInitInfo object is only valid during ORB_init"; - + private static final String MESSAGE_ORBINITINFO_INVALID = "ORBInitInfo object is only valid during ORB_init"; + /** * Creates a new ORBInitInfoImpl object (scoped to package) * * @param args The arguments passed to ORB_init. */ - ORBInitInfoImpl( ORB orb, String[] args, - String orbId, CodecFactory codecFactory ) - { + ORBInitInfoImpl(ORB orb, String[] args, String orbId, CodecFactory codecFactory) { this.orb = orb; this.args = args; this.orbId = orbId; this.codecFactory = codecFactory; } - /** Return the ORB behind this ORBInitInfo. This is defined in the - * ORBInitInfoExt interface. + /** + * Return the ORB behind this ORBInitInfo. This is defined in the ORBInitInfoExt interface. */ - public ORB getORB() - { - return orb ; + public ORB getORB() { + return orb; } /** - * Sets the current stage we are in. This limits access to certain - * functionality. + * Sets the current stage we are in. This limits access to certain functionality. */ - void setStage( int stage ) { + void setStage(int stage) { this.stage = stage; } /** - * Throws an exception if the current stage is STAGE_CLOSED. - * This is called before any method is invoked to ensure that - * no method invocations are attempted after all calls to post_init() - * are completed. + * Throws an exception if the current stage is STAGE_CLOSED. This is called before any method is invoked to ensure that + * no method invocations are attempted after all calls to post_init() are completed. */ private void checkStage() { - if( stage == STAGE_CLOSED ) { - throw wrapper.orbinitinfoInvalid() ; + if (stage == STAGE_CLOSED) { + throw wrapper.orbinitinfoInvalid(); } } @@ -129,103 +116,94 @@ private void checkStage() { *******************************************************************/ /** - * This attribute contains the arguments passed to ORB_init. They may - * or may not contain the ORB's arguments + * This attribute contains the arguments passed to ORB_init. They may or may not contain the ORB's arguments */ - public String[] arguments () { + public String[] arguments() { checkStage(); - return args.clone() ; + return args.clone(); } /** * This attribute is the ID of the ORB being initialized */ - public String orb_id () { + public String orb_id() { checkStage(); return orbId; } /** - * This attribute is the IOP::CodecFactory. The CodecFactory is normally - * obtained via a call to ORB::resolve_initial_references( "CodecFactory" ) - * but since the ORB is not yet available and Interceptors, particularly - * when processing service contexts, will require a Codec, a means of - * obtaining a Codec is necessary during ORB intialization. + * This attribute is the IOP::CodecFactory. The CodecFactory is normally obtained via a call to + * ORB::resolve_initial_references( "CodecFactory" ) but since the ORB is not yet available and Interceptors, + * particularly when processing service contexts, will require a Codec, a means of obtaining a Codec is necessary during + * ORB intialization. */ - public CodecFactory codec_factory () { + public CodecFactory codec_factory() { checkStage(); return codecFactory; } /** - * See orbos/99-12-02, Chapter 11, Dynamic Initial References on page - * 11-81. This operation is identical to ORB::register_initial_reference - * described there. This same functionality exists here because the ORB, - * not yet fully initialized, is not yet available but initial references - * may need to be registered as part of Interceptor registration. + * See orbos/99-12-02, Chapter 11, Dynamic Initial References on page 11-81. This operation is identical to + * ORB::register_initial_reference described there. This same functionality exists here because the ORB, not yet fully + * initialized, is not yet available but initial references may need to be registered as part of Interceptor + * registration. *

* This method may not be called during post_init. */ - public void register_initial_reference( String id, - org.omg.CORBA.Object obj ) - throws InvalidName - { + public void register_initial_reference(String id, org.omg.CORBA.Object obj) throws InvalidName { checkStage(); - if( id == null ) nullParam(); + if (id == null) + nullParam(); - // As per CORBA 3.0 section 21.8.1, + // As per CORBA 3.0 section 21.8.1, // if null is passed as the obj parameter, // throw BAD_PARAM with minor code OMGSystemException.RIR_WITH_NULL_OBJECT. // Though the spec is talking about IDL null, we will address both // Java null and IDL null: // Note: Local Objects can never be nil! - if( obj == null ) { - throw omgWrapper.rirWithNullObject() ; + if (obj == null) { + throw omgWrapper.rirWithNullObject(); } - // Delegate to ORB. If ORB version throws InvalidName, convert to + // Delegate to ORB. If ORB version throws InvalidName, convert to // equivalent Portable Interceptors InvalidName. try { - orb.register_initial_reference( id, obj ); - } catch( org.omg.CORBA.ORBPackage.InvalidName e ) { - InvalidName exc = new InvalidName( e.getMessage() ); - exc.initCause( e ) ; - throw exc ; + orb.register_initial_reference(id, obj); + } catch (org.omg.CORBA.ORBPackage.InvalidName e) { + InvalidName exc = new InvalidName(e.getMessage()); + exc.initCause(e); + throw exc; } } /** - * This operation is only valid during post_init. It is identical to - * ORB::resolve_initial_references. This same functionality exists here - * because the ORB, not yet fully initialized, is not yet available, - * but initial references may be required from the ORB as part - * of Interceptor registration. + * This operation is only valid during post_init. It is identical to ORB::resolve_initial_references. This same + * functionality exists here because the ORB, not yet fully initialized, is not yet available, but initial references + * may be required from the ORB as part of Interceptor registration. *

* (incorporates changes from errata in orbos/00-01-01) *

* This method may not be called during pre_init. */ - public org.omg.CORBA.Object resolve_initial_references (String id) - throws InvalidName - { + public org.omg.CORBA.Object resolve_initial_references(String id) throws InvalidName { checkStage(); - if( id == null ) nullParam(); + if (id == null) + nullParam(); - if( stage == STAGE_PRE_INIT ) { - // Initializer is not allowed to invoke this method during + if (stage == STAGE_PRE_INIT) { + // Initializer is not allowed to invoke this method during // this stage. - // _REVISIT_ Spec issue: What exception should really be + // _REVISIT_ Spec issue: What exception should really be // thrown here? - throw wrapper.rirInvalidPreInit() ; + throw wrapper.rirInvalidPreInit(); } org.omg.CORBA.Object objRef = null; - + try { - objRef = orb.resolve_initial_references( id ); - } - catch( org.omg.CORBA.ORBPackage.InvalidName e ) { + objRef = orb.resolve_initial_references(id); + } catch (org.omg.CORBA.ORBPackage.InvalidName e) { // Convert PIDL to IDL exception: throw new InvalidName(); } @@ -234,118 +212,90 @@ public org.omg.CORBA.Object resolve_initial_references (String id) } // New method from CORBA 3.1 - public void add_client_request_interceptor_with_policy ( - ClientRequestInterceptor interceptor, Policy[] policies ) - throws DuplicateName - { - add_client_request_interceptor( interceptor ) ; + public void add_client_request_interceptor_with_policy(ClientRequestInterceptor interceptor, Policy[] policies) throws DuplicateName { + add_client_request_interceptor(interceptor); } /** - * This operation is used to add a client-side request Interceptor to - * the list of client-side request Interceptors. + * This operation is used to add a client-side request Interceptor to the list of client-side request Interceptors. *

- * If a client-side request Interceptor has already been registered - * with this Interceptor's name, DuplicateName is raised. + * If a client-side request Interceptor has already been registered with this Interceptor's name, DuplicateName is + * raised. */ - public void add_client_request_interceptor ( - ClientRequestInterceptor interceptor) - throws DuplicateName - { + public void add_client_request_interceptor(ClientRequestInterceptor interceptor) throws DuplicateName { checkStage(); - if( interceptor == null ) nullParam(); + if (interceptor == null) + nullParam(); - orb.getPIHandler().register_interceptor( interceptor, - InterceptorList.INTERCEPTOR_TYPE_CLIENT ); + orb.getPIHandler().register_interceptor(interceptor, InterceptorList.INTERCEPTOR_TYPE_CLIENT); } // New method from CORBA 3.1 - public void add_server_request_interceptor_with_policy ( - ServerRequestInterceptor interceptor, Policy[] policies ) - throws DuplicateName, PolicyError - { - add_server_request_interceptor( interceptor ) ; + public void add_server_request_interceptor_with_policy(ServerRequestInterceptor interceptor, Policy[] policies) + throws DuplicateName, PolicyError { + add_server_request_interceptor(interceptor); } /** - * This operation is used to add a server-side request Interceptor to - * the list of server-side request Interceptors. + * This operation is used to add a server-side request Interceptor to the list of server-side request Interceptors. *

- * If a server-side request Interceptor has already been registered - * with this Interceptor's name, DuplicateName is raised. + * If a server-side request Interceptor has already been registered with this Interceptor's name, DuplicateName is + * raised. */ - public void add_server_request_interceptor ( - ServerRequestInterceptor interceptor) - throws DuplicateName - { + public void add_server_request_interceptor(ServerRequestInterceptor interceptor) throws DuplicateName { checkStage(); - if( interceptor == null ) nullParam(); - - orb.getPIHandler().register_interceptor( interceptor, - InterceptorList.INTERCEPTOR_TYPE_SERVER ); + if (interceptor == null) + nullParam(); + + orb.getPIHandler().register_interceptor(interceptor, InterceptorList.INTERCEPTOR_TYPE_SERVER); } // New method from CORBA 3.1 - public void add_ior_interceptor_with_policy ( - IORInterceptor interceptor, Policy[] policies ) - throws DuplicateName, PolicyError - { - add_ior_interceptor( interceptor ) ; + public void add_ior_interceptor_with_policy(IORInterceptor interceptor, Policy[] policies) throws DuplicateName, PolicyError { + add_ior_interceptor(interceptor); } /** - * This operation is used to add an IOR Interceptor to - * the list of IOR Interceptors. + * This operation is used to add an IOR Interceptor to the list of IOR Interceptors. *

- * If an IOR Interceptor has already been registered - * with this Interceptor's name, DuplicateName is raised. + * If an IOR Interceptor has already been registered with this Interceptor's name, DuplicateName is raised. */ - public void add_ior_interceptor ( - IORInterceptor interceptor ) - throws DuplicateName - { + public void add_ior_interceptor(IORInterceptor interceptor) throws DuplicateName { checkStage(); - if( interceptor == null ) nullParam(); + if (interceptor == null) + nullParam(); - orb.getPIHandler().register_interceptor( interceptor, - InterceptorList.INTERCEPTOR_TYPE_IOR ); + orb.getPIHandler().register_interceptor(interceptor, InterceptorList.INTERCEPTOR_TYPE_IOR); } /** - * A service calls allocate_slot_id to allocate a slot on - * PortableInterceptor::Current. + * A service calls allocate_slot_id to allocate a slot on PortableInterceptor::Current. * * @return The index to the slot which has been allocated. */ - public int allocate_slot_id () { + public int allocate_slot_id() { checkStage(); - return ((PICurrent)orb.getPIHandler().getPICurrent()).allocateSlotId( ); + return ((PICurrent) orb.getPIHandler().getPICurrent()).allocateSlotId(); } /** * Register a PolicyFactory for the given PolicyType. *

- * If a PolicyFactory already exists for the given PolicyType, - * BAD_INV_ORDER is raised with a minor code of TBD_BIO+2. + * If a PolicyFactory already exists for the given PolicyType, BAD_INV_ORDER is raised with a minor code of TBD_BIO+2. */ - public void register_policy_factory( int type, - PolicyFactory policy_factory ) - { + public void register_policy_factory(int type, PolicyFactory policy_factory) { checkStage(); - if( policy_factory == null ) nullParam(); - orb.getPIHandler().registerPolicyFactory( type, policy_factory ); + if (policy_factory == null) + nullParam(); + orb.getPIHandler().registerPolicyFactory(type, policy_factory); } - /** - * Called when an invalid null parameter was passed. Throws a - * BAD_PARAM with a minor code of 1 + * Called when an invalid null parameter was passed. Throws a BAD_PARAM with a minor code of 1 */ - private void nullParam() - throws BAD_PARAM - { - throw orbutilWrapper.nullParam() ; + private void nullParam() throws BAD_PARAM { + throw orbutilWrapper.nullParam(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PICurrent.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PICurrent.java index 7c7098f1a..0774de7d5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PICurrent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PICurrent.java @@ -27,17 +27,12 @@ import org.omg.PortableInterceptor.InvalidSlot; /** - * PICurrent is the implementation of Current as specified in the Portable - * Interceptors Spec orbos/99-12-02. - * IMPORTANT: PICurrent is implemented with the assumption that get_slot() - * or set_slot() will not be called in ORBInitializer.pre_init() and - * post_init(). + * PICurrent is the implementation of Current as specified in the Portable Interceptors Spec orbos/99-12-02. IMPORTANT: + * PICurrent is implemented with the assumption that get_slot() or set_slot() will not be called in + * ORBInitializer.pre_init() and post_init(). */ -public class PICurrent extends org.omg.CORBA.LocalObject - implements Current -{ - private static final OMGSystemException wrapper = - OMGSystemException.self ; +public class PICurrent extends org.omg.CORBA.LocalObject implements Current { + private static final OMGSystemException wrapper = OMGSystemException.self; // slotCounter is used to keep track of ORBInitInfo.allocate_slot_id() private int slotCounter; @@ -51,19 +46,17 @@ public class PICurrent extends org.omg.CORBA.LocalObject // ThreadLocal contains a stack of SlotTable which are used // for resolve_initial_references( "PICurrent" ); - private transient ThreadLocal threadLocalSlotTable - = new ThreadLocal() { + private transient ThreadLocal threadLocalSlotTable = new ThreadLocal() { @Override - protected SlotTableStack initialValue( ) { - return new SlotTableStack( myORB, PICurrent.this ); - } - }; + protected SlotTableStack initialValue() { + return new SlotTableStack(myORB, PICurrent.this); + } + }; /** - * PICurrent constructor which will be called for every ORB - * initialization. + * PICurrent constructor which will be called for every ORB initialization. */ - PICurrent( ORB myORB ) { + PICurrent(ORB myORB) { this.myORB = myORB; this.orbInitializing = true; slotCounter = 0; @@ -75,95 +68,85 @@ public org.omg.CORBA.ORB _orb() { } synchronized int getTableSize() { - return slotCounter ; + return slotCounter; } /** - * This method will be called from ORBInitInfo.allocate_slot_id( ). - * simply returns a slot id by incrementing slotCounter. + * This method will be called from ORBInitInfo.allocate_slot_id( ). simply returns a slot id by incrementing + * slotCounter. */ - synchronized int allocateSlotId( ) { + synchronized int allocateSlotId() { int slotId = slotCounter; slotCounter = slotCounter + 1; return slotId; } /** - * This method gets the SlotTable which is on the top of the - * ThreadLocalStack. + * This method gets the SlotTable which is on the top of the ThreadLocalStack. */ - SlotTable getSlotTable( ) { + SlotTable getSlotTable() { SlotTable table = threadLocalSlotTable.get().peekSlotTable(); return table; } /** - * This method pushes a SlotTable on the SlotTableStack. When there is - * a resolve_initial_references("PICurrent") after this call. The new - * PICurrent will be returned. + * This method pushes a SlotTable on the SlotTableStack. When there is a resolve_initial_references("PICurrent") after + * this call. The new PICurrent will be returned. */ - void pushSlotTable( ) { + void pushSlotTable() { SlotTableStack st = threadLocalSlotTable.get(); - st.pushSlotTable( ); + st.pushSlotTable(); } - /** * This method pops a SlotTable on the SlotTableStack. */ - void popSlotTable( ) { + void popSlotTable() { SlotTableStack st = threadLocalSlotTable.get(); - st.popSlotTable( ); + st.popSlotTable(); } /** - * This method sets the slot data at the given slot id (index) in the - * Slot Table which is on the top of the SlotTableStack. + * This method sets the slot data at the given slot id (index) in the Slot Table which is on the top of the + * SlotTableStack. */ - public void set_slot( int id, Any data ) throws InvalidSlot - { - if( orbInitializing ) { + public void set_slot(int id, Any data) throws InvalidSlot { + if (orbInitializing) { // As per ptc/00-08-06 if the ORB is still initializing, disallow - // calls to get_slot and set_slot. If an attempt is made to call, + // calls to get_slot and set_slot. If an attempt is made to call, // throw a BAD_INV_ORDER. - throw wrapper.invalidPiCall3() ; + throw wrapper.invalidPiCall3(); } - getSlotTable().set_slot( id, data ); + getSlotTable().set_slot(id, data); } /** - * This method gets the slot data at the given slot id (index) from the - * Slot Table which is on the top of the SlotTableStack. + * This method gets the slot data at the given slot id (index) from the Slot Table which is on the top of the + * SlotTableStack. */ - public Any get_slot( int id ) throws InvalidSlot - { - if( orbInitializing ) { + public Any get_slot(int id) throws InvalidSlot { + if (orbInitializing) { // As per ptc/00-08-06 if the ORB is still initializing, disallow - // calls to get_slot and set_slot. If an attempt is made to call, + // calls to get_slot and set_slot. If an attempt is made to call, // throw a BAD_INV_ORDER. - throw wrapper.invalidPiCall4() ; + throw wrapper.invalidPiCall4(); } - return getSlotTable().get_slot( id ); + return getSlotTable().get_slot(id); } /** - * This method resets all the slot data to null in the - * Slot Table which is on the top of SlotTableStack. + * This method resets all the slot data to null in the Slot Table which is on the top of SlotTableStack. */ - void resetSlotTable( ) { + void resetSlotTable() { getSlotTable().resetSlots(); } /** - * Called from ORB when the ORBInitializers are about to start - * initializing. + * Called from ORB when the ORBInitializers are about to start initializing. */ - void setORBInitializing( boolean init ) { + void setORBInitializing(boolean init) { this.orbInitializing = init; } } - - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PIHandlerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PIHandlerImpl.java index 9b22a78a1..c412a552f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PIHandlerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PIHandlerImpl.java @@ -20,7 +20,7 @@ package com.sun.corba.ee.impl.interceptors; import java.util.*; - + import org.omg.CORBA.Any; import org.omg.CORBA.BAD_PARAM; import org.omg.CORBA.BAD_POLICY; @@ -43,7 +43,7 @@ import org.omg.PortableInterceptor.TRANSPORT_RETRY; import org.omg.PortableInterceptor.USER_EXCEPTION; import org.omg.PortableInterceptor.PolicyFactory; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; @@ -52,7 +52,7 @@ import com.sun.corba.ee.spi.protocol.MessageMediator; import com.sun.corba.ee.spi.protocol.ForwardException; import com.sun.corba.ee.spi.protocol.PIHandler; -import com.sun.corba.ee.spi.protocol.RetryType ; +import com.sun.corba.ee.spi.protocol.RetryType; import com.sun.corba.ee.spi.logging.InterceptorsSystemException; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; @@ -66,20 +66,16 @@ import org.glassfish.pfl.basic.func.NullaryFunction; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; -/** - * Provides portable interceptor functionality. +/** + * Provides portable interceptor functionality. */ @TraceInterceptor -public class PIHandlerImpl implements PIHandler -{ - private ORB orb ; +public class PIHandlerImpl implements PIHandler { + private ORB orb; - static final InterceptorsSystemException wrapper = - InterceptorsSystemException.self ; - static final ORBUtilSystemException orbutilWrapper = - ORBUtilSystemException.self ; - static final OMGSystemException omgWrapper = - OMGSystemException.self ; + static final InterceptorsSystemException wrapper = InterceptorsSystemException.self; + static final ORBUtilSystemException orbutilWrapper = ORBUtilSystemException.self; + static final OMGSystemException omgWrapper = OMGSystemException.self; // A unique id used in ServerRequestInfo. // This does not correspond to the GIOP request id. @@ -88,7 +84,7 @@ public class PIHandlerImpl implements PIHandler // Stores the codec factory for producing codecs CodecFactory codecFactory = null; - // The arguments passed to the application's main method. May be null. + // The arguments passed to the application's main method. May be null. // This is used for ORBInitializers and set from set_parameters. String[] arguments = null; @@ -96,9 +92,9 @@ public class PIHandlerImpl implements PIHandler private InterceptorList interceptorList; // Cached information for optimization - do we have any interceptors - // registered of the given types? Set during ORB initialization. + // registered of the given types? Set during ORB initialization. private boolean hasIORInterceptors; - private boolean hasClientInterceptors; // temp always true + private boolean hasClientInterceptors; // temp always true private boolean hasServerInterceptors; // The class responsible for invoking interceptors @@ -111,182 +107,177 @@ public class PIHandlerImpl implements PIHandler // ORBInitInfo.registerPolicyFactory() method. // Key for the table is PolicyType which is an Integer // Value is PolicyFactory. - private Map policyFactoryTable; - + private Map policyFactoryTable; + // Table to convert from a ReplyMessage.? to a PI replyStatus short. - // Note that this table relies on the order and constants of + // Note that this table relies on the order and constants of // ReplyMessage not to change. - private final static short REPLY_MESSAGE_TO_PI_REPLY_STATUS[] = { - SUCCESSFUL.value, // = ReplyMessage.NO_EXCEPTION - USER_EXCEPTION.value, // = ReplyMessage.USER_EXCEPTION - SYSTEM_EXCEPTION.value, // = ReplyMessage.SYSTEM_EXCEPTION - LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD - LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD_PERM - TRANSPORT_RETRY.value // = ReplyMessage.NEEDS_ADDRESSING_MODE + private final static short REPLY_MESSAGE_TO_PI_REPLY_STATUS[] = { SUCCESSFUL.value, // = ReplyMessage.NO_EXCEPTION + USER_EXCEPTION.value, // = ReplyMessage.USER_EXCEPTION + SYSTEM_EXCEPTION.value, // = ReplyMessage.SYSTEM_EXCEPTION + LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD + LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD_PERM + TRANSPORT_RETRY.value // = ReplyMessage.NEEDS_ADDRESSING_MODE }; - - static String getReplyStatus( int piReplyStatus ) { + + static String getReplyStatus(int piReplyStatus) { switch (piReplyStatus) { - case SUCCESSFUL.value: return "SUCCESSFUL" ; - case USER_EXCEPTION.value: return "USER_EXCEPTION" ; - case SYSTEM_EXCEPTION.value: return "SYSTEM_EXCEPTION" ; - case LOCATION_FORWARD.value: return "LOCATION_FORWARD" ; - case TRANSPORT_RETRY.value: return "TRANSPORT_RETRY" ; - default: return "UNINITIALIZED" ; + case SUCCESSFUL.value: + return "SUCCESSFUL"; + case USER_EXCEPTION.value: + return "USER_EXCEPTION"; + case SYSTEM_EXCEPTION.value: + return "SYSTEM_EXCEPTION"; + case LOCATION_FORWARD.value: + return "LOCATION_FORWARD"; + case TRANSPORT_RETRY.value: + return "TRANSPORT_RETRY"; + default: + return "UNINITIALIZED"; } } // ThreadLocal containing a stack to store client request info objects // and a disable count. - private ThreadLocal> - threadLocalClientRequestInfoStack = - new ThreadLocal>() { - @Override - protected RequestInfoStack initialValue() { - return new RequestInfoStack(); - } - }; + private ThreadLocal> threadLocalClientRequestInfoStack = new ThreadLocal>() { + @Override + protected RequestInfoStack initialValue() { + return new RequestInfoStack(); + } + }; // ThreadLocal containing the current server request info object. - private ThreadLocal> - threadLocalServerRequestInfoStack = - new ThreadLocal>() { - @Override - protected RequestInfoStack initialValue() { - return new RequestInfoStack(); - } - }; - + private ThreadLocal> threadLocalServerRequestInfoStack = new ThreadLocal>() { + @Override + protected RequestInfoStack initialValue() { + return new RequestInfoStack(); + } + }; + @TraceInterceptor public void close() { - orb = null ; - codecFactory = null ; - arguments = null ; - interceptorList = null ; - interceptorInvoker = null ; - current = null ; - policyFactoryTable = null ; - threadLocalClientRequestInfoStack = null ; - threadLocalServerRequestInfoStack = null ; + orb = null; + codecFactory = null; + arguments = null; + interceptorList = null; + interceptorInvoker = null; + current = null; + policyFactoryTable = null; + threadLocalClientRequestInfoStack = null; + threadLocalServerRequestInfoStack = null; } + // Class to contain all ThreadLocal data for ClientRequestInfo // maintenance. // // RequestInfoStack is used quite frequently. private static final class RequestInfoStack extends Stack { // Number of times a request has been made to disable interceptors. - // When this reaches 0, interception hooks are disabled. Any higher + // When this reaches 0, interception hooks are disabled. Any higher // value indicates they are enabled. // NOTE: The is only currently used on the client side. public int disableCount = 0; // Get FindBugs to shut up about not overridding equals. @Override - public boolean equals( Object o ) { - return super.equals( o ) ; + public boolean equals(Object o) { + return super.equals(o); } - + @Override public int hashCode() { - return super.hashCode() ; + return super.hashCode(); } } - - public PIHandlerImpl( ORB orb, String[] args ) { - this.orb = orb ; + + public PIHandlerImpl(ORB orb, String[] args) { + this.orb = orb; if (args == null) { - arguments = null ; + arguments = null; } else { - arguments = args.clone() ; + arguments = args.clone(); } // Create codec factory: - codecFactory = new CodecFactoryImpl( orb ); + codecFactory = new CodecFactoryImpl(orb); // Create new interceptor list: interceptorList = new InterceptorList(); // Create a new PICurrent. - current = new PICurrent( orb ); + current = new PICurrent(orb); // Create new interceptor invoker, initially disabled: - interceptorInvoker = new InterceptorInvoker( orb, interceptorList, - current ); + interceptorInvoker = new InterceptorInvoker(orb, interceptorList, current); // Register the PI current and Codec factory objects - orb.getLocalResolver().register( ORBConstants.PI_CURRENT_NAME, - NullaryFunction.Factory.makeConstant( - (org.omg.CORBA.Object)current ) ) ; - orb.getLocalResolver().register( ORBConstants.CODEC_FACTORY_NAME, - NullaryFunction.Factory.makeConstant( - (org.omg.CORBA.Object)codecFactory ) ) ; - hasClientInterceptors = true ; // Issue 11033: with the other changes, - // make sure this is true in case - // initialize gets called between - // initiateClientPIRequest and - // cleanupClientPIRequest. - hasServerInterceptors = true ; // same as hasClientInterceptors. + orb.getLocalResolver().register(ORBConstants.PI_CURRENT_NAME, NullaryFunction.Factory.makeConstant((org.omg.CORBA.Object) current)); + orb.getLocalResolver().register(ORBConstants.CODEC_FACTORY_NAME, + NullaryFunction.Factory.makeConstant((org.omg.CORBA.Object) codecFactory)); + hasClientInterceptors = true; // Issue 11033: with the other changes, + // make sure this is true in case + // initialize gets called between + // initiateClientPIRequest and + // cleanupClientPIRequest. + hasServerInterceptors = true; // same as hasClientInterceptors. } @TraceInterceptor public void initialize() { // If we have any orb initializers, make use of them: - if( orb.getORBData().getORBInitializers() != null ) { + if (orb.getORBData().getORBInitializers() != null) { // Create the ORBInitInfo object to pass to ORB intializers: ORBInitInfoImpl orbInitInfo = createORBInitInfo(); // Make sure get_slot and set_slot are not called from within // ORB initializers: - current.setORBInitializing( true ); + current.setORBInitializing(true); // Call pre_init on all ORB initializers: - preInitORBInitializers( orbInitInfo ); + preInitORBInitializers(orbInitInfo); // Call post_init on all ORB initializers: - postInitORBInitializers( orbInitInfo ); + postInitORBInitializers(orbInitInfo); // Proprietary: sort interceptors: interceptorList.sortInterceptors(); // Re-enable get_slot and set_slot to be called from within // ORB initializers: - current.setORBInitializing( false ); + current.setORBInitializing(false); // Ensure nobody makes any more calls on this object. - orbInitInfo.setStage( ORBInitInfoImpl.STAGE_CLOSED ); + orbInitInfo.setStage(ORBInitInfoImpl.STAGE_CLOSED); // Set cached flags indicating whether we have interceptors // registered of a given type. - hasIORInterceptors = interceptorList.hasInterceptorsOfType( - InterceptorList.INTERCEPTOR_TYPE_IOR ); + hasIORInterceptors = interceptorList.hasInterceptorsOfType(InterceptorList.INTERCEPTOR_TYPE_IOR); // This must always be true, so that using the new generic // RPC framework can pass info between the PI stack and the - // framework invocation stack. Temporary until Harold fixes - // this. Note that this must never be true until after the + // framework invocation stack. Temporary until Harold fixes + // this. Note that this must never be true until after the // ORBInitializer instances complete executing. // (KMC 11/17/09 (probably 5 years later): temporary is a long time! - //hasClientInterceptors = interceptorList.hasInterceptorsOfType( - //InterceptorList.INTERCEPTOR_TYPE_CLIENT ); + // hasClientInterceptors = interceptorList.hasInterceptorsOfType( + // InterceptorList.INTERCEPTOR_TYPE_CLIENT ); // hasClientInterceptors = true; // hasServerInterceptors = interceptorList.hasInterceptorsOfType( - // InterceptorList.INTERCEPTOR_TYPE_SERVER ); + // InterceptorList.INTERCEPTOR_TYPE_SERVER ); // Enable interceptor invoker (not necessary if no interceptors - // are registered). This should be the last stage of ORB + // are registered). This should be the last stage of ORB // initialization. - interceptorInvoker.setEnabled( true ); + interceptorInvoker.setEnabled(true); } } /** - * ptc/00-08-06 p 205: "When an application calls ORB::destroy, the ORB - * 1) waits for all requests in progress to complete - * 2) calls the Interceptor::destroy operation for each interceptor - * 3) completes destruction of the ORB" + * ptc/00-08-06 p 205: "When an application calls ORB::destroy, the ORB 1) waits for all requests in progress to + * complete 2) calls the Interceptor::destroy operation for each interceptor 3) completes destruction of the ORB" * - * This must be called at the end of ORB.destroy. Note that this is not - * part of the PIHandler interface, since ORBImpl implements the ORB interface. + * This must be called at the end of ORB.destroy. Note that this is not part of the PIHandler interface, since ORBImpl + * implements the ORB interface. */ @TraceInterceptor public void destroyInterceptors() { @@ -294,31 +285,29 @@ public void destroyInterceptors() { } @TraceInterceptor - public void objectAdapterCreated( ObjectAdapter oa ) { + public void objectAdapterCreated(ObjectAdapter oa) { if (!hasIORInterceptors) - return ; + return; - interceptorInvoker.objectAdapterCreated( oa ) ; + interceptorInvoker.objectAdapterCreated(oa); } @TraceInterceptor - public void adapterManagerStateChanged( int managerId, - short newState ) { + public void adapterManagerStateChanged(int managerId, short newState) { if (!hasIORInterceptors) - return ; + return; - interceptorInvoker.adapterManagerStateChanged( managerId, newState ) ; + interceptorInvoker.adapterManagerStateChanged(managerId, newState); } @TraceInterceptor - public void adapterStateChanged( ObjectReferenceTemplate[] - templates, short newState ) { + public void adapterStateChanged(ObjectReferenceTemplate[] templates, short newState) { if (!hasIORInterceptors) - return ; + return; - interceptorInvoker.adapterStateChanged( templates, newState ) ; + interceptorInvoker.adapterStateChanged(templates, newState); } /* @@ -328,87 +317,83 @@ public void adapterStateChanged( ObjectReferenceTemplate[] @TraceInterceptor public void disableInterceptorsThisThread() { - if( !hasClientInterceptors ) return; + if (!hasClientInterceptors) + return; - RequestInfoStack infoStack = - threadLocalClientRequestInfoStack.get(); + RequestInfoStack infoStack = threadLocalClientRequestInfoStack.get(); infoStack.disableCount++; } - + @TraceInterceptor public void enableInterceptorsThisThread() { - if( !hasClientInterceptors ) + if (!hasClientInterceptors) return; - RequestInfoStack infoStack = - threadLocalClientRequestInfoStack.get(); + RequestInfoStack infoStack = threadLocalClientRequestInfoStack.get(); infoStack.disableCount--; } - + @TraceInterceptor - public void invokeClientPIStartingPoint() - throws RemarshalException { + public void invokeClientPIStartingPoint() throws RemarshalException { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; + if (!hasClientInterceptors) + return; + if (!isClientPIEnabledForThisThread()) + return; // Invoke the starting interception points and record exception // and reply status info in the info object: ClientRequestInfoImpl info = peekClientRequestInfoImplStack(); - interceptorInvoker.invokeClientInterceptorStartingPoint( info ); + interceptorInvoker.invokeClientInterceptorStartingPoint(info); - // Check reply status. If we will not have another chance later + // Check reply status. If we will not have another chance later // to invoke the client ending points, do it now. short replyStatus = info.getReplyStatus(); - if( (replyStatus == SYSTEM_EXCEPTION.value) || - (replyStatus == LOCATION_FORWARD.value) ) { + if ((replyStatus == SYSTEM_EXCEPTION.value) || (replyStatus == LOCATION_FORWARD.value)) { // Note: Transport retry cannot happen here since this happens // before the request hits the wire. - Exception exception = invokeClientPIEndingPoint( - convertPIReplyStatusToReplyMessage( replyStatus ), - info.getException() ); - if( exception == null ) { - // Do not throw anything. Otherwise, it must be a + Exception exception = invokeClientPIEndingPoint(convertPIReplyStatusToReplyMessage(replyStatus), info.getException()); + if (exception == null) { + // Do not throw anything. Otherwise, it must be a // SystemException, UserException or RemarshalException. - } if( exception instanceof SystemException ) { - throw (SystemException)exception; - } else if( exception instanceof RemarshalException ) { - throw (RemarshalException)exception; - } else if( (exception instanceof UserException) || - (exception instanceof ApplicationException) ) { + } + if (exception instanceof SystemException) { + throw (SystemException) exception; + } else if (exception instanceof RemarshalException) { + throw (RemarshalException) exception; + } else if ((exception instanceof UserException) || (exception instanceof ApplicationException)) { // It should not be possible for an interceptor to throw - // a UserException. By asserting instead of throwing the + // a UserException. By asserting instead of throwing the // UserException, we need not declare anything but // RemarshalException in the throws clause. - throw wrapper.exceptionInvalid() ; + throw wrapper.exceptionInvalid(); } - } else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) { - throw wrapper.replyStatusNotInit() ; + } else if (replyStatus != ClientRequestInfoImpl.UNINITIALIZED) { + throw wrapper.replyStatusNotInit(); } } // Needed when an error forces a retry AFTER initiateClientPIRequest // but BEFORE invokeClientPIStartingPoint. - public Exception makeCompletedClientRequest( int replyStatus, - Exception exception ) { + public Exception makeCompletedClientRequest(int replyStatus, Exception exception) { // 6763340 - return handleClientPIEndingPoint( replyStatus, exception, false ) ; + return handleClientPIEndingPoint(replyStatus, exception, false); } - public Exception invokeClientPIEndingPoint( int replyStatus, - Exception exception ) { + public Exception invokeClientPIEndingPoint(int replyStatus, Exception exception) { // 6763340 - return handleClientPIEndingPoint( replyStatus, exception, true ) ; + return handleClientPIEndingPoint(replyStatus, exception, true); } @TraceInterceptor - public Exception handleClientPIEndingPoint( - int replyStatus, Exception exception, boolean invokeEndingPoint ) { - if( !hasClientInterceptors ) return exception; - if( !isClientPIEnabledForThisThread() ) return exception; + public Exception handleClientPIEndingPoint(int replyStatus, Exception exception, boolean invokeEndingPoint) { + if (!hasClientInterceptors) + return exception; + if (!isClientPIEnabledForThisThread()) + return exception; // Translate ReplyMessage.replyStatus into PI replyStatus: // Note: this is also an assertion to make sure a valid replyStatus @@ -418,33 +403,31 @@ public Exception handleClientPIEndingPoint( // Invoke the ending interception points and record exception // and reply status info in the info object: ClientRequestInfoImpl info = peekClientRequestInfoImplStack(); - info.setReplyStatus( piReplyStatus ); - info.setException( exception ); + info.setReplyStatus(piReplyStatus); + info.setException(exception); if (invokeEndingPoint) { // 6763340 - interceptorInvoker.invokeClientInterceptorEndingPoint( info ); + interceptorInvoker.invokeClientInterceptorEndingPoint(info); piReplyStatus = info.getReplyStatus(); } // Check reply status: - if( (piReplyStatus == LOCATION_FORWARD.value) || - (piReplyStatus == TRANSPORT_RETRY.value) ) { + if ((piReplyStatus == LOCATION_FORWARD.value) || (piReplyStatus == TRANSPORT_RETRY.value)) { // If this is a forward or a retry, reset and reuse // info object: info.reset(); // fix for 6763340: if (invokeEndingPoint) { - info.setRetryRequest( RetryType.AFTER_RESPONSE ) ; + info.setRetryRequest(RetryType.AFTER_RESPONSE); } else { - info.setRetryRequest( RetryType.BEFORE_RESPONSE ) ; + info.setRetryRequest(RetryType.BEFORE_RESPONSE); } // ... and return a RemarshalException so the orb internals know exception = new RemarshalException(); - } else if( (piReplyStatus == SYSTEM_EXCEPTION.value) || - (piReplyStatus == USER_EXCEPTION.value) ) { + } else if ((piReplyStatus == SYSTEM_EXCEPTION.value) || (piReplyStatus == USER_EXCEPTION.value)) { exception = info.getException(); } @@ -453,43 +436,47 @@ public Exception handleClientPIEndingPoint( } @InfoMethod - private void secondCallForADIIRequest() { } + private void secondCallForADIIRequest() { + } @InfoMethod - private void normalCall() { } + private void normalCall() { + } @InfoMethod - private void clientInfoStackWasPushed() { } + private void clientInfoStackWasPushed() { + } @TraceInterceptor - public void initiateClientPIRequest( boolean diiRequest ) { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; + public void initiateClientPIRequest(boolean diiRequest) { + if (!hasClientInterceptors) + return; + if (!isClientPIEnabledForThisThread()) + return; // Get the most recent info object from the thread local // ClientRequestInfoImpl stack: - RequestInfoStack infoStack = - threadLocalClientRequestInfoStack.get(); + RequestInfoStack infoStack = threadLocalClientRequestInfoStack.get(); ClientRequestInfoImpl info = null; - if (!infoStack.empty() ) { + if (!infoStack.empty()) { info = infoStack.peek(); } - if (!diiRequest && (info != null) && info.isDIIInitiate() ) { + if (!diiRequest && (info != null) && info.isDIIInitiate()) { // In RequestImpl.doInvocation we already called // initiateClientPIRequest( true ), so ignore this initiate. secondCallForADIIRequest(); - info.setDIIInitiate( false ); + info.setDIIInitiate(false); } else { // If there is no info object or if we are not retrying a request, // push a new ClientRequestInfoImpl on the stack: normalCall(); // 6763340: don't push unless this is not a retry - if( (info == null) || !info.getRetryRequest().isRetry() ) { - info = new ClientRequestInfoImpl( orb ); - infoStack.push( info ); + if ((info == null) || !info.getRetryRequest().isRetry()) { + info = new ClientRequestInfoImpl(orb); + infoStack.push(info); clientInfoStackWasPushed(); // Note: the entry count is automatically initialized to 0. } @@ -497,35 +484,38 @@ public void initiateClientPIRequest( boolean diiRequest ) { // Reset the retry request flag so that recursive calls will // push a new info object, and bump up entry count so we know // when to pop this info object: - info.setRetryRequest( RetryType.NONE ); + info.setRetryRequest(RetryType.NONE); info.incrementEntryCount(); // KMC 6763340: I don't know why this wasn't set earlier, // but we do not want a retry to pick up the previous - // reply status, so clear it here. Most likely a new + // reply status, so clear it here. Most likely a new // info was pushed before, so that this was not a problem. - info.setReplyStatus( RequestInfoImpl.UNINITIALIZED ) ; + info.setReplyStatus(RequestInfoImpl.UNINITIALIZED); // If this is a DII request, make sure we ignore the next initiate. - if( diiRequest ) { - info.setDIIInitiate( true ); + if (diiRequest) { + info.setDIIInitiate(true); } } } @InfoMethod - private void clientInfoStackWasPopped() { } - + private void clientInfoStackWasPopped() { + } + @TraceInterceptor public void cleanupClientPIRequest() { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; + if (!hasClientInterceptors) + return; + if (!isClientPIEnabledForThisThread()) + return; ClientRequestInfoImpl info = peekClientRequestInfoImplStack(); - RetryType rt = info.getRetryRequest() ; + RetryType rt = info.getRetryRequest(); // fix for 6763340 - if (!rt.equals( RetryType.BEFORE_RESPONSE )) { + if (!rt.equals(RetryType.BEFORE_RESPONSE)) { // If the replyStatus has not yet been set, this is an indication // that the ORB threw an exception before we had a chance to // invoke the client interceptor ending points. @@ -535,9 +525,8 @@ public void cleanupClientPIRequest() { // to gracefully handle this in any of the calling code. // This is a rare corner case, so we will ignore this for now. short replyStatus = info.getReplyStatus(); - if (replyStatus == ClientRequestInfoImpl.UNINITIALIZED ) { - invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION, - wrapper.unknownRequestInvoke() ) ; + if (replyStatus == ClientRequestInfoImpl.UNINITIALIZED) { + invokeClientPIEndingPoint(ReplyMessage.SYSTEM_EXCEPTION, wrapper.unknownRequestInvoke()); } } @@ -546,97 +535,98 @@ public void cleanupClientPIRequest() { // fix for 6763340, and probably other cases (non-recursive retry) if (info.getEntryCount() == 0 && !info.getRetryRequest().isRetry()) { - RequestInfoStack infoStack = - threadLocalClientRequestInfoStack.get(); + RequestInfoStack infoStack = threadLocalClientRequestInfoStack.get(); infoStack.pop(); clientInfoStackWasPopped(); } } @TraceInterceptor - public void setClientPIInfo(MessageMediator messageMediator) - { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; + public void setClientPIInfo(MessageMediator messageMediator) { + if (!hasClientInterceptors) + return; + if (!isClientPIEnabledForThisThread()) + return; peekClientRequestInfoImplStack().setInfo(messageMediator); } - + @TraceInterceptor - public void setClientPIInfo( RequestImpl requestImpl ) { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; + public void setClientPIInfo(RequestImpl requestImpl) { + if (!hasClientInterceptors) + return; + if (!isClientPIEnabledForThisThread()) + return; - peekClientRequestInfoImplStack().setDIIRequest( requestImpl ); + peekClientRequestInfoImplStack().setDIIRequest(requestImpl); } - + /* ***************** * Server PI hooks *****************/ - + @TraceInterceptor public void invokeServerPIStartingPoint() { - if( !hasServerInterceptors ) return; + if (!hasServerInterceptors) + return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - interceptorInvoker.invokeServerInterceptorStartingPoint( info ); + interceptorInvoker.invokeServerInterceptorStartingPoint(info); // Handle SystemException or ForwardRequest: - serverPIHandleExceptions( info ); + serverPIHandleExceptions(info); } @TraceInterceptor public void invokeServerPIIntermediatePoint() { - if( !hasServerInterceptors ) return; + if (!hasServerInterceptors) + return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - interceptorInvoker.invokeServerInterceptorIntermediatePoint( info ); + interceptorInvoker.invokeServerInterceptorIntermediatePoint(info); // Clear servant from info object so that the user has control over // its lifetime: info.releaseServant(); // Handle SystemException or ForwardRequest: - serverPIHandleExceptions( info ); + serverPIHandleExceptions(info); } - + @TraceInterceptor - public void invokeServerPIEndingPoint( ReplyMessage replyMessage ) { - if( !hasServerInterceptors ) return; + public void invokeServerPIEndingPoint(ReplyMessage replyMessage) { + if (!hasServerInterceptors) + return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); // REVISIT: This needs to be done "early" for the following workaround. - info.setReplyMessage( replyMessage ); + info.setReplyMessage(replyMessage); // REVISIT: This was done inside of invokeServerInterceptorEndingPoint - // but needs to be here for now. See comment in that method for why. - info.setCurrentExecutionPoint( - ServerRequestInfoImpl.EXECUTION_POINT_ENDING ); + // but needs to be here for now. See comment in that method for why. + info.setCurrentExecutionPoint(ServerRequestInfoImpl.EXECUTION_POINT_ENDING); // It is possible we might have entered this method more than // once (e.g. if an ending point threw a SystemException, then // a new ServerResponseImpl is created). - if( !info.getAlreadyExecuted() ) { + if (!info.getAlreadyExecuted()) { int replyStatus = replyMessage.getReplyStatus(); // Translate ReplyMessage.replyStatus into PI replyStatus: // Note: this is also an assertion to make sure a valid // replyStatus is passed in (IndexOutOfBoundsException will be // thrown otherwise) - short piReplyStatus = - REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus]; + short piReplyStatus = REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus]; // Make forwarded IOR available to interceptors, if applicable: - if( ( piReplyStatus == LOCATION_FORWARD.value ) || - ( piReplyStatus == TRANSPORT_RETRY.value ) ) - { - info.setForwardRequest( replyMessage.getIOR() ); + if ((piReplyStatus == LOCATION_FORWARD.value) || (piReplyStatus == TRANSPORT_RETRY.value)) { + info.setForwardRequest(replyMessage.getIOR()); } // REVISIT: Do early above for now. // Make reply message available to interceptors: - //info.setReplyMessage( replyMessage ); + // info.setReplyMessage( replyMessage ); // Remember exception so we can tell if an interceptor changed it. Exception prevException = info.getException(); @@ -644,234 +634,221 @@ public void invokeServerPIEndingPoint( ReplyMessage replyMessage ) { // _REVISIT_ We do not have access to the User Exception at // this point, so treat it as an UNKNOWN for now. // Note that if this is a DSI call, we do have the user exception. - if( !info.isDynamic() && - (piReplyStatus == USER_EXCEPTION.value) ) - { - info.setException( omgWrapper.unknownUserException() ) ; + if (!info.isDynamic() && (piReplyStatus == USER_EXCEPTION.value)) { + info.setException(omgWrapper.unknownUserException()); } // Invoke the ending interception points: - info.setReplyStatus( piReplyStatus ); - interceptorInvoker.invokeServerInterceptorEndingPoint( info ); + info.setReplyStatus(piReplyStatus); + interceptorInvoker.invokeServerInterceptorEndingPoint(info); short newPIReplyStatus = info.getReplyStatus(); Exception newException = info.getException(); - // Check reply status. If an interceptor threw a SystemException + // Check reply status. If an interceptor threw a SystemException // and it is different than the one that we came in with, // rethrow it so the proper response can be constructed: - if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) && - ( newException != prevException ) ) - { - throw (SystemException)newException; + if ((newPIReplyStatus == SYSTEM_EXCEPTION.value) && (newException != prevException)) { + throw (SystemException) newException; } // If we are to forward the location: - if( newPIReplyStatus == LOCATION_FORWARD.value ) { - if( piReplyStatus != LOCATION_FORWARD.value ) { + if (newPIReplyStatus == LOCATION_FORWARD.value) { + if (piReplyStatus != LOCATION_FORWARD.value) { // Treat a ForwardRequest as a ForwardException. IOR ior = info.getForwardRequestIOR(); - throw new ForwardException( orb, ior ) ; - } - else if( info.isForwardRequestRaisedInEnding() ) { + throw new ForwardException(orb, ior); + } else if (info.isForwardRequestRaisedInEnding()) { // Treat a ForwardRequest by changing the IOR. - replyMessage.setIOR( info.getForwardRequestIOR() ); + replyMessage.setIOR(info.getForwardRequestIOR()); } } } } - + @TraceInterceptor - public void setServerPIInfo( Exception exception ) { - if( !hasServerInterceptors ) return; + public void setServerPIInfo(Exception exception) { + if (!hasServerInterceptors) + return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setException( exception ); + info.setException(exception); } @TraceInterceptor - public void setServerPIInfo( NVList arguments ) { - if( !hasServerInterceptors ) return; + public void setServerPIInfo(NVList arguments) { + if (!hasServerInterceptors) + return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setDSIArguments( arguments ); + info.setDSIArguments(arguments); } @TraceInterceptor - public void setServerPIExceptionInfo( Any exception ) { - if( !hasServerInterceptors ) return; + public void setServerPIExceptionInfo(Any exception) { + if (!hasServerInterceptors) + return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setDSIException( exception ); + info.setDSIException(exception); } @TraceInterceptor - public void setServerPIInfo( Any result ) { - if( !hasServerInterceptors ) return; + public void setServerPIInfo(Any result) { + if (!hasServerInterceptors) + return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setDSIResult( result ); + info.setDSIResult(result); } @InfoMethod - private void serverInfoStackWasPushed() { } + private void serverInfoStackWasPushed() { + } @InfoMethod - private void serverInfoStackWasPopped() { } + private void serverInfoStackWasPopped() { + } @TraceInterceptor - public void initializeServerPIInfo( MessageMediator request, - ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp ) { + public void initializeServerPIInfo(MessageMediator request, ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp) { - if( !hasServerInterceptors ) return; + if (!hasServerInterceptors) + return; - RequestInfoStack infoStack = - threadLocalServerRequestInfoStack.get(); - ServerRequestInfoImpl info = new ServerRequestInfoImpl( orb ); - infoStack.push( info ); + RequestInfoStack infoStack = threadLocalServerRequestInfoStack.get(); + ServerRequestInfoImpl info = new ServerRequestInfoImpl(orb); + infoStack.push(info); serverInfoStackWasPushed(); // Notify request object that once response is constructed, make // sure we execute ending points. - request.setExecutePIInResponseConstructor( true ); + request.setExecutePIInResponseConstructor(true); - info.setInfo( request, oa, objectId, oktemp ); + info.setInfo(request, oa, objectId, oktemp); } - + @TraceInterceptor - public void setServerPIInfo( java.lang.Object servant, - String targetMostDerivedInterface ) { - if( !hasServerInterceptors ) return; + public void setServerPIInfo(java.lang.Object servant, String targetMostDerivedInterface) { + if (!hasServerInterceptors) + return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setInfo( servant, targetMostDerivedInterface ); + info.setInfo(servant, targetMostDerivedInterface); } @TraceInterceptor public void cleanupServerPIRequest() { - if( !hasServerInterceptors ) return; + if (!hasServerInterceptors) + return; - RequestInfoStack infoStack = - threadLocalServerRequestInfoStack.get(); + RequestInfoStack infoStack = threadLocalServerRequestInfoStack.get(); infoStack.pop(); serverInfoStackWasPopped(); } - - /* + + /* ********************************************************************** - * The following methods are private utility methods. + * The following methods are private utility methods. ************************************************************************/ /** - * Handles exceptions for the starting and intermediate points for - * server request interceptors. This is common code that has been - * factored out into this utility method. + * Handles exceptions for the starting and intermediate points for server request interceptors. This is common code that + * has been factored out into this utility method. *

* This method will NOT work for ending points. */ @TraceInterceptor - private void serverPIHandleExceptions( ServerRequestInfoImpl info ) { + private void serverPIHandleExceptions(ServerRequestInfoImpl info) { int endingPointCall = info.getEndingPointCall(); - if(endingPointCall == ServerRequestInfoImpl.CALL_SEND_EXCEPTION) { + if (endingPointCall == ServerRequestInfoImpl.CALL_SEND_EXCEPTION) { // If a system exception was thrown, throw it to caller: - throw (SystemException)info.getException(); - } - else if( (endingPointCall == ServerRequestInfoImpl.CALL_SEND_OTHER) && - (info.getForwardRequestException() != null) ) - { + throw (SystemException) info.getException(); + } else if ((endingPointCall == ServerRequestInfoImpl.CALL_SEND_OTHER) && (info.getForwardRequestException() != null)) { // If an interceptor throws a forward request, convert it // into a ForwardException for easier handling: IOR ior = info.getForwardRequestIOR(); - throw new ForwardException( orb, ior ); + throw new ForwardException(orb, ior); } } /** - * Utility method to convert a PI reply status short to a ReplyMessage - * constant. This is a reverse lookup on the table defined in - * REPLY_MESSAGE_TO_PI_REPLY_STATUS. The reverse lookup need not be - * performed as quickly since it is only executed in exception - * conditions. + * Utility method to convert a PI reply status short to a ReplyMessage constant. This is a reverse lookup on the table + * defined in REPLY_MESSAGE_TO_PI_REPLY_STATUS. The reverse lookup need not be performed as quickly since it is only + * executed in exception conditions. */ @TraceInterceptor - private int convertPIReplyStatusToReplyMessage( short replyStatus ) { + private int convertPIReplyStatusToReplyMessage(short replyStatus) { int result = 0; - for( int i = 0; i < REPLY_MESSAGE_TO_PI_REPLY_STATUS.length; i++ ) { - if( REPLY_MESSAGE_TO_PI_REPLY_STATUS[i] == replyStatus ) { + for (int i = 0; i < REPLY_MESSAGE_TO_PI_REPLY_STATUS.length; i++) { + if (REPLY_MESSAGE_TO_PI_REPLY_STATUS[i] == replyStatus) { result = i; break; } } return result; } - - /** - * Convenience method to get the ClientRequestInfoImpl object off the - * top of the ThreadLocal stack. Throws an INTERNAL exception if - * the Info stack is empty. + + /** + * Convenience method to get the ClientRequestInfoImpl object off the top of the ThreadLocal stack. Throws an INTERNAL + * exception if the Info stack is empty. */ @TraceInterceptor private ClientRequestInfoImpl peekClientRequestInfoImplStack() { - RequestInfoStack infoStack = - threadLocalClientRequestInfoStack.get(); + RequestInfoStack infoStack = threadLocalClientRequestInfoStack.get(); ClientRequestInfoImpl info = null; - if( !infoStack.empty() ) { + if (!infoStack.empty()) { info = infoStack.peek(); } else { - throw wrapper.clientInfoStackNull() ; + throw wrapper.clientInfoStackNull(); } return info; } - /** - * Convenience method to get the ServerRequestInfoImpl object off the - * top of the ThreadLocal stack. Returns null if there are none. + /** + * Convenience method to get the ServerRequestInfoImpl object off the top of the ThreadLocal stack. Returns null if + * there are none. */ @TraceInterceptor private ServerRequestInfoImpl peekServerRequestInfoImplStack() { - RequestInfoStack infoStack = - threadLocalServerRequestInfoStack.get(); + RequestInfoStack infoStack = threadLocalServerRequestInfoStack.get(); ServerRequestInfoImpl info = null; - if( !infoStack.empty() ) { + if (!infoStack.empty()) { info = infoStack.peek(); } else { - throw wrapper.serverInfoStackNull() ; + throw wrapper.serverInfoStackNull(); } return info; } - + /** - * Convenience method to determine whether Client PI is enabled - * for requests on this thread. + * Convenience method to determine whether Client PI is enabled for requests on this thread. */ @TraceInterceptor private boolean isClientPIEnabledForThisThread() { - RequestInfoStack infoStack = - threadLocalClientRequestInfoStack.get(); + RequestInfoStack infoStack = threadLocalClientRequestInfoStack.get(); return (infoStack.disableCount == 0); } - + /** * Call pre_init on all ORB initializers */ @TraceInterceptor - private void preInitORBInitializers( ORBInitInfoImpl info ) { + private void preInitORBInitializers(ORBInitInfoImpl info) { // Inform ORBInitInfo we are in pre_init stage - info.setStage( ORBInitInfoImpl.STAGE_PRE_INIT ); + info.setStage(ORBInitInfoImpl.STAGE_PRE_INIT); // Step through each initializer instantiation and call its - // pre_init. Ignore any exceptions. - for( int i = 0; i < orb.getORBData().getORBInitializers().length; - i++ ) { + // pre_init. Ignore any exceptions. + for (int i = 0; i < orb.getORBData().getORBInitializers().length; i++) { ORBInitializer init = orb.getORBData().getORBInitializers()[i]; - if( init != null ) { + if (init != null) { try { - init.pre_init( info ); - } - catch( Exception e ) { + init.pre_init(info); + } catch (Exception e) { // As per orbos/99-12-02, section 9.3.1.2, "If there are // any exceptions, the ORB shall ignore them and proceed." } @@ -883,20 +860,18 @@ private void preInitORBInitializers( ORBInitInfoImpl info ) { * Call post_init on all ORB initializers */ @TraceInterceptor - private void postInitORBInitializers( ORBInitInfoImpl info ) { + private void postInitORBInitializers(ORBInitInfoImpl info) { // Inform ORBInitInfo we are in post_init stage - info.setStage( ORBInitInfoImpl.STAGE_POST_INIT ); + info.setStage(ORBInitInfoImpl.STAGE_POST_INIT); // Step through each initializer instantiation and call its post_init. // Ignore any exceptions. - for( int i = 0; i < orb.getORBData().getORBInitializers().length; - i++ ) { + for (int i = 0; i < orb.getORBData().getORBInitializers().length; i++) { ORBInitializer init = orb.getORBData().getORBInitializers()[i]; - if( init != null ) { + if (init != null) { try { - init.post_init( info ); - } - catch( Exception e ) { + init.post_init(info); + } catch (Exception e) { // As per orbos/99-12-02, section 9.3.1.2, "If there are // any exceptions, the ORB shall ignore them and proceed." } @@ -904,123 +879,108 @@ private void postInitORBInitializers( ORBInitInfoImpl info ) { } } - /** - * Creates the ORBInitInfo object to be passed to ORB intializers' - * pre_init and post_init methods + /** + * Creates the ORBInitInfo object to be passed to ORB intializers' pre_init and post_init methods */ @TraceInterceptor private ORBInitInfoImpl createORBInitInfo() { ORBInitInfoImpl result = null; - // arguments comes from set_parameters. May be null. + // arguments comes from set_parameters. May be null. // _REVISIT_ The spec does not specify which ID this is to be. // We currently get this from the corba.ORB, which reads it from // the ORB_ID_PROPERTY property. - String orbId = orb.getORBData().getORBId() ; + String orbId = orb.getORBData().getORBId(); - result = new ORBInitInfoImpl( orb, arguments, orbId, codecFactory ); + result = new ORBInitInfoImpl(orb, arguments, orbId, codecFactory); return result; } /** - * Called by ORBInitInfo when an interceptor needs to be registered. - * The type is one of: + * Called by ORBInitInfo when an interceptor needs to be registered. The type is one of: *

    - *
  • INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor - *
  • INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor - *
  • INTERCEPTOR_TYPE_IOR - IORInterceptor + *
  • INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor + *
  • INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor + *
  • INTERCEPTOR_TYPE_IOR - IORInterceptor *
* - * @exception DuplicateName Thrown if an interceptor of the given - * name already exists for the given type. + * @exception DuplicateName Thrown if an interceptor of the given name already exists for the given type. */ @TraceInterceptor - public void register_interceptor( Interceptor interceptor, int type ) - throws DuplicateName { + public void register_interceptor(Interceptor interceptor, int type) throws DuplicateName { // We will assume interceptor is not null, since it is called // internally. - if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) { - throw wrapper.typeOutOfRange( type ) ; + if ((type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0)) { + throw wrapper.typeOutOfRange(type); } String interceptorName = interceptor.name(); - if( interceptorName == null ) { - throw wrapper.nameNull() ; + if (interceptorName == null) { + throw wrapper.nameNull(); } // Register with interceptor list: - interceptorList.register_interceptor( interceptor, type ); + interceptorList.register_interceptor(interceptor, type); } - public Current getPICurrent( ) { + public Current getPICurrent() { return current; } /** - * Called when an invalid null parameter was passed. Throws a - * BAD_PARAM with a minor code of 1 + * Called when an invalid null parameter was passed. Throws a BAD_PARAM with a minor code of 1 */ - private void nullParam() - throws BAD_PARAM - { - throw orbutilWrapper.nullParam() ; + private void nullParam() throws BAD_PARAM { + throw orbutilWrapper.nullParam(); } - /** This is the implementation of standard API defined in org.omg.CORBA.ORB - * class. This method finds the Policy Factory for the given Policy Type - * and instantiates the Policy object from the Factory. It will throw - * PolicyError exception, If the PolicyFactory for the given type is - * not registered. - * _REVISIT_, Once Policy Framework work is completed, Reorganize - * this method to com.sun.corba.ee.spi.orb.ORB. + /** + * This is the implementation of standard API defined in org.omg.CORBA.ORB class. This method finds the Policy Factory + * for the given Policy Type and instantiates the Policy object from the Factory. It will throw PolicyError exception, + * If the PolicyFactory for the given type is not registered. _REVISIT_, Once Policy Framework work is completed, + * Reorganize this method to com.sun.corba.ee.spi.orb.ORB. */ @TraceInterceptor - public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) - throws org.omg.CORBA.PolicyError { - if( val == null ) { - nullParam( ); + public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError { + if (val == null) { + nullParam(); } - if( policyFactoryTable == null ) { - throw new org.omg.CORBA.PolicyError( - "There is no PolicyFactory Registered for type " + type, - BAD_POLICY.value ); + if (policyFactoryTable == null) { + throw new org.omg.CORBA.PolicyError("There is no PolicyFactory Registered for type " + type, BAD_POLICY.value); } - PolicyFactory factory = policyFactoryTable.get( type ); - if( factory == null ) { - throw new org.omg.CORBA.PolicyError( - " Could Not Find PolicyFactory for the Type " + type, - BAD_POLICY.value); + PolicyFactory factory = policyFactoryTable.get(type); + if (factory == null) { + throw new org.omg.CORBA.PolicyError(" Could Not Find PolicyFactory for the Type " + type, BAD_POLICY.value); } - org.omg.CORBA.Policy policy = factory.create_policy( type, val ); + org.omg.CORBA.Policy policy = factory.create_policy(type, val); return policy; } - /** This method registers the Policy Factory in the policyFactoryTable, - * which is a HashMap. This method is made package private, because - * it is used internally by the Interceptors. + /** + * This method registers the Policy Factory in the policyFactoryTable, which is a HashMap. This method is made package + * private, because it is used internally by the Interceptors. */ @TraceInterceptor - public void registerPolicyFactory( int type, PolicyFactory factory ) { - if( policyFactoryTable == null ) { - policyFactoryTable = new HashMap(); + public void registerPolicyFactory(int type, PolicyFactory factory) { + if (policyFactoryTable == null) { + policyFactoryTable = new HashMap(); } - Integer key = Integer.valueOf( type ); - PolicyFactory val = policyFactoryTable.get( key ); + Integer key = Integer.valueOf(type); + PolicyFactory val = policyFactoryTable.get(key); if (val == null) { - policyFactoryTable.put( key, factory ); + policyFactoryTable.put(key, factory); } else { - throw omgWrapper.policyFactoryRegFailed( type ) ; + throw omgWrapper.policyFactoryRegFailed(type); } } - - public synchronized int allocateServerRequestId () - { + + public synchronized int allocateServerRequestId() { return serverRequestIdCounter++; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PINoOpHandlerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PINoOpHandlerImpl.java index 6d99cb745..088073b6c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PINoOpHandlerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/PINoOpHandlerImpl.java @@ -19,26 +19,22 @@ package com.sun.corba.ee.impl.interceptors; - import org.omg.CORBA.Any; import org.omg.CORBA.NVList; - import org.omg.CORBA.portable.RemarshalException; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; import org.omg.PortableInterceptor.Interceptor; import org.omg.PortableInterceptor.PolicyFactory; import org.omg.PortableInterceptor.Current; -import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ; - +import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; import com.sun.corba.ee.spi.oa.ObjectAdapter; - import com.sun.corba.ee.spi.protocol.PIHandler; import com.sun.corba.ee.spi.protocol.MessageMediator; @@ -46,15 +42,13 @@ import com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage; -/** - * This is No-Op implementation of PIHandler. It is used in ORBConfigurator - * to initialize a piHandler before the Persistent Server Activation. This - * PIHandler implementation will be replaced by the real PIHandler in - * ORB.postInit( ) call. +/** + * This is No-Op implementation of PIHandler. It is used in ORBConfigurator to initialize a piHandler before the + * Persistent Server Activation. This PIHandler implementation will be replaced by the real PIHandler in ORB.postInit( ) + * call. */ -public class PINoOpHandlerImpl implements PIHandler -{ - public PINoOpHandlerImpl( ) { +public class PINoOpHandlerImpl implements PIHandler { + public PINoOpHandlerImpl() { } public void close() { @@ -66,123 +60,92 @@ public void initialize() { public void destroyInterceptors() { } - public void objectAdapterCreated( ObjectAdapter oa ) - { + public void objectAdapterCreated(ObjectAdapter oa) { } - public void adapterManagerStateChanged( int managerId, - short newState ) - { + public void adapterManagerStateChanged(int managerId, short newState) { } - public void adapterStateChanged( ObjectReferenceTemplate[] - templates, short newState ) - { + public void adapterStateChanged(ObjectReferenceTemplate[] templates, short newState) { } - public void disableInterceptorsThisThread() { } - + public void enableInterceptorsThisThread() { } - - public void invokeClientPIStartingPoint() - throws RemarshalException - { + + public void invokeClientPIStartingPoint() throws RemarshalException { } - - public Exception invokeClientPIEndingPoint( - int replyStatus, Exception exception ) - { + + public Exception invokeClientPIEndingPoint(int replyStatus, Exception exception) { return null; } - public Exception makeCompletedClientRequest( - int replyStatus, Exception exception ) - { + public Exception makeCompletedClientRequest(int replyStatus, Exception exception) { return null; } - - public void initiateClientPIRequest( boolean diiRequest ) { + + public void initiateClientPIRequest(boolean diiRequest) { } - + public void cleanupClientPIRequest() { } - public void setClientPIInfo(MessageMediator messageMediator) - { + public void setClientPIInfo(MessageMediator messageMediator) { } - public void setClientPIInfo( RequestImpl requestImpl ) - { + public void setClientPIInfo(RequestImpl requestImpl) { } - - final public void sendCancelRequestIfFinalFragmentNotSent() - { + + final public void sendCancelRequestIfFinalFragmentNotSent() { } - - - public void invokeServerPIStartingPoint() - { + + public void invokeServerPIStartingPoint() { } - public void invokeServerPIIntermediatePoint() - { + public void invokeServerPIIntermediatePoint() { } - - public void invokeServerPIEndingPoint( ReplyMessage replyMessage ) - { + + public void invokeServerPIEndingPoint(ReplyMessage replyMessage) { } - - public void setServerPIInfo( Exception exception ) { + + public void setServerPIInfo(Exception exception) { } - public void setServerPIInfo( NVList arguments ) - { + public void setServerPIInfo(NVList arguments) { } - public void setServerPIExceptionInfo( Any exception ) - { + public void setServerPIExceptionInfo(Any exception) { } - public void setServerPIInfo( Any result ) - { + public void setServerPIInfo(Any result) { } - public void initializeServerPIInfo( MessageMediator request, - ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp ) - { + public void initializeServerPIInfo(MessageMediator request, ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp) { } - - public void setServerPIInfo( java.lang.Object servant, - String targetMostDerivedInterface ) - { + + public void setServerPIInfo(java.lang.Object servant, String targetMostDerivedInterface) { } public void cleanupServerPIRequest() { } - - public void register_interceptor( Interceptor interceptor, int type ) - throws DuplicateName - { + + public void register_interceptor(Interceptor interceptor, int type) throws DuplicateName { } - public Current getPICurrent( ) { + public Current getPICurrent() { return null; } - public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) - throws org.omg.CORBA.PolicyError - { + public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError { return null; } - public void registerPolicyFactory( int type, PolicyFactory factory ) { + public void registerPolicyFactory(int type, PolicyFactory factory) { } - - public int allocateServerRequestId () - { + + public int allocateServerRequestId() { return 0; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/RequestInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/RequestInfoImpl.java index c77e2c539..0d3e2fe74 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/RequestInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/RequestInfoImpl.java @@ -62,13 +62,12 @@ import org.omg.PortableInterceptor.RequestInfo; /** - * Implementation of the RequestInfo interface as specified in - * orbos/99-12-02 section 5.4.1. + * Implementation of the RequestInfo interface as specified in orbos/99-12-02 section 5.4.1. */ public abstract class RequestInfoImpl extends LocalObject implements RequestInfo, RequestInfoExt { - - protected static final InterceptorsSystemException wrapper = InterceptorsSystemException.self ; - static final OMGSystemException stdWrapper = OMGSystemException.self ; + + protected static final InterceptorsSystemException wrapper = InterceptorsSystemException.self; + static final OMGSystemException stdWrapper = OMGSystemException.self; ////////////////////////////////////////////////////////////////////// // @@ -79,63 +78,73 @@ public abstract class RequestInfoImpl extends LocalObject implements RequestInfo /** The ORB from which to get PICurrent and other info */ protected ORB myORB; - /** The number of interceptors actually invoked for this client request. - * See setFlowStackIndex for a detailed description.*/ + /** + * The number of interceptors actually invoked for this client request. See setFlowStackIndex for a detailed + * description. + */ private int flowStackIndex = 0; - /** The type of starting point call to make to the interceptors - * See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of - * appropriate constants. */ + /** + * The type of starting point call to make to the interceptors See ClientRequestInfoImpl and ServerRequestInfoImpl for a + * list of appropriate constants. + */ int startingPointCall; - - /** The type of intermediate point call to make to the interceptors - * See ServerRequestInfoImpl for a list of appropriate constants. - * This does not currently apply to client request interceptors but is - * here in case intermediate points are introduced in the future. */ + + /** + * The type of intermediate point call to make to the interceptors See ServerRequestInfoImpl for a list of appropriate + * constants. This does not currently apply to client request interceptors but is here in case intermediate points are + * introduced in the future. + */ int intermediatePointCall; - - /** The type of ending point call to make to the interceptors - * See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of - * appropriate constants. */ + + /** + * The type of ending point call to make to the interceptors See ClientRequestInfoImpl and ServerRequestInfoImpl for a + * list of appropriate constants. + */ int endingPointCall; - - /** The reply status to return in reply_status. This is initialized - * to UNINITIALIZED so that we can tell if this has been set or not. */ + + /** + * The reply status to return in reply_status. This is initialized to UNINITIALIZED so that we can tell if this has been + * set or not. + */ protected short replyStatus = UNINITIALIZED; - + /** Constant for an uninitialized reply status. */ static final short UNINITIALIZED = -1; - - /** Which points we are currently executing (so we can implement the - * validity table). */ + + /** + * Which points we are currently executing (so we can implement the validity table). + */ int currentExecutionPoint; static final int EXECUTION_POINT_STARTING = 0; static final int EXECUTION_POINT_INTERMEDIATE = 1; static final int EXECUTION_POINT_ENDING = 2; - - /** Set to true if all interceptors have had all their points - * executed. */ + + /** + * Set to true if all interceptors have had all their points executed. + */ private boolean alreadyExecuted; - + /** Sources of request information */ - protected Connection connection; + protected Connection connection; // The ForwardRequest object if this request is being forwarded. // Either the forwardRequest or the forwardRequestIOR field is set. - // When set, the other field is set to null initially. If the other - // field is queried, it is lazily calculated and cached. These + // When set, the other field is set to null initially. If the other + // field is queried, it is lazily calculated and cached. These // two attributes are always kept in sync. private ForwardRequest forwardRequest; private IOR forwardRequestIOR; - /** PICurrent's SlotTable */ + /** PICurrent's SlotTable */ SlotTable slotTable; - /** The exception to be returned by received_exception and - * received_exception_id */ + /** + * The exception to be returned by received_exception and received_exception_id + */ protected Exception exception; - - boolean interceptorsEnabledForThisRequest ; + + boolean interceptorsEnabledForThisRequest; ////////////////////////////////////////////////////////////////////// // @@ -149,8 +158,7 @@ public org.omg.CORBA.ORB _orb() { } /** - * Reset the info object so that it can be reused for a retry, - * for example. + * Reset the info object so that it can be reused for a retry, for example. */ void reset() { @@ -161,7 +169,7 @@ void reset() { intermediatePointCall = 0; endingPointCall = 0; // 6763340 - setReplyStatus( UNINITIALIZED ) ; + setReplyStatus(UNINITIALIZED); currentExecutionPoint = EXECUTION_POINT_STARTING; alreadyExecuted = false; connection = null; @@ -172,9 +180,9 @@ void reset() { // We don't need to reset the Slots because they are // already in the clean state after recieve_ interceptor - // are called. + // are called. - interceptorsEnabledForThisRequest = false ; + interceptorsEnabledForThisRequest = false; } /* @@ -182,208 +190,195 @@ void reset() { * Access protection **********************************************************************/ - // Method IDs for all methods in RequestInfo. This allows for a + // Method IDs for all methods in RequestInfo. This allows for a // convenient O(1) lookup for checkAccess(). - protected static final int MID_REQUEST_ID = 0; - protected static final int MID_OPERATION = 1; - protected static final int MID_ARGUMENTS = 2; - protected static final int MID_EXCEPTIONS = 3; - protected static final int MID_CONTEXTS = 4; - protected static final int MID_OPERATION_CONTEXT = 5; - protected static final int MID_RESULT = 6; - protected static final int MID_RESPONSE_EXPECTED = 7; - protected static final int MID_SYNC_SCOPE = 8; - protected static final int MID_REPLY_STATUS = 9; - protected static final int MID_FORWARD_REFERENCE = 10; - protected static final int MID_GET_SLOT = 11; - protected static final int MID_GET_REQUEST_SERVICE_CONTEXT = 12; - protected static final int MID_GET_REPLY_SERVICE_CONTEXT = 13; + protected static final int MID_REQUEST_ID = 0; + protected static final int MID_OPERATION = 1; + protected static final int MID_ARGUMENTS = 2; + protected static final int MID_EXCEPTIONS = 3; + protected static final int MID_CONTEXTS = 4; + protected static final int MID_OPERATION_CONTEXT = 5; + protected static final int MID_RESULT = 6; + protected static final int MID_RESPONSE_EXPECTED = 7; + protected static final int MID_SYNC_SCOPE = 8; + protected static final int MID_REPLY_STATUS = 9; + protected static final int MID_FORWARD_REFERENCE = 10; + protected static final int MID_GET_SLOT = 11; + protected static final int MID_GET_REQUEST_SERVICE_CONTEXT = 12; + protected static final int MID_GET_REPLY_SERVICE_CONTEXT = 13; // The last value from RequestInfo (be sure to update this): - protected static final int MID_RI_LAST = 13; - + protected static final int MID_RI_LAST = 13; + /* ********************************************************************** * Public interfaces **********************************************************************/ - + /** * Creates a new RequestInfoImpl object. + * * @param myORB ORB to use */ - public RequestInfoImpl( ORB myORB ) { + public RequestInfoImpl(ORB myORB) { super(); - + this.myORB = myORB; // Capture the current TSC and make it the RSC of this request. - PICurrent current = (PICurrent)(myORB.getPIHandler().getPICurrent()); - slotTable = current.getSlotTable( ); + PICurrent current = (PICurrent) (myORB.getPIHandler().getPICurrent()); + slotTable = current.getSlotTable(); - interceptorsEnabledForThisRequest = false ; + interceptorsEnabledForThisRequest = false; } /** - * Implementation for request_id() differs for client and server - * implementations. + * Implementation for request_id() differs for client and server implementations. * - * Uniquely identifies an active request/reply sequence. Once a - * request/reply sequence is concluded this ID may be reused. (this - * is NOT necessarily the same as the GIOP request_id). + * Uniquely identifies an active request/reply sequence. Once a request/reply sequence is concluded this ID may be + * reused. (this is NOT necessarily the same as the GIOP request_id). + * * @return unique request identifier */ @Override - abstract public int request_id (); + abstract public int request_id(); /** - * Implementation for operation() differs for client and server - * implementations. + * Implementation for operation() differs for client and server implementations. * * @return The name of the operation being invoked. */ @Override - abstract public String operation (); - + abstract public String operation(); /** - * This method returns the list of arguments for the operation that was - * invoked. It raises NO_RESOURCES exception if the operation is not invoked - * by using DII mechanism. + * This method returns the list of arguments for the operation that was invoked. It raises NO_RESOURCES exception if the + * operation is not invoked by using DII mechanism. + * * @return array of arguments */ @Override - abstract public Parameter[] arguments (); - + abstract public Parameter[] arguments(); + /** - * This method returns the list of exceptions that was raised when the - * operation was invoked. It raises NO_RESOURCES exception if the operation - * is not invoked by using DII mechanism. + * This method returns the list of exceptions that was raised when the operation was invoked. It raises NO_RESOURCES + * exception if the operation is not invoked by using DII mechanism. + * * @return array of raised exceptions */ @Override - abstract public TypeCode[] exceptions (); - + abstract public TypeCode[] exceptions(); + /** - * This method returns the list of contexts for the DII operation. - * It raises NO_RESOURCES exception if the operation is not invoked by - * using DII mechanism. + * This method returns the list of contexts for the DII operation. It raises NO_RESOURCES exception if the operation is + * not invoked by using DII mechanism. + * * @return array of contexts */ @Override - abstract public String[] contexts (); - + abstract public String[] contexts(); + /** - * This method returns the list of operation_context for the DII operation. - * It raises NO_RESOURCES exception if the operation is not invoked by - * using DII mechanism. + * This method returns the list of operation_context for the DII operation. It raises NO_RESOURCES exception if the + * operation is not invoked by using DII mechanism. + * * @return array of operation contexts */ @Override - abstract public String[] operation_context (); + abstract public String[] operation_context(); /** - * This method returns the result from the invoked DII operation. - * It raises NO_RESOURCES exception if the operation is not invoked by - * using DII mechanism. + * This method returns the result from the invoked DII operation. It raises NO_RESOURCES exception if the operation is + * not invoked by using DII mechanism. + * * @return the result from the invoked operation */ @Override - abstract public Any result (); - + abstract public Any result(); + /** - * Implementation for response_expected() differs for client and server - * implementations. + * Implementation for response_expected() differs for client and server implementations. * - * Indicates whether a response is expected. On the client, a reply is - * not returned when response_expected is false, so receive_reply cannot - * be called. receive_other is called unless an exception occurs, in - * which case receive_exception is called. On the client, within - * send_poll, this attribute is true. + * Indicates whether a response is expected. On the client, a reply is not returned when response_expected is false, so + * receive_reply cannot be called. receive_other is called unless an exception occurs, in which case receive_exception + * is called. On the client, within send_poll, this attribute is true. + * * @return if a response is expected */ @Override - abstract public boolean response_expected (); - - /** - * Defined in the Messaging specification. Pertinent only when - * response_expected is false. If response_expected is true, the value - * of sync_scope is undefined. It defines how far the request shall - * progress before control is returned to the client. This attribute may - * have one of the follwing values: + abstract public boolean response_expected(); + + /** + * Defined in the Messaging specification. Pertinent only when response_expected is false. If response_expected is true, + * the value of sync_scope is undefined. It defines how far the request shall progress before control is returned to the + * client. This attribute may have one of the follwing values: *
    - *
  • {@link org.omg.Messaging.SYNC_NONE}
  • - *
  • {@link org.omg.Messaging.SYNC_WITH_TRANSPORT}
  • - *
  • {@link org.omg.Messaging.SYNC_WITH_SERVER}
  • - *
  • {@link org.omg.Messaging.SYNC_WITH_TARGET}
  • + *
  • {@link org.omg.Messaging.SYNC_NONE}
  • + *
  • {@link org.omg.Messaging.SYNC_WITH_TRANSPORT}
  • + *
  • {@link org.omg.Messaging.SYNC_WITH_SERVER}
  • + *
  • {@link org.omg.Messaging.SYNC_WITH_TARGET}
  • *
*/ @Override - public short sync_scope (){ - checkAccess( MID_SYNC_SCOPE ); + public short sync_scope() { + checkAccess(MID_SYNC_SCOPE); return SYNC_WITH_TRANSPORT.value; // REVISIT - get from MessageMediator } - + /** - * Describes the state of the result of the operation invocation. Its - * value can be one of the following: + * Describes the state of the result of the operation invocation. Its value can be one of the following: *
    - *
  • {@link org.omg.PortableInterceptor.SUCCESSFUL}
  • - *
  • {@link org.omg.PortableInterceptor.SYSTEM_EXCEPTION}
  • - *
  • {@link org.omg.PortableInterceptor.USER_EXCEPTION}
  • - *
  • {@link org.omg.PortableInterceptor.LOCATION_FORWARD}
  • - *
  • {@link org.omg.PortableInterceptor.TRANSPORT_RETRY}
  • + *
  • {@link org.omg.PortableInterceptor.SUCCESSFUL}
  • + *
  • {@link org.omg.PortableInterceptor.SYSTEM_EXCEPTION}
  • + *
  • {@link org.omg.PortableInterceptor.USER_EXCEPTION}
  • + *
  • {@link org.omg.PortableInterceptor.LOCATION_FORWARD}
  • + *
  • {@link org.omg.PortableInterceptor.TRANSPORT_RETRY}
  • *
+ * * @return result status */ @Override - public short reply_status (){ - checkAccess( MID_REPLY_STATUS ); + public short reply_status() { + checkAccess(MID_REPLY_STATUS); return replyStatus; } - + /** - * Implementation for forward_reference() differs for client and server - * implementations. + * Implementation for forward_reference() differs for client and server implementations. * - * If the reply_status attribute is LOCATION_FORWARD - * then this attribute will contain the object - * to which the request will be forwarded. It is indeterminate whether a - * forwarded request will actually occur. + * If the reply_status attribute is LOCATION_FORWARD then this attribute will contain the object to which the request + * will be forwarded. It is indeterminate whether a forwarded request will actually occur. + * * @return object to which attribute is forwarded. */ @Override - abstract public Object forward_reference (); + abstract public Object forward_reference(); - /** - * Returns the data from the given slot of the PortableInterceptor::Current - * that is in the scope of the request. + * Returns the data from the given slot of the PortableInterceptor::Current that is in the scope of the request. *

- * If the given slot has not been set, then an any containing a type code - * with a TCKind value of tk_null is returned. + * If the given slot has not been set, then an any containing a type code with a TCKind value of tk_null is returned. *

* If the ID does not define an allocated slot, InvalidSlot is raised. + * * @param id ID of the slot to get data from * @return Data held in the given slot * @throws InvalidSlot If the id is not for an allocated slot */ @Override - public Any get_slot (int id) throws InvalidSlot - { + public Any get_slot(int id) throws InvalidSlot { // access is currently valid for all states: - //checkAccess( MID_GET_SLOT ); + // checkAccess( MID_GET_SLOT ); // Delegate the call to the slotTable which was set when RequestInfo was // created. - return slotTable.get_slot( id ); + return slotTable.get_slot(id); } /** - * Implementation for get_request_service_context() differs for client - * and server implementations. + * Implementation for get_request_service_context() differs for client and server implementations. * - * This operation returns a copy of the service context with the given ID - * that is associated with the request. If the request's service context - * does not contain an entry for that ID, BAD_PARAM with a minor code of - * TBD_BP is raised. + * This operation returns a copy of the service context with the given ID that is associated with the request. If the + * request's service context does not contain an entry for that ID, BAD_PARAM with a minor code of TBD_BP is raised. + * * @param id ID of the service context * @return A copy of the service context */ @@ -391,28 +386,23 @@ public Any get_slot (int id) throws InvalidSlot abstract public org.omg.IOP.ServiceContext get_request_service_context(int id); /** - * Implementation for get_reply_service_context() differs for client - * and server implementations. + * Implementation for get_reply_service_context() differs for client and server implementations. * - * This operation returns a copy of the service context with the given ID - * that is associated with the reply. IF the request's service context - * does not contain an entry for that ID, BAD_PARAM with a minor code of - * TBD_BP is raised. + * This operation returns a copy of the service context with the given ID that is associated with the reply. IF the + * request's service context does not contain an entry for that ID, BAD_PARAM with a minor code of TBD_BP is raised. + * * @param id ID of the service context * @return A copy of the Service Context */ @Override - abstract public org.omg.IOP.ServiceContext get_reply_service_context (int id); + abstract public org.omg.IOP.ServiceContext get_reply_service_context(int id); - // NOTE: When adding a method, be sure to: // 1. Add a MID_* constant for that method // 2. Call checkAccess at the start of the method // 3. Define entries in the validCall[][] table for interception points - // in both ClientRequestInfoImpl and ServerRequestInfoImpl. - + // in both ClientRequestInfoImpl and ServerRequestInfoImpl. - /* ********************************************************************** * Proprietary methods @@ -421,12 +411,10 @@ public Any get_slot (int id) throws InvalidSlot /** * @return The connection on which the request is made. * - * Note: we store the connection as an internal type but - * expose it here as an external type. + * Note: we store the connection as an internal type but expose it here as an external type. */ @Override - public com.sun.corba.ee.spi.legacy.connection.Connection connection() - { + public com.sun.corba.ee.spi.legacy.connection.Connection connection() { return connection; } @@ -436,90 +424,78 @@ public com.sun.corba.ee.spi.legacy.connection.Connection connection() **********************************************************************/ /** - * Inserts the UserException inside the given ApplicationException - * into the given Any. Throws an UNKNOWN with minor code - * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be - * found to insert it with. + * Inserts the UserException inside the given ApplicationException into the given Any. Throws an UNKNOWN with minor code + * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be found to insert it with. + * * @param appException Exception to insert * @param result {@link Any} to insert Exception into */ - private void insertApplicationException( ApplicationException appException, - Any result ) - throws UNKNOWN - { + private void insertApplicationException(ApplicationException appException, Any result) throws UNKNOWN { try { // Extract the UserException from the ApplicationException. // Look up class name from repository id: - RepositoryId repId = RepositoryId.cache.getId( - appException.getId() ); + RepositoryId repId = RepositoryId.cache.getId(appException.getId()); String className = repId.getClassName(); - + // Find the read method on the helper class: String helperClassName = className + "Helper"; - Class helperClass = ORBClassLoader.loadClass( helperClassName ); + Class helperClass = ORBClassLoader.loadClass(helperClassName); Class[] readParams = new Class[1]; readParams[0] = org.omg.CORBA.portable.InputStream.class; - Method readMethod = helperClass.getMethod( "read", readParams ); - + Method readMethod = helperClass.getMethod("read", readParams); + // Invoke the read method, passing in the input stream to - // retrieve the user exception. Mark and reset the stream + // retrieve the user exception. Mark and reset the stream // as to not disturb it. InputStream ueInputStream = appException.getInputStream(); - ueInputStream.mark( 0 ); + ueInputStream.mark(0); UserException userException = null; try { java.lang.Object[] readArguments = new java.lang.Object[1]; readArguments[0] = ueInputStream; - userException = (UserException)readMethod.invoke( - null, readArguments ); - } - finally { + userException = (UserException) readMethod.invoke(null, readArguments); + } finally { try { ueInputStream.reset(); - } - catch( IOException e ) { - throw wrapper.markAndResetFailed( e ) ; + } catch (IOException e) { + throw wrapper.markAndResetFailed(e); } } // Insert this UserException into the provided Any using the // helper class. - insertUserException( userException, result ); - } catch( ClassNotFoundException | NoSuchMethodException | SecurityException | - IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { - throw stdWrapper.unknownUserException( e ) ; + insertUserException(userException, result); + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + throw stdWrapper.unknownUserException(e); } } /** - * Inserts the UserException into the given Any. - * Throws an UNKNOWN with minor code - * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be - * found to insert it with. + * Inserts the UserException into the given Any. Throws an UNKNOWN with minor code + * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be found to insert it with. + * * @param userException Exception to insert * @param result {@link Any} to insert the exception into */ - private void insertUserException( UserException userException, Any result ) - throws UNKNOWN - { + private void insertUserException(UserException userException, Any result) throws UNKNOWN { try { // Insert this UserException into the provided Any using the // helper class. - if( userException != null ) { + if (userException != null) { Class exceptionClass = userException.getClass(); String className = exceptionClass.getName(); String helperClassName = className + "Helper"; - Class helperClass = ORBClassLoader.loadClass( helperClassName ); - - Method insertMethod = helperClass.getMethod( - "insert", org.omg.CORBA.Any.class, exceptionClass ); + Class helperClass = ORBClassLoader.loadClass(helperClassName); + + Method insertMethod = helperClass.getMethod("insert", org.omg.CORBA.Any.class, exceptionClass); - insertMethod.invoke( null, result, userException ); + insertMethod.invoke(null, result, userException); } - } catch( ClassNotFoundException | NoSuchMethodException | SecurityException | - IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { - throw stdWrapper.unknownUserException( e ); - } + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + throw stdWrapper.unknownUserException(e); + } } /* @@ -529,10 +505,11 @@ private void insertUserException( UserException userException, Any result ) /** * Internal utility method to convert an NVList into a PI Parameter[] + * * @param parNVList list to concert * @return parameter array */ - protected Parameter[] nvListToParameterArray( NVList parNVList ) { + protected Parameter[] nvListToParameterArray(NVList parNVList) { // _REVISIT_ This utility method should probably be doing a deep // copy so interceptor can't accidentally change the arguments. @@ -540,10 +517,10 @@ protected Parameter[] nvListToParameterArray( NVList parNVList ) { int count = parNVList.count(); Parameter[] plist = new Parameter[count]; try { - for( int i = 0; i < count; i++ ) { + for (int i = 0; i < count; i++) { Parameter p = new Parameter(); plist[i] = p; - NamedValue nv = parNVList.item( i ); + NamedValue nv = parNVList.item(i); plist[i].argument = nv.value(); // ParameterMode spec can be found in 99-10-07.pdf // Section:10.5.22 @@ -552,154 +529,138 @@ protected Parameter[] nvListToParameterArray( NVList parNVList ) { // nv.flags has ARG_IN as 1, ARG_OUT as 2 and ARG_INOUT as 3 // To convert this into enum PARAM_IN, PARAM_OUT and // PARAM_INOUT the value is subtracted by 1. - plist[i].mode = ParameterMode.from_int( nv.flags() - 1 ); + plist[i].mode = ParameterMode.from_int(nv.flags() - 1); } - } catch ( Exception e ) { - throw wrapper.exceptionInArguments( e ) ; + } catch (Exception e) { + throw wrapper.exceptionInArguments(e); } return plist; } /** - * Utility to wrap the given Exception in an Any object and return it. - * If the exception is a UserException which cannot be inserted into - * an any, then this returns an Any containing the system exception - * UNKNOWN. + * Utility to wrap the given Exception in an Any object and return it. If the exception is a UserException which cannot + * be inserted into an any, then this returns an Any containing the system exception UNKNOWN. + * * @param exception Exception to wrap * @return {@link Any} wrapping the exception */ - protected Any exceptionToAny( Exception exception ){ + protected Any exceptionToAny(Exception exception) { Any result = myORB.create_any(); - if( exception == null ) { + if (exception == null) { // Note: exception should never be null here since we will throw // a BAD_INV_ORDER if this is not called from receive_exception. - throw wrapper.exceptionWasNull2() ; - } else if( exception instanceof SystemException ) { - ORBUtility.insertSystemException( - (SystemException)exception, result ); - } else if( exception instanceof ApplicationException ) { + throw wrapper.exceptionWasNull2(); + } else if (exception instanceof SystemException) { + ORBUtility.insertSystemException((SystemException) exception, result); + } else if (exception instanceof ApplicationException) { // Use the Helper class for this exception to insert it into an // Any. try { // Insert the user exception inside the application exception // into the Any result: - ApplicationException appException = - (ApplicationException)exception; - insertApplicationException( appException, result ); - } catch( UNKNOWN e ) { + ApplicationException appException = (ApplicationException) exception; + insertApplicationException(appException, result); + } catch (UNKNOWN e) { // As per ptc/00-08-06, 21.3.13.4. if we cannot find the // appropriate class, then return an any containing UNKNOWN, - // with a minor code of 1. This is conveniently the same - // exception that is returned from the + // with a minor code of 1. This is conveniently the same + // exception that is returned from the // insertApplicationException utility method. - ORBUtility.insertSystemException( e, result ); + ORBUtility.insertSystemException(e, result); } - } else if( exception instanceof UserException ) { + } else if (exception instanceof UserException) { try { - UserException userException = (UserException)exception; - insertUserException( userException, result ); - } catch( UNKNOWN e ) { - ORBUtility.insertSystemException( e, result ); + UserException userException = (UserException) exception; + insertUserException(userException, result); + } catch (UNKNOWN e) { + ORBUtility.insertSystemException(e, result); } } - return result; } /** - * Utility method to look up a service context with the given id and - * convert it to an IOP.ServiceContext. Uses the given HashMap as - * a cache. If not found in cache, the result is inserted in the cache. + * Utility method to look up a service context with the given id and convert it to an IOP.ServiceContext. Uses the given + * HashMap as a cache. If not found in cache, the result is inserted in the cache. + * * @param cachedServiceContexts cache to search first in * @param serviceContexts contexts to look up in - * @param id ID to use for look up + * @param id ID to use for look up * @return found ServiceContext */ - protected org.omg.IOP.ServiceContext getServiceContext( - Map cachedServiceContexts, - ServiceContexts serviceContexts, int id ) - { + protected org.omg.IOP.ServiceContext getServiceContext(Map cachedServiceContexts, + ServiceContexts serviceContexts, int id) { org.omg.IOP.ServiceContext result = null; // Search cache first: - result = cachedServiceContexts.get( id ); + result = cachedServiceContexts.get(id); - // null could normally mean that either we cached the value null - // or it's not in the cache. However, there is no way for us to + // null could normally mean that either we cached the value null + // or it's not in the cache. However, there is no way for us to // cache the value null in the following code. - if( result == null ) { - // Not in cache. Find it and put in cache. + if (result == null) { + // Not in cache. Find it and put in cache. // Get the desired "core" service context. - com.sun.corba.ee.spi.servicecontext.ServiceContext context = - serviceContexts.get( id ); + com.sun.corba.ee.spi.servicecontext.ServiceContext context = serviceContexts.get(id); if (context == null) { // The OMG PI standard requires throwing an exception, // but that is slow, so we allow disabling this behavior. if (myORB.getORBData().getServiceContextReturnsNull()) { - return null ; + return null; } else { - throw stdWrapper.invalidServiceContextId() ; + throw stdWrapper.invalidServiceContextId(); } } - // Convert the "core" service context to an - // "IOP" ServiceContext by writing it to a + // Convert the "core" service context to an + // "IOP" ServiceContext by writing it to a // CDROutputStream and reading it back. EncapsOutputStream out = OutputStreamFactory.newEncapsOutputStream(myORB); - context.write( out, GIOPVersion.V1_2 ); + context.write(out, GIOPVersion.V1_2); InputStream inputStream = out.create_input_stream(); - result = ServiceContextHelper.read( inputStream ); + result = ServiceContextHelper.read(inputStream); - cachedServiceContexts.put( id, result ); + cachedServiceContexts.put(id, result); } // Good citizen: For increased efficiency, we assume that interceptors - // will not modify the returned ServiceContext. Otherwise, we would + // will not modify the returned ServiceContext. Otherwise, we would // have to make a deep copy. return result; } - /** - * Utility method to add an IOP.ServiceContext to a core.ServiceContexts - * object. If replace is true, any service context with the given id - * is replaced. + * Utility method to add an IOP.ServiceContext to a core.ServiceContexts object. If replace is true, any service context + * with the given id is replaced. *

- * Raises BAD_INV_ORDER if replace is false and a service context with - * the given id already exists. + * Raises BAD_INV_ORDER if replace is false and a service context with the given id already exists. *

- * Uses the given HashMap as a cache. If a service context is placed - * in the container, it goes in the HashMap as well. + * Uses the given HashMap as a cache. If a service context is placed in the container, it goes in the HashMap as well. + * * @param cachedServiceContexts map to also add the context to * @param serviceContexts ServiceContexts to add it to * @param service_context context to add * @param replace if a previous instance should be replaced */ - protected void addServiceContext( - Map cachedServiceContexts, - ServiceContexts serviceContexts, - org.omg.IOP.ServiceContext service_context, - boolean replace ) - { - int id = 0 ; + protected void addServiceContext(Map cachedServiceContexts, ServiceContexts serviceContexts, + org.omg.IOP.ServiceContext service_context, boolean replace) { + int id = 0; // Convert IOP.service_context to core.ServiceContext: - EncapsOutputStream outputStream = OutputStreamFactory.newEncapsOutputStream( - myORB ); + EncapsOutputStream outputStream = OutputStreamFactory.newEncapsOutputStream(myORB); InputStream inputStream = null; UnknownServiceContext coreServiceContext = null; - ServiceContextHelper.write( outputStream, service_context ); + ServiceContextHelper.write(outputStream, service_context); inputStream = outputStream.create_input_stream(); // Constructor expects id to already have been read from stream. - coreServiceContext = ServiceContextDefaults.makeUnknownServiceContext( - inputStream.read_long(), - (org.omg.CORBA_2_3.portable.InputStream)inputStream ); + coreServiceContext = ServiceContextDefaults.makeUnknownServiceContext(inputStream.read_long(), + (org.omg.CORBA_2_3.portable.InputStream) inputStream); id = coreServiceContext.getId(); @@ -711,164 +672,165 @@ protected void addServiceContext( } } - serviceContexts.put( coreServiceContext ); + serviceContexts.put(coreServiceContext); // Place IOP.ServiceContext in cache as well: - cachedServiceContexts.put( id, service_context ); + cachedServiceContexts.put(id, service_context); } /** - * Sets the number of interceptors whose starting interception - * points were successfully invoked on this client call. As specified - * in orbos/99-12-02, section 5.2.1., not all interceptors will - * be invoked if a ForwardRequest exception or a system exception - * is raised. This keeps track of how many were successfully executed - * so we know not to execute the corresponding ending interception - * points for the interceptors whose starting interception points - * were not completed. This simulates the "Flow Stack Visual Model" - * presented in section 5.1.3. + * Sets the number of interceptors whose starting interception points were successfully invoked on this client call. As + * specified in orbos/99-12-02, section 5.2.1., not all interceptors will be invoked if a ForwardRequest exception or a + * system exception is raised. This keeps track of how many were successfully executed so we know not to execute the + * corresponding ending interception points for the interceptors whose starting interception points were not completed. + * This simulates the "Flow Stack Visual Model" presented in section 5.1.3. + * * @param num number of interceptors successfully invoked */ - protected void setFlowStackIndex(int num ) { + protected void setFlowStackIndex(int num) { this.flowStackIndex = num; } /** - * Returns the number of interceptors whose starting interception - * points were actually invoked on this client request. See - * setFlowStackIndex for more details. + * Returns the number of interceptors whose starting interception points were actually invoked on this client request. + * See setFlowStackIndex for more details. + * * @return number of interceptors - * @see #setFlowStackIndex(int) + * @see #setFlowStackIndex(int) */ protected int getFlowStackIndex() { return this.flowStackIndex; } /** - * Sets which ending interception point should be called - * for each interceptor in the virtual flow stack. + * Sets which ending interception point should be called for each interceptor in the virtual flow stack. + * * @param call ending interception point */ - protected void setEndingPointCall( int call ) { + protected void setEndingPointCall(int call) { this.endingPointCall = call; } /** - * Retrieves the current ending point call type (see - * setEndingPointCall for more details). + * Retrieves the current ending point call type (see setEndingPointCall for more details). + * * @return ending point call type - * @see #setEndingPointCall(int) + * @see #setEndingPointCall(int) */ protected int getEndingPointCall() { return this.endingPointCall; } /** - * Sets which intermediate interception point should be called - * for each interceptor in the virtual flow stack. + * Sets which intermediate interception point should be called for each interceptor in the virtual flow stack. + * * @param call intermediate interception point */ - protected void setIntermediatePointCall( int call ) { + protected void setIntermediatePointCall(int call) { this.intermediatePointCall = call; } /** - * Retrieves the current intermediate point call type (see - * setEndingPointCall for more details). + * Retrieves the current intermediate point call type (see setEndingPointCall for more details). + * * @return current intermediate point - * @see #setEndingPointCall(int) + * @see #setEndingPointCall(int) */ protected int getIntermediatePointCall() { return this.intermediatePointCall; } - + /** - * Sets which starting interception point should be called - * for each interceptor in the virtual flow stack. + * Sets which starting interception point should be called for each interceptor in the virtual flow stack. + * * @param call which point should called */ - protected void setStartingPointCall( int call ) { + protected void setStartingPointCall(int call) { this.startingPointCall = call; } /** - * Retrieves the current starting point call type (see - * setStartingPointCall for more details). + * Retrieves the current starting point call type (see setStartingPointCall for more details). + * * @return the current stating point - * @see #setStartingPointCall(int) + * @see #setStartingPointCall(int) */ protected int getStartingPointCall() { return this.startingPointCall; } - + /** - * Returns true if all interceptors' starting and ending points - * have already executed to completion, or false if not yet. + * Returns true if all interceptors' starting and ending points have already executed to completion, or false if not + * yet. + * * @return if all interceptors have been executed to completion */ protected boolean getAlreadyExecuted() { return this.alreadyExecuted; } - + /** - * Sets whether all interceptors' starting and ending points - * have already been executed to completion. + * Sets whether all interceptors' starting and ending points have already been executed to completion. + * * @param alreadyExecuted if all interceptors have been executed */ - protected void setAlreadyExecuted( boolean alreadyExecuted ) { + protected void setAlreadyExecuted(boolean alreadyExecuted) { this.alreadyExecuted = alreadyExecuted; } - + /** * Sets the value to be returned by reply_status + * * @param replyStatus The value of the reply status */ - protected void setReplyStatus( short replyStatus ) { + protected void setReplyStatus(short replyStatus) { this.replyStatus = replyStatus; } - + /** - * Gets the current reply_status without doing an access check - * (available only to package and subclasses) + * Gets the current reply_status without doing an access check (available only to package and subclasses) + * * @return Current reply status */ protected short getReplyStatus() { return this.replyStatus; } - + /** - * Stores the given ForwardRequest object for later analysis. - * This version supplements setForwardRequest( IOR ); + * Stores the given ForwardRequest object for later analysis. This version supplements setForwardRequest( IOR ); + * * @param forwardRequest ForwardRequest to store * @see #setForwardRequest(com.sun.corba.ee.spi.ior.IOR) */ - protected void setForwardRequest( ForwardRequest forwardRequest ) { + protected void setForwardRequest(ForwardRequest forwardRequest) { this.forwardRequest = forwardRequest; this.forwardRequestIOR = null; } - /** - * Stores the given IOR for later forward request analysis. - * This version supplements setForwardRequest( ForwardRequest ); + /** + * Stores the given IOR for later forward request analysis. This version supplements setForwardRequest( ForwardRequest + * ); + * * @param ior IOR to store * @see #setForwardRequest(org.omg.PortableInterceptor.ForwardRequest) */ - protected void setForwardRequest( IOR ior ) { + protected void setForwardRequest(IOR ior) { this.forwardRequestIOR = ior; this.forwardRequest = null; } - + /** * Retrieves the ForwardRequest object as a ForwardRequest exception. + * * @return the ForwardRequest object */ protected ForwardRequest getForwardRequestException() { - if( this.forwardRequest == null ) { - if( this.forwardRequestIOR != null ) { + if (this.forwardRequest == null) { + if (this.forwardRequestIOR != null) { // Convert the internal IOR to a forward request exception // by creating an object reference. org.omg.CORBA.Object obj = iorToObject(this.forwardRequestIOR); - this.forwardRequest = new ForwardRequest( obj ); + this.forwardRequest = new ForwardRequest(obj); } } @@ -877,73 +839,64 @@ protected ForwardRequest getForwardRequestException() { /** * Retrieves the IOR of the ForwardRequest exception. + * * @return The IOR of the exception */ protected IOR getForwardRequestIOR() { - if( this.forwardRequestIOR == null ) { - if( this.forwardRequest != null ) { - this.forwardRequestIOR = myORB.getIOR( - this.forwardRequest.forward, false ) ; + if (this.forwardRequestIOR == null) { + if (this.forwardRequest != null) { + this.forwardRequestIOR = myORB.getIOR(this.forwardRequest.forward, false); } } return this.forwardRequestIOR; } - + /** - * Sets the exception to be returned by received_exception and - * received_exception_id. + * Sets the exception to be returned by received_exception and received_exception_id. + * * @param exception exception to be returned */ - protected void setException( Exception exception ) { + protected void setException(Exception exception) { this.exception = exception; } - + /** - * Returns the exception to be returned by received_exception and - * received_exception_id. + * Returns the exception to be returned by received_exception and received_exception_id. */ Exception getException() { return this.exception; } - + /** - * Sets the execution point that we are currently executing - * (starting points, intermediate points, or ending points). + * Sets the execution point that we are currently executing (starting points, intermediate points, or ending points). * This allows us to enforce the validity table. + * * @param executionPoint Current execution point */ - protected void setCurrentExecutionPoint( int executionPoint ) { + protected void setCurrentExecutionPoint(int executionPoint) { this.currentExecutionPoint = executionPoint; } /** - * Check whether the caller is allowed to access this method at - * this particular time. This is overridden in subclasses to implement - * the validity table specified in ptc/00-04-05, table 21-1 and 21-2. - * The currentExecutionPoint attribute is checked, and if access is - * forbidden at this time, BAD_INV_ORDER is raised with a minor code of - * TBD_BIO. + * Check whether the caller is allowed to access this method at this particular time. This is overridden in subclasses + * to implement the validity table specified in ptc/00-04-05, table 21-1 and 21-2. The currentExecutionPoint attribute + * is checked, and if access is forbidden at this time, BAD_INV_ORDER is raised with a minor code of TBD_BIO. * - * @param methodID The ID of this method, one of the MID_* constants. - * This allows us to easily look up the method access in a table. - * Note that method ids may overlap between subclasses. + * @param methodID The ID of this method, one of the MID_* constants. This allows us to easily look up the method access + * in a table. Note that method ids may overlap between subclasses. */ - protected abstract void checkAccess( int methodID ) - throws BAD_INV_ORDER; + protected abstract void checkAccess(int methodID) throws BAD_INV_ORDER; /** - * The server side does an explicit set rather than taking the - * current PICurrent table as is done in the general RequestInfoImpl - * constructor. + * The server side does an explicit set rather than taking the current PICurrent table as is done in the general + * RequestInfoImpl constructor. */ - void setSlotTable(SlotTable slotTable) - { + void setSlotTable(SlotTable slotTable) { this.slotTable = slotTable; } - protected org.omg.CORBA.Object iorToObject( IOR ior ) - { - return ORBUtility.makeObjectReference( ior ) ; + protected org.omg.CORBA.Object iorToObject(IOR ior) { + return ORBUtility.makeObjectReference(ior); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ServerRequestInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ServerRequestInfoImpl.java index 83972daec..9f4648756 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ServerRequestInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/ServerRequestInfoImpl.java @@ -18,7 +18,7 @@ */ package com.sun.corba.ee.impl.interceptors; - + import org.omg.CORBA.Any; import org.omg.CORBA.BAD_INV_ORDER; import org.omg.CORBA.NVList; @@ -49,7 +49,7 @@ import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; import com.sun.corba.ee.spi.legacy.interceptor.ServerRequestInfoExt; import com.sun.corba.ee.spi.protocol.MessageMediator; @@ -57,21 +57,17 @@ import java.util.*; /** - * Implementation of the ServerRequestInfo interface as specified in - * orbos/99-12-02 section 5.4.3. + * Implementation of the ServerRequestInfo interface as specified in orbos/99-12-02 section 5.4.3. */ -public final class ServerRequestInfoImpl - extends RequestInfoImpl - implements ServerRequestInfo, ServerRequestInfoExt -{ +public final class ServerRequestInfoImpl extends RequestInfoImpl implements ServerRequestInfo, ServerRequestInfoExt { // The available constants for startingPointCall static final int CALL_RECEIVE_REQUEST_SERVICE_CONTEXT = 0; - - // The available constants for intermediatePointCall. The default (0) + + // The available constants for intermediatePointCall. The default (0) // is receive_request, but can be set to none on demand. static final int CALL_RECEIVE_REQUEST = 0; static final int CALL_INTERMEDIATE_NONE = 1; - + // The available constants for endingPointCall static final int CALL_SEND_REPLY = 0; static final int CALL_SEND_EXCEPTION = 1; @@ -82,7 +78,7 @@ public final class ServerRequestInfoImpl // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); // ////////////////////////////////////////////////////////////////////// - + // Set to true if the server ending point raised ForwardRequest at some // point in the ending point. private boolean forwardRequestRaisedInEnding; @@ -91,7 +87,7 @@ public final class ServerRequestInfoImpl private MessageMediator request; private java.lang.Object servant; private byte[] objectId; - private ObjectKeyTemplate oktemp ; + private ObjectKeyTemplate oktemp; // Information cached from calls to oktemp private byte[] adapterId; @@ -110,25 +106,23 @@ public final class ServerRequestInfoImpl // Cached information: private Parameter[] cachedArguments; private Any cachedSendingException; - private HashMap cachedRequestServiceContexts; - private HashMap cachedReplyServiceContexts; - + private HashMap cachedRequestServiceContexts; + private HashMap cachedReplyServiceContexts; + ////////////////////////////////////////////////////////////////////// // // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); // ////////////////////////////////////////////////////////////////////// - /** - * Reset the info object so that it can be reused for a retry, - * for example. + * Reset the info object so that it can be reused for a retry, for example. */ synchronized void reset() { super.reset(); // Please keep these in the same order as declared above. - + forwardRequestRaisedInEnding = false; request = null; @@ -159,108 +153,95 @@ synchronized void reset() { intermediatePointCall = CALL_RECEIVE_REQUEST; endingPointCall = CALL_SEND_REPLY; } - + /* ********************************************************************** * Access protection **********************************************************************/ - // Method IDs for all methods in ServerRequestInfo. This allows for a + // Method IDs for all methods in ServerRequestInfo. This allows for a // convenient O(1) lookup for checkAccess(). - private static final int MID_SENDING_EXCEPTION = MID_RI_LAST + 1; - private static final int MID_OBJECT_ID = MID_RI_LAST + 2; - private static final int MID_ADAPTER_ID = MID_RI_LAST + 3; + private static final int MID_SENDING_EXCEPTION = MID_RI_LAST + 1; + private static final int MID_OBJECT_ID = MID_RI_LAST + 2; + private static final int MID_ADAPTER_ID = MID_RI_LAST + 3; private static final int MID_TARGET_MOST_DERIVED_INTERFACE = MID_RI_LAST + 4; - private static final int MID_GET_SERVER_POLICY = MID_RI_LAST + 5; - private static final int MID_SET_SLOT = MID_RI_LAST + 6; - private static final int MID_TARGET_IS_A = MID_RI_LAST + 7; - private static final int MID_ADD_REPLY_SERVICE_CONTEXT = MID_RI_LAST + 8; - private static final int MID_SERVER_ID = MID_RI_LAST + 9; - private static final int MID_ORB_ID = MID_RI_LAST + 10; - private static final int MID_ADAPTER_NAME = MID_RI_LAST + 11; - + private static final int MID_GET_SERVER_POLICY = MID_RI_LAST + 5; + private static final int MID_SET_SLOT = MID_RI_LAST + 6; + private static final int MID_TARGET_IS_A = MID_RI_LAST + 7; + private static final int MID_ADD_REPLY_SERVICE_CONTEXT = MID_RI_LAST + 8; + private static final int MID_SERVER_ID = MID_RI_LAST + 9; + private static final int MID_ORB_ID = MID_RI_LAST + 10; + private static final int MID_ADAPTER_NAME = MID_RI_LAST + 11; + // ServerRequestInfo validity table (see ptc/00-08-06 table 21-2). // Note: These must be in the same order as specified in contants. private static final boolean validCall[][] = { - // LEGEND: - // r_rsc = receive_request_service_contexts - // r_req = receive_request - // s_rep = send_reply - // s_exc = send_exception - // s_oth = send_other - // - // A true value indicates call is valid at specified point. - // A false value indicates the call is invalid. - // - // NOTE: If the order or number of columns change, update - // checkAccess() accordingly. - // - // { r_rsc, r_req, s_rep, s_exc, s_oth } - // RequestInfo methods: - /*request_id*/ { true , true , true , true , true }, - /*operation*/ { true , true , true , true , true }, - /*arguments*/ { false, true , true , false, false }, - /*exceptions*/ { false, true , true , true , true }, - /*contexts*/ { false, true , true , true , true }, - /*operation_context*/ { false, true , true , false, false }, - /*result*/ { false, false, true , false, false }, - /*response_expected*/ { true , true , true , true , true }, - /*sync_scope*/ { true , true , true , true , true }, - /*reply_status*/ { false, false, true , true , true }, - /*forward_reference*/ { false, false, false, false, true }, - /*get_slot*/ { true , true , true , true , true }, - /*get_request_service_context*/ { true , true , true , true , true }, - /*get_reply_service_context*/ { false, false, true , true , true }, - // - // ServerRequestInfo methods:: - /*sending_exception*/ { false, false, false, true , false }, - /*object_id*/ { false, true , true , true , true }, - /*adapter_id*/ { false, true , true , true , true }, - /*target_most_derived_inte...*/ { false, true , false, false, false }, - /*get_server_policy*/ { true , true , true , true , true }, - /*set_slot*/ { true , true , true , true , true }, - /*target_is_a*/ { false, true , false, false, false }, - /*add_reply_service_context*/ { true , true , true , true , true }, - /*orb_id*/ { false, true , true , true , true }, - /*server_id*/ { false, true , true , true , true }, - /*adapter_name*/ { false, true , true , true , true } - }; - + // LEGEND: + // r_rsc = receive_request_service_contexts + // r_req = receive_request + // s_rep = send_reply + // s_exc = send_exception + // s_oth = send_other + // + // A true value indicates call is valid at specified point. + // A false value indicates the call is invalid. + // + // NOTE: If the order or number of columns change, update + // checkAccess() accordingly. + // + // { r_rsc, r_req, s_rep, s_exc, s_oth } + // RequestInfo methods: + /* request_id */ { true, true, true, true, true }, /* operation */ { true, true, true, true, true }, + /* arguments */ { false, true, true, false, false }, /* exceptions */ { false, true, true, true, true }, + /* contexts */ { false, true, true, true, true }, /* operation_context */ { false, true, true, false, false }, + /* result */ { false, false, true, false, false }, /* response_expected */ { true, true, true, true, true }, + /* sync_scope */ { true, true, true, true, true }, /* reply_status */ { false, false, true, true, true }, + /* forward_reference */ { false, false, false, false, true }, /* get_slot */ { true, true, true, true, true }, + /* get_request_service_context */ { true, true, true, true, true }, + /* get_reply_service_context */ { false, false, true, true, true }, + // + // ServerRequestInfo methods:: + /* sending_exception */ { false, false, false, true, false }, /* object_id */ { false, true, true, true, true }, + /* adapter_id */ { false, true, true, true, true }, /* target_most_derived_inte... */ { false, true, false, false, false }, + /* get_server_policy */ { true, true, true, true, true }, /* set_slot */ { true, true, true, true, true }, + /* target_is_a */ { false, true, false, false, false }, /* add_reply_service_context */ { true, true, true, true, true }, + /* orb_id */ { false, true, true, true, true }, /* server_id */ { false, true, true, true, true }, + /* adapter_name */ { false, true, true, true, true } }; + /* ********************************************************************** * Public interfaces **********************************************************************/ - + /** - * Creates a new ServerRequestInfo implementation. - * The constructor is package scope since no other package need create + * Creates a new ServerRequestInfo implementation. The constructor is package scope since no other package need create * an instance of this class. */ - ServerRequestInfoImpl( ORB myORB ) { - super( myORB ); + ServerRequestInfoImpl(ORB myORB) { + super(myORB); startingPointCall = CALL_RECEIVE_REQUEST_SERVICE_CONTEXT; intermediatePointCall = CALL_RECEIVE_REQUEST; endingPointCall = CALL_SEND_REPLY; serverRequestId = myORB.getPIHandler().allocateServerRequestId(); } - + /** * Any containing the exception to be returned to the client. */ - public Any sending_exception () { - checkAccess( MID_SENDING_EXCEPTION ); + public Any sending_exception() { + checkAccess(MID_SENDING_EXCEPTION); - if( cachedSendingException == null ) { - Any result = null ; + if (cachedSendingException == null) { + Any result = null; - if( dsiException != null ) { + if (dsiException != null) { result = dsiException; - } else if( exception != null ) { - result = exceptionToAny( exception ); + } else if (exception != null) { + result = exceptionToAny(exception); } else { // sending_exception should not be callable if both dsiException // and exception are null. - throw wrapper.exceptionUnavailable() ; + throw wrapper.exceptionUnavailable(); } cachedSendingException = result; @@ -268,107 +249,101 @@ public Any sending_exception () { return cachedSendingException; } - + /** * The opaque object_id describing the target of the operation invocation. */ - public byte[] object_id () { - checkAccess( MID_OBJECT_ID ); + public byte[] object_id() { + checkAccess(MID_OBJECT_ID); - if( objectId == null ) { - // For some reason, we never set object id. This could be + if (objectId == null) { + // For some reason, we never set object id. This could be // because a servant locator caused a location forward or - // raised an exception. As per ptc/00-08-06, section 21.3.14, + // raised an exception. As per ptc/00-08-06, section 21.3.14, // we throw NO_RESOURCES - throw stdWrapper.piOperationNotSupported6() ; + throw stdWrapper.piOperationNotSupported6(); } // Good citizen: In the interest of efficiency, we will assume // interceptors will not change the resulting byte[] array. // Otherwise, we would need to make a clone of this array. - return objectId.clone() ; + return objectId.clone(); } - private void checkForNullTemplate() - { + private void checkForNullTemplate() { if (oktemp == null) { // For some reason, we never set the ObjectKeyTemplate // because a servant locator caused a location forward or - // raised an exception. As per ptc/00-08-06, section 21.3.14, + // raised an exception. As per ptc/00-08-06, section 21.3.14, // we throw NO_RESOURCES - throw stdWrapper.piOperationNotSupported7() ; + throw stdWrapper.piOperationNotSupported7(); } } - - public synchronized String server_id() - { - checkAccess( MID_SERVER_ID ) ; - checkForNullTemplate() ; + + public synchronized String server_id() { + checkAccess(MID_SERVER_ID); + checkForNullTemplate(); // Good citizen: In the interest of efficiency, we will assume // interceptors will not change the resulting byte[] array. // Otherwise, we would need to make a clone of this array. - return Integer.toString( oktemp.getServerId() ) ; + return Integer.toString(oktemp.getServerId()); } - public String orb_id() - { - checkAccess( MID_ORB_ID ) ; + public String orb_id() { + checkAccess(MID_ORB_ID); - return myORB.getORBData().getORBId() ; + return myORB.getORBData().getORBId(); } - synchronized public String[] adapter_name() - { - checkAccess( MID_ADAPTER_NAME ) ; + synchronized public String[] adapter_name() { + checkAccess(MID_ADAPTER_NAME); if (adapterName == null) { - checkForNullTemplate() ; + checkForNullTemplate(); - ObjectAdapterId oaid = oktemp.getObjectAdapterId() ; - adapterName = oaid.getAdapterName() ; + ObjectAdapterId oaid = oktemp.getObjectAdapterId(); + adapterName = oaid.getAdapterName(); } - return adapterName.clone() ; + return adapterName.clone(); } /** * The opaque identifier for the object adapter. */ - synchronized public byte[] adapter_id () - { - checkAccess( MID_ADAPTER_ID ); + synchronized public byte[] adapter_id() { + checkAccess(MID_ADAPTER_ID); - if( adapterId == null ) { - checkForNullTemplate() ; - adapterId = oktemp.getAdapterId() ; + if (adapterId == null) { + checkForNullTemplate(); + adapterId = oktemp.getAdapterId(); } - return adapterId.clone() ; + return adapterId.clone(); } - + /** * The RepositoryID for the most derived interface of the servant. */ - public String target_most_derived_interface () { - checkAccess( MID_TARGET_MOST_DERIVED_INTERFACE ); + public String target_most_derived_interface() { + checkAccess(MID_TARGET_MOST_DERIVED_INTERFACE); return targetMostDerivedInterface; } - + /** - * Returns the policy in effect for this operation for the given policy - * type. + * Returns the policy in effect for this operation for the given policy type. */ - public Policy get_server_policy (int type) { + public Policy get_server_policy(int type) { // access is currently valid for all states: - //checkAccess( MID_GET_SERVER_POLICY ); + // checkAccess( MID_GET_SERVER_POLICY ); Policy result = null; - if( objectAdapter != null ) { - result = objectAdapter.getEffectivePolicy( type ); + if (objectAdapter != null) { + result = objectAdapter.getEffectivePolicy(type); } // _REVISIT_ RTF Issue: get_server_policy spec not in sync with @@ -376,67 +351,60 @@ public Policy get_server_policy (int type) { return result; } - + /** - * Allows an Interceptor to set a slot in the Current that is in the scope - * of the request. If data already exists in that slot, it will be - * overwritten. If the ID does not define an allocated slot, InvalidSlot - * is raised. + * Allows an Interceptor to set a slot in the Current that is in the scope of the request. If data already exists in + * that slot, it will be overwritten. If the ID does not define an allocated slot, InvalidSlot is raised. */ - public void set_slot (int id, Any data) throws InvalidSlot { + public void set_slot(int id, Any data) throws InvalidSlot { // access is currently valid for all states: - //checkAccess( MID_SET_SLOT ); - - slotTable.set_slot( id, data ); + // checkAccess( MID_SET_SLOT ); + + slotTable.set_slot(id, data); } - + /** - * Returns true if the servant is the given RepositoryId, false if it is - * not. + * Returns true if the servant is the given RepositoryId, false if it is not. */ - public boolean target_is_a (String id) { - checkAccess( MID_TARGET_IS_A ); + public boolean target_is_a(String id) { + checkAccess(MID_TARGET_IS_A); - boolean result = false ; - if( servant instanceof Servant ) { - result = ((Servant)servant)._is_a( id ); - } else if (StubAdapter.isStub( servant )) { - result = ((org.omg.CORBA.Object)servant)._is_a( id ); + boolean result = false; + if (servant instanceof Servant) { + result = ((Servant) servant)._is_a(id); + } else if (StubAdapter.isStub(servant)) { + result = ((org.omg.CORBA.Object) servant)._is_a(id); } else { - throw wrapper.servantInvalid() ; + throw wrapper.servantInvalid(); } return result; } - + /** * Allows Interceptors to add service contexts to the request. */ - public void add_reply_service_context ( ServiceContext service_context, - boolean replace ) - { + public void add_reply_service_context(ServiceContext service_context, boolean replace) { // access is currently valid for all states: - //checkAccess( MID_ADD_REPLY_SERVICE_CONTEXT ); + // checkAccess( MID_ADD_REPLY_SERVICE_CONTEXT ); - if( currentExecutionPoint == EXECUTION_POINT_ENDING ) { + if (currentExecutionPoint == EXECUTION_POINT_ENDING) { ServiceContexts scs = replyMessage.getServiceContexts(); - if( cachedReplyServiceContexts == null ) { - cachedReplyServiceContexts = - new HashMap(); + if (cachedReplyServiceContexts == null) { + cachedReplyServiceContexts = new HashMap(); } // This is during and ending point, so we now have enough // information to add the reply service context. - addServiceContext( cachedReplyServiceContexts, scs, - service_context, replace ); + addServiceContext(cachedReplyServiceContexts, scs, service_context, replace); } // We enqueue all adds for the following reasons: // // If we are not in the ending point then we do not yet have a // pointer to the ServiceContexts object so we cannot access the - // service contexts until we get to the ending point. + // service contexts until we get to the ending point. // So we enqueue this add reply service context request. // It is added when we do have a handle on the service contexts object. // @@ -448,18 +416,16 @@ public void add_reply_service_context ( ServiceContext service_context, // Therefore we always enqueue and never dequeue (per request) so // that all adds will be completed. - AddReplyServiceContextCommand addReply = - new AddReplyServiceContextCommand(); + AddReplyServiceContextCommand addReply = new AddReplyServiceContextCommand(); addReply.service_context = service_context; addReply.replace = replace; - if( addReplyServiceContextQueue == null ) { - addReplyServiceContextQueue = - new ArrayList(); + if (addReplyServiceContextQueue == null) { + addReplyServiceContextQueue = new ArrayList(); } // REVISIT: this does not add to the cache. - enqueue( addReply ); + enqueue(addReply); } // NOTE: When adding a method, be sure to: @@ -471,22 +437,20 @@ public void add_reply_service_context ( ServiceContext service_context, ********************************************************************** * Public RequestInfo interfaces * - * These are implemented here because they have differing - * implementations depending on whether this is a client or a server - * request info object. + * These are implemented here because they have differing implementations depending on whether this is a client or a + * server request info object. **********************************************************************/ /** * See ServerRequestInfo for javadocs. */ - public int request_id (){ + public int request_id() { // access is currently valid for all states: - //checkAccess( MID_REQUEST_ID ); + // checkAccess( MID_REQUEST_ID ); /* - * NOTE: The request id in server interceptors is NOT the - * same as the GIOP request id. The ORB may be servicing several - * connections, each with possibly overlapping sets of request ids. - * Therefore we create a request id specific to interceptors. + * NOTE: The request id in server interceptors is NOT the same as the GIOP request id. The ORB may be servicing several + * connections, each with possibly overlapping sets of request ids. Therefore we create a request id specific to + * interceptors. */ return serverRequestId; } @@ -494,91 +458,90 @@ public int request_id (){ /** * See ServerRequestInfo for javadocs. */ - public String operation(){ + public String operation() { // access is currently valid for all states: - //checkAccess( MID_OPERATION ); + // checkAccess( MID_OPERATION ); return request.getOperationName(); } public String toString() { - return "ServerRequestInfoImpl[operation=" - + operation() + "]" ; + return "ServerRequestInfoImpl[operation=" + operation() + "]"; } /** * See ServerRequestInfo for javadocs. */ - public Parameter[] arguments (){ - checkAccess( MID_ARGUMENTS ); + public Parameter[] arguments() { + checkAccess(MID_ARGUMENTS); - if( cachedArguments == null ) { - if( !isDynamic ) { - throw stdWrapper.piOperationNotSupported1() ; + if (cachedArguments == null) { + if (!isDynamic) { + throw stdWrapper.piOperationNotSupported1(); } - if( dsiArguments == null ) { - throw stdWrapper.piOperationNotSupported8() ; + if (dsiArguments == null) { + throw stdWrapper.piOperationNotSupported8(); } // If it is a DSI request then get the arguments from the DSI req // and convert that into parameters. - cachedArguments = nvListToParameterArray( dsiArguments ); + cachedArguments = nvListToParameterArray(dsiArguments); } - // Good citizen: In the interest of efficiency, we assume - // interceptors will be "good citizens" in that they will not - // modify the contents of the Parameter[] array. We also assume + // Good citizen: In the interest of efficiency, we assume + // interceptors will be "good citizens" in that they will not + // modify the contents of the Parameter[] array. We also assume // they will not change the values of the containing Anys. - return cachedArguments.clone() ; + return cachedArguments.clone(); } /** * See ServerRequestInfo for javadocs. */ - public TypeCode[] exceptions (){ - checkAccess( MID_EXCEPTIONS ); + public TypeCode[] exceptions() { + checkAccess(MID_EXCEPTIONS); // _REVISIT_ PI RTF Issue: No exception list on server side. - throw stdWrapper.piOperationNotSupported2() ; + throw stdWrapper.piOperationNotSupported2(); } /** * See ServerRequestInfo for javadocs. */ - public String[] contexts (){ - checkAccess( MID_CONTEXTS ); + public String[] contexts() { + checkAccess(MID_CONTEXTS); // We do not support this because our ORB does not send contexts. - throw stdWrapper.piOperationNotSupported3() ; + throw stdWrapper.piOperationNotSupported3(); } /** * See ServerRequestInfo for javadocs. */ - public String[] operation_context (){ - checkAccess( MID_OPERATION_CONTEXT ); + public String[] operation_context() { + checkAccess(MID_OPERATION_CONTEXT); - // We do not support this because our ORB does not send + // We do not support this because our ORB does not send // operation_context. - throw stdWrapper.piOperationNotSupported4() ; + throw stdWrapper.piOperationNotSupported4(); } /** * See ServerRequestInfo for javadocs. */ - public Any result (){ - checkAccess( MID_RESULT ); + public Any result() { + checkAccess(MID_RESULT); - if( !isDynamic ) { - throw stdWrapper.piOperationNotSupported5() ; + if (!isDynamic) { + throw stdWrapper.piOperationNotSupported5(); } - if( dsiResult == null ) { - throw wrapper.piDsiResultIsNull() ; + if (dsiResult == null) { + throw wrapper.piDsiResultIsNull(); } // Good citizen: In the interest of efficiency, we assume that @@ -591,22 +554,22 @@ public Any result (){ /** * See ServerRequestInfo for javadocs. */ - public boolean response_expected (){ + public boolean response_expected() { // access is currently valid for all states: - //checkAccess( MID_RESPONSE_EXPECTED ); + // checkAccess( MID_RESPONSE_EXPECTED ); return !request.isOneWay(); } /** * See ServerRequestInfo for javadocs. */ - public Object forward_reference (){ - checkAccess( MID_FORWARD_REFERENCE ); + public Object forward_reference() { + checkAccess(MID_FORWARD_REFERENCE); // Check to make sure we are in LOCATION_FORWARD // state as per ptc/00-08-06, table 21-2 // footnote 2. - if( replyStatus != LOCATION_FORWARD.value ) { - throw stdWrapper.invalidPiCall1() ; + if (replyStatus != LOCATION_FORWARD.value) { + throw stdWrapper.invalidPiCall1(); } return getForwardRequestException().forward; @@ -615,35 +578,31 @@ public Object forward_reference (){ /** * See ServerRequestInfo for javadocs. */ - public org.omg.IOP.ServiceContext get_request_service_context( int id ) { - checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT ); + public org.omg.IOP.ServiceContext get_request_service_context(int id) { + checkAccess(MID_GET_REQUEST_SERVICE_CONTEXT); - if( cachedRequestServiceContexts == null ) { - cachedRequestServiceContexts = - new HashMap(); + if (cachedRequestServiceContexts == null) { + cachedRequestServiceContexts = new HashMap(); } - return getServiceContext( cachedRequestServiceContexts, - request.getRequestServiceContexts(), id ); + return getServiceContext(cachedRequestServiceContexts, request.getRequestServiceContexts(), id); } /** * See ServerRequestInfo for javadocs. */ - public org.omg.IOP.ServiceContext get_reply_service_context( int id ) { - checkAccess( MID_GET_REPLY_SERVICE_CONTEXT ); + public org.omg.IOP.ServiceContext get_reply_service_context(int id) { + checkAccess(MID_GET_REPLY_SERVICE_CONTEXT); - if( cachedReplyServiceContexts == null ) { - cachedReplyServiceContexts = - new HashMap(); + if (cachedReplyServiceContexts == null) { + cachedReplyServiceContexts = new HashMap(); } - return getServiceContext( cachedReplyServiceContexts, - replyMessage.getServiceContexts(), id ); + return getServiceContext(cachedReplyServiceContexts, replyMessage.getServiceContexts(), id); } public boolean isNameService() { - return objectAdapter.isNameService() ; + return objectAdapter.isNameService(); } /* @@ -660,34 +619,30 @@ private static class AddReplyServiceContextCommand { } // Adds the given add reply service context command to the queue of - // such commands. If a command is detected to have the same id as - // the service context in this command, and replace is false, - // BAD_INV_ORDER is thrown. If replace is true, the original command + // such commands. If a command is detected to have the same id as + // the service context in this command, and replace is false, + // BAD_INV_ORDER is thrown. If replace is true, the original command // in the queue is replaced by this command. - private void enqueue( AddReplyServiceContextCommand addReply ) { + private void enqueue(AddReplyServiceContextCommand addReply) { int size = addReplyServiceContextQueue.size(); boolean found = false; - for( int i = 0; i < size; i++ ) { - AddReplyServiceContextCommand cmd = - addReplyServiceContextQueue.get( i ); + for (int i = 0; i < size; i++) { + AddReplyServiceContextCommand cmd = addReplyServiceContextQueue.get(i); - if( cmd.service_context.context_id == - addReply.service_context.context_id ) - { + if (cmd.service_context.context_id == addReply.service_context.context_id) { found = true; - if( addReply.replace ) { - addReplyServiceContextQueue.set( i, addReply ); + if (addReply.replace) { + addReplyServiceContextQueue.set(i, addReply); } else { - throw stdWrapper.serviceContextAddFailed( - cmd.service_context.context_id ) ; + throw stdWrapper.serviceContextAddFailed(cmd.service_context.context_id); } break; } } - if( !found ) { - addReplyServiceContextQueue.add( addReply ); + if (!found) { + addReplyServiceContextQueue.add(addReply); } } @@ -697,33 +652,27 @@ private void enqueue( AddReplyServiceContextCommand addReply ) { **********************************************************************/ /** - * Overridden from RequestInfoImpl. This version calls the super - * and then, if we are changing to ending points, executes all - * enqueued AddReplyServiceContextCommands. + * Overridden from RequestInfoImpl. This version calls the super and then, if we are changing to ending points, executes + * all enqueued AddReplyServiceContextCommands. */ - protected void setCurrentExecutionPoint( int executionPoint ) { - super.setCurrentExecutionPoint( executionPoint ); + protected void setCurrentExecutionPoint(int executionPoint) { + super.setCurrentExecutionPoint(executionPoint); // If we are transitioning to ending point, we will now have a pointer // to the reply service contexts, so we can execute all queued // add reply service context requests. - if( (executionPoint == EXECUTION_POINT_ENDING) && - (addReplyServiceContextQueue != null) ) - { + if ((executionPoint == EXECUTION_POINT_ENDING) && (addReplyServiceContextQueue != null)) { int size = addReplyServiceContextQueue.size(); - for( int i = 0; i < size; i++ ) { - AddReplyServiceContextCommand addReply = - addReplyServiceContextQueue.get( i ); + for (int i = 0; i < size; i++) { + AddReplyServiceContextCommand addReply = addReplyServiceContextQueue.get(i); try { - add_reply_service_context( addReply.service_context, - addReply.replace ); - } - catch( BAD_INV_ORDER e ) { - // _REVISIT_ The only way this can happen is if during - // rrsc or rr, the interceptor tried to add with - // replace=false to a service context that is present in - // the reply message. At that time there was no way for - // us to check for this, so the best we can do is ignore + add_reply_service_context(addReply.service_context, addReply.replace); + } catch (BAD_INV_ORDER e) { + // _REVISIT_ The only way this can happen is if during + // rrsc or rr, the interceptor tried to add with + // replace=false to a service context that is present in + // the reply message. At that time there was no way for + // us to check for this, so the best we can do is ignore // the original request. } } @@ -734,37 +683,37 @@ protected void setCurrentExecutionPoint( int executionPoint ) { } } - /** + /** * Stores the various sources of information used for this info object. + * * @param request Request holder, included the Connection * @param oa Object Adapter * @param objectId id of object * @param oktemp template for object */ - protected synchronized void setInfo( MessageMediator request, ObjectAdapter oa, - byte[] objectId, ObjectKeyTemplate oktemp ) - { + protected synchronized void setInfo(MessageMediator request, ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp) { this.request = request; this.objectId = objectId; this.oktemp = oktemp; - this.objectAdapter = oa ; - this.connection = (com.sun.corba.ee.spi.legacy.connection.Connection) - request.getConnection(); + this.objectAdapter = oa; + this.connection = (com.sun.corba.ee.spi.legacy.connection.Connection) request.getConnection(); } /** * Stores the various sources of information used for this info object. + * * @param arguments Arguments for the operation */ - protected void setDSIArguments( NVList arguments ) { + protected void setDSIArguments(NVList arguments) { this.dsiArguments = arguments; } /** * Stores the various sources of information used for this info object. + * * @param exception {@link Any} holding exception that occurred during operation */ - protected void setDSIException( Any exception ) { + protected void setDSIException(Any exception) { this.dsiException = exception; // Clear cached exception value: @@ -773,15 +722,16 @@ protected void setDSIException( Any exception ) { /** * Stores the various sources of information used for this info object. + * * @param result {@link Any} holding result of operation */ - protected void setDSIResult( Any result ) { + protected void setDSIResult(Any result) { this.dsiResult = result; } @Override - protected void setException( Exception exception ) { - super.setException( exception ); + protected void setException(Exception exception) { + super.setException(exception); // Make sure DSIException is null because this is the more recent one. this.dsiException = null; @@ -789,35 +739,34 @@ protected void setException( Exception exception ) { // Clear cached exception value: cachedSendingException = null; } - + /** * Stores the various sources of information used for this info object. + * * @param servant Servant used * @param targetMostDerivedInterface derived interface */ - protected void setInfo( java.lang.Object servant, String targetMostDerivedInterface ) { + protected void setInfo(java.lang.Object servant, String targetMostDerivedInterface) { this.servant = servant; this.targetMostDerivedInterface = targetMostDerivedInterface; - this.isDynamic = - (servant instanceof - org.omg.PortableServer.DynamicImplementation) || - (servant instanceof org.omg.CORBA.DynamicImplementation); + this.isDynamic = (servant instanceof org.omg.PortableServer.DynamicImplementation) + || (servant instanceof org.omg.CORBA.DynamicImplementation); } - + /** * Set reply message */ - void setReplyMessage( ReplyMessage replyMessage ) { + void setReplyMessage(ReplyMessage replyMessage) { this.replyMessage = replyMessage; } /** - * Overridden from RequestInfoImpl. Calls the super class, then - * sets the ending point call depending on the reply status. + * Overridden from RequestInfoImpl. Calls the super class, then sets the ending point call depending on the reply + * status. */ - protected void setReplyStatus( short replyStatus ) { - super.setReplyStatus( replyStatus ); - switch( replyStatus ) { + protected void setReplyStatus(short replyStatus) { + super.setReplyStatus(replyStatus); + switch (replyStatus) { case SUCCESSFUL.value: endingPointCall = CALL_SEND_REPLY; break; @@ -831,26 +780,25 @@ protected void setReplyStatus( short replyStatus ) { break; } } - + /** - * Release the servant object so the user has control over its lifetime. - * Called after receive_request is finished executing. + * Release the servant object so the user has control over its lifetime. Called after receive_request is finished + * executing. */ void releaseServant() { this.servant = null; } - + /** - * Sets the forwardRequestRaisedInEnding flag to true, indicating that - * a server ending point has raised location forward at some point. + * Sets the forwardRequestRaisedInEnding flag to true, indicating that a server ending point has raised location forward + * at some point. */ void setForwardRequestRaisedInEnding() { this.forwardRequestRaisedInEnding = true; } /** - * Returns true if ForwardRequest was raised by a server ending point - * or false otherwise. + * Returns true if ForwardRequest was raised by a server ending point or false otherwise. */ boolean isForwardRequestRaisedInEnding() { return this.forwardRequestRaisedInEnding; @@ -860,18 +808,17 @@ boolean isForwardRequestRaisedInEnding() { * Returns true if this is a dynamic invocation, or false if not */ boolean isDynamic() { - return this.isDynamic; + return this.isDynamic; } /** * See description for RequestInfoImpl.checkAccess */ - protected void checkAccess( int methodID ) - { + protected void checkAccess(int methodID) { // Make sure currentPoint matches the appropriate index in the // validCall table: int validCallIndex = 0; - switch( currentExecutionPoint ) { + switch (currentExecutionPoint) { case EXECUTION_POINT_STARTING: validCallIndex = 0; break; @@ -879,7 +826,7 @@ protected void checkAccess( int methodID ) validCallIndex = 1; break; case EXECUTION_POINT_ENDING: - switch( endingPointCall ) { + switch (endingPointCall) { case CALL_SEND_REPLY: validCallIndex = 2; break; @@ -892,11 +839,11 @@ protected void checkAccess( int methodID ) } break; } - + // Check the validCall table: - if( !validCall[methodID][validCallIndex] ) { - throw stdWrapper.invalidPiCall2() ; + if (!validCall[methodID][validCallIndex]) { + throw stdWrapper.invalidPiCall2(); } } - + } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/SlotTable.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/SlotTable.java index 6e68814af..9831b39a8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/SlotTable.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/SlotTable.java @@ -35,17 +35,19 @@ public class SlotTable { /** Required for instantiating Any object. */ private ORB orb; - /** The flag to check whether there are any updates in the current SlotTable. - * The slots will be reset to null, only if this flag is set. */ + /** + * The flag to check whether there are any updates in the current SlotTable. The slots will be reset to null, only if + * this flag is set. + */ private boolean dirtyFlag; /** - * The constructor instantiates an Array of Any[] of size given by slotSize - * parameter. + * The constructor instantiates an Array of Any[] of size given by slotSize parameter. + * * @param orb The ORB * @param slotSize Size of array */ - SlotTable( ORB orb, int slotSize ) { + SlotTable(ORB orb, int slotSize) { dirtyFlag = false; this.orb = orb; theSlotData = new Any[slotSize]; @@ -53,15 +55,15 @@ public class SlotTable { /** * This method sets the slot data at the given slot id (index). + * * @param id Index * @param data Slot data * @throws InvalidSlot If the id is greater than the slot data size. */ - public void set_slot( int id, Any data ) throws InvalidSlot - { + public void set_slot(int id, Any data) throws InvalidSlot { // First check whether the slot is allocated // If not, raise the invalid slot exception - if( id >= theSlotData.length ) { + if (id >= theSlotData.length) { throw new InvalidSlot(); } dirtyFlag = true; @@ -70,30 +72,29 @@ public void set_slot( int id, Any data ) throws InvalidSlot /** * This method get the slot data for the given slot id (index). + * * @param id Index * @return Slot data * @throws InvalidSlot If the id is greater than the slot data size. */ - public Any get_slot( int id ) throws InvalidSlot - { + public Any get_slot(int id) throws InvalidSlot { // First check whether the slot is allocated // If not, raise the invalid slot exception - if( id >= theSlotData.length ) { + if (id >= theSlotData.length) { throw new InvalidSlot(); } - if( theSlotData[id] == null ) { - theSlotData [id] = new AnyImpl(orb); + if (theSlotData[id] == null) { + theSlotData[id] = new AnyImpl(orb); } - return theSlotData[ id ]; + return theSlotData[id]; } - /** * This method resets all the slot data to null if dirtyFlag is set. */ - void resetSlots( ) { - if( dirtyFlag == true ) { - for( int i = 0; i < theSlotData.length; i++ ) { + void resetSlots() { + if (dirtyFlag == true) { + for (int i = 0; i < theSlotData.length; i++) { theSlotData[i] = null; } } @@ -101,11 +102,11 @@ void resetSlots( ) { /** * This method returns the size of the allocated slots. + * * @return slot size */ - int getSize( ) { + int getSize() { return theSlotData.length; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/SlotTableStack.java b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/SlotTableStack.java index 8d23d50ff..85d05bc96 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/SlotTableStack.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/interceptors/SlotTableStack.java @@ -26,10 +26,8 @@ /** * SlotTableStack is the container of SlotTable instances for each thread */ -public class SlotTableStack -{ - private static final InterceptorsSystemException wrapper = - InterceptorsSystemException.self ; +public class SlotTableStack { + private static final InterceptorsSystemException wrapper = InterceptorsSystemException.self; // Contains all the active SlotTables for each thread. // The List is made to behave like a stack. @@ -37,77 +35,72 @@ public class SlotTableStack // Keeps track of number of PICurrents in the stack. private int currentIndex; - + // The ORB associated with this slot table stack private ORB orb; - private PICurrent current ; + private PICurrent current; /** - * Constructs the stack. This stack must always contain at least - * one element so that peek never failes. + * Constructs the stack. This stack must always contain at least one element so that peek never failes. */ - SlotTableStack( ORB orb, PICurrent current ) { - this.current = current ; - this.orb = orb; + SlotTableStack(ORB orb, PICurrent current) { + this.current = current; + this.orb = orb; - currentIndex = 0; - tableContainer = new java.util.ArrayList( ); - pushSlotTable() ; + currentIndex = 0; + tableContainer = new java.util.ArrayList(); + pushSlotTable(); } /** - * pushSlotTable pushes a fresh Slot Table on to the stack by - * creating a new SlotTable and pushing that into the SlotTableStack. + * pushSlotTable pushes a fresh Slot Table on to the stack by creating a new SlotTable and pushing that into the + * SlotTableStack. */ - void pushSlotTable( ) { - SlotTable table = new SlotTable( orb, current.getTableSize() ); - + void pushSlotTable() { + SlotTable table = new SlotTable(orb, current.getTableSize()); + // NOTE: Very important not to always "add" - otherwise a memory leak. if (currentIndex == tableContainer.size()) { // Add will cause the table to grow. - tableContainer.add( currentIndex, table ); + tableContainer.add(currentIndex, table); } else if (currentIndex > tableContainer.size()) { - throw wrapper.slotTableInvariant( currentIndex, - tableContainer.size() ) ; + throw wrapper.slotTableInvariant(currentIndex, tableContainer.size()); } else { // Set will override unused slots. - tableContainer.set( currentIndex, table ); + tableContainer.set(currentIndex, table); } currentIndex++; } /** - * popSlotTable does the following - * 1: pops the top SlotTable in the SlotTableStack (if there is more than one) + * popSlotTable does the following 1: pops the top SlotTable in the SlotTableStack (if there is more than one) * - * 2: resets the slots in the SlotTable which resets the slotvalues to - * null if there are any previous sets. + * 2: resets the slots in the SlotTable which resets the slotvalues to null if there are any previous sets. */ - void popSlotTable( ) { - if(currentIndex == 1) { + void popSlotTable() { + if (currentIndex == 1) { // Do not pop the SlotTable, If there is only one. // This should not happen, But an extra check for safety. - throw wrapper.cantPopOnlyPicurrent() ; + throw wrapper.cantPopOnlyPicurrent(); } currentIndex--; - SlotTable table = tableContainer.get( currentIndex ); - tableContainer.set( currentIndex, null ); // Do not leak memory. - table.resetSlots( ); + SlotTable table = tableContainer.get(currentIndex); + tableContainer.set(currentIndex, null); // Do not leak memory. + table.resetSlots(); } /** - * peekSlotTable gets the top SlotTable from the SlotTableStack without - * popping. + * peekSlotTable gets the top SlotTable from the SlotTableStack without popping. */ - SlotTable peekSlotTable( ) { - SlotTable result = tableContainer.get( currentIndex - 1 ) ; + SlotTable peekSlotTable() { + SlotTable result = tableContainer.get(currentIndex - 1); if (result.getSize() != current.getTableSize()) { // stale table, so throw it away - result = new SlotTable( orb, current.getTableSize() ) ; - tableContainer.set( currentIndex - 1, result ) ; + result = new SlotTable(orb, current.getTableSize()); + tableContainer.set(currentIndex - 1, result); } - return result ; + return result; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/Exceptions.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/Exceptions.java index 65326e38e..397226a9c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/Exceptions.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/Exceptions.java @@ -31,172 +31,161 @@ import org.glassfish.pfl.basic.logex.Message; import org.glassfish.pfl.basic.logex.WrapperGenerator; -/** Logging and Exception handling for the io package. +/** + * Logging and Exception handling for the io package. * * @author ken */ -@ExceptionWrapper( idPrefix="ORBIO" ) +@ExceptionWrapper(idPrefix = "ORBIO") public interface Exceptions { - public Exceptions self = WrapperGenerator.makeWrapper( Exceptions.class, - StandardLogger.self ); + public Exceptions self = WrapperGenerator.makeWrapper(Exceptions.class, StandardLogger.self); // Allow 100 exceptions per class - static final int EXCEPTIONS_PER_CLASS = 100 ; + static final int EXCEPTIONS_PER_CLASS = 100; // IIOPInputStream - static final int IIS_START = 1 ; + static final int IIS_START = 1; - @Message( "No optional data exception constructor available" ) - @Log( id = IIS_START + 0 ) - ExceptionInInitializerError noOptionalDataExceptionConstructor( - @Chain Exception exc ); + @Message("No optional data exception constructor available") + @Log(id = IIS_START + 0) + ExceptionInInitializerError noOptionalDataExceptionConstructor(@Chain Exception exc); - @Message( "Can't create optional data exception") - @Log( id = IIS_START + 1 ) + @Message("Can't create optional data exception") + @Log(id = IIS_START + 1) Error cantCreateOptionalDataException(@Chain Exception ex); - @Message( "readLine method not supported") - @Log( id = IIS_START + 2 ) + @Message("readLine method not supported") + @Log(id = IIS_START + 2) IOException readLineMethodNotSupported(); - @Message( "registerValidation method not supported") - @Log( id = IIS_START + 3 ) + @Message("registerValidation method not supported") + @Log(id = IIS_START + 3) Error registerValidationNotSupport(); - @Message( "resolveClass method not supported") - @Log( id = IIS_START + 4 ) + @Message("resolveClass method not supported") + @Log(id = IIS_START + 4) IOException resolveClassNotSupported(); - @Message( "resolveObject method not supported") - @Log( id = IIS_START + 5 ) + @Message("resolveObject method not supported") + @Log(id = IIS_START + 5) IOException resolveObjectNotSupported(); - @Message( "IllegalAccessException when invoking readObject") - @Log( id = IIS_START + 6 ) + @Message("IllegalAccessException when invoking readObject") + @Log(id = IIS_START + 6) void illegalAccessInvokingObjectRead(@Chain IllegalAccessException e); - @Message( "Bad type {0} for primitive field") - @Log( id = IIS_START + 7 ) + @Message("Bad type {0} for primitive field") + @Log(id = IIS_START + 7) InvalidClassException invalidClassForPrimitive(String name); - @Message( "Unknown call type {0} while reading object field: " - + "possible stream corruption") - @Log( id = IIS_START + 8 ) + @Message("Unknown call type {0} while reading object field: " + "possible stream corruption") + @Log(id = IIS_START + 8) StreamCorruptedException unknownCallType(int callType); - @Message( "Unknown typecode kind {0} while reading object field: " - + "possible stream corruption") - @Log( id = IIS_START + 9 ) + @Message("Unknown typecode kind {0} while reading object field: " + "possible stream corruption") + @Log(id = IIS_START + 9) StreamCorruptedException unknownTypecodeKind(int value); - @Message( "Assigning instance of class {0} to field {1}" ) - @Log( id = IIS_START + 10 ) - ClassCastException couldNotAssignObjectToField( - @Chain IllegalArgumentException exc, String className, - String fieldName ); + @Message("Assigning instance of class {0} to field {1}") + @Log(id = IIS_START + 10) + ClassCastException couldNotAssignObjectToField(@Chain IllegalArgumentException exc, String className, String fieldName); - @Message( "Not setting field {0} on class {1}: " - + "likely that class has evolved") - @Log( level=LogLevel.FINE, id = IIS_START + 11 ) - void notSettingField( String fieldName, String className ); + @Message("Not setting field {0} on class {1}: " + "likely that class has evolved") + @Log(level = LogLevel.FINE, id = IIS_START + 11) + void notSettingField(String fieldName, String className); - @Message( "Stream corrupted" ) - @Log( id = IIS_START + 12 ) + @Message("Stream corrupted") + @Log(id = IIS_START + 12) StreamCorruptedException streamCorrupted(Throwable t); - @Log( id= IIS_START + 13 ) - @Message( "Could not unmarshal enum with cls {0}, value {1} using EnumDesc" ) - IOException couldNotUnmarshalEnum( String cls, String value ) ; + @Log(id = IIS_START + 13) + @Message("Could not unmarshal enum with cls {0}, value {1} using EnumDesc") + IOException couldNotUnmarshalEnum(String cls, String value); // IIOPOutputStream - int IOS_START = IIS_START + EXCEPTIONS_PER_CLASS ; + int IOS_START = IIS_START + EXCEPTIONS_PER_CLASS; - @Message( "method annotateClass not supported" ) - @Log( id = IOS_START + 1 ) + @Message("method annotateClass not supported") + @Log(id = IOS_START + 1) IOException annotateClassNotSupported(); - @Message( "method replaceObject not supported" ) - @Log( id = IOS_START + 2 ) + @Message("method replaceObject not supported") + @Log(id = IOS_START + 2) IOException replaceObjectNotSupported(); - @Message( "serialization of ObjectStreamClass not supported" ) - @Log( id = IOS_START + 3 ) + @Message("serialization of ObjectStreamClass not supported") + @Log(id = IOS_START + 3) IOException serializationObjectStreamClassNotSupported(); - @Message( "serialization of ObjectStreamClass not supported" ) - @Log( id = IOS_START + 4 ) + @Message("serialization of ObjectStreamClass not supported") + @Log(id = IOS_START + 4) NotSerializableException notSerializable(String name); - @Message( "Invalid class {0} for writing field" ) - @Log( id = IOS_START + 5 ) + @Message("Invalid class {0} for writing field") + @Log(id = IOS_START + 5) InvalidClassException invalidClassForWrite(String name); // InputStreamHook - int ISH_START = IOS_START + EXCEPTIONS_PER_CLASS ; + int ISH_START = IOS_START + EXCEPTIONS_PER_CLASS; - @Message( "Default data already read" ) - @Log( id = ISH_START + 1 ) + @Message("Default data already read") + @Log(id = ISH_START + 1) StreamCorruptedException defaultDataAlreadyRead(); - @Message( "Default data must be read first" ) - @Log( id = ISH_START + 2 ) + @Message("Default data must be read first") + @Log(id = ISH_START + 2) StreamCorruptedException defaultDataMustBeReadFirst(); - @Message( "Default data not sent or already read" ) - @Log( id = ISH_START + 3 ) + @Message("Default data not sent or already read") + @Log(id = ISH_START + 3) StreamCorruptedException defaultDataNotPresent(); // ObjectStreamClass - int OSC_START = ISH_START + EXCEPTIONS_PER_CLASS ; - - @Message( "Default data not sent or already read" ) - @Log( level=LogLevel.FINE, id = OSC_START + 1 ) - void couldNotAccessSerialPersistentFields( @Chain Exception e, - String name); - - @Message( "Field type mismatch in Class {0} for field (name {1}, type {2})" - + "and reflected field (name {3}, type {4})") - @Log( level=LogLevel.FINE, id = OSC_START + 2 ) - void fieldTypeMismatch( String cname, String fldName, - Class fldType, String rfldName, Class rfldType ) ; - - @Message( "Could not find field {1} in class {0}" ) - @Log( level=LogLevel.FINE, id = OSC_START + 3 ) - void noSuchField( @Chain NoSuchFieldException e, String className, - String fieldName ); - - @Message( "Could not hasStaticInitializer method in class {0}" ) - @Log( id = OSC_START + 4 ) + int OSC_START = ISH_START + EXCEPTIONS_PER_CLASS; + + @Message("Default data not sent or already read") + @Log(level = LogLevel.FINE, id = OSC_START + 1) + void couldNotAccessSerialPersistentFields(@Chain Exception e, String name); + + @Message("Field type mismatch in Class {0} for field (name {1}, type {2})" + "and reflected field (name {3}, type {4})") + @Log(level = LogLevel.FINE, id = OSC_START + 2) + void fieldTypeMismatch(String cname, String fldName, Class fldType, String rfldName, Class rfldType); + + @Message("Could not find field {1} in class {0}") + @Log(level = LogLevel.FINE, id = OSC_START + 3) + void noSuchField(@Chain NoSuchFieldException e, String className, String fieldName); + + @Message("Could not hasStaticInitializer method in class {0}") + @Log(id = OSC_START + 4) InternalError cantFindHasStaticInitializer(String cname); - @Message( "Could not invoke hasStaticInitializer method" ) - @Log( id = OSC_START + 5 ) + @Message("Could not invoke hasStaticInitializer method") + @Log(id = OSC_START + 5) InternalError errorInvokingHasStaticInitializer(@Chain Exception ex); // OutputStreamHook - int OSH_START = OSC_START + EXCEPTIONS_PER_CLASS ; + int OSH_START = OSC_START + EXCEPTIONS_PER_CLASS; - @Message( "Call writeObject twice" ) - @Log( id = OSH_START + 1 ) + @Message("Call writeObject twice") + @Log(id = OSH_START + 1) IOException calledWriteObjectTwice(); - @Message( "Call defaultWriteObject or writeFields twice" ) - @Log( id = OSH_START + 2 ) + @Message("Call defaultWriteObject or writeFields twice") + @Log(id = OSH_START + 2) IOException calledDefaultWriteObjectTwice(); - @Message( "Cannot call defaultWriteObject or writeFields after " - + "writing custom data") - @Log( id = OSH_START + 3 ) + @Message("Cannot call defaultWriteObject or writeFields after " + "writing custom data") + @Log(id = OSH_START + 3) IOException defaultWriteObjectAfterCustomData(); // ValueHandleImpl - int VHI_START = OSH_START + EXCEPTIONS_PER_CLASS ; + int VHI_START = OSH_START + EXCEPTIONS_PER_CLASS; - @Message( "Invalid primitive type {0}") - @Log( id = VHI_START + 1 ) + @Message("Invalid primitive type {0}") + @Log(id = VHI_START + 1) Error invalidPrimitiveType(String name); - @Message( "Invalid primitive component type {0}") - @Log( id = VHI_START + 2 ) + @Message("Invalid primitive component type {0}") + @Log(id = VHI_START + 2) Error invalidPrimitiveComponentType(String name); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/FVDCodeBaseImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/FVDCodeBaseImpl.java index d418b2add..fc25c4519 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/FVDCodeBaseImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/FVDCodeBaseImpl.java @@ -37,21 +37,17 @@ import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; /** - * This class acts as the remote interface to receivers wishing to retrieve - * the information of a remote Class. + * This class acts as the remote interface to receivers wishing to retrieve the information of a remote Class. */ -public class FVDCodeBaseImpl extends _CodeBaseImplBase -{ +public class FVDCodeBaseImpl extends _CodeBaseImplBase { // Contains rep. ids as keys to FullValueDescriptions - private static Map fvds = - new HashMap(); + private static Map fvds = new HashMap(); - // Private ORBSingleton used when we need an ORB while not - // having a delegate set. + // Private ORBSingleton used when we need an ORB while not + // having a delegate set. private transient ORB orb = null; - private static final OMGSystemException wrapper = - OMGSystemException.self ; + private static final OMGSystemException wrapper = OMGSystemException.self; // backward compatability so that appropriate rep-id calculations // can take place @@ -59,34 +55,33 @@ public class FVDCodeBaseImpl extends _CodeBaseImplBase // marshalling/unmarshalling private transient ValueHandlerImpl vhandler = null; - public FVDCodeBaseImpl( ValueHandler vh ) { + public FVDCodeBaseImpl(ValueHandler vh) { // vhandler will never be null - this.vhandler = (com.sun.corba.ee.impl.io.ValueHandlerImpl)vh ; + this.vhandler = (com.sun.corba.ee.impl.io.ValueHandlerImpl) vh; } // Operation to obtain the IR from the sending context - public com.sun.org.omg.CORBA.Repository get_ir (){ + public com.sun.org.omg.CORBA.Repository get_ir() { return null; } // Operations to obtain a URL to the implementation code - public String implementation (String x){ - try{ + public String implementation(String x) { + try { // Util.getCodebase may return null which would // cause a BAD_PARAM exception. - String result = Util.getInstance().getCodebase( - vhandler.getClassFromType(x)); + String result = Util.getInstance().getCodebase(vhandler.getClassFromType(x)); if (result == null) { return ""; } else { return result; } - } catch(ClassNotFoundException cnfe){ - throw wrapper.missingLocalValueImpl( cnfe ) ; + } catch (ClassNotFoundException cnfe) { + throw wrapper.missingLocalValueImpl(cnfe); } } - public String[] implementations (String[] x){ + public String[] implementations(String[] x) { String result[] = new String[x.length]; for (int i = 0; i < x.length; i++) { @@ -97,37 +92,35 @@ public String[] implementations (String[] x){ } // the same information - public FullValueDescription meta (String x){ - try{ + public FullValueDescription meta(String x) { + try { FullValueDescription result = fvds.get(x); if (result == null) { - try{ - result = ValueUtility.translate(_orb(), - ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler); - } catch(Throwable t){ + try { + result = ValueUtility.translate(_orb(), ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler); + } catch (Throwable t) { if (orb == null) { orb = ORB.init(); } - result = ValueUtility.translate(orb, - ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler); + result = ValueUtility.translate(orb, ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler); } - if (result != null){ + if (result != null) { fvds.put(x, result); } else { throw wrapper.missingLocalValueImpl(); } } - + return result; - } catch(Throwable t){ + } catch (Throwable t) { throw wrapper.incompatibleValueImpl(t); } } - public FullValueDescription[] metas (String[] x){ + public FullValueDescription[] metas(String[] x) { FullValueDescription descriptions[] = new FullValueDescription[x.length]; for (int i = 0; i < x.length; i++) { @@ -138,11 +131,10 @@ public FullValueDescription[] metas (String[] x){ } // information - public String[] bases (String x){ + public String[] bases(String x) { try { Stack repIds = new Stack(); - Class parent = ObjectStreamClass.lookup( - vhandler.getClassFromType(x)).forClass().getSuperclass(); + Class parent = ObjectStreamClass.lookup(vhandler.getClassFromType(x)).forClass().getSuperclass(); while (!parent.equals(java.lang.Object.class)) { repIds.push(vhandler.createForAnyType(parent)); @@ -156,7 +148,7 @@ public String[] bases (String x){ return result; } catch (Throwable t) { - throw wrapper.missingLocalValueImpl( t ); + throw wrapper.missingLocalValueImpl(t); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/IIOPInputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/IIOPInputStream.java index 6c2d65e48..901250265 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/IIOPInputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/IIOPInputStream.java @@ -65,43 +65,38 @@ import javax.rmi.CORBA.ValueHandler; /** - * IIOPInputStream is used by the ValueHandlerImpl to handle Java serialization - * input semantics. + * IIOPInputStream is used by the ValueHandlerImpl to handle Java serialization input semantics. * - * @author Stephen Lewallen - * @since JDK1.1.6 + * @author Stephen Lewallen + * @since JDK1.1.6 */ @ValueHandlerRead -public class IIOPInputStream - extends com.sun.corba.ee.impl.io.InputStreamHook -{ - private static Bridge bridge = AccessController.doPrivileged( - new PrivilegedAction() { - public Bridge run() { - return Bridge.get() ; - } - } - ) ; +public class IIOPInputStream extends com.sun.corba.ee.impl.io.InputStreamHook { + private static Bridge bridge = AccessController.doPrivileged(new PrivilegedAction() { + public Bridge run() { + return Bridge.get(); + } + }); // Necessary to pass the appropriate fields into the // defaultReadObjectDelegate method (which takes no - // parameters since it's called from + // parameters since it's called from // java.io.ObjectInpuStream defaultReadObject() // which we can't change). // - // This is only used in the case where the fields had + // This is only used in the case where the fields had // to be obtained remotely because of a serializable - // version difference. Set in inputObjectUsingFVD. + // version difference. Set in inputObjectUsingFVD. // Part of serialization evolution fixes for Ladybird, // bug 4365188. private ValueMember defaultReadObjectFVDMembers[] = null; private org.omg.CORBA_2_3.portable.InputStream orbStream; - private CodeBase cbSender; + private CodeBase cbSender; - private ValueHandlerImpl vhandler; //d4365188 + private ValueHandlerImpl vhandler; // d4365188 private Object currentObject = null; @@ -128,16 +123,17 @@ public Bridge run() { /* Remember the first exception that stopped this stream. */ private ClassNotFoundException abortClassNotFoundException = null; - /* List of validation callback objects - * The vector is created as needed. The vector is maintained in - * order of highest (first) priority to lowest + /* + * List of validation callback objects The vector is created as needed. The vector is maintained in order of highest + * (first) priority to lowest */ private List callbacks; // Serialization machinery fields - /* Arrays used to keep track of classes and ObjectStreamClasses - * as they are being merged; used in inputObject. - * spClass is the stack pointer for both. */ + /* + * Arrays used to keep track of classes and ObjectStreamClasses as they are being merged; used in inputObject. spClass + * is the stack pointer for both. + */ ObjectStreamClass[] classdesc; Class[] classes; int spClass; @@ -145,10 +141,8 @@ public Bridge run() { private static final String kEmptyStr = ""; - public static final TypeCode kRemoteTypeCode = - ORB.init().get_primitive_tc(TCKind.tk_objref); - public static final TypeCode kValueTypeCode = - ORB.init().get_primitive_tc(TCKind.tk_value); + public static final TypeCode kRemoteTypeCode = ORB.init().get_primitive_tc(TCKind.tk_objref); + public static final TypeCode kValueTypeCode = ORB.init().get_primitive_tc(TCKind.tk_value); // TESTING CODE - useFVDOnly should be made final before FCS in order to // optimize out the check. @@ -163,7 +157,8 @@ protected byte getStreamFormatVersion() { } @InfoMethod - private void streamFormatVersionInfo( byte sfv ) { } + private void streamFormatVersionInfo(byte sfv) { + } // At the beginning of data sent by a writeObject or // writeExternal method there is a byte telling the @@ -171,37 +166,36 @@ private void streamFormatVersionInfo( byte sfv ) { } @ValueHandlerRead private void readFormatVersion() throws IOException { streamFormatVersion = orbStream.read_octet(); - streamFormatVersionInfo( streamFormatVersion ) ; + streamFormatVersionInfo(streamFormatVersion); - if (streamFormatVersion < 1 || - streamFormatVersion > vhandler.getMaximumStreamFormatVersion()) { + if (streamFormatVersion < 1 || streamFormatVersion > vhandler.getMaximumStreamFormatVersion()) { SystemException sysex = omgWrapper.unsupportedFormatVersion(); - throw new IOException("Unsupported format version: " + - streamFormatVersion, sysex) ; + throw new IOException("Unsupported format version: " + streamFormatVersion, sysex); } if (streamFormatVersion == 2) { if (!(orbStream instanceof ValueInputStream)) { - SystemException sysex = omgWrapper.notAValueinputstream() ; - + SystemException sysex = omgWrapper.notAValueinputstream(); + throw new IOException("Not a ValueInputStream", sysex); } } } - public static void setTestFVDFlag(boolean val){ - // useFVDOnly = val; + public static void setTestFVDFlag(boolean val) { + // useFVDOnly = val; } /** * Dummy constructor; passes upper stream a dummy stream; + * * @throws IOException If an IO error occurs creating this stream. **/ public IIOPInputStream() throws java.io.IOException { super(); resetStream(); } - + final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) { orbStream = os; } @@ -210,7 +204,7 @@ final org.omg.CORBA_2_3.portable.InputStream getOrbStream() { return orbStream; } - //added setSender and getSender + // added setSender and getSender public final void setSender(CodeBase cb) { cbSender = cb; } @@ -228,60 +222,52 @@ public final void setValueHandler(ValueHandler vh) { public final ValueHandler getValueHandler() { return (javax.rmi.CORBA.ValueHandler) vhandler; } - + @InfoMethod - private void recursionDepthInfo( int rd ) {} + private void recursionDepthInfo(int rd) { + } @ValueHandlerRead - final void increaseRecursionDepth(){ + final void increaseRecursionDepth() { recursionDepth++; recursionDepthInfo(recursionDepth); } @ValueHandlerRead - final int decreaseRecursionDepth(){ + final int decreaseRecursionDepth() { --recursionDepth; recursionDepthInfo(recursionDepth); - return recursionDepth ; + return recursionDepth; } /** - * Override the actions of the final method "readObject()" - * in ObjectInputStream. + * Override the actions of the final method "readObject()" in ObjectInputStream. * - * Read an object from the ObjectInputStream. - * The class of the object, the signature of the class, and the values - * of the non-transient and non-static fields of the class and all - * of its supertypes are read. Default deserializing for a class can be - * overriden using the writeObject and readObject methods. - * Objects referenced by this object are read transitively so - * that a complete equivalent graph of objects is reconstructed by readObject.

+ * Read an object from the ObjectInputStream. The class of the object, the signature of the class, and the values of the + * non-transient and non-static fields of the class and all of its supertypes are read. Default deserializing for a + * class can be overriden using the writeObject and readObject methods. Objects referenced by this object are read + * transitively so that a complete equivalent graph of objects is reconstructed by readObject. + *

* - * The root object is completly restored when all of its fields - * and the objects it references are completely restored. At this - * point the object validation callbacks are executed in order - * based on their registered priorities. The callbacks are - * registered by objects (in the readObject special methods) - * as they are individually restored. + * The root object is completly restored when all of its fields and the objects it references are completely restored. + * At this point the object validation callbacks are executed in order based on their registered priorities. The + * callbacks are registered by objects (in the readObject special methods) as they are individually restored. * - * Exceptions are thrown for problems with the InputStream and for classes - * that should not be deserialized. All exceptions are fatal to the - * InputStream and leave it in an indeterminate state; it is up to the caller - * to ignore or recover the stream state. + * Exceptions are thrown for problems with the InputStream and for classes that should not be deserialized. All + * exceptions are fatal to the InputStream and leave it in an indeterminate state; it is up to the caller to ignore or + * recover the stream state. + * * @return the object read from stream - * @exception InvalidClassException Something is wrong with a class used by - * serialization. - * @exception StreamCorruptedException Control information in the - * stream is inconsistent. - * @exception OptionalDataException Primitive data was found in the - * stream instead of objects. + * @exception InvalidClassException Something is wrong with a class used by serialization. + * @exception StreamCorruptedException Control information in the stream is inconsistent. + * @exception OptionalDataException Primitive data was found in the stream instead of objects. * @exception IOException Any of the usual Input/Output related exceptions. * @exception ClassNotFoundException Deserialised class could not be found - * @since JDK1.1 + * @since JDK1.1 */ @ValueHandlerRead - public final synchronized Object readObjectDelegate() throws ClassNotFoundException, OptionalDataException, StreamCorruptedException, IOException - { + public final synchronized Object readObjectDelegate() + throws ClassNotFoundException, OptionalDataException, StreamCorruptedException, IOException { try { readObjectState.readData(this); @@ -289,7 +275,7 @@ public final synchronized Object readObjectDelegate() throws ClassNotFoundExcept } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, true); throw marshalException; - } catch(IndirectionException cdrie) { + } catch (IndirectionException cdrie) { // The CDR stream had never seen the given offset before, // so check the recursion manager (it will throw an // IOException if it doesn't have a reference, either). @@ -298,19 +284,18 @@ public final synchronized Object readObjectDelegate() throws ClassNotFoundExcept } @ValueHandlerRead - final synchronized Object simpleReadObject(Class clz, ClassInfoCache.ClassInfo cinfo, - String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender, - int offset) { + final synchronized Object simpleReadObject(Class clz, ClassInfoCache.ClassInfo cinfo, String repositoryID, + com.sun.org.omg.SendingContext.CodeBase sender, int offset) { /* Save the current state and get ready to read an object. */ Object prevObject = currentObject; ObjectStreamClass prevClassDesc = currentClassDesc; Class prevClass = currentClass; byte oldStreamFormatVersion = streamFormatVersion; - simpleReadDepth++; // Entering + simpleReadDepth++; // Entering Object obj = null; - OperationTracer.startReadValue( clz.getName() ) ; + OperationTracer.startReadValue(clz.getName()); /* * Check for reset, handle it before reading an object. @@ -323,41 +308,40 @@ final synchronized Object simpleReadObject(Class clz, ClassInfoCache.ClassInfo c } obj = currentClassDesc.readResolve(obj); - } catch(ClassNotFoundException cnfe) { - bridge.throwException( cnfe ) ; + } catch (ClassNotFoundException cnfe) { + bridge.throwException(cnfe); return null; - } catch(IOException ioe) { + } catch (IOException ioe) { // System.out.println("CLZ = " + clz + "; " + ioe.toString()); - bridge.throwException(ioe) ; + bridge.throwException(ioe); return null; } finally { - simpleReadDepth --; + simpleReadDepth--; currentObject = prevObject; currentClassDesc = prevClassDesc; currentClass = prevClass; streamFormatVersion = oldStreamFormatVersion; - OperationTracer.endReadValue() ; + OperationTracer.endReadValue(); } - /* Check for thrown exceptions and re-throw them, clearing them if - * this is the last recursive call . + /* + * Check for thrown exceptions and re-throw them, clearing them if this is the last recursive call . */ IOException exIOE = abortIOException; if (simpleReadDepth == 0) { abortIOException = null; } - if (exIOE != null){ - bridge.throwException( exIOE ) ; + if (exIOE != null) { + bridge.throwException(exIOE); return null; } - ClassNotFoundException exCNF = abortClassNotFoundException; if (simpleReadDepth == 0) { abortClassNotFoundException = null; } if (exCNF != null) { - bridge.throwException( exCNF ) ; + bridge.throwException(exCNF); return null; } @@ -365,16 +349,14 @@ final synchronized Object simpleReadObject(Class clz, ClassInfoCache.ClassInfo c } @ValueHandlerRead - public final synchronized void simpleSkipObject( String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender) - { + public final synchronized void simpleSkipObject(String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender) { /* Save the current state and get ready to read an object. */ Object prevObject = currentObject; ObjectStreamClass prevClassDesc = currentClassDesc; Class prevClass = currentClass; byte oldStreamFormatVersion = streamFormatVersion; - simpleReadDepth++; // Entering + simpleReadDepth++; // Entering Object obj = null; /* @@ -382,40 +364,38 @@ public final synchronized void simpleSkipObject( String repositoryID, */ try { skipObjectUsingFVD(repositoryID, sender); - } catch(ClassNotFoundException cnfe) { - bridge.throwException( cnfe ) ; + } catch (ClassNotFoundException cnfe) { + bridge.throwException(cnfe); return; - } catch(IOException ioe) { - bridge.throwException( ioe ) ; + } catch (IOException ioe) { + bridge.throwException(ioe); return; } finally { - simpleReadDepth --; + simpleReadDepth--; streamFormatVersion = oldStreamFormatVersion; currentObject = prevObject; currentClassDesc = prevClassDesc; currentClass = prevClass; } - - /* Check for thrown exceptions and re-throw them, clearing them if - * this is the last recursive call . + /* + * Check for thrown exceptions and re-throw them, clearing them if this is the last recursive call . */ IOException exIOE = abortIOException; if (simpleReadDepth == 0) { abortIOException = null; } - if (exIOE != null){ - bridge.throwException( exIOE ) ; + if (exIOE != null) { + bridge.throwException(exIOE); return; } - ClassNotFoundException exCNF = abortClassNotFoundException; if (simpleReadDepth == 0) { abortClassNotFoundException = null; } if (exCNF != null) { - bridge.throwException( exCNF ) ; + bridge.throwException(exCNF); return; } @@ -423,10 +403,8 @@ public final synchronized void simpleSkipObject( String repositoryID, } /** - * This method is called by trusted subclasses of ObjectOutputStream - * that constructed ObjectOutputStream using the - * protected no-arg constructor. The subclass is expected to provide - * an override method with the modifier "final". + * This method is called by trusted subclasses of ObjectOutputStream that constructed ObjectOutputStream using the + * protected no-arg constructor. The subclass is expected to provide an override method with the modifier "final". * * @return the Object read from the stream. * @@ -434,26 +412,23 @@ public final synchronized void simpleSkipObject( String repositoryID, * @since JDK 1.2 */ @Override - protected final Object readObjectOverride() - throws OptionalDataException, ClassNotFoundException, IOException - { + protected final Object readObjectOverride() throws OptionalDataException, ClassNotFoundException, IOException { return readObjectDelegate(); } @InfoMethod - private void usingLocalFieldsToRead() { } + private void usingLocalFieldsToRead() { + } /** - * Override the actions of the final method "defaultReadObject()" - * in ObjectInputStream. - * @since JDK1.1.6 + * Override the actions of the final method "defaultReadObject()" in ObjectInputStream. + * + * @since JDK1.1.6 * - * Read the non-static and non-transient fields of the current class - * from this stream. This may only be called from the readObject method - * of the class being deserialized. It will throw the NotActiveException - * if it is called otherwise. + * Read the non-static and non-transient fields of the current class from this stream. This may only be called from the + * readObject method of the class being deserialized. It will throw the NotActiveException if it is called otherwise. * - * @since JDK1.1 + * @since JDK1.1 */ @ValueHandlerRead @Override @@ -462,59 +437,51 @@ public final synchronized void defaultReadObjectDelegate() { if (currentObject == null || currentClassDesc == null) { throw new NotActiveException("defaultReadObjectDelegate"); } - - if (!currentClassDesc.forClass().isAssignableFrom( - currentObject.getClass())) { + + if (!currentClassDesc.forClass().isAssignableFrom(currentObject.getClass())) { throw new IOException("Object Type mismatch"); } - if (defaultReadObjectFVDMembers != null && defaultReadObjectFVDMembers.length > 0) { + if (defaultReadObjectFVDMembers != null && defaultReadObjectFVDMembers.length > 0) { // Clear this here so that a recursion back to another // defaultReadObjectDelegate call from inputClassFields // does NOT pick up inapplicable defaultReadObjectFVDMembers // (see bug 6614558). - ValueMember[] valueMembers = defaultReadObjectFVDMembers ; - defaultReadObjectFVDMembers = null ; + ValueMember[] valueMembers = defaultReadObjectFVDMembers; + defaultReadObjectFVDMembers = null; - displayValueMembers( valueMembers ) ; + displayValueMembers(valueMembers); - inputClassFields(currentObject, - currentClass, - currentClassDesc, - valueMembers, - cbSender); + inputClassFields(currentObject, currentClass, currentClassDesc, valueMembers, cbSender); } else { - usingLocalFieldsToRead() ; - + usingLocalFieldsToRead(); + // Use the local fields to unmarshal. - ObjectStreamField[] fields = - currentClassDesc.getFieldsNoCopy(); + ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy(); if (fields.length > 0) { - inputClassFields(currentObject, currentClass, fields, cbSender); + inputClassFields(currentObject, currentClass, fields, cbSender); } } - } catch(NotActiveException nae) { - bridge.throwException( nae ) ; - } catch(IOException | ClassNotFoundException ioe) { - bridge.throwException( ioe ) ; + } catch (NotActiveException nae) { + bridge.throwException(nae); + } catch (IOException | ClassNotFoundException ioe) { + bridge.throwException(ioe); } } /** - * Override the actions of the final method "enableResolveObject()" - * in ObjectInputStream. + * Override the actions of the final method "enableResolveObject()" in ObjectInputStream. * - * Enable the stream to allow objects read from the stream to be replaced. - * If the stream is a trusted class it is allowed to enable replacment. - * Trusted classes are those classes with a classLoader equals null.

+ * Enable the stream to allow objects read from the stream to be replaced. If the stream is a trusted class it is + * allowed to enable replacment. Trusted classes are those classes with a classLoader equals null. + *

* - * When enabled the resolveObject method is called for every object - * being deserialized. + * When enabled the resolveObject method is called for every object being deserialized. * - * @param enable ignored + * @param enable ignored * @return false * @exception SecurityException The classloader of this stream object is non-null. - * @since JDK1.1.6 + * @since JDK1.1.6 */ public final boolean enableResolveObjectDelegate(boolean enable) /* throws SecurityException */ @@ -529,77 +496,75 @@ public final boolean enableResolveObjectDelegate(boolean enable) public final void mark(int readAheadLimit) { orbStream.mark(readAheadLimit); } - + @Override public final boolean markSupported() { return orbStream.markSupported(); } - + @Override public final void reset() throws IOException { try { orbStream.reset(); } catch (Error e) { - throw new IOException(e) ; + throw new IOException(e); } } @Override - public final int available() throws IOException{ + public final int available() throws IOException { return 0; // unreliable } @Override - public final void close() throws IOException{ + public final void close() throws IOException { // no op } @ValueHandlerRead @Override - public final int read() throws IOException{ - try{ + public final int read() throws IOException { + try { readObjectState.readData(this); return (orbStream.read_octet()) & 0x000000FF; } catch (MARSHAL marshalException) { - if (marshalException.minor - == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE) { + if (marshalException.minor == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE) { setState(IN_READ_OBJECT_NO_MORE_OPT_DATA); return -1; } throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final int read(byte data[], int offset, int length) throws IOException{ - try{ + public final int read(byte data[], int offset, int length) throws IOException { + try { readObjectState.readData(this); orbStream.read_octet_array(data, offset, length); return length; } catch (MARSHAL marshalException) { - if (marshalException.minor - == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE) { + if (marshalException.minor == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE) { setState(IN_READ_OBJECT_NO_MORE_OPT_DATA); return -1; } throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final boolean readBoolean() throws IOException{ - try{ + public final boolean readBoolean() throws IOException { + try { readObjectState.readData(this); return orbStream.read_boolean(); @@ -607,15 +572,15 @@ public final boolean readBoolean() throws IOException{ handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final byte readByte() throws IOException{ - try{ + public final byte readByte() throws IOException { + try { readObjectState.readData(this); return orbStream.read_octet(); @@ -623,15 +588,15 @@ public final byte readByte() throws IOException{ handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final char readChar() throws IOException{ - try{ + public final char readChar() throws IOException { + try { readObjectState.readData(this); return orbStream.read_wchar(); @@ -639,44 +604,44 @@ public final char readChar() throws IOException{ handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final double readDouble() throws IOException{ - try{ + public final double readDouble() throws IOException { + try { readObjectState.readData(this); return orbStream.read_double(); } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final float readFloat() throws IOException{ - try{ + public final float readFloat() throws IOException { + try { readObjectState.readData(this); return orbStream.read_float(); } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final void readFully(byte data[]) throws IOException{ + public final void readFully(byte data[]) throws IOException { // d11623 : implement readFully, required for serializing some core classes readFully(data, 0, data.length); @@ -684,133 +649,131 @@ public final void readFully(byte data[]) throws IOException{ @ValueHandlerRead @Override - public final void readFully(byte data[], int offset, int size) throws IOException{ + public final void readFully(byte data[], int offset, int size) throws IOException { // d11623 : implement readFully, required for serializing some core classes - try{ + try { readObjectState.readData(this); orbStream.read_octet_array(data, offset, size); } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); - + throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final int readInt() throws IOException{ - try{ + public final int readInt() throws IOException { + try { readObjectState.readData(this); return orbStream.read_long(); } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @Override @SuppressWarnings("deprecation") - public final String readLine() throws IOException{ - throw Exceptions.self.readLineMethodNotSupported() ; + public final String readLine() throws IOException { + throw Exceptions.self.readLineMethodNotSupported(); } @ValueHandlerRead @Override - public final long readLong() throws IOException{ - try{ + public final long readLong() throws IOException { + try { readObjectState.readData(this); return orbStream.read_longlong(); } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final short readShort() throws IOException{ - try{ + public final short readShort() throws IOException { + try { readObjectState.readData(this); return orbStream.read_short(); } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @Override - protected final void readStreamHeader() throws IOException, StreamCorruptedException{ + protected final void readStreamHeader() throws IOException, StreamCorruptedException { // no op } @ValueHandlerRead @Override - public final int readUnsignedByte() throws IOException{ - try{ + public final int readUnsignedByte() throws IOException { + try { readObjectState.readData(this); return (orbStream.read_octet()) & 0x000000FF; } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead @Override - public final int readUnsignedShort() throws IOException{ - try{ + public final int readUnsignedShort() throws IOException { + try { readObjectState.readData(this); return (orbStream.read_ushort()) & 0x0000FFFF; } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } /** - * Helper method for correcting the Kestrel bug 4367783 (dealing - * with larger than 8-bit chars). The old behavior was preserved - * in orbutil.IIOPInputStream_1_3 in order to interoperate with - * our legacy ORBs. + * Helper method for correcting the Kestrel bug 4367783 (dealing with larger than 8-bit chars). The old behavior was + * preserved in orbutil.IIOPInputStream_1_3 in order to interoperate with our legacy ORBs. + * * @param stream Stream to read from * @return String value read from the stream */ @ValueHandlerRead - protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream) - { + protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream) { return stream.read_wstring(); } @ValueHandlerRead @Override - public final String readUTF() throws IOException{ - try{ + public final String readUTF() throws IOException { + try { readObjectState.readData(this); return internalReadUTF(orbStream); } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @@ -821,9 +784,7 @@ public final String readUTF() throws IOException{ // So far in RMI-IIOP, this process isn't specific enough to // tell the readObject how much data is available, so we always // set the OptionalDataException's EOF marker to true. - private void handleOptionalDataMarshalException(MARSHAL marshalException, - boolean objectRead) - throws IOException { + private void handleOptionalDataMarshalException(MARSHAL marshalException, boolean objectRead) throws IOException { // Java Object Serialization spec 3.4: "If the readObject method // of the class attempts to read more data than is present in the @@ -831,8 +792,7 @@ private void handleOptionalDataMarshalException(MARSHAL marshalException, // return -1 for bytewise reads, throw an EOFException for // primitive data reads, or throw an OptionalDataException // with the eof field set to true for object reads." - if (marshalException.minor - == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE) { + if (marshalException.minor == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE) { IOException result; @@ -852,23 +812,23 @@ private void handleOptionalDataMarshalException(MARSHAL marshalException, @Override public final synchronized void registerValidation(ObjectInputValidation obj, int prio) { - throw Exceptions.self.registerValidationNotSupport() ; + throw Exceptions.self.registerValidationNotSupport(); } @Override protected final Class resolveClass(java.io.ObjectStreamClass v) throws IOException { - throw Exceptions.self.resolveClassNotSupported() ; + throw Exceptions.self.resolveClassNotSupported(); } @Override - protected final Object resolveObject(Object obj) throws IOException{ - throw Exceptions.self.resolveObjectNotSupported() ; + protected final Object resolveObject(Object obj) throws IOException { + throw Exceptions.self.resolveObjectNotSupported(); } @ValueHandlerRead @Override - public final int skipBytes(int len) throws IOException{ - try{ + public final int skipBytes(int len) throws IOException { + try { readObjectState.readData(this); byte[] buf = new byte[len]; @@ -876,56 +836,61 @@ public final int skipBytes(int len) throws IOException{ return len; } catch (MARSHAL marshalException) { handleOptionalDataMarshalException(marshalException, false); - + throw marshalException; - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerRead - private Object handleEnum( Class clz, - ClassInfoCache.ClassInfo cinfo ) throws IOException { - + private Object handleEnum(Class clz, ClassInfoCache.ClassInfo cinfo) throws IOException { + // Only for backwards compatibility with JDK: // int ordinal = orbStream.read_long() ; - String value = (String)orbStream.read_value( String.class ) ; + String value = (String) orbStream.read_value(String.class); // Issue 11681: find the real enum class. - final Class enumClass = ClassInfoCache.getEnumClass( cinfo, clz ) ; + final Class enumClass = ClassInfoCache.getEnumClass(cinfo, clz); if (enumClass == null) { - throw Exceptions.self.couldNotUnmarshalEnum( clz.getName(), value ) ; + throw Exceptions.self.couldNotUnmarshalEnum(clz.getName(), value); } else { // Need to skip any other data marshaled from the enum, // if the enum type has non-static non-transient state. - return Enum.valueOf( enumClass, value ); + return Enum.valueOf(enumClass, value); } } @InfoMethod - private void readingExternalizable() { } + private void readingExternalizable() { + } @InfoMethod - private void readingSerializable() { } + private void readingSerializable() { + } @InfoMethod - private void newInstanceInfo( Class cls ) { } + private void newInstanceInfo(Class cls) { + } @InfoMethod - private void readingDataForClass( Class cls ) { } + private void readingDataForClass(Class cls) { + } @InfoMethod - private void classHasWriteObject( boolean flag ) { } + private void classHasWriteObject(boolean flag) { + } @InfoMethod - private void currentClassInfo( ObjectStreamClass ocs, Class cls ) { } + private void currentClassInfo(ObjectStreamClass ocs, Class cls) { + } @InfoMethod - private void matchingClassInfo( Class cls ) { } + private void matchingClassInfo(Class cls) { + } @ValueHandlerRead - private void callReadExternal( Externalizable ext ) - throws IOException, ClassNotFoundException { + private void callReadExternal(Externalizable ext) throws IOException, ClassNotFoundException { // KMC issue 5161: just as in the IIOPOutputStream, we must // save and restore the state for reading as well! @@ -934,31 +899,29 @@ private void callReadExternal( Externalizable ext ) try { ext.readExternal(this); } finally { - setState(oldState) ; + setState(oldState); } } @ValueHandlerRead - private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinfo, - String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender, - int offset) throws IOException, ClassNotFoundException { + private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinfo, String repositoryID, + com.sun.org.omg.SendingContext.CodeBase sender, int offset) throws IOException, ClassNotFoundException { - int spBase = spClass ; + int spBase = spClass; try { currentClassDesc = ObjectStreamClass.lookup(clz); currentClass = currentClassDesc.forClass(); - + // KMC start of enum receiver-makes-right changes if (cinfo.isEnum()) { - return handleEnum( clz, cinfo ) ; + return handleEnum(clz, cinfo); } else if (currentClassDesc.isExternalizable()) { readingExternalizable(); try { - newInstanceInfo( currentClass ) ; + newInstanceInfo(currentClass); - currentObject = (currentClass == null) ? - null : currentClassDesc.newInstance(); + currentObject = (currentClass == null) ? null : currentClassDesc.newInstance(); if (currentObject != null) { // Store this object and its beginning position @@ -969,26 +932,23 @@ private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinf // Read format version readFormatVersion(); - callReadExternal( (Externalizable)currentObject ) ; + callReadExternal((Externalizable) currentObject); } } catch (InvocationTargetException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InvocationTargetException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "InvocationTargetException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } catch (UnsupportedOperationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "UnsupportedOperationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "UnsupportedOperationException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } catch (InstantiationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InstantiationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "InstantiationException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } } else { readingSerializable(); @@ -997,14 +957,13 @@ private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinf Class currclass = currentClass; // MS: cstack.mark() ; - spBase = spClass; // current top of stack + spBase = spClass; // current top of stack if (currentClass.getName().equals("java.lang.String")) { return this.readUTF(); - } - for (currdesc = currentClassDesc, currclass = currentClass; - currdesc != null && currdesc.isSerializable(); - currdesc = currdesc.getSuperclass()) { + } + for (currdesc = currentClassDesc, currclass = currentClass; currdesc != null + && currdesc.isSerializable(); currdesc = currdesc.getSuperclass()) { Class cc = currdesc.forClass(); @@ -1015,12 +974,12 @@ private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinf if (cc == cl) { matchingClassInfo(cl); break; - } - } + } + } // MS: cstack.push( new Pair( cl, currdesc ) ) ; // if (cl != null) - // currclass = cl.getSuperclass() ; + // currclass = cl.getSuperclass() ; spClass++; if (spClass >= classes.length) { int newlen = classes.length * 2; @@ -1045,78 +1004,71 @@ private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinf } // end : for (currdesc = currentClassDesc, currclass = currentClass; try { - newInstanceInfo( currentClass ) ; + newInstanceInfo(currentClass); - currentObject = (currentClass == null) ? - null : currentClassDesc.newInstance() ; + currentObject = (currentClass == null) ? null : currentClassDesc.newInstance(); // Store this object and its beginning position // since there might be indirections to it while // it's been unmarshalled. activeRecursionMgr.addObject(offset, currentObject); } catch (InvocationTargetException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InvocationTargetException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "InvocationTargetException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } catch (UnsupportedOperationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "UnsupportedOperationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "UnsupportedOperationException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } catch (InstantiationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InstantiationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "InstantiationException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } - // MS: while (!cstack.isEmpty) - // Pair pair = cstack.pop() ; + // MS: while (!cstack.isEmpty) + // Pair pair = cstack.pop() ; for (spClass = spClass; spClass > spBase; spClass--) { // MS: currentClassDesc = pair.second() ; // currentClass = pair.first() ; currentClassDesc = classdesc[spClass]; currentClass = classes[spClass]; - readingDataForClass( currentClass ) ; - - // MS: if (currentClass != null) + readingDataForClass(currentClass); + + // MS: if (currentClass != null) if (classes[spClass] != null) { ReadObjectState oldState = readObjectState; setState(DEFAULT_STATE); try { if (currentClassDesc.hasWriteObject()) { - classHasWriteObject( true ) ; + classHasWriteObject(true); readFormatVersion(); // Read defaultWriteObject indicator boolean calledDefaultWriteObject = readDefaultWriteObjectCalledFlag(); - readObjectState.beginUnmarshalCustomValue( this, - calledDefaultWriteObject, - (currentClassDesc.getReadObjectMethod() != null)); + readObjectState.beginUnmarshalCustomValue(this, calledDefaultWriteObject, + (currentClassDesc.getReadObjectMethod() != null)); } else { - classHasWriteObject( false ) ; + classHasWriteObject(false); if (currentClassDesc.hasReadObject()) { setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED); } } - if (!invokeObjectReader(currentClassDesc, currentObject, - currentClass, null) || - readObjectState == IN_READ_OBJECT_DEFAULTS_SENT) { + if (!invokeObjectReader(currentClassDesc, currentObject, currentClass, null) + || readObjectState == IN_READ_OBJECT_DEFAULTS_SENT) { // Error case of no readObject and didn't call // defaultWriteObject handled in default state - ObjectStreamField[] fields = - currentClassDesc.getFieldsNoCopy(); + ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy(); if (fields.length > 0) { inputClassFields(currentObject, currentClass, fields, sender); @@ -1131,13 +1083,11 @@ private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinf } } else { // _REVISIT_ : Can we ever get here? - /* No local class for this descriptor, - * Skip over the data for this class. - * like defaultReadObject with a null currentObject. - * The code will read the values but discard them. + /* + * No local class for this descriptor, Skip over the data for this class. like defaultReadObject with a null + * currentObject. The code will read the values but discard them. */ - ObjectStreamField[] fields = - currentClassDesc.getFieldsNoCopy(); + ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy(); if (fields.length > 0) { inputClassFields(null, currentClass, fields, sender); @@ -1149,10 +1099,10 @@ private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinf // Make sure we exit at the same stack level as when we started. // MS: cstack.popMark() ; spClass = spBase; - - // We've completed deserializing this object. Any + + // We've completed deserializing this object. Any // future indirections will be handled correctly at the - // CDR level. The ActiveRecursionManager only deals with + // CDR level. The ActiveRecursionManager only deals with // objects currently being deserialized. activeRecursionMgr.removeObject(offset); } @@ -1169,7 +1119,8 @@ private synchronized Object inputObject(Class clz, ClassInfoCache.ClassInfo cinf private boolean readDefaultWriteObjectCalledFlag() throws IOException { boolean sentDefaultWriteObjectCalled = readBoolean(); - if (isDateClassWorkaroundRequired()) return getSimulatedDefaultWriteObjectCalledFlag(); + if (isDateClassWorkaroundRequired()) + return getSimulatedDefaultWriteObjectCalledFlag(); return sentDefaultWriteObjectCalled; } @@ -1188,17 +1139,16 @@ private boolean isJdk9_orLater() { } @InfoMethod - private void fullValueDescriptorsInfo( List fvds ) { } + private void fullValueDescriptorsInfo(List fvds) { + } - // This retrieves a vector of FVD's for the hierarchy of serializable - // classes stemming from repositoryID. It is assumed that the sender + // This retrieves a vector of FVD's for the hierarchy of serializable + // classes stemming from repositoryID. It is assumed that the sender // will not provide base_value id's for non-serializable classes! @ValueHandlerRead - private List getOrderedDescriptions( - String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender) { + private List getOrderedDescriptions(String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender) { - List descs = - new ArrayList(); + List descs = new ArrayList(); if (sender == null) { return descs; @@ -1221,190 +1171,186 @@ private List getOrderedDescriptions( // XXX Do we want to replace this with something integrated with the // tracing facility? - // Interesting question. The full display of an FVD is likely to be + // Interesting question. The full display of an FVD is likely to be // valuable for debugging FVD issues (which we haven't had in >10 years), - // but it's too verbose for the dprint MethodMonitor. Possibly some kind - // of extra data display (not inline) might be interesting here: need + // but it's too verbose for the dprint MethodMonitor. Possibly some kind + // of extra data display (not inline) might be interesting here: need // to revisit dprint, and think about how to flag alternate formatting/handling // of arguments. - private String displayFVD( FullValueDescription fvd ) { - StringBuilder sb = new StringBuilder() ; - sb.append( "FVD(" ) ; - sb.append( "\n\tname=" ) ; - sb.append( fvd.name ) ; - sb.append( "\n\tid=" ) ; - sb.append( fvd.id ) ; - sb.append( "\n\tis_abstract=" ) ; - sb.append( fvd.is_abstract ) ; - sb.append( "\n\tis_custom=" ) ; - sb.append( fvd.is_custom ) ; - sb.append( "\n\tdefined_in=" ) ; - sb.append( fvd.defined_in ) ; - sb.append( "\n\tversion=" ) ; - sb.append( fvd.version ) ; - sb.append( "\n\tis_truncatable=" ) ; - sb.append( fvd.is_truncatable ) ; - sb.append( "\n\tbase_value=" ) ; - sb.append( fvd.base_value ) ; - - int ctr = 0 ; - sb.append( "\n\toperations:" ) ; + private String displayFVD(FullValueDescription fvd) { + StringBuilder sb = new StringBuilder(); + sb.append("FVD("); + sb.append("\n\tname="); + sb.append(fvd.name); + sb.append("\n\tid="); + sb.append(fvd.id); + sb.append("\n\tis_abstract="); + sb.append(fvd.is_abstract); + sb.append("\n\tis_custom="); + sb.append(fvd.is_custom); + sb.append("\n\tdefined_in="); + sb.append(fvd.defined_in); + sb.append("\n\tversion="); + sb.append(fvd.version); + sb.append("\n\tis_truncatable="); + sb.append(fvd.is_truncatable); + sb.append("\n\tbase_value="); + sb.append(fvd.base_value); + + int ctr = 0; + sb.append("\n\toperations:"); for (OperationDescription opdesc : fvd.operations) { - sb.append( "\n\t [" ) ; - sb.append( ctr++ ) ; - sb.append( "]" ) ; - sb.append( "\n\t\tname=" ) ; - sb.append( opdesc.name ) ; - sb.append( "\n\t\tid=" ) ; - sb.append( opdesc.id ) ; - sb.append( "\n\t\tdefined_in=" ) ; - sb.append( opdesc.defined_in ) ; - sb.append( "\n\t\tversion=" ) ; - sb.append( opdesc.version ) ; - sb.append( "\n\t\tmode=" ) ; - sb.append( opdesc.mode ) ; - - int ctr2 = 0 ; - sb.append( "\n\t\tcontexts=" ) ; + sb.append("\n\t ["); + sb.append(ctr++); + sb.append("]"); + sb.append("\n\t\tname="); + sb.append(opdesc.name); + sb.append("\n\t\tid="); + sb.append(opdesc.id); + sb.append("\n\t\tdefined_in="); + sb.append(opdesc.defined_in); + sb.append("\n\t\tversion="); + sb.append(opdesc.version); + sb.append("\n\t\tmode="); + sb.append(opdesc.mode); + + int ctr2 = 0; + sb.append("\n\t\tcontexts="); for (String str : opdesc.contexts) { - sb.append( "\n\t\t [" ) ; - sb.append( ctr2++ ) ; - sb.append( "]" ) ; - sb.append( "\n\t\t" ) ; - sb.append( str ) ; + sb.append("\n\t\t ["); + sb.append(ctr2++); + sb.append("]"); + sb.append("\n\t\t"); + sb.append(str); } - ctr2 = 0 ; - sb.append( "\n\t\tparameters" ) ; + ctr2 = 0; + sb.append("\n\t\tparameters"); for (ParameterDescription pdesc : opdesc.parameters) { - sb.append( "\n\t\t [" ) ; - sb.append( ctr2++ ) ; - sb.append( "]" ) ; - sb.append( "\n\t\t\tname=" ) ; - sb.append( pdesc.name ) ; - sb.append( "\n\t\t\tmode=" ) ; - sb.append( pdesc.mode ) ; + sb.append("\n\t\t ["); + sb.append(ctr2++); + sb.append("]"); + sb.append("\n\t\t\tname="); + sb.append(pdesc.name); + sb.append("\n\t\t\tmode="); + sb.append(pdesc.mode); } - ctr2 = 0 ; - sb.append( "\n\t\texceptions" ) ; + ctr2 = 0; + sb.append("\n\t\texceptions"); for (ExceptionDescription edesc : opdesc.exceptions) { - sb.append( "\n\t\t [" ) ; - sb.append( ctr2++ ) ; - sb.append( "]" ) ; - sb.append( "\n\t\t\tname=" ) ; - sb.append( edesc.name ) ; - sb.append( "\n\t\t\tid=" ) ; - sb.append( edesc.id ) ; - sb.append( "\n\t\t\tdefined_in=" ) ; - sb.append( edesc.defined_in ) ; - sb.append( "\n\t\t\tversion=" ) ; - sb.append( edesc.version ) ; + sb.append("\n\t\t ["); + sb.append(ctr2++); + sb.append("]"); + sb.append("\n\t\t\tname="); + sb.append(edesc.name); + sb.append("\n\t\t\tid="); + sb.append(edesc.id); + sb.append("\n\t\t\tdefined_in="); + sb.append(edesc.defined_in); + sb.append("\n\t\t\tversion="); + sb.append(edesc.version); } } - ctr = 0 ; - sb.append( "\n\tattributes:" ) ; + ctr = 0; + sb.append("\n\tattributes:"); for (AttributeDescription atdesc : fvd.attributes) { - sb.append( "\n\t [" ) ; - sb.append( ctr++ ) ; - sb.append( "]" ) ; - sb.append( "\n\t\t\tname=" ) ; - sb.append( atdesc.name ) ; - sb.append( "\n\t\t\tid=" ) ; - sb.append( atdesc.id ) ; - sb.append( "\n\t\t\tdefined_in=" ) ; - sb.append( atdesc.defined_in ) ; - sb.append( "\n\t\t\tversion=" ) ; - sb.append( atdesc.version ) ; - sb.append( "\n\t\t\tmode=" ) ; - sb.append( atdesc.mode ) ; - } - - ctr = 0 ; - sb.append( "\n\tmembers:" ) ; + sb.append("\n\t ["); + sb.append(ctr++); + sb.append("]"); + sb.append("\n\t\t\tname="); + sb.append(atdesc.name); + sb.append("\n\t\t\tid="); + sb.append(atdesc.id); + sb.append("\n\t\t\tdefined_in="); + sb.append(atdesc.defined_in); + sb.append("\n\t\t\tversion="); + sb.append(atdesc.version); + sb.append("\n\t\t\tmode="); + sb.append(atdesc.mode); + } + + ctr = 0; + sb.append("\n\tmembers:"); for (ValueMember vm : fvd.members) { - sb.append( "\n\t [" ) ; - sb.append( ctr++ ) ; - sb.append( "]" ) ; - sb.append( "\n\t\tname=" ) ; - sb.append( vm.name ) ; - sb.append( "\n\t\tid=" ) ; - sb.append( vm.id ) ; - sb.append( "\n\t\tdefined_in=" ) ; - sb.append( vm.defined_in ) ; - sb.append( "\n\t\tversion=" ) ; - sb.append( vm.version ) ; - sb.append( "\n\t\taccess=" ) ; - sb.append( vm.access ) ; + sb.append("\n\t ["); + sb.append(ctr++); + sb.append("]"); + sb.append("\n\t\tname="); + sb.append(vm.name); + sb.append("\n\t\tid="); + sb.append(vm.id); + sb.append("\n\t\tdefined_in="); + sb.append(vm.defined_in); + sb.append("\n\t\tversion="); + sb.append(vm.version); + sb.append("\n\t\taccess="); + sb.append(vm.access); } // Ignore for now // for (Initializer init : fvd.initializers) { // } - ctr = 0 ; - sb.append( "\n\tsupported_interfaces:" ) ; + ctr = 0; + sb.append("\n\tsupported_interfaces:"); for (String str : fvd.supported_interfaces) { - sb.append( "\n\t [" ) ; - sb.append( ctr++ ) ; - sb.append( "]" ) ; - sb.append( "\n\t\t" ) ; - sb.append( str ) ; + sb.append("\n\t ["); + sb.append(ctr++); + sb.append("]"); + sb.append("\n\t\t"); + sb.append(str); } - ctr = 0 ; - sb.append( "\n\tabstract_base_values:" ) ; + ctr = 0; + sb.append("\n\tabstract_base_values:"); for (String str : fvd.abstract_base_values) { - sb.append( "\n\t [" ) ; - sb.append( ctr++ ) ; - sb.append( "]" ) ; - sb.append( "\n\t\t" ) ; - sb.append( str ) ; + sb.append("\n\t ["); + sb.append(ctr++); + sb.append("]"); + sb.append("\n\t\t"); + sb.append(str); } - sb.append( "\n)" ) ; - return sb.toString() ; + sb.append("\n)"); + return sb.toString(); } @InfoMethod - private void readingDataUsingFVD( FullValueDescription fvd ) { } + private void readingDataUsingFVD(FullValueDescription fvd) { + } /** - * This input method uses FullValueDescriptions retrieved from the sender's runtime to - * read in the data. This method is capable of throwing out data not applicable to client's fields. - * This method handles instances where the reader has a class not sent by the sender, the sender sent - * a class not present on the reader, and/or the reader's class does not match the sender's class. + * This input method uses FullValueDescriptions retrieved from the sender's runtime to read in the data. This method is + * capable of throwing out data not applicable to client's fields. This method handles instances where the reader has a + * class not sent by the sender, the sender sent a class not present on the reader, and/or the reader's class does not + * match the sender's class. * - * NOTE : If the local description indicates custom marshaling and the remote type's FVD also - * indicates custom marsahling than the local type is used to read the data off the wire. However, - * if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is - * a form of custom marshaling. + * NOTE : If the local description indicates custom marshaling and the remote type's FVD also indicates custom + * marsahling than the local type is used to read the data off the wire. However, if either says custom while the other + * does not, a MARSHAL error is thrown. Externalizable is a form of custom marshaling. * */ @ValueHandlerRead - private synchronized Object inputObjectUsingFVD(final Class clz, - final ClassInfoCache.ClassInfo cinfo, - final String repositoryID, - final com.sun.org.omg.SendingContext.CodeBase sender, - final int offset) throws IOException, ClassNotFoundException { + private synchronized Object inputObjectUsingFVD(final Class clz, final ClassInfoCache.ClassInfo cinfo, final String repositoryID, + final com.sun.org.omg.SendingContext.CodeBase sender, final int offset) throws IOException, ClassNotFoundException { - int spBase = spClass ; + int spBase = spClass; try { currentClassDesc = ObjectStreamClass.lookup(clz); currentClass = currentClassDesc.forClass(); // KMC start of enum receiver-makes-right changes if (cinfo.isEnum()) { - return handleEnum( clz, cinfo ) ; + return handleEnum(clz, cinfo); } else if (currentClassDesc.isExternalizable()) { readingExternalizable(); try { - newInstanceInfo( currentClass ) ; + newInstanceInfo(currentClass); - currentObject = (currentClass == null) ? - null : currentClassDesc.newInstance(); + currentObject = (currentClass == null) ? null : currentClassDesc.newInstance(); if (currentObject != null) { // Store this object and its beginning position @@ -1414,68 +1360,61 @@ private synchronized Object inputObjectUsingFVD(final Class clz, // Read format version readFormatVersion(); - - callReadExternal( (Externalizable)currentObject ) ; + + callReadExternal((Externalizable) currentObject); } } catch (InvocationTargetException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InvocationTargetException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "InvocationTargetException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } catch (UnsupportedOperationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "UnsupportedOperationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "UnsupportedOperationException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } catch (InstantiationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InstantiationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "InstantiationException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } } else { - readingSerializable() ; + readingSerializable(); - ObjectStreamClass currdesc = currentClassDesc ; + ObjectStreamClass currdesc = currentClassDesc; Class currclass = currentClass = clz; - + // MS: cstack.mark() ; - spBase = spClass; // current top of stack + spBase = spClass; // current top of stack - for (currdesc = currentClassDesc, currclass = currentClass; - currdesc != null && currdesc.isSerializable(); - currdesc = currdesc.getSuperclass()) { + for (currdesc = currentClassDesc, currclass = currentClass; currdesc != null + && currdesc.isSerializable(); currdesc = currdesc.getSuperclass()) { Class cc = currdesc.forClass(); - currentClassInfo(currdesc, cc) ; - + currentClassInfo(currdesc, cc); + Class cl; for (cl = currclass; cl != null; cl = cl.getSuperclass()) { if (cc == cl) { matchingClassInfo(cl); break; } - } + } // MS: cstack.push( new Pair( cl, currdesc ) ) ; // if (cl != null) - // currclass = cl.getSuperclass() ; + // currclass = cl.getSuperclass() ; spClass++; if (spClass >= classes.length) { int newlen = classes.length * 2; Class[] newclasses = new Class[newlen]; - ObjectStreamClass[] newclassdesc = - new ObjectStreamClass[newlen]; - - System.arraycopy(classes, 0, newclasses, - 0, classes.length); - System.arraycopy(classdesc, 0, newclassdesc, - 0, classes.length); - + ObjectStreamClass[] newclassdesc = new ObjectStreamClass[newlen]; + + System.arraycopy(classes, 0, newclasses, 0, classes.length); + System.arraycopy(classdesc, 0, newclassdesc, 0, classes.length); + classes = newclasses; classdesc = newclassdesc; } @@ -1489,62 +1428,54 @@ private synchronized Object inputObjectUsingFVD(final Class clz, currclass = cl.getSuperclass(); } } // end : for (currdesc = currentClassDesc, currclass = currentClass; - + try { - newInstanceInfo( currentClass ) ; - currentObject = (currentClass == null) ? - null : currentClassDesc.newInstance(); + newInstanceInfo(currentClass); + currentObject = (currentClass == null) ? null : currentClassDesc.newInstance(); // Store this object and its beginning position // since there might be indirections to it while // it's been unmarshalled. activeRecursionMgr.addObject(offset, currentObject); } catch (InvocationTargetException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InvocationTargetException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "InvocationTargetException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } catch (UnsupportedOperationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "UnsupportedOperationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "UnsupportedOperationException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } catch (InstantiationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InstantiationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; + InvalidClassException exc = new InvalidClassException(currentClass.getName(), + "InstantiationException accessing no-arg constructor"); + exc.initCause(e); + throw exc; } - - Iterator fvdsList = - getOrderedDescriptions(repositoryID, sender).iterator(); - + + Iterator fvdsList = getOrderedDescriptions(repositoryID, sender).iterator(); + // MS: while (fvdsList.hasNext() && !cstack.isEmpty()) - while((fvdsList.hasNext()) && (spClass > spBase)) { + while ((fvdsList.hasNext()) && (spClass > spBase)) { FullValueDescription fvd = fvdsList.next(); readingDataUsingFVD(fvd); - String repIDForFVD = vhandler.getClassName( fvd.id); - String repIDForClass = vhandler.getClassName( - vhandler.getRMIRepositoryID(currentClass)); - + String repIDForFVD = vhandler.getClassName(fvd.id); + String repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass)); + // MS: while (!cstack.isEmpty() && - while ((spClass > spBase) && - (!repIDForFVD.equals(repIDForClass))) { + while ((spClass > spBase) && (!repIDForFVD.equals(repIDForClass))) { // MS: while (!cstack.isEmpty() && !cstack.peek().first().getName.equals( repIDForFVD )) - // cstack.pop() ; + // cstack.pop() ; int pos = findNextClass(repIDForFVD, classes, spClass, spBase); - // if (!cstack.isEmpty()) - // currClass = currentClass = cstack.peek.first() ; + // if (!cstack.isEmpty()) + // currClass = currentClass = cstack.peek.first() ; if (pos != -1) { spClass = pos; currclass = currentClass = classes[spClass]; - repIDForClass = vhandler.getClassName( - vhandler.getRMIRepositoryID(currentClass)); - } else { + repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass)); + } else { // Read and throw away one level of the fvdslist // This seems to mean that the sender had a superclass that // we don't have @@ -1554,15 +1485,12 @@ private synchronized Object inputObjectUsingFVD(final Class clz, boolean calledDefaultWriteObject = readBoolean(); if (calledDefaultWriteObject) { - inputClassFields(null, null, null, - fvd.members, sender); + inputClassFields(null, null, null, fvd.members, sender); } if (getStreamFormatVersion() == 2) { - ((ValueInputStream)getOrbStream()) - .start_value(); - ((ValueInputStream)getOrbStream()) - .end_value(); + ((ValueInputStream) getOrbStream()).start_value(); + ((ValueInputStream) getOrbStream()).end_value(); } // WARNING: If stream format version is 1 and there's @@ -1572,7 +1500,7 @@ private synchronized Object inputObjectUsingFVD(final Class clz, inputClassFields(null, currentClass, null, fvd.members, sender); } - if (fvdsList.hasNext()){ + if (fvdsList.hasNext()) { fvd = fvdsList.next(); repIDForFVD = vhandler.getClassName(fvd.id); } else { @@ -1581,14 +1509,13 @@ private synchronized Object inputObjectUsingFVD(final Class clz, } } - currdesc = currentClassDesc - = ObjectStreamClass.lookup(currentClass); + currdesc = currentClassDesc = ObjectStreamClass.lookup(currentClass); if (!repIDForClass.equals("java.lang.Object")) { // If the sender used custom marshaling, then it should have put // the two bytes on the wire indicating stream format version - // and whether or not the writeObject method called + // and whether or not the writeObject method called // defaultWriteObject/writeFields. ReadObjectState oldState = readObjectState; @@ -1598,9 +1525,8 @@ private synchronized Object inputObjectUsingFVD(final Class clz, if (fvd.is_custom) { readFormatVersion(); boolean calledDefaultWriteObject = readBoolean(); - readObjectState.beginUnmarshalCustomValue( this, - calledDefaultWriteObject, - (currentClassDesc.getReadObjectMethod() != null)); + readObjectState.beginUnmarshalCustomValue(this, calledDefaultWriteObject, + (currentClassDesc.getReadObjectMethod() != null)); } boolean usedReadObject = false; @@ -1611,15 +1537,13 @@ private synchronized Object inputObjectUsingFVD(final Class clz, setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED); } - usedReadObject = invokeObjectReader(currentClassDesc, - currentObject, currentClass, fvd.members ); + usedReadObject = invokeObjectReader(currentClassDesc, currentObject, currentClass, fvd.members); // Note that the !usedReadObject !calledDefaultWriteObject // case is handled by the beginUnmarshalCustomValue method // of the default state if (!usedReadObject || readObjectState == IN_READ_OBJECT_DEFAULTS_SENT) { - inputClassFields(currentObject, currentClass, - currdesc, fvd.members, sender); + inputClassFields(currentObject, currentClass, currdesc, fvd.members, sender); } if (fvd.is_custom) { @@ -1628,28 +1552,27 @@ private synchronized Object inputObjectUsingFVD(final Class clz, } finally { setState(oldState); } - + currclass = currentClass = classes[--spClass]; - } else { + } else { // The remaining hierarchy of the local class does not match the sender's FVD. - // So, use remaining FVDs to read data off wire. If any remaining FVDs indicate + // So, use remaining FVDs to read data off wire. If any remaining FVDs indicate // custom marshaling, throw MARSHAL error. inputClassFields(null, currentClass, null, fvd.members, sender); - - while (fvdsList.hasNext()){ + + while (fvdsList.hasNext()) { fvd = fvdsList.next(); if (fvd.is_custom) { skipCustomUsingFVD(fvd.members, sender); } else { - inputClassFields(null, currentClass, null, - fvd.members, sender); + inputClassFields(null, currentClass, null, fvd.members, sender); } } } - } // end : while(fvdsList.hasNext()) + } // end : while(fvdsList.hasNext()) - while (fvdsList.hasNext()){ + while (fvdsList.hasNext()) { FullValueDescription fvd = fvdsList.next(); if (fvd.is_custom) { skipCustomUsingFVD(fvd.members, sender); @@ -1663,9 +1586,9 @@ private synchronized Object inputObjectUsingFVD(final Class clz, // MS: cstack.popMark() ; spClass = spBase; - // We've completed deserializing this object. Any + // We've completed deserializing this object. Any // future indirections will be handled correctly at the - // CDR level. The ActiveRecursionManager only deals with + // CDR level. The ActiveRecursionManager only deals with // objects currently being deserialized. activeRecursionMgr.removeObject(offset); } @@ -1674,50 +1597,47 @@ private synchronized Object inputObjectUsingFVD(final Class clz, } /** - * This input method uses FullValueDescriptions retrieved from the sender's runtime to - * read in the data. This method is capable of throwing out data not applicable to client's fields. + * This input method uses FullValueDescriptions retrieved from the sender's runtime to read in the data. This method is + * capable of throwing out data not applicable to client's fields. * - * NOTE : If the local description indicates custom marshaling and the remote type's FVD also - * indicates custom marsahling than the local type is used to read the data off the wire. However, - * if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is - * a form of custom marshaling. + * NOTE : If the local description indicates custom marshaling and the remote type's FVD also indicates custom + * marsahling than the local type is used to read the data off the wire. However, if either says custom while the other + * does not, a MARSHAL error is thrown. Externalizable is a form of custom marshaling. * */ @ValueHandlerRead - private Object skipObjectUsingFVD(String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender) - throws IOException, ClassNotFoundException { + private Object skipObjectUsingFVD(String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender) + throws IOException, ClassNotFoundException { - for (FullValueDescription fvd : - getOrderedDescriptions( repositoryID, sender )) { + for (FullValueDescription fvd : getOrderedDescriptions(repositoryID, sender)) { String repIDForFVD = vhandler.getClassName(fvd.id); - + if (!repIDForFVD.equals("java.lang.Object")) { if (fvd.is_custom) { readFormatVersion(); - + boolean calledDefaultWriteObject = readBoolean(); - + if (calledDefaultWriteObject) { inputClassFields(null, null, null, fvd.members, sender); } if (getStreamFormatVersion() == 2) { - ((ValueInputStream)getOrbStream()).start_value(); - ((ValueInputStream)getOrbStream()).end_value(); + ((ValueInputStream) getOrbStream()).start_value(); + ((ValueInputStream) getOrbStream()).end_value(); } // WARNING: If stream format version is 1 and there's // optional data, we'll get some form of exception down // the line. - } else { + } else { // Use default marshaling inputClassFields(null, null, null, fvd.members, sender); } } - } + } return null; } @@ -1725,38 +1645,33 @@ private Object skipObjectUsingFVD(String repositoryID, /////////////////// @ValueHandlerRead - private int findNextClass(String classname, Class classes[], - int _spClass, int _spBase){ + private int findNextClass(String classname, Class classes[], int _spClass, int _spBase) { - for (int i = _spClass; i > _spBase; i--){ + for (int i = _spClass; i > _spBase; i--) { if (classname.equals(classes[i].getName())) { - return i ; + return i; } } - return -1 ; + return -1; } /* - * Invoke the readObject method if present. Assumes that in the case of custom - * marshaling, the format version and defaultWriteObject indicator were already - * removed. + * Invoke the readObject method if present. Assumes that in the case of custom marshaling, the format version and + * defaultWriteObject indicator were already removed. */ @ValueHandlerRead - private boolean invokeObjectReader(ObjectStreamClass osc, Object obj, - Class aclass, ValueMember[] valueMembers ) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException - { - OperationTracer.readingField( "<>" ) ; + private boolean invokeObjectReader(ObjectStreamClass osc, Object obj, Class aclass, ValueMember[] valueMembers) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException { + OperationTracer.readingField("<>"); - boolean result = false ; + boolean result = false; if (osc.getReadObjectMethod() != null) { try { - defaultReadObjectFVDMembers = valueMembers ; - osc.getReadObjectMethod().invoke( obj, this ) ; - result = true ; + defaultReadObjectFVDMembers = valueMembers; + osc.getReadObjectMethod().invoke(obj, this); + result = true; } catch (Throwable t) { if (t instanceof ClassNotFoundException) { throw (ClassNotFoundException) t; @@ -1771,16 +1686,16 @@ private boolean invokeObjectReader(ObjectStreamClass osc, Object obj, } } finally { // Make sure this is cleared no matter what - // the readObject method does. If the readObject + // the readObject method does. If the readObject // method calls either defaultReadObject or - // getFields, this will be cleared. Any other + // getFields, this will be cleared. Any other // behavior is an error, but we want to protect // ourselves from a bad readObject method. - defaultReadObjectFVDMembers = null ; + defaultReadObjectFVDMembers = null; } } - return result ; + return result; } /* @@ -1812,87 +1727,82 @@ private void resetStream() throws IOException { } /** - * Factored out of inputClassFields This reads a primitive value and sets it - * in the field of o described by the ObjectStreamField field. + * Factored out of inputClassFields This reads a primitive value and sets it in the field of o described by the + * ObjectStreamField field. * - * Note that reflection cannot be used here, because reflection cannot be used - * to set final fields. + * Note that reflection cannot be used here, because reflection cannot be used to set final fields. */ @ValueHandlerRead - private void inputPrimitiveField(Object o, Class cl, - ObjectStreamField field) throws InvalidClassException, IOException { + private void inputPrimitiveField(Object o, Class cl, ObjectStreamField field) throws InvalidClassException, IOException { try { switch (field.getTypeCode()) { - case 'B': - byte byteValue = orbStream.read_octet(); - bridge.putByte( o, field.getFieldID(), byteValue ) ; - //reflective code: field.getField().setByte( o, byteValue ) ; - break; - case 'Z': - boolean booleanValue = orbStream.read_boolean(); - bridge.putBoolean( o, field.getFieldID(), booleanValue ) ; - //reflective code: field.getField().setBoolean( o, booleanValue ) ; - break; - case 'C': - char charValue = orbStream.read_wchar(); - bridge.putChar( o, field.getFieldID(), charValue ) ; - //reflective code: field.getField().setChar( o, charValue ) ; - break; - case 'S': - short shortValue = orbStream.read_short(); - bridge.putShort( o, field.getFieldID(), shortValue ) ; - //reflective code: field.getField().setShort( o, shortValue ) ; - break; - case 'I': - int intValue = orbStream.read_long(); - bridge.putInt( o, field.getFieldID(), intValue ) ; - //reflective code: field.getField().setInt( o, intValue ) ; - break; - case 'J': - long longValue = orbStream.read_longlong(); - bridge.putLong( o, field.getFieldID(), longValue ) ; - //reflective code: field.getField().setLong( o, longValue ) ; - break; - case 'F' : - float floatValue = orbStream.read_float(); - bridge.putFloat( o, field.getFieldID(), floatValue ) ; - //reflective code: field.getField().setFloat( o, floatValue ) ; - break; - case 'D' : - double doubleValue = orbStream.read_double(); - bridge.putDouble( o, field.getFieldID(), doubleValue ) ; - //reflective code: field.getField().setDouble( o, doubleValue ) ; - break; - default: - throw Exceptions.self.invalidClassForPrimitive( - cl.getName() ) ; + case 'B': + byte byteValue = orbStream.read_octet(); + bridge.putByte(o, field.getFieldID(), byteValue); + // reflective code: field.getField().setByte( o, byteValue ) ; + break; + case 'Z': + boolean booleanValue = orbStream.read_boolean(); + bridge.putBoolean(o, field.getFieldID(), booleanValue); + // reflective code: field.getField().setBoolean( o, booleanValue ) ; + break; + case 'C': + char charValue = orbStream.read_wchar(); + bridge.putChar(o, field.getFieldID(), charValue); + // reflective code: field.getField().setChar( o, charValue ) ; + break; + case 'S': + short shortValue = orbStream.read_short(); + bridge.putShort(o, field.getFieldID(), shortValue); + // reflective code: field.getField().setShort( o, shortValue ) ; + break; + case 'I': + int intValue = orbStream.read_long(); + bridge.putInt(o, field.getFieldID(), intValue); + // reflective code: field.getField().setInt( o, intValue ) ; + break; + case 'J': + long longValue = orbStream.read_longlong(); + bridge.putLong(o, field.getFieldID(), longValue); + // reflective code: field.getField().setLong( o, longValue ) ; + break; + case 'F': + float floatValue = orbStream.read_float(); + bridge.putFloat(o, field.getFieldID(), floatValue); + // reflective code: field.getField().setFloat( o, floatValue ) ; + break; + case 'D': + double doubleValue = orbStream.read_double(); + bridge.putDouble(o, field.getFieldID(), doubleValue); + // reflective code: field.getField().setDouble( o, doubleValue ) ; + break; + default: + throw Exceptions.self.invalidClassForPrimitive(cl.getName()); } } catch (IllegalArgumentException e) { - /* This case should never happen. If the field types - are not the same, InvalidClassException is raised when - matching the local class to the serialized ObjectStreamClass. */ - ClassCastException cce = new ClassCastException( - "Assigning instance of class " - + field.getType().getName() + " to field " - + currentClassDesc.getName() + '#' - + field.getField().getName()); - cce.initCause( e ) ; - throw cce ; + /* + * This case should never happen. If the field types are not the same, InvalidClassException is raised when matching the + * local class to the serialized ObjectStreamClass. + */ + ClassCastException cce = new ClassCastException("Assigning instance of class " + field.getType().getName() + " to field " + + currentClassDesc.getName() + '#' + field.getField().getName()); + cce.initCause(e); + throw cce; } } @InfoMethod - private void callTypeInfo( int ct ) { } + private void callTypeInfo(int ct) { + } @InfoMethod - private void typeInfo( Class type ) { } + private void typeInfo(Class type) { + } @ValueHandlerRead - private Object inputObjectField(org.omg.CORBA.ValueMember field, - com.sun.org.omg.SendingContext.CodeBase sender) - throws IndirectionException, ClassNotFoundException, IOException, - StreamCorruptedException { + private Object inputObjectField(org.omg.CORBA.ValueMember field, com.sun.org.omg.SendingContext.CodeBase sender) + throws IndirectionException, ClassNotFoundException, IOException, StreamCorruptedException { Object objectValue = null; Class type = null; @@ -1900,7 +1810,7 @@ private Object inputObjectField(org.omg.CORBA.ValueMember field, try { type = vhandler.getClassFromType(id); - } catch(ClassNotFoundException cnfe) { + } catch (ClassNotFoundException cnfe) { // Make sure type = null type = null; } @@ -1912,9 +1822,8 @@ private Object inputObjectField(org.omg.CORBA.ValueMember field, signature = ValueUtility.getSignature(field); } - if (signature != null && (signature.equals("Ljava/lang/Object;") - || signature.equals("Ljava/io/Serializable;") - || signature.equals("Ljava/io/Externalizable;"))) { + if (signature != null && (signature.equals("Ljava/lang/Object;") || signature.equals("Ljava/io/Serializable;") + || signature.equals("Ljava/io/Externalizable;"))) { objectValue = Util.getInstance().readAny(orbStream); } else { // Decide what method call to make based on the type. If @@ -1929,30 +1838,27 @@ private Object inputObjectField(org.omg.CORBA.ValueMember field, if (!vhandler.isSequence(id)) { - if (field.type.kind().value() == - kRemoteTypeCode.kind().value()) { + if (field.type.kind().value() == kRemoteTypeCode.kind().value()) { // RMI Object reference... callType = ValueHandlerImpl.kRemoteType; } else { - // REVISIT. If we don't have the local class, + // REVISIT. If we don't have the local class, // we should probably verify that it's an RMI type, // query the remote FVD, and use is_abstract. // Our FVD seems to get NullPointerExceptions for any // non-RMI types. // This uses the local class in the same way as - // inputObjectField(ObjectStreamField) does. REVISIT + // inputObjectField(ObjectStreamField) does. REVISIT // inputObjectField(ObjectStreamField)'s loadStubClass - // logic. Assumption is that the given type cannot + // logic. Assumption is that the given type cannot // evolve to become a CORBA abstract interface or // a RMI abstract interface. - ClassInfoCache.ClassInfo cinfo = - ClassInfoCache.get( type ) ; - if (type != null && cinfo.isInterface() && - (vhandler.isAbstractBase(type) || - ObjectStreamClassCorbaExt.isAbstractInterface(type))) { + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(type); + if (type != null && cinfo.isInterface() + && (vhandler.isAbstractBase(type) || ObjectStreamClassCorbaExt.isAbstractInterface(type))) { callType = ValueHandlerImpl.kAbstractType; } @@ -1966,31 +1872,29 @@ private Object inputObjectField(org.omg.CORBA.ValueMember field, // the rep. id for this read will also follow on the wire. switch (callType) { - case ValueHandlerImpl.kRemoteType: - if (type != null) { - objectValue = - Utility.readObjectAndNarrow(orbStream, type); - } else { - objectValue = orbStream.read_Object(); - } - break; - case ValueHandlerImpl.kAbstractType: - if (type != null) { - objectValue = - Utility.readAbstractAndNarrow(orbStream, type); - } else { - objectValue = orbStream.read_abstract_interface(); - } - break; - case ValueHandlerImpl.kValueType: - if (type != null) { - objectValue = orbStream.read_value(type); - } else { - objectValue = orbStream.read_value(); - } - break; - default: - throw Exceptions.self.unknownCallType( callType ) ; + case ValueHandlerImpl.kRemoteType: + if (type != null) { + objectValue = Utility.readObjectAndNarrow(orbStream, type); + } else { + objectValue = orbStream.read_Object(); + } + break; + case ValueHandlerImpl.kAbstractType: + if (type != null) { + objectValue = Utility.readAbstractAndNarrow(orbStream, type); + } else { + objectValue = orbStream.read_abstract_interface(); + } + break; + case ValueHandlerImpl.kValueType: + if (type != null) { + objectValue = orbStream.read_value(type); + } else { + objectValue = orbStream.read_value(); + } + break; + default: + throw Exceptions.self.unknownCallType(callType); } } @@ -1998,16 +1902,14 @@ private Object inputObjectField(org.omg.CORBA.ValueMember field, } /** - * Factored out of inputClassFields and reused in - * inputCurrentClassFieldsForReadFields. + * Factored out of inputClassFields and reused in inputCurrentClassFieldsForReadFields. * - * Reads the field (which is of an Object type as opposed to a primitive) - * described by ObjectStreamField field and returns it. + * Reads the field (which is of an Object type as opposed to a primitive) described by ObjectStreamField field and + * returns it. */ @ValueHandlerRead - private Object inputObjectField(ObjectStreamField field) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IndirectionException, IOException { + private Object inputObjectField(ObjectStreamField field) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IndirectionException, IOException { if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) { return Util.getInstance().readAny(orbStream); @@ -2020,18 +1922,18 @@ private Object inputObjectField(ObjectStreamField field) // Class type = osc.forClass(); Class fieldType = field.getType(); Class actualType = fieldType; // This may change if stub loaded. - + // Decide what method call to make based on the fieldType. If // it is a type for which we need to load a stub, convert // the type to the correct stub type. - + int callType = ValueHandlerImpl.kValueType; boolean narrow = false; - - ClassInfoCache.ClassInfo cinfo = field.getClassInfo() ; - if (cinfo.isInterface()) { + + ClassInfoCache.ClassInfo cinfo = field.getClassInfo(); + if (cinfo.isInterface()) { boolean loadStubClass = false; - + if (cinfo.isARemote(fieldType)) { // RMI Object reference... callType = ValueHandlerImpl.kRemoteType; @@ -2043,18 +1945,16 @@ private Object inputObjectField(ObjectStreamField field) // IDL Abstract Object reference... callType = ValueHandlerImpl.kAbstractType; loadStubClass = true; - } else if (ObjectStreamClassCorbaExt.isAbstractInterface( - fieldType)) { + } else if (ObjectStreamClassCorbaExt.isAbstractInterface(fieldType)) { // RMI Abstract Object reference... callType = ValueHandlerImpl.kAbstractType; } - + if (loadStubClass) { try { String codebase = Util.getInstance().getCodebase(fieldType); String repID = vhandler.createForAnyType(fieldType); - Class stubType = - Utility.loadStubClass(repID, codebase, fieldType); + Class stubType = Utility.loadStubClass(repID, codebase, fieldType); actualType = stubType; } catch (ClassNotFoundException e) { narrow = true; @@ -2062,39 +1962,36 @@ private Object inputObjectField(ObjectStreamField field) } else { narrow = true; } - } + } switch (callType) { - case ValueHandlerImpl.kRemoteType: - if (!narrow) { - objectValue = (Object) orbStream.read_Object(actualType); - } else { - objectValue = - Utility.readObjectAndNarrow(orbStream, actualType); - } - break; - case ValueHandlerImpl.kAbstractType: - if (!narrow) { - objectValue = orbStream.read_abstract_interface(actualType); - } else { - objectValue = - Utility.readAbstractAndNarrow(orbStream, actualType); - } - break; - case ValueHandlerImpl.kValueType: - objectValue = (Object)orbStream.read_value(actualType); - break; - default: - throw Exceptions.self.unknownCallType(callType) ; + case ValueHandlerImpl.kRemoteType: + if (!narrow) { + objectValue = (Object) orbStream.read_Object(actualType); + } else { + objectValue = Utility.readObjectAndNarrow(orbStream, actualType); + } + break; + case ValueHandlerImpl.kAbstractType: + if (!narrow) { + objectValue = orbStream.read_abstract_interface(actualType); + } else { + objectValue = Utility.readAbstractAndNarrow(orbStream, actualType); + } + break; + case ValueHandlerImpl.kValueType: + objectValue = (Object) orbStream.read_value(actualType); + break; + default: + throw Exceptions.self.unknownCallType(callType); } return objectValue; } // Note that this is need for getFields support. - void readFields(Map fieldToValueMap) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException { + void readFields(Map fieldToValueMap) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException { if (defaultReadObjectFVDMembers != null) { inputRemoteMembersForReadFields(fieldToValueMap); @@ -2104,67 +2001,57 @@ void readFields(Map fieldToValueMap) } @ValueHandlerRead - private void inputRemoteMembersForReadFields( - Map fieldToValueMap) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException { + private void inputRemoteMembersForReadFields(Map fieldToValueMap) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException { // Must have this local variable since defaultReadObjectFVDMembers // may get mangled by recursion. ValueMember fields[] = defaultReadObjectFVDMembers; - defaultReadObjectFVDMembers = null ; + defaultReadObjectFVDMembers = null; try { for (int i = 0; i < fields.length; i++) { - OperationTracer.readingField( fields[i].name ) ; - displayValueMember( fields[i] ); + OperationTracer.readingField(fields[i].name); + displayValueMember(fields[i]); switch (fields[i].type.kind().value()) { case TCKind._tk_octet: byte byteValue = orbStream.read_octet(); - fieldToValueMap.put(fields[i].name, Byte.valueOf( - byteValue)); + fieldToValueMap.put(fields[i].name, Byte.valueOf(byteValue)); break; case TCKind._tk_boolean: boolean booleanValue = orbStream.read_boolean(); - fieldToValueMap.put(fields[i].name, Boolean.valueOf( - booleanValue)); + fieldToValueMap.put(fields[i].name, Boolean.valueOf(booleanValue)); break; case TCKind._tk_char: - // Backwards compatibility. Older Sun ORBs sent + // Backwards compatibility. Older Sun ORBs sent // _tk_char even though they read and wrote wchars // correctly. // // Fall through to the _tk_wchar case. case TCKind._tk_wchar: char charValue = orbStream.read_wchar(); - fieldToValueMap.put(fields[i].name, Character.valueOf( - charValue)); + fieldToValueMap.put(fields[i].name, Character.valueOf(charValue)); break; case TCKind._tk_short: short shortValue = orbStream.read_short(); - fieldToValueMap.put(fields[i].name, Short.valueOf( - shortValue)); + fieldToValueMap.put(fields[i].name, Short.valueOf(shortValue)); break; case TCKind._tk_long: int intValue = orbStream.read_long(); - fieldToValueMap.put(fields[i].name, Integer.valueOf( - intValue)); + fieldToValueMap.put(fields[i].name, Integer.valueOf(intValue)); break; case TCKind._tk_longlong: long longValue = orbStream.read_longlong(); - fieldToValueMap.put(fields[i].name, Long.valueOf( - longValue)); + fieldToValueMap.put(fields[i].name, Long.valueOf(longValue)); break; case TCKind._tk_float: float floatValue = orbStream.read_float(); - fieldToValueMap.put(fields[i].name, Float.valueOf( - floatValue)); + fieldToValueMap.put(fields[i].name, Float.valueOf(floatValue)); break; case TCKind._tk_double: double doubleValue = orbStream.read_double(); - fieldToValueMap.put(fields[i].name, Double.valueOf( - doubleValue)); + fieldToValueMap.put(fields[i].name, Double.valueOf(doubleValue)); break; case TCKind._tk_value: case TCKind._tk_objref: @@ -2182,8 +2069,7 @@ private void inputRemoteMembersForReadFields( fieldToValueMap.put(fields[i].name, objectValue); break; default: - throw Exceptions.self.unknownTypecodeKind( - fields[i].type.kind().value()); + throw Exceptions.self.unknownTypecodeKind(fields[i].type.kind().value()); } } } catch (Throwable t) { @@ -2196,15 +2082,12 @@ private void inputRemoteMembersForReadFields( /** * Called from InputStreamHook. * - * Reads the fields of the current class (could be the ones - * queried from the remote FVD) and puts them in - * the given Map, name to value. Wraps primitives in the - * corresponding java.lang Objects. + * Reads the fields of the current class (could be the ones queried from the remote FVD) and puts them in the given Map, + * name to value. Wraps primitives in the corresponding java.lang Objects. */ @ValueHandlerRead - private void inputCurrentClassFieldsForReadFields( - Map fieldToValueMap) throws InvalidClassException, - StreamCorruptedException, ClassNotFoundException, IOException { + private void inputCurrentClassFieldsForReadFields(Map fieldToValueMap) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException { ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy(); @@ -2213,61 +2096,52 @@ private void inputCurrentClassFieldsForReadFields( // Handle the primitives first for (int i = 0; i < primFields; ++i) { switch (fields[i].getTypeCode()) { - case 'B': - byte byteValue = orbStream.read_octet(); - fieldToValueMap.put(fields[i].getName(), - Byte.valueOf(byteValue)); - break; - case 'Z': - boolean booleanValue = orbStream.read_boolean(); - fieldToValueMap.put(fields[i].getName(), - Boolean.valueOf(booleanValue)); - break; - case 'C': - char charValue = orbStream.read_wchar(); - fieldToValueMap.put(fields[i].getName(), - Character.valueOf(charValue)); - break; - case 'S': - short shortValue = orbStream.read_short(); - fieldToValueMap.put(fields[i].getName(), - Short.valueOf(shortValue)); - break; - case 'I': - int intValue = orbStream.read_long(); - fieldToValueMap.put(fields[i].getName(), - Integer.valueOf(intValue)); - break; - case 'J': - long longValue = orbStream.read_longlong(); - fieldToValueMap.put(fields[i].getName(), - Long.valueOf(longValue)); - break; - case 'F' : - float floatValue = orbStream.read_float(); - fieldToValueMap.put(fields[i].getName(), - Float.valueOf(floatValue)); - break; - case 'D' : - double doubleValue = orbStream.read_double(); - fieldToValueMap.put(fields[i].getName(), - Double.valueOf(doubleValue)); - break; - default: - throw Exceptions.self.invalidClassForPrimitive( - currentClassDesc.getName() ); + case 'B': + byte byteValue = orbStream.read_octet(); + fieldToValueMap.put(fields[i].getName(), Byte.valueOf(byteValue)); + break; + case 'Z': + boolean booleanValue = orbStream.read_boolean(); + fieldToValueMap.put(fields[i].getName(), Boolean.valueOf(booleanValue)); + break; + case 'C': + char charValue = orbStream.read_wchar(); + fieldToValueMap.put(fields[i].getName(), Character.valueOf(charValue)); + break; + case 'S': + short shortValue = orbStream.read_short(); + fieldToValueMap.put(fields[i].getName(), Short.valueOf(shortValue)); + break; + case 'I': + int intValue = orbStream.read_long(); + fieldToValueMap.put(fields[i].getName(), Integer.valueOf(intValue)); + break; + case 'J': + long longValue = orbStream.read_longlong(); + fieldToValueMap.put(fields[i].getName(), Long.valueOf(longValue)); + break; + case 'F': + float floatValue = orbStream.read_float(); + fieldToValueMap.put(fields[i].getName(), Float.valueOf(floatValue)); + break; + case 'D': + double doubleValue = orbStream.read_double(); + fieldToValueMap.put(fields[i].getName(), Double.valueOf(doubleValue)); + break; + default: + throw Exceptions.self.invalidClassForPrimitive(currentClassDesc.getName()); } } /* Read and set object fields from the input stream. */ if (currentClassDesc.objFields > 0) { for (int i = primFields; i < fields.length; i++) { - OperationTracer.readingField( fields[i].getName() ) ; + OperationTracer.readingField(fields[i].getName()); Object objectValue = null; try { objectValue = inputObjectField(fields[i]); - } catch(IndirectionException cdrie) { + } catch (IndirectionException cdrie) { // The CDR stream had never seen the given offset before, // so check the recursion manager (it will throw an // IOException if it doesn't have a reference, either). @@ -2280,34 +2154,29 @@ private void inputCurrentClassFieldsForReadFields( } @InfoMethod - private void readingPrimitiveFields( int count ) { } + private void readingPrimitiveFields(int count) { + } @InfoMethod - private void readingField( int index, ObjectStreamField fld ) { } + private void readingField(int index, ObjectStreamField fld) { + } /* - * Read the fields of the specified class from the input stream and set - * the values of the fields in the specified object. If the specified - * object is null, just consume the fields without setting any values. If - * any ObjectStreamField does not have a reflected Field, don't try to set - * that field in the object. + * Read the fields of the specified class from the input stream and set the values of the fields in the specified + * object. If the specified object is null, just consume the fields without setting any values. If any ObjectStreamField + * does not have a reflected Field, don't try to set that field in the object. * - * REVISIT -- This code doesn't do what the comment says to when - * getField() is null! + * REVISIT -- This code doesn't do what the comment says to when getField() is null! */ @ValueHandlerRead - private void inputClassFields(Object o, Class cl, - ObjectStreamField[] fields, - com.sun.org.omg.SendingContext.CodeBase sender) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException - { + private void inputClassFields(Object o, Class cl, ObjectStreamField[] fields, com.sun.org.omg.SendingContext.CodeBase sender) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException { int primFields = fields.length - currentClassDesc.objFields; readingPrimitiveFields(primFields); if (o != null) { for (int i = 0; i < primFields; ++i) { - OperationTracer.readingField( fields[i].getName() ) ; + OperationTracer.readingField(fields[i].getName()); if (fields[i].getField() == null) { continue; } @@ -2319,13 +2188,13 @@ private void inputClassFields(Object o, Class cl, /* Read and set object fields from the input stream. */ if (currentClassDesc.objFields > 0) { for (int i = primFields; i < fields.length; i++) { - OperationTracer.readingField( fields[i].getName() ) ; + OperationTracer.readingField(fields[i].getName()); Object objectValue = null; try { - readingField( i, fields[i] ) ; + readingField(i, fields[i]); objectValue = inputObjectField(fields[i]); - } catch(IndirectionException cdrie) { + } catch (IndirectionException cdrie) { // The CDR stream had never seen the given offset before, // so check the recursion manager (it will throw an // IOException if it doesn't have a reference, either). @@ -2337,10 +2206,8 @@ private void inputClassFields(Object o, Class cl, } try { - Class fieldCl = fields[i].getClazz(); - if ((objectValue != null) - && (!fieldCl.isAssignableFrom( - objectValue.getClass()))) { + Class fieldCl = fields[i].getClazz(); + if ((objectValue != null) && (!fieldCl.isAssignableFrom(objectValue.getClass()))) { throw new IllegalArgumentException("Field mismatch"); } @@ -2358,68 +2225,57 @@ private void inputClassFields(Object o, Class cl, // check input field type is a declared field type // input field is a subclass of the declared field if (!declaredFieldClass.isAssignableFrom(fieldCl)) { - throw new IllegalArgumentException( - "Field Type mismatch"); + throw new IllegalArgumentException("Field Type mismatch"); } if (objectValue != null && !fieldCl.isInstance(objectValue)) { throw new IllegalArgumentException(); } - - bridge.putObject( o, fields[i].getFieldID(), objectValue ) ; + + bridge.putObject(o, fields[i].getFieldID(), objectValue); // reflective code: fields[i].getField().set( o, objectValue ) ; } catch (IllegalArgumentException e) { - ClassCastException exc = new ClassCastException( - "Assigning instance of class " - + objectValue.getClass().getName() + " to field " - + currentClassDesc.getName() + '#' - + fields[i].getField().getName()); - exc.initCause( e ) ; - throw exc ; + ClassCastException exc = new ClassCastException("Assigning instance of class " + objectValue.getClass().getName() + + " to field " + currentClassDesc.getName() + '#' + fields[i].getField().getName()); + exc.initCause(e); + throw exc; } } } } @InfoMethod - private void valueMemberInfo( String name, String id, String definedIn, - String version, short access ) { } + private void valueMemberInfo(String name, String id, String definedIn, String version, short access) { + } @ValueHandlerRead - private void displayValueMember( ValueMember member ) { - valueMemberInfo( member.name, member.id, member.defined_in, - member.version, member.access ) ; + private void displayValueMember(ValueMember member) { + valueMemberInfo(member.name, member.id, member.defined_in, member.version, member.access); } @ValueHandlerRead - private void displayValueMembers( ValueMember[] members ) { - for (ValueMember member : members ) { + private void displayValueMembers(ValueMember[] members) { + for (ValueMember member : members) { displayValueMember(member); } } /* - * Read the fields of the specified class from the input stream and set - * the values of the fields in the specified object. If the specified - * object is null, just consume the fields without setting any values. If - * any ObjectStreamField does not have a reflected Field, don't try to set - * that field in the object. + * Read the fields of the specified class from the input stream and set the values of the fields in the specified + * object. If the specified object is null, just consume the fields without setting any values. If any ObjectStreamField + * does not have a reflected Field, don't try to set that field in the object. */ @ValueHandlerRead - private void inputClassFields(Object o, Class cl, - ObjectStreamClass osc, - ValueMember[] fields, - com.sun.org.omg.SendingContext.CodeBase sender) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException - { - displayValueMembers( fields ) ; + private void inputClassFields(Object o, Class cl, ObjectStreamClass osc, ValueMember[] fields, + com.sun.org.omg.SendingContext.CodeBase sender) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException { + displayValueMembers(fields); try { for (int i = 0; i < fields.length; ++i) { - OperationTracer.readingField( fields[i].name ) ; + OperationTracer.readingField(fields[i].name); - displayValueMember( fields[i] ) ; + displayValueMember(fields[i]); try { switch (fields[i].type.kind().value()) { @@ -2436,7 +2292,7 @@ private void inputClassFields(Object o, Class cl, } break; case TCKind._tk_char: - // Backwards compatibility. Older Sun ORBs sent + // Backwards compatibility. Older Sun ORBs sent // _tk_char even though they read and wrote wchars // correctly. // @@ -2489,44 +2345,36 @@ private void inputClassFields(Object o, Class cl, // IOException if it doesn't have a reference, either). objectValue = activeRecursionMgr.getObject(cdrie.offset); } - + if (o == null) { continue; } try { - if (osc.hasField(fields[i])){ - setObjectField(o, cl, fields[i].name, - objectValue); + if (osc.hasField(fields[i])) { + setObjectField(o, cl, fields[i].name, objectValue); } else { - Exceptions.self.notSettingField( fields[i].name, - osc.getName() ) ; + Exceptions.self.notSettingField(fields[i].name, osc.getName()); } } catch (IllegalArgumentException e) { - throw Exceptions.self.couldNotAssignObjectToField( - e, objectValue.getClass().getName(), - fields[i].name ) ; - } + throw Exceptions.self.couldNotAssignObjectToField(e, objectValue.getClass().getName(), fields[i].name); + } break; default: - throw Exceptions.self.unknownTypecodeKind( - fields[i].type.kind().value()); + throw Exceptions.self.unknownTypecodeKind(fields[i].type.kind().value()); } } catch (IllegalArgumentException e) { - throw Exceptions.self.couldNotAssignObjectToField( e, - fields[i].id, fields[i].name ) ; + throw Exceptions.self.couldNotAssignObjectToField(e, fields[i].id, fields[i].name); } } - } catch(Throwable t){ - throw Exceptions.self.streamCorrupted( t ) ; + } catch (Throwable t) { + throw Exceptions.self.streamCorrupted(t); } } @ValueHandlerRead - private void skipCustomUsingFVD(ValueMember[] fields, - com.sun.org.omg.SendingContext.CodeBase sender - ) throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException { + private void skipCustomUsingFVD(ValueMember[] fields, com.sun.org.omg.SendingContext.CodeBase sender) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException { readFormatVersion(); boolean calledDefaultWriteObject = readBoolean(); @@ -2536,24 +2384,22 @@ private void skipCustomUsingFVD(ValueMember[] fields, } if (getStreamFormatVersion() == 2) { - - ((ValueInputStream)getOrbStream()).start_value(); - ((ValueInputStream)getOrbStream()).end_value(); + + ((ValueInputStream) getOrbStream()).start_value(); + ((ValueInputStream) getOrbStream()).end_value(); } } - + /* - * Read the fields of the specified class from the input stream throw data - * away. This must handle same switch logic as above. + * Read the fields of the specified class from the input stream throw data away. This must handle same switch logic as + * above. */ @ValueHandlerRead - private void throwAwayData(ValueMember[] fields, - com.sun.org.omg.SendingContext.CodeBase sender - ) throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException { + private void throwAwayData(ValueMember[] fields, com.sun.org.omg.SendingContext.CodeBase sender) + throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException { for (int i = 0; i < fields.length; ++i) { - OperationTracer.readingField( fields[i].name ) ; + OperationTracer.readingField(fields[i].name); try { switch (fields[i].type.kind().value()) { case TCKind._tk_octet: @@ -2563,7 +2409,7 @@ private void throwAwayData(ValueMember[] fields, orbStream.read_boolean(); break; case TCKind._tk_char: - // Backwards compatibility. Older Sun ORBs sent + // Backwards compatibility. Older Sun ORBs sent // _tk_char even though they read and wrote wchars // correctly. // @@ -2594,8 +2440,7 @@ private void throwAwayData(ValueMember[] fields, try { type = vhandler.getClassFromType(id); - } - catch(ClassNotFoundException cnfe){ + } catch (ClassNotFoundException cnfe) { // Make sure type = null type = null; } @@ -2603,25 +2448,22 @@ private void throwAwayData(ValueMember[] fields, if (type != null) { signature = ValueUtility.getSignature(fields[i]); } - + // Read value try { - if ((signature != null) && ( - signature.equals("Ljava/lang/Object;") - || signature.equals("Ljava/io/Serializable;") - || signature.equals("Ljava/io/Externalizable;")) ) { + if ((signature != null) && (signature.equals("Ljava/lang/Object;") || signature.equals("Ljava/io/Serializable;") + || signature.equals("Ljava/io/Externalizable;"))) { Util.getInstance().readAny(orbStream); } else { // Decide what method call to make based on the type. // - // NOTE : Since FullValueDescription does not allow - // us to ask whether something is an interface we + // NOTE : Since FullValueDescription does not allow + // us to ask whether something is an interface we // do not have the ability to optimize this check. int callType = ValueHandlerImpl.kValueType; if (!vhandler.isSequence(id)) { - FullValueDescription fieldFVD = - sender.meta(fields[i].id); + FullValueDescription fieldFVD = sender.meta(fields[i].id); if (kRemoteTypeCode == fields[i].type) { // RMI Object reference... @@ -2632,19 +2474,19 @@ private void throwAwayData(ValueMember[] fields, callType = ValueHandlerImpl.kAbstractType; } } - - // Now that we have used the FVD of the field to + + // Now that we have used the FVD of the field to // determine the proper course - // of action, it is ok to use the type (Class) - // from this point forward since - // the rep. id for this read will also follow on + // of action, it is ok to use the type (Class) + // from this point forward since + // the rep. id for this read will also follow on // the wire. switch (callType) { - case ValueHandlerImpl.kRemoteType: + case ValueHandlerImpl.kRemoteType: orbStream.read_Object(); break; - case ValueHandlerImpl.kAbstractType: - orbStream.read_abstract_interface(); + case ValueHandlerImpl.kAbstractType: + orbStream.read_abstract_interface(); break; case ValueHandlerImpl.kValueType: if (type != null) { @@ -2654,271 +2496,212 @@ private void throwAwayData(ValueMember[] fields, } break; default: - throw Exceptions.self.unknownCallType(callType) ; + throw Exceptions.self.unknownCallType(callType); } } - } catch(IndirectionException cdrie) { - // Since we are throwing this away, don't bother + } catch (IndirectionException cdrie) { + // Since we are throwing this away, don't bother // handling recursion. continue; } - + break; default: - throw Exceptions.self.unknownTypecodeKind( - fields[i].type.kind().value()); + throw Exceptions.self.unknownTypecodeKind(fields[i].type.kind().value()); } } catch (IllegalArgumentException e) { - throw Exceptions.self.couldNotAssignObjectToField( e, - fields[i].id, currentClassDesc.getName() ) ; + throw Exceptions.self.couldNotAssignObjectToField(e, fields[i].id, currentClassDesc.getName()); } } - + } @ValueHandlerRead - private static void setObjectField(Object o, Class c, String fieldName, - Object v) { + private static void setObjectField(Object o, Class c, String fieldName, Object v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); Class fieldCl = fld.getType(); - if(v != null && !fieldCl.isInstance(v)) { + if (v != null && !fieldCl.isInstance(v)) { throw new Exception(); } - long key = bridge.objectFieldOffset( fld ) ; - bridge.putObject( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putObject(o, key, v); } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetObjectField( e, fieldName, - o.toString(), - v.toString() ) ; + if (o != null) { + throw utilWrapper.errorSetObjectField(e, fieldName, o.toString(), v.toString()); } else { - throw utilWrapper.errorSetObjectField( e, fieldName, - "null " + c.getName() + " object", - v.toString() ) ; + throw utilWrapper.errorSetObjectField(e, fieldName, "null " + c.getName() + " object", v.toString()); } - + } } @ValueHandlerRead - private static void setBooleanField(Object o, Class c, String fieldName, - boolean v) - { + private static void setBooleanField(Object o, Class c, String fieldName, boolean v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); if ((fld != null) && (fld.getType() == Boolean.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putBoolean( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putBoolean(o, key, v); } else { throw new InvalidObjectException("Field Type mismatch"); } } catch (Exception e) { if (o != null) { - throw utilWrapper.errorSetBooleanField( e, fieldName, - o.toString(), - new Boolean(v) ) ; - } else { - throw utilWrapper.errorSetBooleanField( e, fieldName, - "null " + c.getName() + " object", - new Boolean(v) ) ; - } + throw utilWrapper.errorSetBooleanField(e, fieldName, o.toString(), new Boolean(v)); + } else { + throw utilWrapper.errorSetBooleanField(e, fieldName, "null " + c.getName() + " object", new Boolean(v)); + } } } @ValueHandlerRead - private static void setByteField(Object o, Class c, String fieldName, - byte v) - { + private static void setByteField(Object o, Class c, String fieldName, byte v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); if ((fld != null) && (fld.getType() == Byte.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putByte( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putByte(o, key, v); } else { throw new InvalidObjectException("Field Type mismatch"); } } catch (Exception e) { if (o != null) { - throw utilWrapper.errorSetByteField( e, fieldName, - o.toString(), - new Byte(v) ) ; + throw utilWrapper.errorSetByteField(e, fieldName, o.toString(), new Byte(v)); } else { - throw utilWrapper.errorSetByteField( e, fieldName, - "null " + c.getName() + " object", - new Byte(v) ) ; + throw utilWrapper.errorSetByteField(e, fieldName, "null " + c.getName() + " object", new Byte(v)); } } } @ValueHandlerRead - private static void setCharField(Object o, Class c, String fieldName, - char v) - { + private static void setCharField(Object o, Class c, String fieldName, char v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); if ((fld != null) && (fld.getType() == Character.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putChar( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putChar(o, key, v); } else { throw new InvalidObjectException("Field Type mismatch"); } } catch (Exception e) { if (o != null) { - throw utilWrapper.errorSetCharField( e, fieldName, - o.toString(), - new Character(v) ) ; + throw utilWrapper.errorSetCharField(e, fieldName, o.toString(), new Character(v)); } else { - throw utilWrapper.errorSetCharField( e, fieldName, - "null " + c.getName() + " object", - new Character(v) ) ; + throw utilWrapper.errorSetCharField(e, fieldName, "null " + c.getName() + " object", new Character(v)); } } } @ValueHandlerRead - private static void setShortField(Object o, Class c, String fieldName, - short v) - { + private static void setShortField(Object o, Class c, String fieldName, short v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); if ((fld != null) && (fld.getType() == Short.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putShort( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putShort(o, key, v); } else { throw new InvalidObjectException("Field Type mismatch"); } } catch (Exception e) { if (o != null) { - throw utilWrapper.errorSetShortField( e, fieldName, - o.toString(), - new Short(v) ) ; + throw utilWrapper.errorSetShortField(e, fieldName, o.toString(), new Short(v)); } else { - throw utilWrapper.errorSetShortField( e, fieldName, - "null " + c.getName() + " object", - new Short(v) ) ; + throw utilWrapper.errorSetShortField(e, fieldName, "null " + c.getName() + " object", new Short(v)); } } } @ValueHandlerRead - private static void setIntField(Object o, Class c, String fieldName, - int v) - { + private static void setIntField(Object o, Class c, String fieldName, int v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); if ((fld != null) && (fld.getType() == Integer.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putInt( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putInt(o, key, v); } else { throw new InvalidObjectException("Field Type mismatch"); } } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetIntField( e, fieldName, - o.toString(), - new Integer(v) ) ; + if (o != null) { + throw utilWrapper.errorSetIntField(e, fieldName, o.toString(), new Integer(v)); } else { - throw utilWrapper.errorSetIntField( e, fieldName, - "null " + c.getName() + " object", - new Integer(v) ) ; + throw utilWrapper.errorSetIntField(e, fieldName, "null " + c.getName() + " object", new Integer(v)); } } } @ValueHandlerRead - private static void setLongField(Object o, Class c, String fieldName, - long v) - { + private static void setLongField(Object o, Class c, String fieldName, long v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); if ((fld != null) && (fld.getType() == Long.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putLong( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putLong(o, key, v); } else { throw new InvalidObjectException("Field Type mismatch"); } } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetLongField( e, fieldName, - o.toString(), - new Long(v) ) ; + if (o != null) { + throw utilWrapper.errorSetLongField(e, fieldName, o.toString(), new Long(v)); } else { - throw utilWrapper.errorSetLongField( e, fieldName, - "null " + c.getName() + " object", - new Long(v) ) ; + throw utilWrapper.errorSetLongField(e, fieldName, "null " + c.getName() + " object", new Long(v)); } } } @ValueHandlerRead - private static void setFloatField(Object o, Class c, String fieldName, - float v) - { + private static void setFloatField(Object o, Class c, String fieldName, float v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); if ((fld != null) && (fld.getType() == Float.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putFloat( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putFloat(o, key, v); } else { throw new InvalidObjectException("Field Type mismatch"); } } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetFloatField( e, fieldName, - o.toString(), - new Float(v) ) ; + if (o != null) { + throw utilWrapper.errorSetFloatField(e, fieldName, o.toString(), new Float(v)); } else { - throw utilWrapper.errorSetFloatField( e, fieldName, - "null " + c.getName() + " object", - new Float(v) ) ; + throw utilWrapper.errorSetFloatField(e, fieldName, "null " + c.getName() + " object", new Float(v)); } } } @ValueHandlerRead - private static void setDoubleField(Object o, Class c, String fieldName, - double v) - { + private static void setDoubleField(Object o, Class c, String fieldName, double v) { try { - Field fld = c.getDeclaredField( fieldName ) ; + Field fld = c.getDeclaredField(fieldName); if ((fld != null) && (fld.getType() == Double.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putDouble( o, key, v ) ; + long key = bridge.objectFieldOffset(fld); + bridge.putDouble(o, key, v); } else { throw new InvalidObjectException("Field Type mismatch"); } } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetDoubleField( e, fieldName, - o.toString(), - new Double(v) ) ; + if (o != null) { + throw utilWrapper.errorSetDoubleField(e, fieldName, o.toString(), new Double(v)); } else { - throw utilWrapper.errorSetDoubleField( e, fieldName, - "null " + c.getName() + " object", - new Double(v) ) ; + throw utilWrapper.errorSetDoubleField(e, fieldName, "null " + c.getName() + " object", new Double(v)); } } } /** - * This class maintains a map of stream position to - * an Object currently being deserialized. It is used - * to handle the cases where the are indirections to - * an object on the recursion stack. The CDR level - * handles indirections to objects previously seen - * (and completely deserialized) in the stream. + * This class maintains a map of stream position to an Object currently being deserialized. It is used to handle the + * cases where the are indirections to an object on the recursion stack. The CDR level handles indirections to objects + * previously seen (and completely deserialized) in the stream. */ - static class ActiveRecursionManager - { - private Map offsetToObjectMap; - + static class ActiveRecursionManager { + private Map offsetToObjectMap; + public ActiveRecursionManager() { // A hash map is unsynchronized and allows // null values - offsetToObjectMap = new HashMap(); + offsetToObjectMap = new HashMap(); } // Called right after allocating a new object. @@ -2942,10 +2725,10 @@ public Object getObject(int offset) throws IOException { return offsetToObjectMap.get(position); } - + // Called when an object has been completely // deserialized, so it should no longer be in - // this mapping. The CDR level can handle + // this mapping. The CDR level can handle // further indirections. public void removeObject(int offset) { offsetToObjectMap.remove(offset); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/IIOPOutputStream.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/IIOPOutputStream.java index 4fdf48093..9e0288a7a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/IIOPOutputStream.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/IIOPOutputStream.java @@ -37,27 +37,21 @@ import java.security.PrivilegedAction; import java.util.Stack; - /** * IIOPOutputStream is ... * - * @author Stephen Lewallen + * @author Stephen Lewallen * @version 0.01, 4/6/98 - * @since JDK1.1.6 + * @since JDK1.1.6 */ @ValueHandlerWrite -public class IIOPOutputStream - extends com.sun.corba.ee.impl.io.OutputStreamHook -{ - private static Bridge bridge = - AccessController.doPrivileged( - new PrivilegedAction() { - public Bridge run() { - return Bridge.get() ; - } - } - ) ; +public class IIOPOutputStream extends com.sun.corba.ee.impl.io.OutputStreamHook { + private static Bridge bridge = AccessController.doPrivileged(new PrivilegedAction() { + public Bridge run() { + return Bridge.get(); + } + }); private org.omg.CORBA_2_3.portable.OutputStream orbStream; @@ -71,12 +65,9 @@ public Bridge run() { private IOException abortIOException = null; - private Stack classDescStack = - new Stack(); + private Stack classDescStack = new Stack(); - public IIOPOutputStream() - throws java.io.IOException - { + public IIOPOutputStream() throws java.io.IOException { super(); } @@ -88,8 +79,7 @@ public IIOPOutputStream() protected void beginOptionalCustomData() { if (streamFormatVersion == 2) { - org.omg.CORBA.portable.ValueOutputStream vout - = (org.omg.CORBA.portable.ValueOutputStream)orbStream; + org.omg.CORBA.portable.ValueOutputStream vout = (org.omg.CORBA.portable.ValueOutputStream) orbStream; vout.start_value(currentClassDesc.getRMIIIOPOptionalDataRepId()); } @@ -104,19 +94,20 @@ final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() { } @InfoMethod - private void recursionDepthInfo( int rd ) {} + private void recursionDepthInfo(int rd) { + } @ValueHandlerWrite - final void increaseRecursionDepth(){ + final void increaseRecursionDepth() { recursionDepth++; - recursionDepthInfo( recursionDepth ) ; + recursionDepthInfo(recursionDepth); } @ValueHandlerWrite - final int decreaseRecursionDepth(){ + final int decreaseRecursionDepth() { --recursionDepth; recursionDepthInfo(recursionDepth); - return recursionDepth ; + return recursionDepth; } @ValueHandlerWrite @@ -125,26 +116,25 @@ private void writeFormatVersion() { } /** - * Override the actions of the final method "writeObject()" - * in ObjectOutputStream. - * @since JDK1.1.6 + * Override the actions of the final method "writeObject()" in ObjectOutputStream. + * + * @since JDK1.1.6 */ @ValueHandlerWrite @Override - public final void writeObjectOverride(Object obj) - throws IOException { + public final void writeObjectOverride(Object obj) throws IOException { writeObjectState.writeData(this); - Util.getInstance().writeAbstractObject((OutputStream)orbStream, obj); + Util.getInstance().writeAbstractObject((OutputStream) orbStream, obj); } /** - * Override the actions of the final method "writeObject()" - * in ObjectOutputStream. + * Override the actions of the final method "writeObject()" in ObjectOutputStream. + * * @param obj Object to write * @param formatVersion Format version - * @since JDK1.1.6 + * @since JDK1.1.6 */ @ValueHandlerWrite public final void simpleWriteObject(Object obj, byte formatVersion) { @@ -172,8 +162,8 @@ public final void simpleWriteObject(Object obj, byte formatVersion) { currentClassDesc = prevClassDesc; } - /* If the recursion depth is 0, test for and clear the pending exception. - * If there is a pending exception throw it. + /* + * If the recursion depth is 0, test for and clear the pending exception. If there is a pending exception throw it. */ IOException pending = abortIOException; if (simpleWriteDepth == 0) { @@ -181,7 +171,7 @@ public final void simpleWriteObject(Object obj, byte formatVersion) { } if (pending != null) { - bridge.throwException( pending ) ; + bridge.throwException(pending); } } @@ -191,9 +181,9 @@ ObjectStreamField[] getFieldsNoCopy() { } /** - * Override the actions of the final method "defaultWriteObject()" - * in ObjectOutputStream. - * @since JDK1.1.6 + * Override the actions of the final method "defaultWriteObject()" in ObjectOutputStream. + * + * @since JDK1.1.6 */ @ValueHandlerWrite @Override @@ -205,78 +195,73 @@ public final void defaultWriteObjectDelegate() throw new NotActiveException("defaultWriteObjectDelegate"); } - ObjectStreamField[] fields = - currentClassDesc.getFieldsNoCopy(); + ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy(); if (fields.length > 0) { - outputClassFields(currentObject, currentClassDesc.forClass(), - fields); + outputClassFields(currentObject, currentClassDesc.forClass(), fields); } - } catch(IOException ioe) { + } catch (IOException ioe) { bridge.throwException(ioe); } } /** - * Override the actions of the final method "enableReplaceObject()" - * in ObjectOutputStream. + * Override the actions of the final method "enableReplaceObject()" in ObjectOutputStream. + * * @param enable ignored * @return {@code false} - * @since JDK1.1.6 + * @since JDK1.1.6 */ public final boolean enableReplaceObjectDelegate(boolean enable) /* throws SecurityException */ { return false; - - } + } @Override - protected final void annotateClass(Class cl) throws IOException{ - throw Exceptions.self.annotateClassNotSupported() ; + protected final void annotateClass(Class cl) throws IOException { + throw Exceptions.self.annotateClassNotSupported(); } @Override - public final void close() throws IOException{ + public final void close() throws IOException { // no op } @Override - protected final void drain() throws IOException{ + protected final void drain() throws IOException { // no op } @ValueHandlerWrite @Override - public final void flush() throws IOException{ - try{ + public final void flush() throws IOException { + try { orbStream.flush(); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - protected final Object replaceObject(Object obj) throws IOException{ - throw Exceptions.self.replaceObjectNotSupported() ; + protected final Object replaceObject(Object obj) throws IOException { + throw Exceptions.self.replaceObjectNotSupported(); } /** - * Reset will disregard the state of any objects already written - * to the stream. The state is reset to be the same as a new - * ObjectOutputStream. The current point in the stream is marked - * as reset so the corresponding ObjectInputStream will be reset - * at the same point. Objects previously written to the stream - * will not be refered to as already being in the stream. They - * will be written to the stream again. - * @since JDK1.1 + * Reset will disregard the state of any objects already written to the stream. The state is reset to be the same as a + * new ObjectOutputStream. The current point in the stream is marked as reset so the corresponding ObjectInputStream + * will be reset at the same point. Objects previously written to the stream will not be refered to as already being in + * the stream. They will be written to the stream again. + * + * @since JDK1.1 */ @ValueHandlerWrite @Override - public final void reset() throws IOException{ - try{ - //orbStream.reset(); + public final void reset() throws IOException { + try { + // orbStream.reset(); if (currentObject != null || currentClassDesc != null) { throw new IOException("Illegal call to reset"); @@ -285,236 +270,228 @@ public final void reset() throws IOException{ abortIOException = null; if (classDescStack == null) { - classDescStack = - new Stack(); + classDescStack = new Stack(); } else { classDescStack.setSize(0); } - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void write(byte b[]) throws IOException{ - try{ + public final void write(byte b[]) throws IOException { + try { writeObjectState.writeData(this); orbStream.write_octet_array(b, 0, b.length); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void write(byte b[], int off, int len) throws IOException{ - try{ + public final void write(byte b[], int off, int len) throws IOException { + try { writeObjectState.writeData(this); orbStream.write_octet_array(b, off, len); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void write(int data) throws IOException{ - try{ + public final void write(int data) throws IOException { + try { writeObjectState.writeData(this); - orbStream.write_octet((byte)(data & 0xFF)); - } catch(Error e) { - throw new IOException(e) ; + orbStream.write_octet((byte) (data & 0xFF)); + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeBoolean(boolean data) throws IOException{ - try{ + public final void writeBoolean(boolean data) throws IOException { + try { writeObjectState.writeData(this); orbStream.write_boolean(data); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeByte(int data) throws IOException{ - try{ + public final void writeByte(int data) throws IOException { + try { writeObjectState.writeData(this); - orbStream.write_octet((byte)data); - } catch(Error e) { - throw new IOException(e) ; + orbStream.write_octet((byte) data); + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeBytes(String data) throws IOException{ - try{ + public final void writeBytes(String data) throws IOException { + try { writeObjectState.writeData(this); byte buf[] = data.getBytes(); orbStream.write_octet_array(buf, 0, buf.length); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeChar(int data) throws IOException{ - try{ + public final void writeChar(int data) throws IOException { + try { writeObjectState.writeData(this); - orbStream.write_wchar((char)data); - } catch(Error e) { - throw new IOException(e) ; + orbStream.write_wchar((char) data); + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeChars(String data) throws IOException{ - try{ + public final void writeChars(String data) throws IOException { + try { writeObjectState.writeData(this); char buf[] = data.toCharArray(); orbStream.write_wchar_array(buf, 0, buf.length); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeDouble(double data) throws IOException{ - try{ + public final void writeDouble(double data) throws IOException { + try { writeObjectState.writeData(this); orbStream.write_double(data); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeFloat(float data) throws IOException{ - try{ + public final void writeFloat(float data) throws IOException { + try { writeObjectState.writeData(this); orbStream.write_float(data); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeInt(int data) throws IOException{ - try{ + public final void writeInt(int data) throws IOException { + try { writeObjectState.writeData(this); orbStream.write_long(data); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeLong(long data) throws IOException{ - try{ + public final void writeLong(long data) throws IOException { + try { writeObjectState.writeData(this); orbStream.write_longlong(data); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } @ValueHandlerWrite @Override - public final void writeShort(int data) throws IOException{ - try{ + public final void writeShort(int data) throws IOException { + try { writeObjectState.writeData(this); - orbStream.write_short((short)data); - } catch(Error e) { - throw new IOException(e) ; + orbStream.write_short((short) data); + } catch (Error e) { + throw new IOException(e); } } @Override - protected final void writeStreamHeader() throws IOException{ + protected final void writeStreamHeader() throws IOException { // no op } /** - * Helper method for correcting the Kestrel bug 4367783 (dealing - * with larger than 8-bit chars). The old behavior was preserved - * in orbutil.IIOPInputStream_1_3 in order to interoperate with - * our legacy ORBs. + * Helper method for correcting the Kestrel bug 4367783 (dealing with larger than 8-bit chars). The old behavior was + * preserved in orbutil.IIOPInputStream_1_3 in order to interoperate with our legacy ORBs. + * * @param stream Stream to write to * @param data Data to write */ - protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream, - String data) - { + protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream, String data) { stream.write_wstring(data); } @ValueHandlerWrite @Override - public final void writeUTF(String data) throws IOException{ - try{ + public final void writeUTF(String data) throws IOException { + try { writeObjectState.writeData(this); internalWriteUTF(orbStream, data); - } catch(Error e) { - throw new IOException(e) ; + } catch (Error e) { + throw new IOException(e); } } // INTERNAL UTILITY METHODS /* - * Check for special cases of serializing objects. - * These objects are not subject to replacement. + * Check for special cases of serializing objects. These objects are not subject to replacement. */ private boolean checkSpecialClasses(Object obj) throws IOException { /* * If this is a class, don't allow substitution */ - //if (obj instanceof Class) { - // throw new IOException("Serialization of Class not supported"); - //} + // if (obj instanceof Class) { + // throw new IOException("Serialization of Class not supported"); + // } if (obj instanceof ObjectStreamClass) { - throw Exceptions.self.serializationObjectStreamClassNotSupported() ; + throw Exceptions.self.serializationObjectStreamClassNotSupported(); } return false; } /* - * Check for special cases of substitutable serializing objects. - * These classes are replaceable. + * Check for special cases of substitutable serializing objects. These classes are replaceable. */ - private boolean checkSubstitutableSpecialClasses(Object obj) - throws IOException - { + private boolean checkSubstitutableSpecialClasses(Object obj) throws IOException { if (obj instanceof String) { - orbStream.write_value((java.io.Serializable)obj); + orbStream.write_value((java.io.Serializable) obj); return true; } @@ -525,47 +502,45 @@ private boolean checkSubstitutableSpecialClasses(Object obj) * Write out the object */ @ValueHandlerWrite - private void outputObject(final Object obj) throws IOException{ + private void outputObject(final Object obj) throws IOException { currentObject = obj; Class currclass = obj.getClass(); - /* Get the Class descriptor for this class, - * Throw a NotSerializableException if there is none. + /* + * Get the Class descriptor for this class, Throw a NotSerializableException if there is none. */ currentClassDesc = ObjectStreamClass.lookup(currclass); if (currentClassDesc == null) { - throw Exceptions.self.notSerializable( currclass.getName() ) ; + throw Exceptions.self.notSerializable(currclass.getName()); } - /* If the object is externalizable, - * call writeExternal. - * else do Serializable processing. + /* + * If the object is externalizable, call writeExternal. else do Serializable processing. */ if (currentClassDesc.isExternalizable()) { // Write format version - writeFormatVersion() ; + writeFormatVersion(); // KMC issue 5161: need to save state for Externalizable also! // Obviously an Externalizable may also call writeObject, which // calls writeObjectOverride, which sends the writeData input to - // the state machine. So we need a new state machine here! - WriteObjectState oldState = writeObjectState ; - setState( NOT_IN_WRITE_OBJECT ) ; + // the state machine. So we need a new state machine here! + WriteObjectState oldState = writeObjectState; + setState(NOT_IN_WRITE_OBJECT); try { - Externalizable ext = (Externalizable)obj; + Externalizable ext = (Externalizable) obj; ext.writeExternal(this); } finally { - setState(oldState) ; + setState(oldState); } } else { - /* The object's classes should be processed from supertype to - * subtype. Push all the clases of the current object onto a stack. - * Remember the stack pointer where this set of classes is being - * pushed. + /* + * The object's classes should be processed from supertype to subtype. Push all the clases of the current object onto a + * stack. Remember the stack pointer where this set of classes is being pushed. */ if (currentClassDesc.forClass().getName().equals("java.lang.String")) { - this.writeUTF((String)obj); + this.writeUTF((String) obj); return; } int stackMark = classDescStack.size(); @@ -583,15 +558,14 @@ private void outputObject(final Object obj) throws IOException{ setState(NOT_IN_WRITE_OBJECT); if (currentClassDesc.hasWriteObject()) { - invokeObjectWriter(currentClassDesc, obj ); + invokeObjectWriter(currentClassDesc, obj); } else { defaultWriteObjectDelegate(); } } finally { setState(oldState); } - } while (classDescStack.size() > stackMark && - (currentClassDesc = classDescStack.pop()) != null); + } while (classDescStack.size() > stackMark && (currentClassDesc = classDescStack.pop()) != null); } finally { classDescStack.setSize(stackMark); } @@ -599,24 +573,22 @@ private void outputObject(final Object obj) throws IOException{ } /* - * Invoke writer. - * _REVISIT_ invokeObjectWriter and invokeObjectReader behave inconsistently with each other since - * the reader returns a boolean...fix later + * Invoke writer. _REVISIT_ invokeObjectWriter and invokeObjectReader behave inconsistently with each other since the + * reader returns a boolean...fix later */ @ValueHandlerWrite - private void invokeObjectWriter(ObjectStreamClass osc, Object obj) - throws IOException { + private void invokeObjectWriter(ObjectStreamClass osc, Object obj) throws IOException { - Class c = osc.forClass() ; + Class c = osc.forClass(); try { // Write format version - writeFormatVersion() ; + writeFormatVersion(); writeObjectState.enterWriteObject(this); try { - osc.getWriteObjectMethod().invoke( obj, this ) ; + osc.getWriteObjectMethod().invoke(obj, this); } finally { writeObjectState.exitWriteObject(this); } @@ -637,88 +609,85 @@ private void invokeObjectWriter(ObjectStreamClass osc, Object obj) @ValueHandlerWrite void writeField(ObjectStreamField field, Object value) throws IOException { switch (field.getTypeCode()) { - case 'B': - if (value == null) { - orbStream.write_octet((byte) 0); - } else { - orbStream.write_octet(((Byte) value).byteValue()); - } - break; - case 'C': - if (value == null) { - orbStream.write_wchar((char) 0); - } else { - orbStream.write_wchar(((Character) value).charValue()); - } - break; - case 'F': - if (value == null) { - orbStream.write_float((float) 0); - } else { - orbStream.write_float(((Float) value).floatValue()); - } - break; - case 'D': - if (value == null) { - orbStream.write_double((double) 0); - } else { - orbStream.write_double(((Double) value).doubleValue()); - } - break; - case 'I': - if (value == null) { - orbStream.write_long(0); - } else { - orbStream.write_long(((Integer) value).intValue()); - } - break; - case 'J': - if (value == null) { - orbStream.write_longlong((long) 0); - } else { - orbStream.write_longlong(((Long) value).longValue()); - } - break; - case 'S': - if (value == null) { - orbStream.write_short((short) 0); - } else { - orbStream.write_short(((Short) value).shortValue()); - } - break; - case 'Z': - if (value == null) { - orbStream.write_boolean(false); - } else { - orbStream.write_boolean(((Boolean) value).booleanValue()); - } - break; - case '[': - case 'L': - // What to do if it's null? - writeObjectField(field, value); - break; - default: - throw Exceptions.self.invalidClassForWrite( - currentClassDesc.getName()); + case 'B': + if (value == null) { + orbStream.write_octet((byte) 0); + } else { + orbStream.write_octet(((Byte) value).byteValue()); + } + break; + case 'C': + if (value == null) { + orbStream.write_wchar((char) 0); + } else { + orbStream.write_wchar(((Character) value).charValue()); } + break; + case 'F': + if (value == null) { + orbStream.write_float((float) 0); + } else { + orbStream.write_float(((Float) value).floatValue()); + } + break; + case 'D': + if (value == null) { + orbStream.write_double((double) 0); + } else { + orbStream.write_double(((Double) value).doubleValue()); + } + break; + case 'I': + if (value == null) { + orbStream.write_long(0); + } else { + orbStream.write_long(((Integer) value).intValue()); + } + break; + case 'J': + if (value == null) { + orbStream.write_longlong((long) 0); + } else { + orbStream.write_longlong(((Long) value).longValue()); + } + break; + case 'S': + if (value == null) { + orbStream.write_short((short) 0); + } else { + orbStream.write_short(((Short) value).shortValue()); + } + break; + case 'Z': + if (value == null) { + orbStream.write_boolean(false); + } else { + orbStream.write_boolean(((Boolean) value).booleanValue()); + } + break; + case '[': + case 'L': + // What to do if it's null? + writeObjectField(field, value); + break; + default: + throw Exceptions.self.invalidClassForWrite(currentClassDesc.getName()); + } } @ValueHandlerWrite - private void writeObjectField(ObjectStreamField field, - Object objectValue) throws IOException { + private void writeObjectField(ObjectStreamField field, Object objectValue) throws IOException { if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) { Util.getInstance().writeAny(orbStream, objectValue); - } - else { + } else { Class type = field.getType(); int callType = ValueHandlerImpl.kValueType; - ClassInfoCache.ClassInfo cinfo = field.getClassInfo() ; + ClassInfoCache.ClassInfo cinfo = field.getClassInfo(); - if (cinfo.isInterface()) { + if (cinfo.isInterface()) { String className = type.getName(); - + if (cinfo.isARemote(type)) { // RMI Object reference... callType = ValueHandlerImpl.kRemoteType; @@ -732,94 +701,87 @@ private void writeObjectField(ObjectStreamField field, callType = ValueHandlerImpl.kAbstractType; } } - + switch (callType) { - case ValueHandlerImpl.kRemoteType: + case ValueHandlerImpl.kRemoteType: Util.getInstance().writeRemoteObject(orbStream, objectValue); break; - case ValueHandlerImpl.kAbstractType: + case ValueHandlerImpl.kAbstractType: Util.getInstance().writeAbstractObject(orbStream, objectValue); break; case ValueHandlerImpl.kValueType: - try{ - orbStream.write_value((java.io.Serializable)objectValue, - type); - } catch(ClassCastException cce){ + try { + orbStream.write_value((java.io.Serializable) objectValue, type); + } catch (ClassCastException cce) { if (objectValue instanceof java.io.Serializable) { throw cce; } else { - Utility.throwNotSerializableForCorba(objectValue.getClass(). - getName()); + Utility.throwNotSerializableForCorba(objectValue.getClass().getName()); } } } } } - /* Write the fields of the specified class by invoking the appropriate - * write* method on this class. + /* + * Write the fields of the specified class by invoking the appropriate write* method on this class. */ @ValueHandlerWrite - private void outputClassFields(Object o, Class cl, - ObjectStreamField[] fields) - throws IOException, InvalidClassException { + private void outputClassFields(Object o, Class cl, ObjectStreamField[] fields) throws IOException, InvalidClassException { // replace this all with // for (int i = 0; i < fields.length; i++) { - // fields[i].write( o, orbStream ) ; + // fields[i].write( o, orbStream ) ; // Should we just put this into ObjectStreamClass? // Could also unroll and codegen this. for (int i = 0; i < fields.length; i++) { - ObjectStreamField field = fields[i] ; - final long offset = field.getFieldID() ; + ObjectStreamField field = fields[i]; + final long offset = field.getFieldID(); if (offset == Bridge.INVALID_FIELD_OFFSET) { - throw new InvalidClassException(cl.getName(), - "Nonexistent field " + fields[i].getName()); + throw new InvalidClassException(cl.getName(), "Nonexistent field " + fields[i].getName()); } switch (field.getTypeCode()) { - case 'B': - byte byteValue = bridge.getByte( o, offset ) ; - orbStream.write_octet(byteValue); - break; - case 'C': - char charValue = bridge.getChar( o, offset ) ; - orbStream.write_wchar(charValue); - break; - case 'F': - float floatValue = bridge.getFloat( o, offset ) ; - orbStream.write_float(floatValue); - break; - case 'D' : - double doubleValue = bridge.getDouble( o, offset ) ; - orbStream.write_double(doubleValue); - break; - case 'I': - int intValue = bridge.getInt( o, offset ) ; - orbStream.write_long(intValue); - break; - case 'J': - long longValue = bridge.getLong( o, offset ) ; - orbStream.write_longlong(longValue); - break; - case 'S': - short shortValue = bridge.getShort( o, offset ) ; - orbStream.write_short(shortValue); - break; - case 'Z': - boolean booleanValue = bridge.getBoolean( o, offset ) ; - orbStream.write_boolean(booleanValue); - break; - case '[': - case 'L': - Object objectValue = bridge.getObject( o, offset ) ; - writeObjectField(fields[i], objectValue); - break; - default: - throw Exceptions.self.invalidClassForWrite( - cl.getName() ) ; + case 'B': + byte byteValue = bridge.getByte(o, offset); + orbStream.write_octet(byteValue); + break; + case 'C': + char charValue = bridge.getChar(o, offset); + orbStream.write_wchar(charValue); + break; + case 'F': + float floatValue = bridge.getFloat(o, offset); + orbStream.write_float(floatValue); + break; + case 'D': + double doubleValue = bridge.getDouble(o, offset); + orbStream.write_double(doubleValue); + break; + case 'I': + int intValue = bridge.getInt(o, offset); + orbStream.write_long(intValue); + break; + case 'J': + long longValue = bridge.getLong(o, offset); + orbStream.write_longlong(longValue); + break; + case 'S': + short shortValue = bridge.getShort(o, offset); + orbStream.write_short(shortValue); + break; + case 'Z': + boolean booleanValue = bridge.getBoolean(o, offset); + orbStream.write_boolean(booleanValue); + break; + case '[': + case 'L': + Object objectValue = bridge.getObject(o, offset); + writeObjectField(fields[i], objectValue); + break; + default: + throw Exceptions.self.invalidClassForWrite(cl.getName()); } } } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/InputStreamHook.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/InputStreamHook.java index cbd3c6c4d..5c10411a8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/InputStreamHook.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/InputStreamHook.java @@ -37,58 +37,50 @@ import java.util.Map; @StreamFormatVersion -public abstract class InputStreamHook extends ObjectInputStream -{ +public abstract class InputStreamHook extends ObjectInputStream { // These should be visible in all the nested classes - static final OMGSystemException omgWrapper = - OMGSystemException.self ; - - static final UtilSystemException utilWrapper = - UtilSystemException.self ; + static final OMGSystemException omgWrapper = OMGSystemException.self; + static final UtilSystemException utilWrapper = UtilSystemException.self; private class HookGetFields extends ObjectInputStream.GetField { - private Map fields = null; + private Map fields = null; - HookGetFields(Map fields){ + HookGetFields(Map fields) { this.fields = fields; } /** * Get the ObjectStreamClass that describes the fields in the stream. * - * REVISIT! This doesn't work since we have our own ObjectStreamClass. + * REVISIT! This doesn't work since we have our own ObjectStreamClass. */ public java.io.ObjectStreamClass getObjectStreamClass() { return null; } - + /** - * Return true if the named field is defaulted and has no value - * in this stream. + * Return true if the named field is defaulted and has no value in this stream. */ - public boolean defaulted(String name) - throws IOException, IllegalArgumentException { + public boolean defaulted(String name) throws IOException, IllegalArgumentException { return (!fields.containsKey(name)); } - + /** * Get the value of the named boolean field from the persistent field. */ - public boolean get(String name, boolean defvalue) - throws IOException, IllegalArgumentException { + public boolean get(String name, boolean defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { return ((Boolean) fields.get(name)).booleanValue(); } } - + /** * Get the value of the named char field from the persistent fields. */ - public char get(String name, char defvalue) - throws IOException, IllegalArgumentException { + public char get(String name, char defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { @@ -96,12 +88,11 @@ public char get(String name, char defvalue) } } - + /** * Get the value of the named byte field from the persistent fields. */ - public byte get(String name, byte defvalue) - throws IOException, IllegalArgumentException { + public byte get(String name, byte defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { @@ -109,12 +100,11 @@ public byte get(String name, byte defvalue) } } - + /** * Get the value of the named short field from the persistent fields. */ - public short get(String name, short defvalue) - throws IOException, IllegalArgumentException { + public short get(String name, short defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { @@ -122,60 +112,55 @@ public short get(String name, short defvalue) } } - + /** * Get the value of the named int field from the persistent fields. */ - public int get(String name, int defvalue) - throws IOException, IllegalArgumentException { + public int get(String name, int defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { return ((Integer) fields.get(name)).intValue(); } } - + /** * Get the value of the named long field from the persistent fields. */ - public long get(String name, long defvalue) - throws IOException, IllegalArgumentException { + public long get(String name, long defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { return ((Long) fields.get(name)).longValue(); } } - + /** * Get the value of the named float field from the persistent fields. */ - public float get(String name, float defvalue) - throws IOException, IllegalArgumentException { + public float get(String name, float defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { return ((Float) fields.get(name)).floatValue(); } } - + /** * Get the value of the named double field from the persistent field. */ - public double get(String name, double defvalue) - throws IOException, IllegalArgumentException { + public double get(String name, double defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { return ((Double) fields.get(name)).doubleValue(); } } - + /** * Get the value of the named Object field from the persistent field. */ - public Object get(String name, Object defvalue) - throws IOException, IllegalArgumentException { + public Object get(String name, Object defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) { return defvalue; } else { @@ -183,23 +168,20 @@ public Object get(String name, Object defvalue) } } - + @Override - public String toString(){ + public String toString() { return fields.toString(); } } - public InputStreamHook() - throws IOException { + public InputStreamHook() throws IOException { super(); } @Override @StreamFormatVersion - public void defaultReadObject() - throws IOException, ClassNotFoundException, NotActiveException - { + public void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException { readObjectState.beginDefaultReadObject(this); defaultReadObjectDelegate(); @@ -209,32 +191,29 @@ public void defaultReadObject() abstract void defaultReadObjectDelegate(); - abstract void readFields(java.util.Map fieldToValueMap) - throws java.io.InvalidClassException, java.io.StreamCorruptedException, - ClassNotFoundException, java.io.IOException; - + abstract void readFields(java.util.Map fieldToValueMap) + throws java.io.InvalidClassException, java.io.StreamCorruptedException, ClassNotFoundException, java.io.IOException; // See java.io.ObjectInputStream.GetField // Remember that this is equivalent to defaultReadObject // in RMI-IIOP @Override - public ObjectInputStream.GetField readFields() - throws IOException, ClassNotFoundException, NotActiveException { + public ObjectInputStream.GetField readFields() throws IOException, ClassNotFoundException, NotActiveException { - Map fieldValueMap = new HashMap(); + Map fieldValueMap = new HashMap(); // We were treating readFields same as defaultReadObject. It is // incorrect if the state is readOptionalData. If this line // is uncommented, it will throw a stream corrupted exception. - // _REVISIT_: The ideal fix would be to add a new state. In + // _REVISIT_: The ideal fix would be to add a new state. In // writeObject user may do one of the following - // 1. Call defaultWriteObject() - // 2. Put out optional fields - // 3. Call writeFields + // 1. Call defaultWriteObject() + // 2. Put out optional fields + // 3. Call writeFields // We have the state defined for (1) and (2) but not for (3), so // we should ideally introduce a new state for 3 and have the // beginDefaultReadObject do nothing. - //readObjectState.beginDefaultReadObject(this); + // readObjectState.beginDefaultReadObject(this); readFields(fieldValueMap); @@ -245,9 +224,9 @@ public ObjectInputStream.GetField readFields() // The following is a State pattern implementation of what // should be done when the sender's Serializable has a - // writeObject method. This was especially necessary for - // RMI-IIOP stream format version 2. Please see the - // state diagrams in the docs directory of the workspace. + // writeObject method. This was especially necessary for + // RMI-IIOP stream format version 2. Please see the + // state diagrams in the docs directory of the workspace. // // On the reader's side, the main factors are whether or not // we have a readObject method and whether or not the @@ -259,82 +238,84 @@ protected void setState(ReadObjectState newState) { } protected abstract byte getStreamFormatVersion(); + abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream(); // Description of possible actions @StreamFormatVersion protected static class ReadObjectState { - private final String name ; + private final String name; public ReadObjectState() { - String className = this.getClass().getName() ; - int index = className.indexOf( '$' ) ; - name = className.substring( index + 1 ) ; + String className = this.getClass().getName(); + int index = className.indexOf('$'); + name = className.substring(index + 1); } @StreamFormatVersion - public final void beginUnmarshalCustomValue(InputStreamHook stream, boolean calledDefaultWriteObject, - boolean hasReadObject) throws IOException { - beginUnmarshalCustomValueOverride( stream, calledDefaultWriteObject, hasReadObject ) ; + public final void beginUnmarshalCustomValue(InputStreamHook stream, boolean calledDefaultWriteObject, boolean hasReadObject) + throws IOException { + beginUnmarshalCustomValueOverride(stream, calledDefaultWriteObject, hasReadObject); } @StreamFormatVersion public final void endUnmarshalCustomValue(InputStreamHook stream) throws IOException { - endUnmarshalCustomValueOverride( stream ) ; + endUnmarshalCustomValueOverride(stream); } @StreamFormatVersion public final void beginDefaultReadObject(InputStreamHook stream) throws IOException { - beginDefaultReadObjectOverride( stream ) ; + beginDefaultReadObjectOverride(stream); } @StreamFormatVersion public final void endDefaultReadObject(InputStreamHook stream) throws IOException { - endDefaultReadObjectOverride( stream ) ; + endDefaultReadObjectOverride(stream); } @StreamFormatVersion public final void readData(InputStreamHook stream) throws IOException { - readDataOverride( stream ) ; + readDataOverride(stream); } - public void beginUnmarshalCustomValueOverride(InputStreamHook stream, - boolean calledDefaultWriteObject, boolean hasReadObject) throws IOException {} - public void endUnmarshalCustomValueOverride(InputStreamHook stream) throws IOException {} - public void beginDefaultReadObjectOverride(InputStreamHook stream) throws IOException {} - public void endDefaultReadObjectOverride(InputStreamHook stream) throws IOException {} - public void readDataOverride(InputStreamHook stream) throws IOException {} + public void beginUnmarshalCustomValueOverride(InputStreamHook stream, boolean calledDefaultWriteObject, boolean hasReadObject) + throws IOException { + } + + public void endUnmarshalCustomValueOverride(InputStreamHook stream) throws IOException { + } + + public void beginDefaultReadObjectOverride(InputStreamHook stream) throws IOException { + } + + public void endDefaultReadObjectOverride(InputStreamHook stream) throws IOException { + } + + public void readDataOverride(InputStreamHook stream) throws IOException { + } @Override public String toString() { - return name ; + return name; } } protected ReadObjectState readObjectState = DEFAULT_STATE; - + protected static final ReadObjectState DEFAULT_STATE = new DefaultState(); - protected static final ReadObjectState IN_READ_OBJECT_OPT_DATA - = new InReadObjectOptionalDataState(); - protected static final ReadObjectState IN_READ_OBJECT_NO_MORE_OPT_DATA - = new InReadObjectNoMoreOptionalDataState(); - protected static final ReadObjectState IN_READ_OBJECT_DEFAULTS_SENT - = new InReadObjectDefaultsSentState(); - protected static final ReadObjectState NO_READ_OBJECT_DEFAULTS_SENT - = new NoReadObjectDefaultsSentState(); - - protected static final ReadObjectState IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED - = new InReadObjectRemoteDidNotUseWriteObjectState(); - protected static final ReadObjectState IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM - = new InReadObjectPastDefaultsRemoteDidNotUseWOState(); + protected static final ReadObjectState IN_READ_OBJECT_OPT_DATA = new InReadObjectOptionalDataState(); + protected static final ReadObjectState IN_READ_OBJECT_NO_MORE_OPT_DATA = new InReadObjectNoMoreOptionalDataState(); + protected static final ReadObjectState IN_READ_OBJECT_DEFAULTS_SENT = new InReadObjectDefaultsSentState(); + protected static final ReadObjectState NO_READ_OBJECT_DEFAULTS_SENT = new NoReadObjectDefaultsSentState(); + + protected static final ReadObjectState IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED = new InReadObjectRemoteDidNotUseWriteObjectState(); + protected static final ReadObjectState IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM = new InReadObjectPastDefaultsRemoteDidNotUseWOState(); protected static class DefaultState extends ReadObjectState { @Override - public void beginUnmarshalCustomValueOverride(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) - throws IOException { + public void beginUnmarshalCustomValueOverride(InputStreamHook stream, boolean calledDefaultWriteObject, boolean hasReadObject) + throws IOException { if (hasReadObject) { if (calledDefaultWriteObject) { @@ -342,17 +323,16 @@ public void beginUnmarshalCustomValueOverride(InputStreamHook stream, } else { try { if (stream.getStreamFormatVersion() == 2) { - ((ValueInputStream) stream.getOrbStream()) - .start_value(); + ((ValueInputStream) stream.getOrbStream()).start_value(); } - } catch( Exception e ) { - // This will happen for Big Integer which uses + } catch (Exception e) { + // This will happen for Big Integer which uses // writeFields in it's writeObject. We should be past // start_value by now. // NOTE: If we don't log any exception here we should - // be fine. If there is an error, it will be caught + // be fine. If there is an error, it will be caught // while reading the optional data. - + } stream.setState(IN_READ_OBJECT_OPT_DATA); } @@ -366,17 +346,14 @@ public void beginUnmarshalCustomValueOverride(InputStreamHook stream, } } - // REVISIT. If a readObject exits here without reading - // default data, we won't skip it. This could be done automatically + // REVISIT. If a readObject exits here without reading + // default data, we won't skip it. This could be done automatically // as in line 1492 in IIOPInputStream. protected static class InReadObjectRemoteDidNotUseWriteObjectState extends ReadObjectState { @Override - public void beginUnmarshalCustomValueOverride(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) - { - throw utilWrapper.badBeginUnmarshalCustomValue() ; + public void beginUnmarshalCustomValueOverride(InputStreamHook stream, boolean calledDefaultWriteObject, boolean hasReadObject) { + throw utilWrapper.badBeginUnmarshalCustomValue(); } @Override @@ -393,52 +370,43 @@ public void readDataOverride(InputStreamHook stream) { protected static class InReadObjectPastDefaultsRemoteDidNotUseWOState extends ReadObjectState { @Override - public void beginUnmarshalCustomValueOverride(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) - { - throw utilWrapper.badBeginUnmarshalCustomValue() ; + public void beginUnmarshalCustomValueOverride(InputStreamHook stream, boolean calledDefaultWriteObject, boolean hasReadObject) { + throw utilWrapper.badBeginUnmarshalCustomValue(); } @Override - public void beginDefaultReadObjectOverride(InputStreamHook stream) throws IOException - { - throw Exceptions.self.defaultDataAlreadyRead() ; + public void beginDefaultReadObjectOverride(InputStreamHook stream) throws IOException { + throw Exceptions.self.defaultDataAlreadyRead(); } - @Override public void readDataOverride(InputStreamHook stream) { stream.throwOptionalDataIncompatibleException(); } } - protected void throwOptionalDataIncompatibleException() - { - throw omgWrapper.rmiiiopOptionalDataIncompatible2() ; + protected void throwOptionalDataIncompatibleException() { + throw omgWrapper.rmiiiopOptionalDataIncompatible2(); } - protected static class InReadObjectDefaultsSentState extends ReadObjectState { - + @Override - public void beginUnmarshalCustomValueOverride(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) { + public void beginUnmarshalCustomValueOverride(InputStreamHook stream, boolean calledDefaultWriteObject, boolean hasReadObject) { // This should never happen. - throw utilWrapper.badBeginUnmarshalCustomValue() ; + throw utilWrapper.badBeginUnmarshalCustomValue(); } @Override public void endUnmarshalCustomValueOverride(InputStreamHook stream) { // In stream format version 2, we can skip over - // the optional data this way. In stream format version 1, + // the optional data this way. In stream format version 1, // we will probably wind up with an error if we're // unmarshaling a superclass. if (stream.getStreamFormatVersion() == 2) { - ((ValueInputStream)stream.getOrbStream()).start_value(); - ((ValueInputStream)stream.getOrbStream()).end_value(); + ((ValueInputStream) stream.getOrbStream()).start_value(); + ((ValueInputStream) stream.getOrbStream()).end_value(); } stream.setState(DEFAULT_STATE); @@ -458,21 +426,18 @@ public void endDefaultReadObjectOverride(InputStreamHook stream) throws IOExcept @Override public void readDataOverride(InputStreamHook stream) throws IOException { org.omg.CORBA.ORB orb = stream.getOrbStream().orb(); - if ((orb == null) || - !(orb instanceof com.sun.corba.ee.spi.orb.ORB)) { - throw new StreamCorruptedException( - "Default data must be read first"); + if ((orb == null) || !(orb instanceof com.sun.corba.ee.spi.orb.ORB)) { + throw new StreamCorruptedException("Default data must be read first"); } - ORBVersion clientOrbVersion = - ((com.sun.corba.ee.spi.orb.ORB)orb).getORBVersion(); + ORBVersion clientOrbVersion = ((com.sun.corba.ee.spi.orb.ORB) orb).getORBVersion(); // Fix Date interop bug. For older versions of the ORB don't do - // anything for readData(). Before this used to throw + // anything for readData(). Before this used to throw // StreamCorruptedException for older versions of the ORB where // calledDefaultWriteObject always returns true. - if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) || - (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) { - throw Exceptions.self.defaultDataMustBeReadFirst() ; + if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) + || (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) { + throw Exceptions.self.defaultDataMustBeReadFirst(); } } } @@ -480,34 +445,27 @@ public void readDataOverride(InputStreamHook stream) throws IOException { protected static class InReadObjectOptionalDataState extends ReadObjectState { @Override - public void beginUnmarshalCustomValueOverride(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) - { + public void beginUnmarshalCustomValueOverride(InputStreamHook stream, boolean calledDefaultWriteObject, boolean hasReadObject) { // This should never happen. - throw utilWrapper.badBeginUnmarshalCustomValue() ; + throw utilWrapper.badBeginUnmarshalCustomValue(); } @Override - public void endUnmarshalCustomValueOverride(InputStreamHook stream) throws IOException - { + public void endUnmarshalCustomValueOverride(InputStreamHook stream) throws IOException { if (stream.getStreamFormatVersion() == 2) { - ((ValueInputStream)stream.getOrbStream()).end_value(); + ((ValueInputStream) stream.getOrbStream()).end_value(); } stream.setState(DEFAULT_STATE); } - + @Override - public void beginDefaultReadObjectOverride(InputStreamHook stream) throws IOException - { - throw Exceptions.self.defaultDataNotPresent() ; + public void beginDefaultReadObjectOverride(InputStreamHook stream) throws IOException { + throw Exceptions.self.defaultDataNotPresent(); } - } - protected static class InReadObjectNoMoreOptionalDataState - extends InReadObjectOptionalDataState { + protected static class InReadObjectNoMoreOptionalDataState extends InReadObjectOptionalDataState { @Override public void readDataOverride(InputStreamHook stream) throws IOException { @@ -521,8 +479,8 @@ public void endUnmarshalCustomValueOverride(InputStreamHook stream) throws IOExc // Code should read default fields before calling this if (stream.getStreamFormatVersion() == 2) { - ((ValueInputStream)stream.getOrbStream()).start_value(); - ((ValueInputStream)stream.getOrbStream()).end_value(); + ((ValueInputStream) stream.getOrbStream()).start_value(); + ((ValueInputStream) stream.getOrbStream()).end_value(); } stream.setState(DEFAULT_STATE); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/JavaCorbaAccess.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/JavaCorbaAccess.java index f7af78ff8..d10c9d590 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/JavaCorbaAccess.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/JavaCorbaAccess.java @@ -20,5 +20,5 @@ package com.sun.corba.ee.impl.io; public interface JavaCorbaAccess { - public ValueHandlerImpl newValueHandlerImpl(); + public ValueHandlerImpl newValueHandlerImpl(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamClass.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamClass.java index e48d96b2d..b7110a15b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamClass.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamClass.java @@ -51,37 +51,31 @@ import java.util.concurrent.ConcurrentMap; /** - * A ObjectStreamClass describes a class that can be serialized to a stream - * or a class that was serialized to a stream. It contains the name - * and the serialVersionUID of the class. - *
- * The ObjectStreamClass for a specific class loaded in this Java VM can - * be found using the lookup method. + * A ObjectStreamClass describes a class that can be serialized to a stream or a class that was serialized to a stream. + * It contains the name and the serialVersionUID of the class.
+ * The ObjectStreamClass for a specific class loaded in this Java VM can be found using the lookup method. * - * @author Roger Riggs - * @version ObjectStreamClass.java 1.17 99/06/07 - * @since JDK1.1 + * @author Roger Riggs + * @version ObjectStreamClass.java 1.17 99/06/07 + * @since JDK1.1 */ @TraceValueHandler public class ObjectStreamClass implements java.io.Serializable { - private static final boolean DEBUG_SVUID = false ; + private static final boolean DEBUG_SVUID = false; public static final long kDefaultUID = -1; // True if this is an Enum type (6877056) - private boolean isEnum ; + private boolean isEnum; - private static final Bridge bridge = - AccessController.doPrivileged( - new PrivilegedAction() { - public Bridge run() { - return Bridge.get() ; - } - } - ) ; + private static final Bridge bridge = AccessController.doPrivileged(new PrivilegedAction() { + public Bridge run() { + return Bridge.get(); + } + }); - /** Find the descriptor for a class that can be serialized. Null - * is returned if the specified class does not implement + /** + * Find the descriptor for a class that can be serialized. Null is returned if the specified class does not implement * java.io.Serializable or java.io.Externalizable. */ @TraceValueHandler @@ -93,25 +87,23 @@ static final ObjectStreamClass lookup(Class cl) { } /* - * Find the class descriptor for the specified class. - * Package access only so it can be called from ObjectIn/OutStream. + * Find the class descriptor for the specified class. Package access only so it can be called from ObjectIn/OutStream. */ - static ObjectStreamClass lookupInternal(Class cl) - { - /* Synchronize on the hashtable so no two threads will do - * this at the same time. + static ObjectStreamClass lookupInternal(Class cl) { + /* + * Synchronize on the hashtable so no two threads will do this at the same time. */ ObjectStreamClass desc = null; synchronized (descriptorFor) { /* Find the matching descriptor if it already known */ - desc = (ObjectStreamClass)descriptorFor.get( cl ) ; + desc = (ObjectStreamClass) descriptorFor.get(cl); if (desc == null) { /* Check if it's serializable */ - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( cl ) ; - boolean serializable = Serializable.class.isAssignableFrom(cl) ; - - /* If the class is only Serializable, - * lookup the descriptor for the superclass. + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(cl); + boolean serializable = Serializable.class.isAssignableFrom(cl); + + /* + * If the class is only Serializable, lookup the descriptor for the superclass. */ ObjectStreamClass superdesc = null; if (serializable) { @@ -120,30 +112,27 @@ static ObjectStreamClass lookupInternal(Class cl) superdesc = lookup(superclass); } - /* Check if its' externalizable. - * If it's Externalizable, clear the serializable flag. - * Only one or the other may be set in the protocol. + /* + * Check if its' externalizable. If it's Externalizable, clear the serializable flag. Only one or the other may be set + * in the protocol. */ boolean externalizable = false; if (serializable) { - externalizable = - ((superdesc != null) && superdesc.isExternalizable()) || - cinfo.isAExternalizable(cl); + externalizable = ((superdesc != null) && superdesc.isExternalizable()) || cinfo.isAExternalizable(cl); if (externalizable) { serializable = false; } } - /* Create a new version descriptor, - * it put itself in the known table. + /* + * Create a new version descriptor, it put itself in the known table. */ - desc = new ObjectStreamClass(cl, superdesc, - serializable, externalizable); + desc = new ObjectStreamClass(cl, superdesc, serializable, externalizable); } - // Must always call init. See bug 4488137. This code was + // Must always call init. See bug 4488137. This code was // incorrectly changed to return immediately on a non-null - // cache result. That allowed threads to gain access to + // cache result. That allowed threads to gain access to // unintialized instances. // // All threads must sync on the member variable lock @@ -154,9 +143,9 @@ static ObjectStreamClass lookupInternal(Class cl) // (see bug 4165204 "ObjectStreamClass can hold global lock // for a very long time"). // - // We will need to live with 4165204 until we can rewrite + // We will need to live with 4165204 until we can rewrite // this to follow the improved java.io.ObjectStreamClass - // in J2SE 1.4 and later. Calling desc.init() outside of + // in J2SE 1.4 and later. Calling desc.init() outside of // this synchronized block can lead to deadlocks as // reported in 5104239. desc.init(); @@ -167,6 +156,7 @@ static ObjectStreamClass lookupInternal(Class cl) /** * The name of the class described by this descriptor. + * * @return name of class */ public final String getName() { @@ -174,26 +164,24 @@ public final String getName() { } /** - * Return the serialVersionUID for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. + * Return the serialVersionUID for this class. The serialVersionUID defines a set of classes all with the same name that + * have evolved from a common root class and agree to be serialized and deserialized using a common format. + * * @param clazz class to get UID of * @return UID for the class */ - public static final long getSerialVersionUID( java.lang.Class clazz) { - ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz ); + public static final long getSerialVersionUID(java.lang.Class clazz) { + ObjectStreamClass theosc = ObjectStreamClass.lookup(clazz); if (theosc != null) { - return theosc.getSerialVersionUID( ); + return theosc.getSerialVersionUID(); } return 0; } /** - * Return the serialVersionUID for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. + * Return the serialVersionUID for this class. The serialVersionUID defines a set of classes all with the same name that + * have evolved from a common root class and agree to be serialized and deserialized using a common format. + * * @return SerialVersionUID for this class. */ public final long getSerialVersionUID() { @@ -201,10 +189,9 @@ public final long getSerialVersionUID() { } /** - * Return the serialVersionUID string for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. + * Return the serialVersionUID string for this class. The serialVersionUID defines a set of classes all with the same + * name that have evolved from a common root class and agree to be serialized and deserialized using a common format. + * * @return UID for this class */ public final String getSerialVersionUIDStr() { @@ -215,21 +202,21 @@ public final String getSerialVersionUIDStr() { /** * Return the actual (computed) serialVersionUID for this class. + * * @param clazz Class to get UID of * @return The class UID */ - public static final long getActualSerialVersionUID( java.lang.Class clazz ) - { - ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz ); - if( theosc != null ) - { - return theosc.getActualSerialVersionUID( ); + public static final long getActualSerialVersionUID(java.lang.Class clazz) { + ObjectStreamClass theosc = ObjectStreamClass.lookup(clazz); + if (theosc != null) { + return theosc.getActualSerialVersionUID(); } return 0; } /** * Return the actual (computed) serialVersionUID for this class. + * * @return UID for this class */ public final long getActualSerialVersionUID() { @@ -238,6 +225,7 @@ public final long getActualSerialVersionUID() { /** * Return the actual (computed) serialVersionUID for this class. + * * @return UID for this class */ public final String getActualSerialVersionUIDStr() { @@ -247,8 +235,9 @@ public final String getActualSerialVersionUIDStr() { } /** - * Return the class in the local VM that this version is mapped to. - * Null is returned if there is no corresponding local class. + * Return the class in the local VM that this version is mapped to. Null is returned if there is no corresponding local + * class. + * * @return Class this is mapped to */ public final Class forClass() { @@ -257,8 +246,8 @@ public final Class forClass() { /** * Return an array of the fields of this serializable class. - * @return an array containing an element for each persistent - * field of this class. Returns an array of length zero if + * + * @return an array containing an element for each persistent field of this class. Returns an array of length zero if * there are no fields. * @since JDK1.2 */ @@ -273,13 +262,11 @@ public ObjectStreamField[] getFields() { } } - public boolean hasField(ValueMember field) - { + public boolean hasField(ValueMember field) { try { for (int i = 0; i < fields.length; i++) { if (fields[i].getName().equals(field.name)) { - if (fields[i].getSignature().equals( - ValueUtility.getSignature(field))) + if (fields[i].getSignature().equals(ValueUtility.getSignature(field))) return true; } } @@ -298,14 +285,15 @@ final ObjectStreamField[] getFieldsNoCopy() { /** * Get the field of this class by name. + * * @param name name of the field to get - * @return The ObjectStreamField object of the named field or null if there - * is no such named field. + * @return The ObjectStreamField object of the named field or null if there is no such named field. */ public final ObjectStreamField getField(String name) { - /* Binary search of fields by name. + /* + * Binary search of fields by name. */ - for (int i = fields.length-1; i >= 0; i--) { + for (int i = fields.length - 1; i >= 0; i--) { if (name.equals(fields[i].getName())) { return fields[i]; } @@ -317,22 +305,22 @@ public Serializable writeReplace(Serializable value) { if (writeReplaceObjectMethod != null) { try { return (Serializable) writeReplaceObjectMethod.invoke(value); - } catch(Throwable t) { + } catch (Throwable t) { throw new RuntimeException(t); } - } - else return value; + } else + return value; } public Object readResolve(Object value) { if (readResolveObjectMethod != null) { try { return readResolveObjectMethod.invoke(value); - } catch(Throwable t) { + } catch (Throwable t) { throw new RuntimeException(t); } - } - else return value; + } else + return value; } /** @@ -350,13 +338,10 @@ public final String toString() { } /* - * Create a new ObjectStreamClass from a loaded class. - * Don't call this directly, call lookup instead. + * Create a new ObjectStreamClass from a loaded class. Don't call this directly, call lookup instead. */ - private ObjectStreamClass(java.lang.Class cl, ObjectStreamClass superdesc, - boolean serial, boolean extern) - { - ofClass = cl; /* created from this class */ + private ObjectStreamClass(java.lang.Class cl, ObjectStreamClass superdesc, boolean serial, boolean extern) { + ofClass = cl; /* created from this class */ if (Proxy.isProxyClass(cl)) { forProxyClass = true; @@ -364,8 +349,8 @@ private ObjectStreamClass(java.lang.Class cl, ObjectStreamClass superdesc, name = cl.getName(); // 6877056 - final ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( cl ) ; - isEnum = cinfo.isEnum() ; + final ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(cl); + isEnum = cinfo.isEnum(); superclass = superdesc; serializable = serial; if (!forProxyClass) { @@ -374,11 +359,10 @@ private ObjectStreamClass(java.lang.Class cl, ObjectStreamClass superdesc, } /* - * Enter this class in the table of known descriptors. - * Otherwise, when the fields are read it may recurse - * trying to find the descriptor for itself. + * Enter this class in the table of known descriptors. Otherwise, when the fields are read it may recurse trying to find + * the descriptor for itself. */ - descriptorFor.put( cl, this ) ; + descriptorFor.put(cl, this); } MethodHandle getWriteObjectMethod() { @@ -391,10 +375,10 @@ MethodHandle getReadObjectMethod() { private static final class PersistentFieldsValue { private final ConcurrentMap, Object> map = new ConcurrentHashMap, Object>(); - private static final Object NULL_VALUE = - (PersistentFieldsValue.class.getName() + ".NULL_VALUE"); + private static final Object NULL_VALUE = (PersistentFieldsValue.class.getName() + ".NULL_VALUE"); - PersistentFieldsValue() { } + PersistentFieldsValue() { + } ObjectStreamField[] get(Class type) { Object value = map.get(type); @@ -405,7 +389,7 @@ ObjectStreamField[] get(Class type) { value = oldValue; } } - return ((value == NULL_VALUE) ? null : (ObjectStreamField[])value); + return ((value == NULL_VALUE) ? null : (ObjectStreamField[]) value); } private static Object computeValue(Class type) { @@ -430,16 +414,14 @@ private static ObjectStreamField[] translateFields(java.io.ObjectStreamField[] f } } - private static final PersistentFieldsValue persistentFieldsValue = - new PersistentFieldsValue(); + private static final PersistentFieldsValue persistentFieldsValue = new PersistentFieldsValue(); + /* - * Initialize class descriptor. This method is only invoked on class - * descriptors created via calls to lookupInternal(). This method was kept - * separate from the ObjectStreamClass constructor so that lookupInternal - * does not have to hold onto a global class descriptor table lock while the - * class descriptor is being initialized (see bug 4165204). However, - * this change leads to a (rare) deadlock. This code needs to be - * significantly re-written as in later (1.4) JDK releases. + * Initialize class descriptor. This method is only invoked on class descriptors created via calls to lookupInternal(). + * This method was kept separate from the ObjectStreamClass constructor so that lookupInternal does not have to hold + * onto a global class descriptor table lock while the class descriptor is being initialized (see bug 4165204). However, + * this change leads to a (rare) deadlock. This code needs to be significantly re-written as in later (1.4) JDK + * releases. */ private void init() { synchronized (lock) { @@ -450,42 +432,37 @@ private void init() { final Class cl = ofClass; // 6877056 - if (!serializable || externalizable || forProxyClass || isEnum || - name.equals("java.lang.String")) { + if (!serializable || externalizable || forProxyClass || isEnum || name.equals("java.lang.String")) { fields = NO_FIELDS; } else if (serializable) { - fields = null ; + fields = null; - /* Ask for permission to override field access checks. + /* + * Ask for permission to override field access checks. */ AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - /* Fill in the list of persistent fields. - * If it is declared, use the declared serialPersistentFields. - * Otherwise, extract the fields from the class itself. + /* + * Fill in the list of persistent fields. If it is declared, use the declared serialPersistentFields. Otherwise, + * extract the fields from the class itself. */ fields = persistentFieldsValue.get(cl); if (fields == null) { - /* Get all of the declared fields for this - * Class. setAccessible on all fields so they - * can be accessed later. Create a temporary - * ObjectStreamField array to hold each - * non-static, non-transient field. Then copy the - * temporary array into an array of the correct - * size once the number of fields is known. + /* + * Get all of the declared fields for this Class. setAccessible on all fields so they can be accessed later. + * Create a temporary ObjectStreamField array to hold each non-static, non-transient field. Then copy the + * temporary array into an array of the correct size once the number of fields is known. */ Field[] actualfields = cl.getDeclaredFields(); int numFields = 0; - ObjectStreamField[] tempFields = - new ObjectStreamField[actualfields.length]; + ObjectStreamField[] tempFields = new ObjectStreamField[actualfields.length]; for (int i = 0; i < actualfields.length; i++) { - Field fld = actualfields[i] ; + Field fld = actualfields[i]; int modifiers = fld.getModifiers(); - if (!Modifier.isStatic(modifiers) && - !Modifier.isTransient(modifiers)) { - // fld.setAccessible(true) ; + if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers)) { + // fld.setAccessible(true) ; tempFields[numFields++] = new ObjectStreamField(fld); } } @@ -496,22 +473,17 @@ public Object run() { // For each declared persistent field, look for an actual // reflected Field. If there is one, make sure it's the correct // type and cache it in the ObjectStreamClass for that field. - for (int j = fields.length-1; j >= 0; j--) { + for (int j = fields.length - 1; j >= 0; j--) { try { Field reflField = cl.getDeclaredField(fields[j].getName()); if (fields[j].getType() == reflField.getType()) { fields[j].setField(reflField); } else { - Exceptions.self.fieldTypeMismatch( - cl.getName(), - fields[j].getName(), - fields[j].getType(), - reflField.getName(), - reflField.getType() ) ; + Exceptions.self.fieldTypeMismatch(cl.getName(), fields[j].getName(), fields[j].getType(), + reflField.getName(), reflField.getType()); } } catch (NoSuchFieldException e) { - Exceptions.self.noSuchField( e, cl.getName(), - fields[j].getName() ) ; + Exceptions.self.noSuchField(e, cl.getName(), fields[j].getName()); } } } @@ -527,18 +499,18 @@ public Object run() { computeFieldInfo(); } - /* Get the serialVersionUID from the class. - * It uses the access override mechanism so make sure - * the field objects is only used here. + /* + * Get the serialVersionUID from the class. It uses the access override mechanism so make sure the field objects is only + * used here. * * NonSerializable classes have a serialVerisonUID of 0L. */ - // 6877056 - if (isNonSerializable() || isEnum) { - suid = 0L; - } else { - // Lookup special Serializable members using reflection. - AccessController.doPrivileged(new PrivilegedAction() { + // 6877056 + if (isNonSerializable() || isEnum) { + suid = 0L; + } else { + // Lookup special Serializable members using reflection. + AccessController.doPrivileged(new PrivilegedAction() { public Object run() { if (forProxyClass) { // proxy classes always have serialVersionUID of 0L @@ -547,8 +519,8 @@ public Object run() { try { final Field f = cl.getDeclaredField("serialVersionUID"); int mods = f.getModifiers(); - // SerialBug 5: static final SUID should be read - if (Modifier.isStatic(mods) && Modifier.isFinal(mods) ) { + // SerialBug 5: static final SUID should be read + if (Modifier.isStatic(mods) && Modifier.isFinal(mods)) { long offset = bridge.staticFieldOffset(f); suid = bridge.getLong(cl, offset); // SerialBug 2: should be computed after writeObject @@ -568,10 +540,10 @@ public Object run() { writeReplaceObjectMethod = bridge.writeReplaceForSerialization(cl); readResolveObjectMethod = bridge.readResolveForSerialization(cl); - if (externalizable) - cons = bridge.newConstructorForExternalization(cl) ; + if (externalizable) + cons = bridge.newConstructorForExternalization(cl); else - cons = bridge.newConstructorForSerialization(cl) ; + cons = bridge.newConstructorForSerialization(cl); if (serializable && !forProxyClass) { /* Look for the readObject and writeObject methods. ObjectOutputStream will call them as necessary. */ @@ -590,7 +562,7 @@ public Object run() { // class is Externalizable. // If we have a write object method, precompute the // RMI-IIOP stream format version 2 optional data - // repository ID. + // repository ID. if (hasWriteObject() || isExternalizable()) rmiiiopOptionalDataRepId = computeRMIIIOPOptionalDataRepId(); @@ -602,11 +574,9 @@ public Object run() { /** * Java to IDL ptc-02-01-12 1.5.1 * - * "The rep_id string passed to the start_value method must be - * 'RMI:org.omg.custom.class:hashcode:suid' where class is the - * fully-qualified name of the class whose writeObject method - * is being invoked and hashcode and suid are the class's hashcode - * and SUID." + * "The rep_id string passed to the start_value method must be 'RMI:org.omg.custom.class:hashcode:suid' where class is + * the fully-qualified name of the class whose writeObject method is being invoked and hashcode and suid are the class's + * hashcode and SUID." */ private String computeRMIIIOPOptionalDataRepId() { @@ -622,6 +592,7 @@ private String computeRMIIIOPOptionalDataRepId() { /** * This will return null if there is no writeObject method. + * * @return A Serializable's optional custom data fake repository ID. */ public final String getRMIIIOPOptionalDataRepId() { @@ -629,10 +600,8 @@ public final String getRMIIIOPOptionalDataRepId() { } /* - * Create an empty ObjectStreamClass for a class about to be read. - * This is separate from read so ObjectInputStream can assign the - * wire handle early, before any nested ObjectStreamClass might - * be read. + * Create an empty ObjectStreamClass for a class about to be read. This is separate from read so ObjectInputStream can + * assign the wire handle early, before any nested ObjectStreamClass might be read. */ ObjectStreamClass(String n, long s) { name = n; @@ -640,23 +609,24 @@ public final String getRMIIIOPOptionalDataRepId() { superclass = null; } - public static final synchronized ObjectStreamField[] translateFields( - java.io.ObjectStreamField fields[]) { + public static final synchronized ObjectStreamField[] translateFields(java.io.ObjectStreamField fields[]) { return PersistentFieldsValue.translateFields(fields); } - /* Compare the base class names of streamName and localName. + /* + * Compare the base class names of streamName and localName. * - * @return Return true iff the base class name compare. - * @parameter streamName Fully qualified class name. - * @parameter localName Fully qualified class name. - * @parameter pkgSeparator class names use either '.' or '/'. + * @return Return true iff the base class name compare. + * + * @parameter streamName Fully qualified class name. + * + * @parameter localName Fully qualified class name. + * + * @parameter pkgSeparator class names use either '.' or '/'. * * Only compare base class name to allow package renaming. */ - static boolean compareClassNames(String streamName, - String localName, - char pkgSeparator) { + static boolean compareClassNames(String streamName, String localName, char pkgSeparator) { /* compare the class names, stripping off package names. */ int streamNameIndex = streamName.lastIndexOf(pkgSeparator); if (streamNameIndex < 0) @@ -666,18 +636,14 @@ static boolean compareClassNames(String streamName, if (localNameIndex < 0) localNameIndex = 0; - return streamName.regionMatches(false, streamNameIndex, - localName, localNameIndex, - streamName.length() - streamNameIndex); + return streamName.regionMatches(false, streamNameIndex, localName, localNameIndex, streamName.length() - streamNameIndex); } /* - * Compare the types of two class descriptors. - * They match if they have the same class name and suid + * Compare the types of two class descriptors. They match if they have the same class name and suid */ final boolean typeEquals(ObjectStreamClass other) { - return (suid == other.suid) && - compareClassNames(name, other.name, '.'); + return (suid == other.suid) && compareClassNames(name, other.name, '.'); } /* @@ -705,42 +671,34 @@ final boolean hasReadObject() { * Return whether the class has a writeObject method */ final boolean hasWriteObject() { - return writeObjectMethod != null ; + return writeObjectMethod != null; } /** - * Returns when or not this class should be custom - * marshaled (use chunking). This should happen if - * it is Externalizable OR if it or - * any of its superclasses has a writeObject method, + * Returns when or not this class should be custom marshaled (use chunking). This should happen if it is Externalizable + * OR if it or any of its superclasses has a writeObject method, */ final boolean isCustomMarshaled() { - return (hasWriteObject() || isExternalizable()) - || (superclass != null && superclass.isCustomMarshaled()); + return (hasWriteObject() || isExternalizable()) || (superclass != null && superclass.isCustomMarshaled()); } /* - * Return true if all instances of 'this' Externalizable class - * are written in block-data mode from the stream that 'this' was read - * from.

+ * Return true if all instances of 'this' Externalizable class are written in block-data mode from the stream that + * 'this' was read from.

* - * In JDK 1.1, all Externalizable instances are not written - * in block-data mode. - * In JDK 1.2, all Externalizable instances, by default, are written - * in block-data mode and the Externalizable instance is terminated with - * tag TC_ENDBLOCKDATA. Change enabled the ability to skip Externalizable - * instances. + * In JDK 1.1, all Externalizable instances are not written in block-data mode. In JDK 1.2, all Externalizable + * instances, by default, are written in block-data mode and the Externalizable instance is terminated with tag + * TC_ENDBLOCKDATA. Change enabled the ability to skip Externalizable instances. * - * IMPLEMENTATION NOTE: - * This should have been a mode maintained per stream; however, - * for compatibility reasons, it was only possible to record - * this change per class. All Externalizable classes within - * a given stream should either have this mode enabled or - * disabled. This is enforced by not allowing the PROTOCOL_VERSION - * of a stream to he changed after any objects have been written. + * IMPLEMENTATION NOTE: This should have been a mode maintained per stream; however, for compatibility reasons, it was + * only possible to record this change per class. All Externalizable classes within a given stream should either have + * this mode enabled or disabled. This is enforced by not allowing the PROTOCOL_VERSION of a stream to he changed after + * any objects have been written. * * @see ObjectOuputStream#useProtocolVersion + * * @see ObjectStreamConstants#PROTOCOL_VERSION_1 + * * @see ObjectStreamConstants#PROTOCOL_VERSION_2 * * @since JDK 1.2 @@ -750,26 +708,20 @@ boolean hasExternalizableBlockDataMode() { } /** - * Creates a new instance of the represented class. If the class is - * externalizable, invokes its public no-arg constructor; otherwise, if the - * class is serializable, invokes the no-arg constructor of the first - * non-serializable superclass. Throws UnsupportedOperationException if - * this class descriptor is not associated with a class, if the associated - * class is non-serializable or if the appropriate no-arg constructor is - * inaccessible/unavailable. + * Creates a new instance of the represented class. If the class is externalizable, invokes its public no-arg + * constructor; otherwise, if the class is serializable, invokes the no-arg constructor of the first non-serializable + * superclass. Throws UnsupportedOperationException if this class descriptor is not associated with a class, if the + * associated class is non-serializable or if the appropriate no-arg constructor is inaccessible/unavailable. */ - Object newInstance() - throws InstantiationException, InvocationTargetException, - UnsupportedOperationException - { + Object newInstance() throws InstantiationException, InvocationTargetException, UnsupportedOperationException { if (cons != null) { try { return cons.newInstance(new Object[0]); } catch (IllegalAccessException ex) { // should not occur, as access checks have been suppressed InternalError ie = new InternalError(); - ie.initCause( ex ) ; - throw ie ; + ie.initCause(ex); + throw ie; } } else { throw new UnsupportedOperationException(); @@ -791,19 +743,18 @@ boolean isExternalizable() { } boolean isNonSerializable() { - return ! (externalizable || serializable); + return !(externalizable || serializable); } /* - * Calculate the size of the array needed to store primitive data and the - * number of object references to read when reading from the input - * stream. + * Calculate the size of the array needed to store primitive data and the number of object references to read when + * reading from the input stream. */ private void computeFieldInfo() { primBytes = 0; objFields = 0; - for (int i = 0; i < fields.length; i++ ) { + for (int i = 0; i < fields.length; i++) { switch (fields[i].getTypeCode()) { case 'B': case 'Z': @@ -819,7 +770,7 @@ private void computeFieldInfo() { primBytes += 4; break; case 'J': - case 'D' : + case 'D': primBytes += 8; break; @@ -831,38 +782,32 @@ private void computeFieldInfo() { } } - private static void msg( String str ) - { - System.out.println( str ) ; + private static void msg(String str) { + System.out.println(str); } - /* JDK 1.5 has introduced some new modifier bits (such as SYNTHETIC) - * that can affect the SVUID computation (see bug 4897937). These bits - * must be ignored, as otherwise interoperability with ORBs in earlier - * JDK versions can be compromised. I am adding these masks for this - * purpose as discussed in the CCC for this bug (see http://ccc.sfbay/4897937). + /* + * JDK 1.5 has introduced some new modifier bits (such as SYNTHETIC) that can affect the SVUID computation (see bug + * 4897937). These bits must be ignored, as otherwise interoperability with ORBs in earlier JDK versions can be + * compromised. I am adding these masks for this purpose as discussed in the CCC for this bug (see + * http://ccc.sfbay/4897937). */ - public static final int CLASS_MASK = Modifier.PUBLIC | Modifier.FINAL | - Modifier.INTERFACE | Modifier.ABSTRACT ; - public static final int FIELD_MASK = Modifier.PUBLIC | Modifier.PRIVATE | - Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL | - Modifier.TRANSIENT | Modifier.VOLATILE ; - public static final int METHOD_MASK = Modifier.PUBLIC | Modifier.PRIVATE | - Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL | - Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.ABSTRACT | - Modifier.STRICT ; - + public static final int CLASS_MASK = Modifier.PUBLIC | Modifier.FINAL | Modifier.INTERFACE | Modifier.ABSTRACT; + public static final int FIELD_MASK = Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL + | Modifier.TRANSIENT | Modifier.VOLATILE; + public static final int METHOD_MASK = Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL + | Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.ABSTRACT | Modifier.STRICT; + /* - * Compute a hash for the specified class. Incrementally add - * items to the hash accumulating in the digest stream. - * Fold the hash into a long. Use the SHA secure hash function. + * Compute a hash for the specified class. Incrementally add items to the hash accumulating in the digest stream. Fold + * the hash into a long. Use the SHA secure hash function. */ private static long _computeSerialVersionUID(Class cl) { if (DEBUG_SVUID) - msg( "Computing SerialVersionUID for " + cl ) ; + msg("Computing SerialVersionUID for " + cl); ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( cl ) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(cl); long h = 0; try { @@ -871,18 +816,15 @@ private static long _computeSerialVersionUID(Class cl) { DataOutputStream data = new DataOutputStream(mdo); if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + cl.getName() + "\" )" ) ; + msg("\twriteUTF( \"" + cl.getName() + "\" )"); data.writeUTF(cl.getName()); int classaccess = cl.getModifiers(); - classaccess &= (Modifier.PUBLIC | Modifier.FINAL | - Modifier.INTERFACE | Modifier.ABSTRACT); - - /* Workaround for javac bug that only set ABSTRACT for - * interfaces if the interface had some methods. - * The ABSTRACT bit reflects that the number of methods > 0. - * This is required so correct hashes can be computed - * for existing class files. + classaccess &= (Modifier.PUBLIC | Modifier.FINAL | Modifier.INTERFACE | Modifier.ABSTRACT); + + /* + * Workaround for javac bug that only set ABSTRACT for interfaces if the interface had some methods. The ABSTRACT bit + * reflects that the number of methods > 0. This is required so correct hashes can be computed for existing class files. * Previously this hack was previously present in the VM. */ Method[] method = cl.getDeclaredMethods(); @@ -894,23 +836,19 @@ private static long _computeSerialVersionUID(Class cl) { } // Mask out any post-1.4 attributes - classaccess &= CLASS_MASK ; + classaccess &= CLASS_MASK; if (DEBUG_SVUID) - msg( "\twriteInt( " + classaccess + " ) " ) ; + msg("\twriteInt( " + classaccess + " ) "); data.writeInt(classaccess); /* - * Get the list of interfaces supported, - * Accumulate their names their names in Lexical order - * and add them to the hash + * Get the list of interfaces supported, Accumulate their names their names in Lexical order and add them to the hash */ if (!cinfo.isArray()) { - /* In 1.2fcs, getInterfaces() was modified to return - * {java.lang.Cloneable, java.io.Serializable} when - * called on array classes. These values would upset - * the computation of the hash, so we explicitly omit - * them from its computation. + /* + * In 1.2fcs, getInterfaces() was modified to return {java.lang.Cloneable, java.io.Serializable} when called on array + * classes. These values would upset the computation of the hash, so we explicitly omit them from its computation. */ Class interfaces[] = cl.getInterfaces(); @@ -918,7 +856,7 @@ private static long _computeSerialVersionUID(Class cl) { for (int i = 0; i < interfaces.length; i++) { if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + interfaces[i].getName() + "\" ) " ) ; + msg("\twriteUTF( \"" + interfaces[i].getName() + "\" ) "); data.writeUTF(interfaces[i].getName()); } } @@ -930,125 +868,120 @@ private static long _computeSerialVersionUID(Class cl) { for (int i = 0; i < field.length; i++) { Field f = field[i]; - /* Include in the hash all fields except those that are - * private transient and private static. + /* + * Include in the hash all fields except those that are private transient and private static. */ int m = f.getModifiers(); - if (Modifier.isPrivate(m) && - (Modifier.isTransient(m) || Modifier.isStatic(m))) + if (Modifier.isPrivate(m) && (Modifier.isTransient(m) || Modifier.isStatic(m))) continue; if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + f.getName() + "\" ) " ) ; + msg("\twriteUTF( \"" + f.getName() + "\" ) "); data.writeUTF(f.getName()); // Mask out any post-1.4 bits - m &= FIELD_MASK ; + m &= FIELD_MASK; if (DEBUG_SVUID) - msg( "\twriteInt( " + m + " ) " ) ; + msg("\twriteInt( " + m + " ) "); data.writeInt(m); if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + getSignature(f.getType()) + "\" ) " ) ; + msg("\twriteUTF( \"" + getSignature(f.getType()) + "\" ) "); data.writeUTF(getSignature(f.getType())); } if (bridge.hasStaticInitializerForSerialization(cl)) { if (DEBUG_SVUID) - msg( "\twriteUTF( \"\" ) " ) ; + msg("\twriteUTF( \"\" ) "); data.writeUTF(""); if (DEBUG_SVUID) - msg( "\twriteInt( " + Modifier.STATIC + " )" ) ; + msg("\twriteInt( " + Modifier.STATIC + " )"); data.writeInt(Modifier.STATIC); // TBD: what modifiers does it have if (DEBUG_SVUID) - msg( "\twriteUTF( \"()V\" )" ) ; + msg("\twriteUTF( \"()V\" )"); data.writeUTF("()V"); } /* - * Get the list of constructors including name and signature - * Sort lexically, add all except the private constructors - * to the hash with their access flags + * Get the list of constructors including name and signature Sort lexically, add all except the private constructors to + * the hash with their access flags */ - MethodSignature[] constructors = - MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors()); + MethodSignature[] constructors = MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors()); for (int i = 0; i < constructors.length; i++) { MethodSignature c = constructors[i]; String mname = ""; String desc = c.signature; desc = desc.replace('/', '.'); if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + mname + "\" )" ) ; + msg("\twriteUTF( \"" + mname + "\" )"); data.writeUTF(mname); // mask out post-1.4 modifiers - int modifier = c.member.getModifiers() & METHOD_MASK ; + int modifier = c.member.getModifiers() & METHOD_MASK; if (DEBUG_SVUID) - msg( "\twriteInt( " + modifier + " ) " ) ; - data.writeInt( modifier ) ; + msg("\twriteInt( " + modifier + " ) "); + data.writeInt(modifier); if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + desc+ "\" )" ) ; + msg("\twriteUTF( \"" + desc + "\" )"); data.writeUTF(desc); } - /* Include in the hash all methods except those that are - * private transient and private static. + /* + * Include in the hash all methods except those that are private transient and private static. */ - MethodSignature[] methods = - MethodSignature.removePrivateAndSort(method); - for (int i = 0; i < methods.length; i++ ) { + MethodSignature[] methods = MethodSignature.removePrivateAndSort(method); + for (int i = 0; i < methods.length; i++) { MethodSignature m = methods[i]; String desc = m.signature; desc = desc.replace('/', '.'); if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + m.member.getName()+ "\" )" ) ; + msg("\twriteUTF( \"" + m.member.getName() + "\" )"); data.writeUTF(m.member.getName()); // mask out post-1.4 modifiers - int modifier = m.member.getModifiers() & METHOD_MASK ; + int modifier = m.member.getModifiers() & METHOD_MASK; if (DEBUG_SVUID) - msg( "\twriteInt( " + modifier + " ) " ) ; - data.writeInt( modifier ) ; + msg("\twriteInt( " + modifier + " ) "); + data.writeInt(modifier); if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + desc + "\" )" ) ; + msg("\twriteUTF( \"" + desc + "\" )"); data.writeUTF(desc); } - /* Compute the hash value for this class. - * Use only the first 64 bits of the hash. + /* + * Compute the hash value for this class. Use only the first 64 bits of the hash. */ data.flush(); byte hasharray[] = md.digest(); for (int i = 0; i < Math.min(8, hasharray.length); i++) { - h += (long)(hasharray[i] & 255) << (i * 8); + h += (long) (hasharray[i] & 255) << (i * 8); } } catch (IOException ignore) { /* can't happen, but be deterministic anyway. */ h = -1; } catch (NoSuchAlgorithmException complain) { - SecurityException se = new SecurityException() ; - se.initCause( complain ) ; - throw se ; + SecurityException se = new SecurityException(); + se.initCause(complain); + throw se; } return h; } - private static long computeStructuralUID( - com.sun.corba.ee.impl.io.ObjectStreamClass osc, Class cl) { + private static long computeStructuralUID(com.sun.corba.ee.impl.io.ObjectStreamClass osc, Class cl) { ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( cl ) ; - + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(cl); + long h = 0; try { if (!cinfo.isASerializable(cl) || cinfo.isInterface()) { @@ -1065,11 +998,11 @@ private static long computeStructuralUID( // Get SUID of parent Class parent = cl.getSuperclass(); - if ((parent != null)) - // SerialBug 1; acc. to spec the one for + if ((parent != null)) + // SerialBug 1; acc. to spec the one for // java.lang.object // should be computed and put - // && (parent != java.lang.Object.class)) + // && (parent != java.lang.Object.class)) { data.writeLong(computeStructuralUID(lookup(parent), parent)); } @@ -1079,7 +1012,7 @@ private static long computeStructuralUID( else data.writeInt(1); - // CORBA formal 00-11-03 10.6.2: For each field of the + // CORBA formal 00-11-03 10.6.2: For each field of the // class that is mapped to IDL, sorted lexicographically // by Java field name, in increasing order... ObjectStreamField[] field = osc.getFields(); @@ -1093,25 +1026,25 @@ private static long computeStructuralUID( data.writeUTF(field[i].getName()); data.writeUTF(field[i].getSignature()); } - - /* Compute the hash value for this class. - * Use only the first 64 bits of the hash. + + /* + * Compute the hash value for this class. Use only the first 64 bits of the hash. */ data.flush(); byte hasharray[] = md.digest(); // int minimum = Math.min(8, hasharray.length); // SerialBug 3: SHA computation is wrong; for loop reversed - //for (int i = minimum; i > 0; i--) + // for (int i = minimum; i > 0; i--) for (int i = 0; i < Math.min(8, hasharray.length); i++) { - h += (long)(hasharray[i] & 255) << (i * 8); + h += (long) (hasharray[i] & 255) << (i * 8); } } catch (IOException ignore) { /* can't happen, but be deterministic anyway. */ h = -1; } catch (NoSuchAlgorithmException complain) { SecurityException se = new SecurityException(); - se.initCause( complain ) ; - throw se ; + se.initCause(complain); + throw se; } return h; } @@ -1121,10 +1054,10 @@ private static long computeStructuralUID( */ static String getSignature(Class clazz) { String type = null; - if (ClassInfoCache.get( clazz ).isArray()) { + if (ClassInfoCache.get(clazz).isArray()) { Class cl = clazz; int dimensions = 0; - while (ClassInfoCache.get( cl ).isArray()) { + while (ClassInfoCache.get(cl).isArray()) { dimensions++; cl = cl.getComponentType(); } @@ -1196,8 +1129,7 @@ static String getSignature(Constructor cons) { /* * Cache of Class -> ClassDescriptor Mappings. */ - static private final SoftCache,ObjectStreamClass> descriptorFor = - new SoftCache,ObjectStreamClass>() ; + static private final SoftCache, ObjectStreamClass> descriptorFor = new SoftCache, ObjectStreamClass>(); /* * The name of this descriptor @@ -1216,8 +1148,7 @@ static String getSignature(Constructor cons) { private boolean externalizable; /* - * Array of persistent fields of this class, sorted by - * type and name. + * Array of persistent fields of this class, sorted by type and name. */ private ObjectStreamField[] fields; @@ -1231,7 +1162,6 @@ static String getSignature(Constructor cons) { */ boolean forProxyClass; - /* * SerialVersionUID for this class. */ @@ -1245,26 +1175,23 @@ static String getSignature(Constructor cons) { private String actualSuidStr = null; /* - * The total number of bytes of primitive fields. - * The total number of object fields. + * The total number of bytes of primitive fields. The total number of object fields. */ int primBytes; int objFields; /** - * Flag indicating whether or not this instance has - * successfully completed initialization. This is to - * try to fix bug 4373844. Working to move to - * reusing java.io.ObjectStreamClass for JDK 1.5. + * Flag indicating whether or not this instance has successfully completed initialization. This is to try to fix bug + * 4373844. Working to move to reusing java.io.ObjectStreamClass for JDK 1.5. */ private boolean initialized = false; /* Internal lock object. */ private final Object lock = new Object(); - /* In JDK 1.1, external data was not written in block mode. - * As of JDK 1.2, external data is written in block data mode. This - * flag enables JDK 1.2 to be able to read JDK 1.1 written external data. + /* + * In JDK 1.1, external data was not written in block mode. As of JDK 1.2, external data is written in block data mode. + * This flag enables JDK 1.2 to be able to read JDK 1.1 written external data. * * @since JDK 1.2 */ @@ -1274,15 +1201,12 @@ static String getSignature(Constructor cons) { private MethodHandle readObjectMethod; private transient MethodHandle writeReplaceObjectMethod; private transient MethodHandle readResolveObjectMethod; - private Constructor cons ; + private Constructor cons; /** - * Beginning in Java to IDL ptc/02-01-12, RMI-IIOP has a - * stream format version 2 which puts a fake valuetype around - * a Serializable's optional custom data. This valuetype has - * a special repository ID made from the Serializable's - * information which we are pre-computing and - * storing here. + * Beginning in Java to IDL ptc/02-01-12, RMI-IIOP has a stream format version 2 which puts a fake valuetype around a + * Serializable's optional custom data. This valuetype has a special repository ID made from the Serializable's + * information which we are pre-computing and storing here. */ private String rmiiiopOptionalDataRepId = null; @@ -1290,20 +1214,16 @@ static String getSignature(Constructor cons) { private static final long serialVersionUID = -6120832682080437368L; /** - * Set serialPersistentFields of a Serializable class to this value to - * denote that the class has no Serializable fields. + * Set serialPersistentFields of a Serializable class to this value to denote that the class has no Serializable fields. */ - public static final ObjectStreamField[] NO_FIELDS = - new ObjectStreamField[0]; + public static final ObjectStreamField[] NO_FIELDS = new ObjectStreamField[0]; /* * Comparator object for Classes and Interfaces */ - private static Comparator> compareClassByName = - new CompareClassByName(); + private static Comparator> compareClassByName = new CompareClassByName(); - private static class CompareClassByName - implements Comparator> { + private static class CompareClassByName implements Comparator> { public int compare(Class c1, Class c2) { return c1.getName().compareTo(c2.getName()); @@ -1313,11 +1233,9 @@ public int compare(Class c1, Class c2) { /** * Comparator for ObjectStreamFields by name */ - private final static Comparator compareObjStrFieldsByName - = new CompareObjStrFieldsByName(); + private final static Comparator compareObjStrFieldsByName = new CompareObjStrFieldsByName(); - private static class CompareObjStrFieldsByName - implements Comparator { + private static class CompareObjStrFieldsByName implements Comparator { public int compare(ObjectStreamField o1, ObjectStreamField o2) { return o1.getName().compareTo(o2.getName()); @@ -1327,50 +1245,51 @@ public int compare(ObjectStreamField o1, ObjectStreamField o2) { /* * Comparator object for Members, Fields, and Methods */ - private static Comparator compareMemberByName = - new CompareMemberByName(); + private static Comparator compareMemberByName = new CompareMemberByName(); - private static class CompareMemberByName - implements Comparator { + private static class CompareMemberByName implements Comparator { public int compare(Member o1, Member o2) { String s1 = o1.getName(); String s2 = o2.getName(); if ((o1 instanceof Method) && (o2 instanceof Method)) { - s1 += getSignature((Method)o1); - s2 += getSignature((Method)o2); + s1 += getSignature((Method) o1); + s2 += getSignature((Method) o2); } else if ((o1 instanceof Constructor) && (o2 instanceof Constructor)) { - s1 += getSignature((Constructor)o1); - s2 += getSignature((Constructor)o2); + s1 += getSignature((Constructor) o1); + s2 += getSignature((Constructor) o2); } return s1.compareTo(s2); } } - /* It is expensive to recompute a method or constructor signature - many times, so compute it only once using this data structure. */ - private static class MethodSignature - implements Comparator { + /* + * It is expensive to recompute a method or constructor signature many times, so compute it only once using this data + * structure. + */ + private static class MethodSignature implements Comparator { Member member; - String signature; // cached parameter signature + String signature; // cached parameter signature - /* Given an array of Method or Constructor members, - return a sorted array of the non-private members.*/ - /* A better implementation would be to implement the returned data - structure as an insertion sorted link list.*/ + /* + * Given an array of Method or Constructor members, return a sorted array of the non-private members. + */ + /* + * A better implementation would be to implement the returned data structure as an insertion sorted link list. + */ static MethodSignature[] removePrivateAndSort(Member[] m) { int numNonPrivate = 0; for (int i = 0; i < m.length; i++) { - if (! Modifier.isPrivate(m[i].getModifiers())) { + if (!Modifier.isPrivate(m[i].getModifiers())) { numNonPrivate++; } } MethodSignature[] cm = new MethodSignature[numNonPrivate]; int cmi = 0; for (int i = 0; i < m.length; i++) { - if (! Modifier.isPrivate(m[i].getModifiers())) { + if (!Modifier.isPrivate(m[i].getModifiers())) { cm[cmi] = new MethodSignature(m[i]); cmi++; } @@ -1380,10 +1299,11 @@ static MethodSignature[] removePrivateAndSort(Member[] m) { return cm; } - /* Assumes that o1 and o2 are either both methods - or both constructors.*/ + /* + * Assumes that o1 and o2 are either both methods or both constructors. + */ public int compare(MethodSignature c1, MethodSignature c2) { - /* Arrays.sort calls compare when o1 and o2 are equal.*/ + /* Arrays.sort calls compare when o1 and o2 are equal. */ if (c1 == c2) return 0; @@ -1405,9 +1325,9 @@ private boolean isConstructor() { private MethodSignature(Member m) { member = m; if (isConstructor()) { - signature = ObjectStreamClass.getSignature((Constructor)m); + signature = ObjectStreamClass.getSignature((Constructor) m); } else { - signature = ObjectStreamClass.getSignature((Method)m); + signature = ObjectStreamClass.getSignature((Method) m); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamClassCorbaExt.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamClassCorbaExt.java index 28aa73e36..7c478d634 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamClassCorbaExt.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamClassCorbaExt.java @@ -30,9 +30,9 @@ import java.lang.reflect.Member; import java.lang.reflect.Method; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; -import com.sun.corba.ee.impl.misc.ORBUtility ; +import com.sun.corba.ee.impl.misc.ORBUtility; // This file contains some utility methods that // originally were in the OSC in the RMI-IIOP @@ -51,15 +51,12 @@ class ObjectStreamClassCorbaExt { /** * Return true, iff, * - * 1. 'cl' is an interface, and - * 2. 'cl' and all its ancestors do not implement java.rmi.Remote, and - * 3. if 'cl' has no methods (including those of its ancestors), or, - * if all the methods (including those of its ancestors) throw an - * exception that is atleast java.rmi.RemoteException or one of - * java.rmi.RemoteException's super classes. + * 1. 'cl' is an interface, and 2. 'cl' and all its ancestors do not implement java.rmi.Remote, and 3. if 'cl' has no + * methods (including those of its ancestors), or, if all the methods (including those of its ancestors) throw an + * exception that is atleast java.rmi.RemoteException or one of java.rmi.RemoteException's super classes. */ static final boolean isAbstractInterface(Class cl) { - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( cl ) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(cl); if (!cinfo.isInterface() || cinfo.isARemote(cl)) { return false; } @@ -69,10 +66,8 @@ static final boolean isAbstractInterface(Class cl) { Class exceptions[] = methods[i].getExceptionTypes(); boolean exceptionMatch = false; for (int j = 0; (j < exceptions.length) && !exceptionMatch; j++) { - if ((java.rmi.RemoteException.class == exceptions[j]) || - (java.lang.Throwable.class == exceptions[j]) || - (java.lang.Exception.class == exceptions[j]) || - (java.io.IOException.class == exceptions[j])) { + if ((java.rmi.RemoteException.class == exceptions[j]) || (java.lang.Throwable.class == exceptions[j]) + || (java.lang.Exception.class == exceptions[j]) || (java.io.IOException.class == exceptions[j])) { exceptionMatch = true; } } @@ -88,63 +83,57 @@ static final boolean isAbstractInterface(Class cl) { // java.lang.String // java.math.BigDecimal // java.math.BigInteger - private static final String objectString = "Ljava/lang/Object;" ; - private static final String serializableString = "Ljava/io/Serializable;" ; - private static final String externalizableString = "Ljava/io/Externalizable;" ; + private static final String objectString = "Ljava/lang/Object;"; + private static final String serializableString = "Ljava/io/Serializable;"; + private static final String externalizableString = "Ljava/io/Externalizable;"; // Note that these 3 lengths are different! - private static final int objectLength = objectString.length() ; - private static final int serializableLength = serializableString.length() ; - private static final int externalizableLength = externalizableString.length() ; + private static final int objectLength = objectString.length(); + private static final int serializableLength = serializableString.length(); + private static final int externalizableLength = externalizableString.length(); - private static final boolean debugIsAny = false ; + private static final boolean debugIsAny = false; /* - * Returns TRUE if type is 'any'. - * This is in the marshaling path, so we want it to run as - * fast as possible. + * Returns TRUE if type is 'any'. This is in the marshaling path, so we want it to run as fast as possible. */ static final boolean isAny(String typeString) { if (debugIsAny) { - ORBUtility.dprint( - ObjectStreamClassCorbaExt.class.getName(), - "IsAny: typeString = " + typeString ) ; + ORBUtility.dprint(ObjectStreamClassCorbaExt.class.getName(), "IsAny: typeString = " + typeString); } - int length = typeString.length() ; + int length = typeString.length(); if (length == objectLength) { // Note that java.lang.String occurs a lot, and has the // same length as java.lang.Object! - if (typeString.charAt(length-2) == 't') - return objectString.equals( typeString ) ; + if (typeString.charAt(length - 2) == 't') + return objectString.equals(typeString); else - return false ; + return false; } if (length == serializableLength) { // java.math.BigInteger and java.math.BigDecimal have the same // length as java.io.Serializable - if (typeString.charAt(length-2) == 'e') - return serializableString.equals( typeString ) ; - else - return false ; + if (typeString.charAt(length - 2) == 'e') + return serializableString.equals(typeString); + else + return false; } if (length == externalizableLength) - return externalizableString.equals( typeString ) ; + return externalizableString.equals(typeString); - return false ; + return false; } private static final Method[] getDeclaredMethods(final Class clz) { - return AccessController.doPrivileged( - new PrivilegedAction() { - public Method[] run() { - return clz.getDeclaredMethods(); - } + return AccessController.doPrivileged(new PrivilegedAction() { + public Method[] run() { + return clz.getDeclaredMethods(); } - ); + }); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamField.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamField.java index eb5db7ec9..4ecc04a3f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamField.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ObjectStreamField.java @@ -28,27 +28,22 @@ import java.security.PrivilegedAction; /** - * A description of a field in a serializable class. - * A array of these is used to declare the persistent fields of - * a class. + * A description of a field in a serializable class. A array of these is used to declare the persistent fields of a + * class. * */ -public class ObjectStreamField implements Comparable -{ - private static final Bridge bridge = - AccessController.doPrivileged( - new PrivilegedAction() { - public Bridge run() { - return Bridge.get() ; - } - } - ) ; +public class ObjectStreamField implements Comparable { + private static final Bridge bridge = AccessController.doPrivileged(new PrivilegedAction() { + public Bridge run() { + return Bridge.get(); + } + }); // Create a named field with the specified type. public ObjectStreamField(String n, Class clazz) { name = n; this.clazz = clazz; - cinfo = ClassInfoCache.get( clazz ) ; + cinfo = ClassInfoCache.get(clazz); // Compute the typecode for easy switching if (clazz.isPrimitive()) { @@ -86,11 +81,12 @@ public ObjectStreamField(String n, Class clazz) { public ObjectStreamField(Field field) { this(field.getName(), field.getType()); - setField( field ) ; + setField(field); } /** * Get the name of this field. + * * @return The field name */ public String getName() { @@ -98,32 +94,41 @@ public String getName() { } public ClassInfoCache.ClassInfo getClassInfo() { - return cinfo ; + return cinfo; } /** * Get the type of the field. + * * @return The type of the field */ public Class getType() { if (clazz != null) return clazz; switch (type) { - case 'B': clazz = Byte.TYPE; + case 'B': + clazz = Byte.TYPE; break; - case 'C': clazz = Character.TYPE; + case 'C': + clazz = Character.TYPE; break; - case 'S': clazz = Short.TYPE; + case 'S': + clazz = Short.TYPE; break; - case 'I': clazz = Integer.TYPE; + case 'I': + clazz = Integer.TYPE; break; - case 'J': clazz = Long.TYPE; + case 'J': + clazz = Long.TYPE; break; - case 'F': clazz = Float.TYPE; + case 'F': + clazz = Float.TYPE; break; - case 'D': clazz = Double.TYPE; + case 'D': + clazz = Double.TYPE; break; - case 'Z': clazz = Boolean.TYPE; + case 'Z': + clazz = Boolean.TYPE; break; case '[': case 'L': @@ -148,12 +153,12 @@ Field getField() { void setField(Field field) { this.field = field; - this.fieldID = bridge.objectFieldOffset( field ) ; + this.fieldID = bridge.objectFieldOffset(field); } - /** * test if this field is a primitive or not. + * * @return if this field is primitive. */ public boolean isPrimitive() { @@ -161,14 +166,12 @@ public boolean isPrimitive() { } /** - * Compare this with another ObjectStreamField. - * return -1 if this is smaller, 0 if equal, 1 if greater - * types that are primitives are "smaller" than objects. - * if equal, the names are compared. + * Compare this with another ObjectStreamField. return -1 if this is smaller, 0 if equal, 1 if greater types that are + * primitives are "smaller" than objects. if equal, the names are compared. */ @Override public int compareTo(Object o) { - ObjectStreamField f2 = (ObjectStreamField)o; + ObjectStreamField f2 = (ObjectStreamField) o; boolean thisprim = (this.typeString == null); boolean otherprim = (f2.typeString == null); @@ -179,9 +182,9 @@ public int compareTo(Object o) { } /** - * Compare the types of two class descriptors. - * The match if they have the same primitive types. - * or if they are both objects and the object types match. + * Compare the types of two class descriptors. The match if they have the same primitive types. or if they are both + * objects and the object types match. + * * @param other type to compare with * @return if the two types are equivalent */ @@ -193,12 +196,11 @@ public boolean typeEquals(ObjectStreamField other) { if (typeString == null && other.typeString == null) return true; - return ObjectStreamClass.compareClassNames(typeString, - other.typeString, - '/'); + return ObjectStreamClass.compareClassNames(typeString, other.typeString, '/'); } - /* Returns the signature of the Field. + /* + * Returns the signature of the Field. * */ public String getSignature() { @@ -221,25 +223,26 @@ public Class getClazz() { return clazz; } - /* Returns the Field ID + /* + * Returns the Field ID * */ public long getFieldID() { - return fieldID ; + return fieldID; } - private String name; // the name of the field - private char type; // type first byte of the type signature - private Field field; // Reflected field - private String typeString; // iff object, typename - private Class clazz; // the type of this field, if has been resolved - private ClassInfoCache.ClassInfo cinfo ; + private String name; // the name of the field + private char type; // type first byte of the type signature + private Field field; // Reflected field + private String typeString; // iff object, typename + private Class clazz; // the type of this field, if has been resolved + private ClassInfoCache.ClassInfo cinfo; // the next 2 things are RMI-IIOP specific, it can be easily // removed, if we can figure out all place where there are dependencies - // to this. Signature is esentially equal to typestring. Then + // to this. Signature is esentially equal to typestring. Then // essentially we can use the java.io.ObjectStreamField as such. - private String signature; // the signature of the field - private long fieldID = Bridge.INVALID_FIELD_OFFSET ; + private String signature; // the signature of the field + private long fieldID = Bridge.INVALID_FIELD_OFFSET; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/OptionalDataException.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/OptionalDataException.java index 632bcb7df..e4408fc6b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/OptionalDataException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/OptionalDataException.java @@ -21,17 +21,13 @@ package com.sun.corba.ee.impl.io; /** - * Unexpected data appeared in an ObjectInputStream trying to read - * an Object. - * This exception occurs when the stream contains primitive data - * instead of the object expected by readObject. - * The eof flag in the exception is true to indicate that no more - * primitive data is available. - * The count field contains the number of bytes available to read. + * Unexpected data appeared in an ObjectInputStream trying to read an Object. This exception occurs when the stream + * contains primitive data instead of the object expected by readObject. The eof flag in the exception is true to + * indicate that no more primitive data is available. The count field contains the number of bytes available to read. * - * @author unascribed + * @author unascribed * @version 1.7, 11/02/98 - * @since JDK1.1 + * @since JDK1.1 */ public class OptionalDataException extends java.io.IOException { /* @@ -43,8 +39,7 @@ public class OptionalDataException extends java.io.IOException { } /* - * Create an OptionalDataException signifing no - * more primitive data is available. + * Create an OptionalDataException signifing no more primitive data is available. */ OptionalDataException(boolean end) { length = 0; @@ -52,8 +47,7 @@ public class OptionalDataException extends java.io.IOException { } /** - * The number of bytes of primitive data available to be read - * in the current buffer. + * The number of bytes of primitive data available to be read in the current buffer. */ public int length; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/OutputStreamHook.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/OutputStreamHook.java index fded3a500..163e21f01 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/OutputStreamHook.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/OutputStreamHook.java @@ -31,91 +31,90 @@ import com.sun.corba.ee.spi.trace.StreamFormatVersion; @StreamFormatVersion -public abstract class OutputStreamHook extends ObjectOutputStream -{ +public abstract class OutputStreamHook extends ObjectOutputStream { private HookPutFields putFields = null; - + /** - * Since ObjectOutputStream.PutField methods specify no exceptions, - * we are not checking for null parameters on put methods. + * Since ObjectOutputStream.PutField methods specify no exceptions, we are not checking for null parameters on put + * methods. */ private class HookPutFields extends ObjectOutputStream.PutField { - private Map fields = new HashMap(); + private Map fields = new HashMap(); /** * Put the value of the named boolean field into the persistent field. */ - public void put(String name, boolean value){ + public void put(String name, boolean value) { fields.put(name, Boolean.valueOf(value)); } - + /** * Put the value of the named char field into the persistent fields. */ - public void put(String name, char value){ + public void put(String name, char value) { fields.put(name, Character.valueOf(value)); } - + /** * Put the value of the named byte field into the persistent fields. */ - public void put(String name, byte value){ + public void put(String name, byte value) { fields.put(name, Byte.valueOf(value)); } - + /** * Put the value of the named short field into the persistent fields. */ - public void put(String name, short value){ + public void put(String name, short value) { fields.put(name, Short.valueOf(value)); } - + /** * Put the value of the named int field into the persistent fields. */ - public void put(String name, int value){ + public void put(String name, int value) { fields.put(name, Integer.valueOf(value)); } - + /** * Put the value of the named long field into the persistent fields. */ - public void put(String name, long value){ + public void put(String name, long value) { fields.put(name, Long.valueOf(value)); } - + /** * Put the value of the named float field into the persistent fields. * */ - public void put(String name, float value){ + public void put(String name, float value) { fields.put(name, Float.valueOf(value)); } - + /** * Put the value of the named double field into the persistent field. */ - public void put(String name, double value){ + public void put(String name, double value) { fields.put(name, Double.valueOf(value)); } - + /** * Put the value of the named Object field into the persistent field. */ - public void put(String name, Object value){ + public void put(String name, Object value) { fields.put(name, value); } - + /** * Write the data and fields to the specified ObjectOutput stream. */ public void write(ObjectOutput out) throws IOException { - OutputStreamHook hook = (OutputStreamHook)out; + OutputStreamHook hook = (OutputStreamHook) out; ObjectStreamField[] osfields = hook.getFieldsNoCopy(); // Write the fields to the stream in the order - // provided by the ObjectStreamClass. (They should + // provided by the ObjectStreamClass. (They should // be sorted appropriately already.) for (int i = 0; i < osfields.length; i++) { @@ -128,10 +127,9 @@ public void write(ObjectOutput out) throws IOException { abstract void writeField(ObjectStreamField field, Object value) throws IOException; - public OutputStreamHook() - throws java.io.IOException { + public OutputStreamHook() throws java.io.IOException { super(); - + } @StreamFormatVersion @@ -143,10 +141,9 @@ public void defaultWriteObject() throws IOException { } public abstract void defaultWriteObjectDelegate(); - + @Override - public ObjectOutputStream.PutField putFields() - throws IOException { + public ObjectOutputStream.PutField putFields() throws IOException { if (putFields == null) { putFields = new HookPutFields(); } @@ -168,8 +165,7 @@ public byte getStreamFormatVersion() { // See java.io.ObjectOutputStream.PutFields @Override @StreamFormatVersion - public void writeFields() - throws IOException { + public void writeFields() throws IOException { writeObjectState.defaultWriteObject(this); @@ -184,15 +180,14 @@ public void writeFields() protected abstract void beginOptionalCustomData(); - // The following is a State pattern implementation of what - // should be done when a Serializable has a - // writeObject method. This was especially necessary for - // RMI-IIOP stream format version 2. Please see the + // should be done when a Serializable has a + // writeObject method. This was especially necessary for + // RMI-IIOP stream format version 2. Please see the // state diagrams in the docs directory of the workspace. protected WriteObjectState writeObjectState = NOT_IN_WRITE_OBJECT; - + @StreamFormatVersion protected void setState(WriteObjectState newState) { writeObjectState = newState; @@ -206,42 +201,49 @@ protected void setState(WriteObjectState newState) { // Description of possible actions @StreamFormatVersion protected static class WriteObjectState { - private final String name ; + private final String name; public WriteObjectState() { - String className = this.getClass().getName() ; - int index = className.indexOf( '$' ) ; - name = className.substring( index + 1 ) ; + String className = this.getClass().getName(); + int index = className.indexOf('$'); + name = className.substring(index + 1); } @StreamFormatVersion public final void enterWriteObject(OutputStreamHook stream) throws IOException { - enterWriteObjectOverride( stream ) ; + enterWriteObjectOverride(stream); } @StreamFormatVersion public final void exitWriteObject(OutputStreamHook stream) throws IOException { - exitWriteObjectOverride( stream ) ; + exitWriteObjectOverride(stream); } @StreamFormatVersion public final void defaultWriteObject(OutputStreamHook stream) throws IOException { - defaultWriteObjectOverride( stream ) ; + defaultWriteObjectOverride(stream); } @StreamFormatVersion public final void writeData(OutputStreamHook stream) throws IOException { - writeDataOverride( stream ) ; + writeDataOverride(stream); } - public void enterWriteObjectOverride(OutputStreamHook stream) throws IOException {} - public void exitWriteObjectOverride(OutputStreamHook stream) throws IOException {} - public void defaultWriteObjectOverride(OutputStreamHook stream) throws IOException {} - public void writeDataOverride(OutputStreamHook stream) throws IOException {} + public void enterWriteObjectOverride(OutputStreamHook stream) throws IOException { + } + + public void exitWriteObjectOverride(OutputStreamHook stream) throws IOException { + } + + public void defaultWriteObjectOverride(OutputStreamHook stream) throws IOException { + } + + public void writeDataOverride(OutputStreamHook stream) throws IOException { + } @Override public String toString() { - return name ; + return name; } } @@ -260,9 +262,9 @@ protected static class InWriteObjectState extends WriteObjectState { @Override @StreamFormatVersion public void enterWriteObjectOverride(OutputStreamHook stream) throws IOException { - throw Exceptions.self.calledWriteObjectTwice() ; + throw Exceptions.self.calledWriteObjectTwice(); } - + @Override @StreamFormatVersion public void exitWriteObjectOverride(OutputStreamHook stream) throws IOException { @@ -298,7 +300,7 @@ public void defaultWriteObjectOverride(OutputStreamHook stream) throws IOExcepti public void writeDataOverride(OutputStreamHook stream) throws IOException { // The writeObject method first called a direct - // write operation. Write the called defaultWriteObject + // write operation. Write the called defaultWriteObject // indicator as false, put the special stream format // version 2 header (if stream format version 2, of course), // and write the data @@ -320,14 +322,14 @@ public void exitWriteObjectOverride(OutputStreamHook stream) throws IOException if (stream.getStreamFormatVersion() == 2) { stream.getOrbStream().write_long(0); } - + stream.setState(NOT_IN_WRITE_OBJECT); } @Override @StreamFormatVersion public void defaultWriteObjectOverride(OutputStreamHook stream) throws IOException { - throw Exceptions.self.calledDefaultWriteObjectTwice() ; + throw Exceptions.self.calledDefaultWriteObjectTwice(); } @Override @@ -338,7 +340,7 @@ public void writeDataOverride(OutputStreamHook stream) throws IOException { // If in stream format version 2, put the fake valuetype // header. stream.beginOptionalCustomData(); - + stream.setState(WROTE_CUSTOM_DATA); } } @@ -359,14 +361,14 @@ public void exitWriteObjectOverride(OutputStreamHook stream) throws IOException @Override @StreamFormatVersion - public void defaultWriteObjectOverride(OutputStreamHook stream) - throws IOException { - throw Exceptions.self.defaultWriteObjectAfterCustomData() ; + public void defaultWriteObjectOverride(OutputStreamHook stream) throws IOException { + throw Exceptions.self.defaultWriteObjectAfterCustomData(); } // We don't have to do anything special here, just let // the stream write the data. @Override - public void writeDataOverride(OutputStreamHook stream) throws IOException {} + public void writeDataOverride(OutputStreamHook stream) throws IOException { + } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/SharedSecrets.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/SharedSecrets.java index b6288f185..a2bc32127 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/SharedSecrets.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/SharedSecrets.java @@ -20,14 +20,11 @@ package com.sun.corba.ee.impl.io; /** - * A repository of "shared secrets", which are a mechanism for - * calling implementation-private methods in another package without - * using reflection. A package-private class implements a public - * interface and provides the ability to call package-private methods - * within that package; the object implementing that interface is - * provided through a third package to which access is restricted. - * This framework avoids the primary disadvantage of using reflection - * for this purpose, namely the loss of compile-time checking. + * A repository of "shared secrets", which are a mechanism for calling implementation-private methods in another package + * without using reflection. A package-private class implements a public interface and provides the ability to call + * package-private methods within that package; the object implementing that interface is provided through a third + * package to which access is restricted. This framework avoids the primary disadvantage of using reflection for this + * purpose, namely the loss of compile-time checking. */ public class SharedSecrets { private static JavaCorbaAccess javaCorbaAccess; @@ -36,11 +33,11 @@ public static JavaCorbaAccess getJavaCorbaAccess() { if (javaCorbaAccess == null) { // Ensure ValueUtility is initialized; we know that that class // provides the shared secret - try { - Class.forName(ValueUtility.class.getName(), true, ValueUtility.class.getClassLoader()); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } + try { + Class.forName(ValueUtility.class.getName(), true, ValueUtility.class.getClassLoader()); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } } return javaCorbaAccess; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/TypeMismatchException.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/TypeMismatchException.java index 76e6bfdc0..8e2ad6c3b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/TypeMismatchException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/TypeMismatchException.java @@ -20,15 +20,12 @@ package com.sun.corba.ee.impl.io; -public class TypeMismatchException extends Error -{ - public TypeMismatchException() - { +public class TypeMismatchException extends Error { + public TypeMismatchException() { super(); } - public TypeMismatchException(String mssg) - { + public TypeMismatchException(String mssg) { super(mssg); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ValueHandlerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ValueHandlerImpl.java index 10a0fc5e0..c53928c5d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ValueHandlerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ValueHandlerImpl.java @@ -20,8 +20,7 @@ package com.sun.corba.ee.impl.io; - -import java.util.Map ; +import java.util.Map; import java.io.IOException; import com.sun.corba.ee.impl.util.RepositoryId; @@ -40,27 +39,24 @@ import com.sun.corba.ee.spi.logging.UtilSystemException; import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; -import com.sun.corba.ee.spi.trace.ValueHandlerWrite ; -import com.sun.corba.ee.spi.trace.ValueHandlerRead ; +import com.sun.corba.ee.spi.trace.ValueHandlerWrite; +import com.sun.corba.ee.spi.trace.ValueHandlerRead; import java.util.concurrent.ConcurrentHashMap; import org.glassfish.pfl.basic.logex.OperationTracer; @ValueHandlerRead @ValueHandlerWrite public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat { - private static final OMGSystemException omgWrapper = - OMGSystemException.self ; - protected static final UtilSystemException utilWrapper = - UtilSystemException.self ; + private static final OMGSystemException omgWrapper = OMGSystemException.self; + protected static final UtilSystemException utilWrapper = UtilSystemException.self; // Property to override our maximum stream format version - public static final String FORMAT_VERSION_PROPERTY - = "com.sun.corba.ee.MaxStreamFormatVersion"; + public static final String FORMAT_VERSION_PROPERTY = "com.sun.corba.ee.MaxStreamFormatVersion"; - private static final byte MAX_SUPPORTED_FORMAT_VERSION = (byte)2; - private static final byte STREAM_FORMAT_VERSION_1 = (byte)1; + private static final byte MAX_SUPPORTED_FORMAT_VERSION = (byte) 2; + private static final byte STREAM_FORMAT_VERSION_1 = (byte) 1; // The ValueHandler's maximum stream format version to advertise, // set in a static initializer. @@ -72,16 +68,14 @@ public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMulti // Looks for the FORMAT_VERSION_PROPERTY system property // to allow the user to override our default stream format - // version. Note that this still only allows them to pick + // version. Note that this still only allows them to pick // a supported version (1 through MAX_STREAM_FORMAT_VERSION). private static byte getMaxStreamFormatVersion() { try { - String propValue = AccessController.doPrivileged( - new PrivilegedAction() { + String propValue = AccessController.doPrivileged(new PrivilegedAction() { public String run() { - return System.getProperty( - ValueHandlerImpl.FORMAT_VERSION_PROPERTY); + return System.getProperty(ValueHandlerImpl.FORMAT_VERSION_PROPERTY); } }); @@ -92,24 +86,22 @@ public String run() { byte result = Byte.parseByte(propValue); - // REVISIT. Just set to MAX_SUPPORTED_FORMAT_VERSION + // REVISIT. Just set to MAX_SUPPORTED_FORMAT_VERSION // or really let the system shutdown with this Error? if (result < 1 || result > MAX_SUPPORTED_FORMAT_VERSION) { throw new ExceptionInInitializerError( - "Invalid stream format version: " + result - + ". Valid range is 1 through " - + MAX_SUPPORTED_FORMAT_VERSION); + "Invalid stream format version: " + result + ". Valid range is 1 through " + MAX_SUPPORTED_FORMAT_VERSION); } return result; } catch (Exception ex) { - // REVISIT. Swallow this or really let + // REVISIT. Swallow this or really let // the system shutdown with this Error? Error err = new ExceptionInInitializerError(ex); - err.initCause( ex ) ; - throw err ; + err.initCause(ex); + throw err; } } @@ -118,15 +110,11 @@ public String run() { public static final short kValueType = 2; // Since the Input/OutputStream is unique to a thread, only one thread - // can ever put a particular key into the stream pairs maps. Multiple threads + // can ever put a particular key into the stream pairs maps. Multiple threads // will simultaneously update these maps, so we need a ConcurrentHashMap. // But we don't need to use putIfAbsent to store into the maps. - private final Map - inputStreamPairs = new ConcurrentHashMap(); - private final Map - outputStreamPairs = new ConcurrentHashMap(); + private final Map inputStreamPairs = new ConcurrentHashMap(); + private final Map outputStreamPairs = new ConcurrentHashMap(); // See javax.rmi.CORBA.ValueHandlerMultiFormat public byte getMaximumStreamFormatVersion() { @@ -135,46 +123,42 @@ public byte getMaximumStreamFormatVersion() { // See javax.rmi.CORBA.ValueHandlerMultiFormat @ValueHandlerWrite - public void writeValue(org.omg.CORBA.portable.OutputStream out, - java.io.Serializable value, - byte streamFormatVersion) { + public void writeValue(org.omg.CORBA.portable.OutputStream out, java.io.Serializable value, byte streamFormatVersion) { if (streamFormatVersion == 2) { if (!(out instanceof org.omg.CORBA.portable.ValueOutputStream)) { - throw omgWrapper.notAValueoutputstream() ; + throw omgWrapper.notAValueoutputstream(); } } else if (streamFormatVersion != 1) { - throw omgWrapper.invalidStreamFormatVersion( - streamFormatVersion ) ; + throw omgWrapper.invalidStreamFormatVersion(streamFormatVersion); } - writeValueWithVersion( out, value, streamFormatVersion); + writeValueWithVersion(out, value, streamFormatVersion); + } + + private ValueHandlerImpl() { } - private ValueHandlerImpl(){} - static ValueHandlerImpl getInstance() { - return new ValueHandlerImpl(); + return new ValueHandlerImpl(); } /** * Writes the value to the stream using java semantics. + * * @param _out The stream to write the value to * @param value The value to be written to the stream **/ @ValueHandlerWrite - public void writeValue(org.omg.CORBA.portable.OutputStream _out, - java.io.Serializable value) { + public void writeValue(org.omg.CORBA.portable.OutputStream _out, java.io.Serializable value) { - writeValueWithVersion( _out, value, STREAM_FORMAT_VERSION_1); + writeValueWithVersion(_out, value, STREAM_FORMAT_VERSION_1); } @ValueHandlerWrite - private void writeValueWithVersion( org.omg.CORBA.portable.OutputStream _out, - java.io.Serializable value, byte streamFormatVersion) { + private void writeValueWithVersion(org.omg.CORBA.portable.OutputStream _out, java.io.Serializable value, byte streamFormatVersion) { - org.omg.CORBA_2_3.portable.OutputStream out = - (org.omg.CORBA_2_3.portable.OutputStream) _out; + org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) _out; IIOPOutputStream jdkToOrbOutputStreamBridge = null; @@ -188,8 +172,7 @@ private void writeValueWithVersion( org.omg.CORBA.portable.OutputStream _out, try { jdkToOrbOutputStreamBridge.increaseRecursionDepth(); - writeValueInternal(jdkToOrbOutputStreamBridge, out, - value, streamFormatVersion); + writeValueInternal(jdkToOrbOutputStreamBridge, out, value, streamFormatVersion); } finally { if (jdkToOrbOutputStreamBridge.decreaseRecursionDepth() == 0) { outputStreamPairs.remove(_out); @@ -198,12 +181,11 @@ private void writeValueWithVersion( org.omg.CORBA.portable.OutputStream _out, } @ValueHandlerWrite - private void writeValueInternal( IIOPOutputStream bridge, - org.omg.CORBA_2_3.portable.OutputStream out, - java.io.Serializable value, byte streamFormatVersion) { + private void writeValueInternal(IIOPOutputStream bridge, org.omg.CORBA_2_3.portable.OutputStream out, java.io.Serializable value, + byte streamFormatVersion) { Class clazz = value.getClass(); - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( clazz ) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(clazz); if (cinfo.isArray()) { write_Array(out, value, clazz.getComponentType()); } else { @@ -213,6 +195,7 @@ private void writeValueInternal( IIOPOutputStream bridge, /** * Reads a value from the stream using java semantics. + * * @param _in The stream to read the value from * @param offset offset position in the stream * @param clazz The type of the value to be read in @@ -221,18 +204,16 @@ private void writeValueInternal( IIOPOutputStream bridge, * @return The serializable value read from the stream **/ @ValueHandlerRead - public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in, - int offset, java.lang.Class clazz, String repositoryID, - org.omg.SendingContext.RunTime _sender) { + public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in, int offset, java.lang.Class clazz, String repositoryID, + org.omg.SendingContext.RunTime _sender) { java.io.Serializable result = null; // Must use narrow rather than a direct cast to a com.sun - // class. Fix for bug 4379539. + // class. Fix for bug 4379539. CodeBase sender = CodeBaseHelper.narrow(_sender); - org.omg.CORBA_2_3.portable.InputStream in = - (org.omg.CORBA_2_3.portable.InputStream) _in; + org.omg.CORBA_2_3.portable.InputStream in = (org.omg.CORBA_2_3.portable.InputStream) _in; IIOPInputStream jdkToOrbInputStreamBridge = inputStreamPairs.get(_in); if (jdkToOrbInputStreamBridge == null) { @@ -246,8 +227,7 @@ public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in, try { jdkToOrbInputStreamBridge.increaseRecursionDepth(); - result = readValueInternal(jdkToOrbInputStreamBridge, in, offset, - clazz, repositoryID, sender); + result = readValueInternal(jdkToOrbInputStreamBridge, in, offset, clazz, repositoryID, sender); } finally { if (jdkToOrbInputStreamBridge.decreaseRecursionDepth() == 0) { inputStreamPairs.remove(_in); @@ -258,30 +238,26 @@ public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in, } @ValueHandlerRead - private java.io.Serializable readValueInternal(IIOPInputStream bridge, - org.omg.CORBA_2_3.portable.InputStream in, int offset, - java.lang.Class clazz, String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender) { + private java.io.Serializable readValueInternal(IIOPInputStream bridge, org.omg.CORBA_2_3.portable.InputStream in, int offset, + java.lang.Class clazz, String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender) { java.io.Serializable result = null; if (clazz == null) { // clazz == null indicates an FVD situation for a nonexistant class - if (isArray(repositoryID)){ - read_Array( bridge, in, null, sender, offset); + if (isArray(repositoryID)) { + read_Array(bridge, in, null, sender, offset); } else { - bridge.simpleSkipObject( repositoryID, sender); + bridge.simpleSkipObject(repositoryID, sender); } return result; } - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( clazz ) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(clazz); if (cinfo.isArray()) { - result = (java.io.Serializable)read_Array( - bridge, in, clazz, sender, offset); + result = (java.io.Serializable) read_Array(bridge, in, clazz, sender, offset); } else { - result = (java.io.Serializable)bridge.simpleReadObject( - clazz, cinfo, repositoryID, sender, offset); + result = (java.io.Serializable) bridge.simpleReadObject(clazz, cinfo, repositoryID, sender, offset); } return result; @@ -289,6 +265,7 @@ private java.io.Serializable readValueInternal(IIOPInputStream bridge, /** * Returns the repository ID for the given RMI value Class. + * * @param clz The class to return a repository ID for. * @return the repository ID of the Class. **/ @@ -297,21 +274,19 @@ public java.lang.String getRMIRepositoryID(java.lang.Class clz) { } /** - * Indicates whether the given Class performs custom or - * default marshaling. + * Indicates whether the given Class performs custom or default marshaling. + * * @param clz The class to test for custom marshaling. - * @return True if the class performs custom marshaling, false - * if it does not. + * @return True if the class performs custom marshaling, false if it does not. **/ public boolean isCustomMarshaled(java.lang.Class clz) { return ObjectStreamClass.lookup(clz).isCustomMarshaled(); } /** - * Returns the CodeBase for this ValueHandler. This is used by - * the ORB runtime. The server sends the service context containing - * the IOR for this CodeBase on the first GIOP reply. The clients - * do the same on the first GIOP request. + * Returns the CodeBase for this ValueHandler. This is used by the ORB runtime. The server sends the service context + * containing the IOR for this CodeBase on the first GIOP reply. The clients do the same on the first GIOP request. + * * @return the SendingContext.CodeBase of this ValueHandler. **/ public org.omg.SendingContext.RunTime getRunTimeCodeBase() { @@ -319,83 +294,67 @@ public org.omg.SendingContext.RunTime getRunTimeCodeBase() { return codeBase; } - // methods supported for backward compatability so that the appropriate // Rep-id calculations take place based on the ORB version /** - * Returns a boolean of whether or not RepositoryId indicates - * FullValueDescriptor. - * used for backward compatability + * Returns a boolean of whether or not RepositoryId indicates FullValueDescriptor. used for backward compatability + * * @param clazz The type to get description for * @param repositoryID The repository ID * @return If full description should be retrieved - * @throws IOException If suids do not match or if the repositoryID - * is not an RMIValueType. + * @throws IOException If suids do not match or if the repositoryID is not an RMIValueType. */ - public boolean useFullValueDescription(Class clazz, String repositoryID) throws IOException - { + public boolean useFullValueDescription(Class clazz, String repositoryID) throws IOException { return RepositoryId.useFullValueDescription(clazz, repositoryID); - } + } - public String getClassName(String id) - { + public String getClassName(String id) { RepositoryId repID = RepositoryId.cache.getId(id); return repID.getClassName(); - } + } - public Class getClassFromType(String id) - throws ClassNotFoundException - { + public Class getClassFromType(String id) throws ClassNotFoundException { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getClassFromType(); - } + } - public Class getAnyClassFromType(String id) - throws ClassNotFoundException - { + public Class getAnyClassFromType(String id) throws ClassNotFoundException { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getAnyClassFromType(); - } + } - public String createForAnyType(Class cl) - { + public String createForAnyType(Class cl) { return RepositoryId.createForAnyType(cl); - } + } - public String getDefinedInId(String id) - { + public String getDefinedInId(String id) { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getDefinedInId(); - } + } - public String getUnqualifiedName(String id) - { + public String getUnqualifiedName(String id) { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getUnqualifiedName(); - } + } - public String getSerialVersionUID(String id) - { + public String getSerialVersionUID(String id) { RepositoryId repId = RepositoryId.cache.getId(id); return repId.getSerialVersionUID(); - } - + } - public boolean isAbstractBase(Class clazz) - { + public boolean isAbstractBase(Class clazz) { return RepositoryId.isAbstractBase(clazz); - } + } - public boolean isSequence(String id) - { + public boolean isSequence(String id) { RepositoryId repId = RepositoryId.cache.getId(id); return repId.isSequence(); - } + } /** - * If the value contains a writeReplace method then the result - * is returned. Otherwise, the value itself is returned. + * If the value contains a writeReplace method then the result is returned. Otherwise, the value itself is returned. + * * @return the true value to marshal on the wire. **/ @ValueHandlerWrite @@ -404,87 +363,80 @@ public java.io.Serializable writeReplace(java.io.Serializable value) { } /** - * Encapsulates writing of Java char arrays so that the 1.3 subclass - * can override it without exposing internals across packages. This - * is a fix for bug 4367783. + * Encapsulates writing of Java char arrays so that the 1.3 subclass can override it without exposing internals across + * packages. This is a fix for bug 4367783. */ @ValueHandlerWrite - private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, - char[] array, - int offset, - int length) - { + private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, char[] array, int offset, int length) { out.write_wchar_array(array, offset, length); } @ValueHandlerWrite - private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, - java.io.Serializable obj, Class type) { + private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, java.io.Serializable obj, Class type) { int i, length; - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( type ) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(type); if (type.isPrimitive()) { if (type == Integer.TYPE) { - int[] array = (int[])((Object)obj); + int[] array = (int[]) ((Object) obj); length = array.length; out.write_ulong(length); out.write_long_array(array, 0, length); } else if (type == Byte.TYPE) { - byte[] array = (byte[])((Object)obj); + byte[] array = (byte[]) ((Object) obj); length = array.length; out.write_ulong(length); out.write_octet_array(array, 0, length); } else if (type == Long.TYPE) { - long[] array = (long[])((Object)obj); + long[] array = (long[]) ((Object) obj); length = array.length; out.write_ulong(length); out.write_longlong_array(array, 0, length); } else if (type == Float.TYPE) { - float[] array = (float[])((Object)obj); + float[] array = (float[]) ((Object) obj); length = array.length; out.write_ulong(length); out.write_float_array(array, 0, length); } else if (type == Double.TYPE) { - double[] array = (double[])((Object)obj); + double[] array = (double[]) ((Object) obj); length = array.length; out.write_ulong(length); out.write_double_array(array, 0, length); } else if (type == Short.TYPE) { - short[] array = (short[])((Object)obj); + short[] array = (short[]) ((Object) obj); length = array.length; out.write_ulong(length); out.write_short_array(array, 0, length); } else if (type == Character.TYPE) { - char[] array = (char[])((Object)obj); + char[] array = (char[]) ((Object) obj); length = array.length; out.write_ulong(length); writeCharArray(out, array, 0, length); } else if (type == Boolean.TYPE) { - boolean[] array = (boolean[])((Object)obj); + boolean[] array = (boolean[]) ((Object) obj); length = array.length; out.write_ulong(length); out.write_boolean_array(array, 0, length); } else { - throw Exceptions.self.invalidPrimitiveType( - obj.getClass().getName() ) ; + throw Exceptions.self.invalidPrimitiveType(obj.getClass().getName()); } } else if (type == java.lang.Object.class) { - Object[] array = (Object[])((Object)obj); + Object[] array = (Object[]) ((Object) obj); length = array.length; out.write_ulong(length); - for (i = 0; i < length; i++) { + for (i = 0; i < length; i++) { Util.getInstance().writeAny(out, array[i]); } } else { - Object[] array = (Object[])((Object)obj); + Object[] array = (Object[]) ((Object) obj); length = array.length; out.write_ulong(length); int callType = kValueType; - - if (cinfo.isInterface()) { + + if (cinfo.isInterface()) { String className = type.getName(); - + if (cinfo.isARemote(type)) { // RMI Object reference... callType = kRemoteType; @@ -498,24 +450,23 @@ private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, callType = kAbstractType; } } - + for (i = 0; i < length; i++) { switch (callType) { - case kRemoteType: + case kRemoteType: Util.getInstance().writeRemoteObject(out, array[i]); break; - case kAbstractType: - Util.getInstance().writeAbstractObject(out,array[i]); + case kAbstractType: + Util.getInstance().writeAbstractObject(out, array[i]); break; case kValueType: - try{ - out.write_value((java.io.Serializable)array[i]); - } catch(ClassCastException cce){ + try { + out.write_value((java.io.Serializable) array[i]); + } catch (ClassCastException cce) { if (array[i] instanceof java.io.Serializable) { throw cce; } else { - Utility.throwNotSerializableForCorba( - array[i].getClass().getName()); + Utility.throwNotSerializableForCorba(array[i].getClass().getName()); } } break; @@ -525,25 +476,17 @@ private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, } /** - * Encapsulates reading of Java char arrays so that the 1.3 subclass - * can override it without exposing internals across packages. This - * is a fix for bug 4367783. + * Encapsulates reading of Java char arrays so that the 1.3 subclass can override it without exposing internals across + * packages. This is a fix for bug 4367783. */ @ValueHandlerRead - private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, - char[] array, - int offset, - int length) - { + private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, char[] array, int offset, int length) { in.read_wchar_array(array, offset, length); } @ValueHandlerRead - private java.lang.Object read_Array( IIOPInputStream bridge, - org.omg.CORBA_2_3.portable.InputStream in, - Class sequence, com.sun.org.omg.SendingContext.CodeBase sender, - int offset) - { + private java.lang.Object read_Array(IIOPInputStream bridge, org.omg.CORBA_2_3.portable.InputStream in, Class sequence, + com.sun.org.omg.SendingContext.CodeBase sender, int offset) { try { // Read length of coming array int length = in.read_ulong(); @@ -556,54 +499,51 @@ private java.lang.Object read_Array( IIOPInputStream bridge, return null; } - - OperationTracer.startReadArray( sequence.getName(), length ) ; + + OperationTracer.startReadArray(sequence.getName(), length); Class componentType = sequence.getComponentType(); Class actualType = componentType; - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( - componentType ) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(componentType); if (componentType.isPrimitive()) { if (componentType == Integer.TYPE) { int[] array = new int[length]; in.read_long_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else if (componentType == Byte.TYPE) { byte[] array = new byte[length]; in.read_octet_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else if (componentType == Long.TYPE) { long[] array = new long[length]; in.read_longlong_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else if (componentType == Float.TYPE) { float[] array = new float[length]; in.read_float_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else if (componentType == Double.TYPE) { double[] array = new double[length]; in.read_double_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else if (componentType == Short.TYPE) { short[] array = new short[length]; in.read_short_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else if (componentType == Character.TYPE) { char[] array = new char[length]; readCharArray(in, array, 0, length); - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else if (componentType == Boolean.TYPE) { boolean[] array = new boolean[length]; in.read_boolean_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else { - throw Exceptions.self.invalidPrimitiveComponentType( - sequence.getName()); + throw Exceptions.self.invalidPrimitiveComponentType(sequence.getName()); } } else if (componentType == java.lang.Object.class) { - Object[] array = (Object[])java.lang.reflect.Array.newInstance( - componentType, length); + Object[] array = (Object[]) java.lang.reflect.Array.newInstance(componentType, length); // Store this object and its beginning position // since there might be indirections to it while @@ -613,51 +553,48 @@ private java.lang.Object read_Array( IIOPInputStream bridge, for (i = 0; i < length; i++) { Object objectValue = null; try { - OperationTracer.readingIndex( i ) ; + OperationTracer.readingIndex(i); objectValue = Util.getInstance().readAny(in); - } catch(IndirectionException cdrie) { + } catch (IndirectionException cdrie) { try { - // The CDR stream had never seen the given offset - // before, so check the recursion manager (it will - // throw an IOException if it doesn't have a + // The CDR stream had never seen the given offset + // before, so check the recursion manager (it will + // throw an IOException if it doesn't have a // reference, either). - objectValue = bridge.activeRecursionMgr.getObject( - cdrie.offset); + objectValue = bridge.activeRecursionMgr.getObject(cdrie.offset); } catch (IOException ie) { // Translate to a MARSHAL exception since // ValueHandlers aren't allowed to throw // IOExceptions - throw utilWrapper.invalidIndirection( ie, - cdrie.offset ) ; + throw utilWrapper.invalidIndirection(ie, cdrie.offset); } } - + array[i] = objectValue; } - return ((java.io.Serializable)((Object)array)); + return ((java.io.Serializable) ((Object) array)); } else { - Object[] array = (Object[])java.lang.reflect.Array.newInstance( - componentType, length); + Object[] array = (Object[]) java.lang.reflect.Array.newInstance(componentType, length); // Store this object and its beginning position // since there might be indirections to it while - // it's been unmarshalled. + // it's been unmarshalled. bridge.activeRecursionMgr.addObject(offset, array); // Decide what method call to make based on the componentType. // If it is a componentType for which we need to load a stub, // convert the componentType to the correct stub type. - + int callType = kValueType; boolean narrow = false; - + if (cinfo.isInterface()) { boolean loadStubClass = false; // String className = componentType.getName(); - + if (cinfo.isARemote(componentType)) { // RMI Object reference... callType = kRemoteType; - + // for better performance, load the stub class once // instead of for each element of the array loadStubClass = true; @@ -669,21 +606,16 @@ private java.lang.Object read_Array( IIOPInputStream bridge, // IDL Abstract Object reference... callType = kAbstractType; loadStubClass = true; - } else if (ObjectStreamClassCorbaExt.isAbstractInterface( - componentType)) { + } else if (ObjectStreamClassCorbaExt.isAbstractInterface(componentType)) { // RMI Abstract Object reference... callType = kAbstractType; } if (loadStubClass) { try { - String codebase = Util.getInstance().getCodebase( - componentType); - String repID = RepositoryId.createForAnyType( - componentType); - Class stubType = - Utility.loadStubClass(repID, codebase, - componentType); + String codebase = Util.getInstance().getCodebase(componentType); + String repID = RepositoryId.createForAnyType(componentType); + Class stubType = Utility.loadStubClass(repID, codebase, componentType); actualType = stubType; } catch (ClassNotFoundException e) { narrow = true; @@ -694,122 +626,109 @@ private java.lang.Object read_Array( IIOPInputStream bridge, } for (i = 0; i < length; i++) { - + try { - OperationTracer.readingIndex( i ) ; + OperationTracer.readingIndex(i); switch (callType) { - case kRemoteType: + case kRemoteType: if (!narrow) { - array[i] = (Object)in.read_Object(actualType); + array[i] = (Object) in.read_Object(actualType); } else { - array[i] = Utility.readObjectAndNarrow(in, - actualType); + array[i] = Utility.readObjectAndNarrow(in, actualType); } break; - case kAbstractType: + case kAbstractType: if (!narrow) { - array[i] = in.read_abstract_interface( - actualType); + array[i] = in.read_abstract_interface(actualType); } else { - array[i] = Utility.readAbstractAndNarrow(in, - actualType); + array[i] = Utility.readAbstractAndNarrow(in, actualType); } break; case kValueType: - array[i] = (Object)in.read_value(actualType); + array[i] = (Object) in.read_value(actualType); break; } - } catch(IndirectionException cdrie) { + } catch (IndirectionException cdrie) { // The CDR stream had never seen the given offset before, // so check the recursion manager (it will throw an // IOException if it doesn't have a reference, either). try { - array[i] = bridge.activeRecursionMgr.getObject( - cdrie.offset); + array[i] = bridge.activeRecursionMgr.getObject(cdrie.offset); } catch (IOException ioe) { // Translate to a MARSHAL exception since // ValueHandlers aren't allowed to throw // IOExceptions - throw utilWrapper.invalidIndirection( ioe, - cdrie.offset ) ; + throw utilWrapper.invalidIndirection(ioe, cdrie.offset); } } - + } - - return ((java.io.Serializable)((Object)array)); + + return ((java.io.Serializable) ((Object) array)); } } finally { - // We've completed deserializing this object. Any + // We've completed deserializing this object. Any // future indirections will be handled correctly at the - // CDR level. The ActiveRecursionManager only deals with + // CDR level. The ActiveRecursionManager only deals with // objects currently being deserialized. bridge.activeRecursionMgr.removeObject(offset); if (sequence != null) { - OperationTracer.endReadArray() ; + OperationTracer.endReadArray(); } } } - private boolean isArray(String repId){ + private boolean isArray(String repId) { return RepositoryId.cache.getId(repId).isSequence(); } private IIOPOutputStream createOutputStream() { if (System.getSecurityManager() != null) { - return AccessController.doPrivileged( - new PrivilegedAction() { - public IIOPOutputStream run() { - try { - return new IIOPOutputStream() ; - } catch (IOException exc) { - throw utilWrapper.exceptionInCreateIiopOutputStream( - exc ) ; - } + return AccessController.doPrivileged(new PrivilegedAction() { + public IIOPOutputStream run() { + try { + return new IIOPOutputStream(); + } catch (IOException exc) { + throw utilWrapper.exceptionInCreateIiopOutputStream(exc); } } - ); + }); } else { try { - return new IIOPOutputStream() ; + return new IIOPOutputStream(); } catch (IOException exc) { - throw utilWrapper.exceptionInCreateIiopOutputStream( exc ) ; + throw utilWrapper.exceptionInCreateIiopOutputStream(exc); } } } private IIOPInputStream createInputStream() { if (System.getSecurityManager() != null) { - return AccessController.doPrivileged( - new PrivilegedAction() { - public IIOPInputStream run() { - try { - return new IIOPInputStream() ; - } catch (IOException exc) { - throw utilWrapper.exceptionInCreateIiopInputStream( - exc ) ; - } + return AccessController.doPrivileged(new PrivilegedAction() { + public IIOPInputStream run() { + try { + return new IIOPInputStream(); + } catch (IOException exc) { + throw utilWrapper.exceptionInCreateIiopInputStream(exc); } } - ); + }); } else { try { - return new IIOPInputStream() ; + return new IIOPInputStream(); } catch (IOException exc) { - throw utilWrapper.exceptionInCreateIiopInputStream( exc ) ; + throw utilWrapper.exceptionInCreateIiopInputStream(exc); } } } /** - * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. - * The correct behavior is for a Java char to map to a CORBA wchar, - * but our older code mapped it to a CORBA char. + * Our JDK 1.3 and JDK 1.3.1 behavior subclasses override this. The correct behavior is for a Java char to map to a + * CORBA wchar, but our older code mapped it to a CORBA char. */ TCKind getJavaCharTCKind() { return TCKind.tk_wchar; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ValueUtility.java b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ValueUtility.java index 68b42a9d0..e5f4798b1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/io/ValueUtility.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/io/ValueUtility.java @@ -34,76 +34,73 @@ import javax.rmi.CORBA.ValueHandler; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; import java.lang.reflect.Modifier; import java.util.Stack; import org.glassfish.pfl.basic.contain.Pair; /** - * Holds utility methods for converting from ObjectStreamClass to - * FullValueDescription and generating typecodes from ObjectStreamClass. + * Holds utility methods for converting from ObjectStreamClass to FullValueDescription and generating typecodes from + * ObjectStreamClass. **/ public class ValueUtility { public static final short PRIVATE_MEMBER = 0; public static final short PUBLIC_MEMBER = 1; - - private static final String primitiveConstants[] = { - null, // tk_null 0 - null, // tk_void 1 - "S", // tk_short 2 - "I", // tk_long 3 - "S", // tk_ushort 4 - "I", // tk_ulong 5 - "F", // tk_float 6 - "D", // tk_double 7 - "Z", // tk_boolean 8 - "C", // tk_char 9 - "B", // tk_octet 10 - null, // tk_any 11 - null, // tk_typecode 12 - null, // tk_principal 13 - null, // tk_objref 14 - null, // tk_struct 15 - null, // tk_union 16 - null, // tk_enum 17 - null, // tk_string 18 - null, // tk_sequence 19 - null, // tk_array 20 - null, // tk_alias 21 - null, // tk_except 22 - "J", // tk_longlong 23 - "J", // tk_ulonglong 24 - "D", // tk_longdouble 25 - "C", // tk_wchar 26 - null, // tk_wstring 27 - null, // tk_fixed 28 - null, // tk_value 29 - null, // tk_value_box 30 - null, // tk_native 31 - null, // tk_abstract_interface 32 + + private static final String primitiveConstants[] = { null, // tk_null 0 + null, // tk_void 1 + "S", // tk_short 2 + "I", // tk_long 3 + "S", // tk_ushort 4 + "I", // tk_ulong 5 + "F", // tk_float 6 + "D", // tk_double 7 + "Z", // tk_boolean 8 + "C", // tk_char 9 + "B", // tk_octet 10 + null, // tk_any 11 + null, // tk_typecode 12 + null, // tk_principal 13 + null, // tk_objref 14 + null, // tk_struct 15 + null, // tk_union 16 + null, // tk_enum 17 + null, // tk_string 18 + null, // tk_sequence 19 + null, // tk_array 20 + null, // tk_alias 21 + null, // tk_except 22 + "J", // tk_longlong 23 + "J", // tk_ulonglong 24 + "D", // tk_longdouble 25 + "C", // tk_wchar 26 + null, // tk_wstring 27 + null, // tk_fixed 28 + null, // tk_value 29 + null, // tk_value_box 30 + null, // tk_native 31 + null, // tk_abstract_interface 32 }; - + static { SharedSecrets.setJavaCorbaAccess(new JavaCorbaAccess() { - @Override - public ValueHandlerImpl newValueHandlerImpl() { - return ValueHandlerImpl.getInstance(); - } + @Override + public ValueHandlerImpl newValueHandlerImpl() { + return ValueHandlerImpl.getInstance(); + } }); } - public static String getSignature(ValueMember member) - throws ClassNotFoundException { + public static String getSignature(ValueMember member) throws ClassNotFoundException { - // REVISIT. Can the type be something that is + // REVISIT. Can the type be something that is // non-primitive yet not a value_box, value, or objref? // If so, should use ObjectStreamClass or throw // exception. - if (member.type.kind().value() == TCKind._tk_value_box || - member.type.kind().value() == TCKind._tk_value || - member.type.kind().value() == TCKind._tk_objref) { + if (member.type.kind().value() == TCKind._tk_value_box || member.type.kind().value() == TCKind._tk_value + || member.type.kind().value() == TCKind._tk_objref) { Class c = RepositoryId.cache.getId(member.id).getClassFromType(); return ObjectStreamClass.getSignature(c); @@ -111,12 +108,11 @@ public static String getSignature(ValueMember member) return primitiveConstants[member.type.kind().value()]; } - + } - public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, - ValueHandler vh){ - + public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh) { + // Create FullValueDescription FullValueDescription result = new FullValueDescription(); Class className = osc.forClass(); @@ -135,9 +131,8 @@ public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, result.id = ""; // Set FVD is_abstract - result.is_abstract = - ObjectStreamClassCorbaExt.isAbstractInterface(className); - + result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className); + // Set FVD is_custom result.is_custom = osc.hasWriteObject() || osc.isExternalizable(); @@ -146,7 +141,7 @@ public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, if (result.defined_in == null) result.defined_in = ""; - // Set FVD version + // Set FVD version result.version = vhandler.getSerialVersionUID(repId); if (result.version == null) result.version = ""; @@ -158,92 +153,82 @@ public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, result.attributes = new AttributeDescription[0]; // Set FVD members - // Maps classes to repositoryIDs strings. + // Maps classes to repositoryIDs strings. // This is used to detect recursive types. IdentityKeyValueStack createdIDs = new IdentityKeyValueStack(); - - // Stores all types created for resolving indirect types at the end. + + // Stores all types created for resolving indirect types at the end. result.members = translateMembers(orb, osc, vh, createdIDs); - + // Skip FVD initializers - N/A result.initializers = new Initializer[0]; - + Class interfaces[] = osc.forClass().getInterfaces(); int abstractCount = 0; // Skip FVD supported_interfaces - result.supported_interfaces = new String[interfaces.length]; - for (int interfaceIndex = 0; interfaceIndex < interfaces.length; - interfaceIndex++) { - result.supported_interfaces[interfaceIndex] = - vhandler.createForAnyType(interfaces[interfaceIndex]); - - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( - interfaces[interfaceIndex] ) ; - if (!cinfo.isARemote(interfaces[interfaceIndex]) || - (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers()))) + result.supported_interfaces = new String[interfaces.length]; + for (int interfaceIndex = 0; interfaceIndex < interfaces.length; interfaceIndex++) { + result.supported_interfaces[interfaceIndex] = vhandler.createForAnyType(interfaces[interfaceIndex]); + + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(interfaces[interfaceIndex]); + if (!cinfo.isARemote(interfaces[interfaceIndex]) || (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers()))) abstractCount++; } - + // Skip FVD abstract_base_values - N/A result.abstract_base_values = new String[abstractCount]; - for (int interfaceIndex = 0; interfaceIndex < interfaces.length; - interfaceIndex++) { - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( - interfaces[interfaceIndex] ) ; - if (!cinfo.isARemote(interfaces[interfaceIndex]) || - (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers()))) - result.abstract_base_values[interfaceIndex] = - vhandler.createForAnyType(interfaces[interfaceIndex]); - + for (int interfaceIndex = 0; interfaceIndex < interfaces.length; interfaceIndex++) { + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(interfaces[interfaceIndex]); + if (!cinfo.isARemote(interfaces[interfaceIndex]) || (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers()))) + result.abstract_base_values[interfaceIndex] = vhandler.createForAnyType(interfaces[interfaceIndex]); + } - + result.is_truncatable = false; - + // Set FVD base_value Class superClass = osc.forClass().getSuperclass(); - if (ClassInfoCache.get( superClass ).isASerializable(superClass)) + if (ClassInfoCache.get(superClass).isASerializable(superClass)) result.base_value = vhandler.getRMIRepositoryID(superClass); - else + else result.base_value = ""; - + // Set FVD type - //result.type = createTypeCodeForClass(orb, osc.forClass()); - result.type = orb.get_primitive_tc(TCKind.tk_value); + // result.type = createTypeCodeForClass(orb, osc.forClass()); + result.type = orb.get_primitive_tc(TCKind.tk_value); return result; } - private static ValueMember[] translateMembers( ORB orb, - ObjectStreamClass osc, ValueHandler vh, - IdentityKeyValueStack createdIDs) { + private static ValueMember[] translateMembers(ORB orb, ObjectStreamClass osc, ValueHandler vh, IdentityKeyValueStack createdIDs) { ValueHandlerImpl vhandler = (com.sun.corba.ee.impl.io.ValueHandlerImpl) vh; ObjectStreamField fields[] = osc.getFields(); int fieldsLength = fields.length; ValueMember[] members = new ValueMember[fieldsLength]; // Note : fields come out of ObjectStreamClass in correct order for - // writing. So, we will create the same order in the members array. + // writing. So, we will create the same order in the members array. for (int i = 0; i < fieldsLength; i++) { String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz()); members[i] = new ValueMember(); members[i].name = fields[i].getName(); - + // _REVISIT_ : Manglings - members[i].id = valRepId; + members[i].id = valRepId; // _REVISIT_ : Manglings members[i].defined_in = vhandler.getDefinedInId(valRepId); members[i].version = "1.0"; - // _REVISIT_ : IDLType implementation missing - members[i].type_def = new _IDLTypeStub(); + // _REVISIT_ : IDLType implementation missing + members[i].type_def = new _IDLTypeStub(); if (fields[i].getField() == null) { // When using serialPersistentFields, the class may // no longer have an actual Field that corresponds - // to one of the items. The Java to IDL spec + // to one of the items. The Java to IDL spec // ptc-00-01-06 1.3.5.6 says that the IDL field // should be private in this case. members[i].access = PRIVATE_MEMBER; @@ -257,37 +242,35 @@ private static ValueMember[] translateMembers( ORB orb, switch (fields[i].getTypeCode()) { case 'B': - members[i].type = orb.get_primitive_tc(TCKind.tk_octet); + members[i].type = orb.get_primitive_tc(TCKind.tk_octet); break; case 'C': - members[i].type - = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); + members[i].type = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); break; case 'F': - members[i].type = orb.get_primitive_tc(TCKind.tk_float); + members[i].type = orb.get_primitive_tc(TCKind.tk_float); break; - case 'D' : - members[i].type = orb.get_primitive_tc(TCKind.tk_double); + case 'D': + members[i].type = orb.get_primitive_tc(TCKind.tk_double); break; case 'I': - members[i].type = orb.get_primitive_tc(TCKind.tk_long); + members[i].type = orb.get_primitive_tc(TCKind.tk_long); break; case 'J': - members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); + members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); break; case 'S': - members[i].type = orb.get_primitive_tc(TCKind.tk_short); + members[i].type = orb.get_primitive_tc(TCKind.tk_short); break; case 'Z': - members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); + members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); break; - // case '[': - // members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); - // members[i].id = RepositoryId.createForAnyType(fields[i].getType()); - // break; + // case '[': + // members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); + // members[i].id = RepositoryId.createForAnyType(fields[i].getType()); + // break; default: - members[i].type = createTypeCodeForClassInternal(orb, - fields[i].getClazz(), vhandler, createdIDs); + members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler, createdIDs); members[i].id = vhandler.createForAnyType(fields[i].getType()); break; } // end switch @@ -297,48 +280,45 @@ private static ValueMember[] translateMembers( ORB orb, return members; } - private static boolean exists(String str, String strs[]){ + private static boolean exists(String str, String strs[]) { for (int i = 0; i < strs.length; i++) if (str.equals(strs[i])) return true; - + return false; } - public static boolean isAssignableFrom(String clzRepositoryId, - FullValueDescription type, com.sun.org.omg.SendingContext.CodeBase sender){ - + public static boolean isAssignableFrom(String clzRepositoryId, FullValueDescription type, + com.sun.org.omg.SendingContext.CodeBase sender) { + if (exists(clzRepositoryId, type.supported_interfaces)) return true; if (clzRepositoryId.equals(type.id)) return true; - - if ((type.base_value != null) && - (!type.base_value.equals(""))) { + + if ((type.base_value != null) && (!type.base_value.equals(""))) { FullValueDescription parent = sender.meta(type.base_value); - + return isAssignableFrom(clzRepositoryId, parent, sender); } return false; } - public static TypeCode createTypeCodeForClass( ORB orb, java.lang.Class c, - ValueHandler vh) { - - // Maps classes to repositoryIDs strings. + public static TypeCode createTypeCodeForClass(ORB orb, java.lang.Class c, ValueHandler vh) { + + // Maps classes to repositoryIDs strings. // This is used to detect recursive types. IdentityKeyValueStack createdIDs = new IdentityKeyValueStack(); - - // Stores all types created for resolving indirect types at the end. + + // Stores all types created for resolving indirect types at the end. TypeCode tc = createTypeCodeForClassInternal(orb, c, vh, createdIDs); return tc; } - private static TypeCode createTypeCodeForClassInternal( ORB orb, - java.lang.Class c, ValueHandler vh, IdentityKeyValueStack createdIDs) { + private static TypeCode createTypeCodeForClassInternal(ORB orb, java.lang.Class c, ValueHandler vh, IdentityKeyValueStack createdIDs) { // This wrapper method is the protection against infinite recursion. TypeCode tc = null; @@ -347,7 +327,8 @@ private static TypeCode createTypeCodeForClassInternal( ORB orb, return orb.create_recursive_tc(id); } else { id = vh.getRMIRepositoryID(c); - if (id == null) id = ""; + if (id == null) + id = ""; // cache the rep id BEFORE creating a new typecode. // so that recursive tc can look up the rep id. createdIDs.push(c, id); @@ -359,14 +340,14 @@ private static TypeCode createTypeCodeForClassInternal( ORB orb, // Maintains a stack of key-value pairs. Compares elements using == operator. private static class IdentityKeyValueStack { - Stack,String>> pairs = null ; + Stack, String>> pairs = null; String get(Class key) { if (pairs == null) { return null; } - for (Pair,String> pair : pairs ) { + for (Pair, String> pair : pairs) { if (pair.first() == key) { return pair.second(); } @@ -377,9 +358,9 @@ String get(Class key) { void push(Class key, String value) { if (pairs == null) { - pairs = new Stack,String>>(); + pairs = new Stack, String>>(); } - pairs.push(new Pair,String>(key, value)); + pairs.push(new Pair, String>(key, value)); } void pop() { @@ -387,66 +368,59 @@ void pop() { } } - private static TypeCode createTypeCodeInternal (ORB orb, java.lang.Class c, - ValueHandler vh, String id, IdentityKeyValueStack createdIDs) { + private static TypeCode createTypeCodeInternal(ORB orb, java.lang.Class c, ValueHandler vh, String id, + IdentityKeyValueStack createdIDs) { - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( c ) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(c); if (cinfo.isArray()) { // Arrays - may recurse for multi-dimensional arrays Class componentClass = c.getComponentType(); TypeCode embeddedType; if (componentClass.isPrimitive()) { - embeddedType = ValueUtility.getPrimitiveTypeCodeForClass( orb, - componentClass, vh); + embeddedType = ValueUtility.getPrimitiveTypeCodeForClass(orb, componentClass, vh); } else { - embeddedType = createTypeCodeForClassInternal(orb, - componentClass, vh, createdIDs); + embeddedType = createTypeCodeForClassInternal(orb, componentClass, vh, createdIDs); } - TypeCode t = orb.create_sequence_tc (0, embeddedType); - return orb.create_value_box_tc (id, "Sequence", t); - } else if ( c == java.lang.String.class ) { + TypeCode t = orb.create_sequence_tc(0, embeddedType); + return orb.create_value_box_tc(id, "Sequence", t); + } else if (c == java.lang.String.class) { // Strings - TypeCode t = orb.create_string_tc (0); - return orb.create_value_box_tc (id, "StringValue", t); + TypeCode t = orb.create_string_tc(0); + return orb.create_value_box_tc(id, "StringValue", t); } else if (cinfo.isARemote(c)) { return orb.get_primitive_tc(TCKind.tk_objref); } else if (cinfo.isACORBAObject(c)) { return orb.get_primitive_tc(TCKind.tk_objref); - } - + } + // Anything else ObjectStreamClass osc = ObjectStreamClass.lookup(c); if (osc == null) { - return orb.create_value_box_tc (id, "Value", - orb.get_primitive_tc (TCKind.tk_value)); + return orb.create_value_box_tc(id, "Value", orb.get_primitive_tc(TCKind.tk_value)); } // type modifier // REVISIT truncatable and abstract? - short modifier = (osc.isCustomMarshaled() ? - org.omg.CORBA.VM_CUSTOM.value : org.omg.CORBA.VM_NONE.value); + short modifier = (osc.isCustomMarshaled() ? org.omg.CORBA.VM_CUSTOM.value : org.omg.CORBA.VM_NONE.value); // concrete base TypeCode base = null; Class superClass = c.getSuperclass(); - if (superClass != null && - ClassInfoCache.get( superClass ).isASerializable( superClass )) { - base = createTypeCodeForClassInternal(orb, superClass, vh, - createdIDs); + if (superClass != null && ClassInfoCache.get(superClass).isASerializable(superClass)) { + base = createTypeCodeForClassInternal(orb, superClass, vh, createdIDs); } // members - ValueMember[] members = translateMembers (orb, osc, vh, createdIDs); + ValueMember[] members = translateMembers(orb, osc, vh, createdIDs); return orb.create_value_tc(id, c.getName(), modifier, base, members); } - public static TypeCode getPrimitiveTypeCodeForClass (ORB orb, - Class c, ValueHandler vh) { - + public static TypeCode getPrimitiveTypeCodeForClass(ORB orb, Class c, ValueHandler vh) { + if (c == Integer.TYPE) { return orb.get_primitive_tc(TCKind.tk_long); } else if (c == Byte.TYPE) { @@ -458,15 +432,14 @@ public static TypeCode getPrimitiveTypeCodeForClass (ORB orb, } else if (c == Double.TYPE) { return orb.get_primitive_tc(TCKind.tk_double); } else if (c == Short.TYPE) { - return orb.get_primitive_tc (TCKind.tk_short); + return orb.get_primitive_tc(TCKind.tk_short); } else if (c == Character.TYPE) { - return orb.get_primitive_tc( - ((ValueHandlerImpl)vh).getJavaCharTCKind()); + return orb.get_primitive_tc(((ValueHandlerImpl) vh).getJavaCharTCKind()); } else if (c == Boolean.TYPE) { - return orb.get_primitive_tc (TCKind.tk_boolean); + return orb.get_primitive_tc(TCKind.tk_boolean); } else { // _REVISIT_ Not sure if this is right. - return orb.get_primitive_tc (TCKind.tk_any); + return orb.get_primitive_tc(TCKind.tk_any); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ByteBuffer.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ByteBuffer.java index 9083e2044..46eb5ab64 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ByteBuffer.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ByteBuffer.java @@ -17,22 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; - +package com.sun.corba.ee.impl.ior; public class ByteBuffer { /** - * The array buffer into which the components of the ByteBuffer are - * stored. The capacity of the ByteBuffer is the length of this array buffer, - * and is at least large enough to contain all the ByteBuffer's elements.

+ * The array buffer into which the components of the ByteBuffer are stored. The capacity of the ByteBuffer is the length + * of this array buffer, and is at least large enough to contain all the ByteBuffer's elements. + *

* * Any array elements following the last element in the ByteBuffer are 0. */ protected byte elementData[]; /** - * The number of valid components in this ByteBuffer object. - * Components elementData[0] through + * The number of valid components in this ByteBuffer object. Components elementData[0] through * elementData[elementCount-1] are the actual items. * * @serial @@ -40,62 +38,52 @@ public class ByteBuffer { protected int elementCount; /** - * The amount by which the capacity of the ByteBuffer is automatically - * incremented when its size becomes greater than its capacity. If - * the capacity increment is less than or equal to zero, the capacity - * of the ByteBuffer is doubled each time it needs to grow. + * The amount by which the capacity of the ByteBuffer is automatically incremented when its size becomes greater than + * its capacity. If the capacity increment is less than or equal to zero, the capacity of the ByteBuffer is doubled each + * time it needs to grow. * * @serial */ protected int capacityIncrement; /** - * Constructs an empty ByteBuffer with the specified initial capacity and - * capacity increment. + * Constructs an empty ByteBuffer with the specified initial capacity and capacity increment. * - * @param initialCapacity the initial capacity of the ByteBuffer. - * @param capacityIncrement the amount by which the capacity is - * increased when the ByteBuffer overflows. - * @exception IllegalArgumentException if the specified initial capacity - * is negative + * @param initialCapacity the initial capacity of the ByteBuffer. + * @param capacityIncrement the amount by which the capacity is increased when the ByteBuffer overflows. + * @exception IllegalArgumentException if the specified initial capacity is negative */ public ByteBuffer(int initialCapacity, int capacityIncrement) { super(); if (initialCapacity < 0) - throw new IllegalArgumentException("Illegal Capacity: "+ - initialCapacity); + throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity); this.elementData = new byte[initialCapacity]; this.capacityIncrement = capacityIncrement; } /** - * Constructs an empty ByteBuffer with the specified initial capacity and - * with its capacity increment equal to zero. + * Constructs an empty ByteBuffer with the specified initial capacity and with its capacity increment equal to zero. * - * @param initialCapacity the initial capacity of the ByteBuffer. - * @exception IllegalArgumentException if the specified initial capacity - * is negative + * @param initialCapacity the initial capacity of the ByteBuffer. + * @exception IllegalArgumentException if the specified initial capacity is negative */ public ByteBuffer(int initialCapacity) { this(initialCapacity, 0); } /** - * Constructs an empty ByteBuffer so that its internal data array - * has size 10 and its standard capacity increment is - * zero. + * Constructs an empty ByteBuffer so that its internal data array has size 10 and its standard capacity + * increment is zero. */ public ByteBuffer() { this(200); } /** - * Trims the capacity of this ByteBuffer to be the ByteBuffer's current - * size. If the capacity of this cector is larger than its current - * size, then the capacity is changed to equal the size by replacing - * its internal data array, kept in the field elementData, - * with a smaller one. An application can use this operation to - * minimize the storage of a ByteBuffer. + * Trims the capacity of this ByteBuffer to be the ByteBuffer's current size. If the capacity of this cector is larger + * than its current size, then the capacity is changed to equal the size by replacing its internal data array, kept in + * the field elementData, with a smaller one. An application can use this operation to minimize the storage of + * a ByteBuffer. */ public void trimToSize() { int oldCapacity = elementData.length; @@ -107,19 +95,16 @@ public void trimToSize() { } /** - * This implements the unsynchronized semantics of ensureCapacity. - * Synchronized methods in this class can internally call this - * method for ensuring capacity without incurring the cost of an - * extra synchronization. + * This implements the unsynchronized semantics of ensureCapacity. Synchronized methods in this class can internally + * call this method for ensuring capacity without incurring the cost of an extra synchronization. * * @see java.util.ByteBuffer#ensureCapacity(int) - */ + */ private void ensureCapacityHelper(int minCapacity) { int oldCapacity = elementData.length; if (minCapacity > oldCapacity) { byte oldData[] = elementData; - int newCapacity = (capacityIncrement > 0) ? - (oldCapacity + capacityIncrement) : (oldCapacity * 2); + int newCapacity = (capacityIncrement > 0) ? (oldCapacity + capacityIncrement) : (oldCapacity * 2); if (newCapacity < minCapacity) { newCapacity = minCapacity; } @@ -131,9 +116,8 @@ private void ensureCapacityHelper(int minCapacity) { /** * Returns the current capacity of this ByteBuffer. * - * @return the current capacity (the length of its internal - * data arary, kept in the field elementData - * of this ByteBuffer. + * @return the current capacity (the length of its internal data arary, kept in the field elementData of this + * ByteBuffer. */ public int capacity() { return elementData.length; @@ -142,7 +126,7 @@ public int capacity() { /** * Returns the number of components in this ByteBuffer. * - * @return the number of components in this ByteBuffer. + * @return the number of components in this ByteBuffer. */ public int size() { return elementCount; @@ -151,52 +135,47 @@ public int size() { /** * Tests if this ByteBuffer has no components. * - * @return true if and only if this ByteBuffer has - * no components, that is, its size is zero; - * false otherwise. + * @return true if and only if this ByteBuffer has no components, that is, its size is zero; + * false otherwise. */ public boolean isEmpty() { return elementCount == 0; } - public void append(byte value) - { + public void append(byte value) { ensureCapacityHelper(elementCount + 1); elementData[elementCount++] = value; } - public void append( int value ) - { + public void append(int value) { ensureCapacityHelper(elementCount + 4); - doAppend( value ) ; + doAppend(value); } - private void doAppend( int value ) - { - int current = value ; - for (int ctr=0; ctr<4; ctr++) { - elementData[elementCount+ctr] = (byte)(current & 255) ; - current = current >> 8 ; + private void doAppend(int value) { + int current = value; + for (int ctr = 0; ctr < 4; ctr++) { + elementData[elementCount + ctr] = (byte) (current & 255); + current = current >> 8; } - elementCount += 4 ; + elementCount += 4; } - public void append( String value ) - { - byte[] data = value.getBytes() ; - ensureCapacityHelper( elementCount + data.length + 4 ) ; - doAppend( data.length ) ; - System.arraycopy( data, 0, elementData, elementCount, data.length ) ; - elementCount += data.length ; + public void append(String value) { + byte[] data = value.getBytes(); + ensureCapacityHelper(elementCount + data.length + 4); + doAppend(data.length); + System.arraycopy(data, 0, elementData, elementCount, data.length); + elementCount += data.length; } /** - * Returns an array containing all of the elements in this ByteBuffer - * in the correct order. + * Returns an array containing all of the elements in this ByteBuffer in the correct order. + * * @return Array of elements in the buffer * @since 1.2 */ public byte[] toArray() { - return (byte[])elementData.clone() ; + return (byte[]) elementData.clone(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/EncapsulationUtility.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/EncapsulationUtility.java index c26e1a9cd..35ae9ef11 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/EncapsulationUtility.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/EncapsulationUtility.java @@ -22,120 +22,113 @@ import java.util.List; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; +import org.omg.CORBA_2_3.portable.InputStream; -import com.sun.corba.ee.spi.ior.Identifiable ; -import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder ; -import com.sun.corba.ee.spi.ior.WriteContents ; +import com.sun.corba.ee.spi.ior.Identifiable; +import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder; +import com.sun.corba.ee.spi.ior.WriteContents; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.impl.encoding.CDROutputObject ; -import com.sun.corba.ee.impl.encoding.EncapsOutputStream ; +import com.sun.corba.ee.impl.encoding.CDROutputObject; +import com.sun.corba.ee.impl.encoding.EncapsOutputStream; import com.sun.corba.ee.impl.encoding.OutputStreamFactory; -import com.sun.corba.ee.impl.encoding.EncapsInputStream ; +import com.sun.corba.ee.impl.encoding.EncapsInputStream; import com.sun.corba.ee.impl.encoding.EncapsInputStreamFactory; /** - * This static utility class contains various utility methods for reading and - * writing CDR encapsulations. + * This static utility class contains various utility methods for reading and writing CDR encapsulations. * * @author Ken Cavanaugh */ -public final class EncapsulationUtility -{ - private EncapsulationUtility() - { +public final class EncapsulationUtility { + private EncapsulationUtility() { } - /** Read the count from is, then read count Identifiables from - * is using the factory. Add each constructed Identifiable to container. + /** + * Read the count from is, then read count Identifiables from is using the factory. Add each constructed Identifiable to + * container. + * * @param extends {@link Identifiable} * @param container List to add constructed Identifiables to * @param finder Factory to use in creation * @param istr Stream to read from */ - public static void readIdentifiableSequence( - List container, - IdentifiableFactoryFinder finder, InputStream istr) - { - int count = istr.read_long() ; - for (int ctr = 0; ctr void readIdentifiableSequence(List container, IdentifiableFactoryFinder finder, + InputStream istr) { + int count = istr.read_long(); + for (int ctr = 0; ctr < count; ctr++) { + int id = istr.read_long(); + E obj = finder.create(id, istr); + container.add(obj); } } - /** Write all Identifiables that we contain to os. The total - * length must be written before this method is called. + /** + * Write all Identifiables that we contain to os. The total length must be written before this method is called. + * * @param extends {@link Identifiable} * @param container List of Identifiables * @param os Stream to write to */ public static void writeIdentifiableSequence(List container, OutputStream os) { - os.write_long( container.size() ) ; + os.write_long(container.size()); for (Identifiable obj : container) { - os.write_long( obj.getId() ) ; - obj.write( os ) ; + os.write_long(obj.getId()); + obj.write(os); } } - /** Helper method that is used to extract data from an output - * stream and write the data to another output stream. Defined - * as static so that it can be used in another class. + /** + * Helper method that is used to extract data from an output stream and write the data to another output stream. Defined + * as static so that it can be used in another class. + * * @param dataStream Stream to get data from * @param os Stream to write to - */ - public static void writeOutputStream( OutputStream dataStream, - OutputStream os ) - { - byte[] data = ((CDROutputObject)dataStream).toByteArray() ; - os.write_long( data.length ) ; - os.write_octet_array( data, 0, data.length ) ; + */ + public static void writeOutputStream(OutputStream dataStream, OutputStream os) { + byte[] data = ((CDROutputObject) dataStream).toByteArray(); + os.write_long(data.length); + os.write_octet_array(data, 0, data.length); } - /** Helper method to read the octet array from is, deencapsulate it, - * and return - * as another InputStream. This must be called inside the - * constructor of a derived class to obtain the correct stream - * for unmarshalling data. + /** + * Helper method to read the octet array from is, deencapsulate it, and return as another InputStream. This must be + * called inside the constructor of a derived class to obtain the correct stream for unmarshalling data. + * * @param orb The ORB * @param is Stream to read from * @return Deencapsulated InputStream - */ - public static InputStream getEncapsulationStream( ORB orb, InputStream is ) - { - byte[] data = readOctets( is ) ; - EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( orb, data, - data.length ) ; - result.consumeEndian() ; - return result ; - } - - /** Helper method that reads an octet array from an input stream. - * Defined as static here so that it can be used in another class. - * @param is Stream to read from - * @return Array of bytes from stream - */ - public static byte[] readOctets( InputStream is ) - { - int len = is.read_ulong() ; - byte[] data = new byte[len] ; - is.read_octet_array( data, 0, len ) ; - return data ; + */ + public static InputStream getEncapsulationStream(ORB orb, InputStream is) { + byte[] data = readOctets(is); + EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream(orb, data, data.length); + result.consumeEndian(); + return result; + } + + /** + * Helper method that reads an octet array from an input stream. Defined as static here so that it can be used in + * another class. + * + * @param is Stream to read from + * @return Array of bytes from stream + */ + public static byte[] readOctets(InputStream is) { + int len = is.read_ulong(); + byte[] data = new byte[len]; + is.read_octet_array(data, 0, len); + return data; } - public static void writeEncapsulation( WriteContents obj, - OutputStream os ) - { - EncapsOutputStream out = OutputStreamFactory.newEncapsOutputStream( (ORB)os.orb() ) ; + public static void writeEncapsulation(WriteContents obj, OutputStream os) { + EncapsOutputStream out = OutputStreamFactory.newEncapsOutputStream((ORB) os.orb()); - out.putEndian() ; + out.putEndian(); - obj.writeContents( out ) ; + obj.writeContents(out); - writeOutputStream( out, os ) ; + writeOutputStream(out, os); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/FreezableList.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/FreezableList.java index dcb8f108e..a89bcb134 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/FreezableList.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/FreezableList.java @@ -17,121 +17,105 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; +package com.sun.corba.ee.impl.ior; -import java.util.List ; -import java.util.AbstractList ; +import java.util.List; +import java.util.AbstractList; -import com.sun.corba.ee.spi.ior.MakeImmutable ; +import com.sun.corba.ee.spi.ior.MakeImmutable; -/** Simple class that delegates all List operations to -* another list. It also can be frozen, which means that -* a number of operations can be performed on the list, -* and then the list can be made immutable, so that no -* further changes are possible. A FreezableList is frozen -* using the makeImmutable method. -*/ +/** + * Simple class that delegates all List operations to another list. It also can be frozen, which means that a number of + * operations can be performed on the list, and then the list can be made immutable, so that no further changes are + * possible. A FreezableList is frozen using the makeImmutable method. + */ public class FreezableList extends AbstractList { - private List delegate = null ; - private boolean immutable = false ; + private List delegate = null; + private boolean immutable = false; @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (obj == null) - return false ; + return false; if (!(obj instanceof FreezableList)) - return false ; + return false; - FreezableList other = FreezableList.class.cast( obj ) ; + FreezableList other = FreezableList.class.cast(obj); - return delegate.equals( other.delegate ) && - (immutable == other.immutable) ; + return delegate.equals(other.delegate) && (immutable == other.immutable); } @Override - public int hashCode() - { - return delegate.hashCode() ; + public int hashCode() { + return delegate.hashCode(); } - public FreezableList( List delegate, boolean immutable ) - { - this.delegate = delegate ; - this.immutable = immutable ; + public FreezableList(List delegate, boolean immutable) { + this.delegate = delegate; + this.immutable = immutable; } - public FreezableList( List delegate ) - { - this( delegate, false ) ; + public FreezableList(List delegate) { + this(delegate, false); } - public void makeImmutable() - { - immutable = true ; + public void makeImmutable() { + immutable = true; } - public boolean isImmutable() - { - return immutable ; + public boolean isImmutable() { + return immutable; } - public void makeElementsImmutable() - { + public void makeElementsImmutable() { for (E x : this) { if (x instanceof MakeImmutable) { - MakeImmutable element = MakeImmutable.class.cast( x ) ; - element.makeImmutable() ; + MakeImmutable element = MakeImmutable.class.cast(x); + element.makeImmutable(); } } } // Methods overridden from AbstractList - public int size() - { - return delegate.size() ; + public int size() { + return delegate.size(); } - public E get(int index) - { - return delegate.get(index) ; + public E get(int index) { + return delegate.get(index); } @Override - public E set(int index, E element) - { + public E set(int index, E element) { if (immutable) - throw new UnsupportedOperationException() ; + throw new UnsupportedOperationException(); - return delegate.set(index, element) ; + return delegate.set(index, element); } @Override - public void add(int index, E element) - { + public void add(int index, E element) { if (immutable) - throw new UnsupportedOperationException() ; + throw new UnsupportedOperationException(); - delegate.add(index, element) ; + delegate.add(index, element); } @Override - public E remove(int index) - { + public E remove(int index) { if (immutable) - throw new UnsupportedOperationException() ; + throw new UnsupportedOperationException(); - return delegate.remove(index) ; + return delegate.remove(index); } // We also override subList so that the result is a FreezableList. @Override - public List subList(int fromIndex, int toIndex) - { - List list = delegate.subList(fromIndex, toIndex) ; - List result = new FreezableList( list, immutable ) ; - return result ; + public List subList(int fromIndex, int toIndex) { + List list = delegate.subList(fromIndex, toIndex); + List result = new FreezableList(list, immutable); + return result; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/GenericIdentifiable.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/GenericIdentifiable.java index a9470d70a..1b2e1ec1e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/GenericIdentifiable.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/GenericIdentifiable.java @@ -19,82 +19,71 @@ package com.sun.corba.ee.impl.ior; -import java.util.Arrays ; +import java.util.Arrays; import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.Identifiable ; +import com.sun.corba.ee.spi.ior.Identifiable; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; /** - * @author - * This is used for unknown components and profiles. A TAG_MULTICOMPONENT_PROFILE will be represented this way. + * @author This is used for unknown components and profiles. A TAG_MULTICOMPONENT_PROFILE will be represented this way. */ @ManagedData -@Description( "A generic implementation of an IIOP encapsulation with an integer id" ) -public abstract class GenericIdentifiable implements Identifiable -{ +@Description("A generic implementation of an IIOP encapsulation with an integer id") +public abstract class GenericIdentifiable implements Identifiable { private int id; private byte data[]; - - public GenericIdentifiable(int id, InputStream is) - { - this.id = id ; - data = EncapsulationUtility.readOctets( is ) ; + + public GenericIdentifiable(int id, InputStream is) { + this.id = id; + data = EncapsulationUtility.readOctets(is); } - - public int getId() - { - return id ; + + public int getId() { + return id; } - - public void write(OutputStream os) - { - os.write_ulong( data.length ) ; - os.write_octet_array( data, 0, data.length ) ; + + public void write(OutputStream os) { + os.write_ulong(data.length); + os.write_octet_array(data, 0, data.length); } - - public String toString() - { - return "GenericIdentifiable[id=" + getId() + "]" ; + + public String toString() { + return "GenericIdentifiable[id=" + getId() + "]"; } - - public boolean equals(Object obj) - { + + public boolean equals(Object obj) { if (obj == null) - return false ; + return false; if (!(obj instanceof GenericIdentifiable)) - return false ; + return false; - GenericIdentifiable encaps = (GenericIdentifiable)obj ; + GenericIdentifiable encaps = (GenericIdentifiable) obj; - return (getId() == encaps.getId()) && - Arrays.equals( data, encaps.data ) ; + return (getId() == encaps.getId()) && Arrays.equals(data, encaps.data); } - - public int hashCode() - { - int result = 17 ; - for (int ctr=0; ctr - implements IOR -{ +/** + * An IOR is represented as a list of profiles. Only objects that extend TaggedProfile should be added to an IOR. + * However, enforcing this restriction requires overriding all of the addYYY methods inherited from List, so no check is + * included here. + * + * @author Ken Cavanaugh + */ +public class IORImpl extends IdentifiableContainerBase implements IOR { private String typeId; - private ORB factory = null ; - static final IORSystemException wrapper = - IORSystemException.self ; + private ORB factory = null; + static final IORSystemException wrapper = IORSystemException.self; private boolean isCachedHashValue = false; private int cachedHashValue; @Override public Iterator getTaggedProfiles() { - return iterator() ; + return iterator(); } @Override - public ORB getORB() - { - return factory ; + public ORB getORB() { + return factory; } - /** This variable is set directly from the constructors that take - * an IORTemplate or IORTemplateList as arguments; otherwise it - * is derived from the list of TaggedProfile instances on the first - * call to getIORTemplates. Note that we assume that an IOR with - * mutiple TaggedProfile instances has the same ObjectId in each - * TaggedProfile, as otherwise the IOR could never be created through - * an ObjectReferenceFactory. + /** + * This variable is set directly from the constructors that take an IORTemplate or IORTemplateList as arguments; + * otherwise it is derived from the list of TaggedProfile instances on the first call to getIORTemplates. Note that we + * assume that an IOR with mutiple TaggedProfile instances has the same ObjectId in each TaggedProfile, as otherwise the + * IOR could never be created through an ObjectReferenceFactory. */ - private IORTemplateList iortemps = null ; + private IORTemplateList iortemps = null; @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (obj == null) { return false; } @@ -104,159 +97,150 @@ public boolean equals( Object obj ) return false; } - IOR other = (IOR)obj ; + IOR other = (IOR) obj; - return super.equals( obj ) && typeId.equals( other.getTypeId() ) ; + return super.equals(obj) && typeId.equals(other.getTypeId()); } @Override - public int hashCode() - { - if (!isCachedHashValue) { - cachedHashValue = (super.hashCode() ^ typeId.hashCode()); - isCachedHashValue = true; + public int hashCode() { + if (!isCachedHashValue) { + cachedHashValue = (super.hashCode() ^ typeId.hashCode()); + isCachedHashValue = true; } return cachedHashValue; } @Override public String toString() { - final StringBuilder sb = new StringBuilder() ; - sb.append( "IORImpl[type=") ; - sb.append( typeId ) ; - sb.append( " iorTemplates=" ) ; - - IORTemplateList list = getIORTemplates() ; - sb.append( list.toString() ) ; - return sb.toString() ; + final StringBuilder sb = new StringBuilder(); + sb.append("IORImpl[type="); + sb.append(typeId); + sb.append(" iorTemplates="); + + IORTemplateList list = getIORTemplates(); + sb.append(list.toString()); + return sb.toString(); } - /** Construct an empty IOR. This is needed for null object references. + /** + * Construct an empty IOR. This is needed for null object references. + * * @param orb ORB to use as factory - */ - public IORImpl( ORB orb ) - { - this( orb, "" ) ; + */ + public IORImpl(ORB orb) { + this(orb, ""); } - public IORImpl( ORB orb, String typeid ) - { - factory = orb ; - this.typeId = typeid ; + public IORImpl(ORB orb, String typeid) { + factory = orb; + this.typeId = typeid; } - /** Construct an IOR from an IORTemplate by applying the same - * object id to each TaggedProfileTemplate in the IORTemplate. + /** + * Construct an IOR from an IORTemplate by applying the same object id to each TaggedProfileTemplate in the IORTemplate. + * * @param orb ORB to use * @param typeId ID of type to use * @param iortemp Template to use * @param id ID of created object - */ - public IORImpl( ORB orb, String typeId, IORTemplate iortemp, ObjectId id) - { - this( orb, typeId ) ; - - this.iortemps = IORFactories.makeIORTemplateList() ; - this.iortemps.add( iortemp ) ; - - addTaggedProfiles( iortemp, id ) ; - - makeImmutable() ; + */ + public IORImpl(ORB orb, String typeId, IORTemplate iortemp, ObjectId id) { + this(orb, typeId); + + this.iortemps = IORFactories.makeIORTemplateList(); + this.iortemps.add(iortemp); + + addTaggedProfiles(iortemp, id); + + makeImmutable(); } - - private void addTaggedProfiles( IORTemplate iortemp, ObjectId id ) - { - ObjectKeyTemplate oktemp = iortemp.getObjectKeyTemplate() ; - for( TaggedProfileTemplate temp : iortemp) { - TaggedProfile profile = temp.create( oktemp, id ) ; - add( profile ) ; + + private void addTaggedProfiles(IORTemplate iortemp, ObjectId id) { + ObjectKeyTemplate oktemp = iortemp.getObjectKeyTemplate(); + for (TaggedProfileTemplate temp : iortemp) { + TaggedProfile profile = temp.create(oktemp, id); + add(profile); } } - /** Construct an IOR from an IORTemplate by applying the same - * object id to each TaggedProfileTemplate in the IORTemplate. + /** + * Construct an IOR from an IORTemplate by applying the same object id to each TaggedProfileTemplate in the IORTemplate. + * * @param orb ORB to use * @param typeId ID of type to use * @param iortemps list of templates * @param id ID of created object - */ - public IORImpl( ORB orb, String typeId, IORTemplateList iortemps, ObjectId id) - { - this( orb, typeId ) ; + */ + public IORImpl(ORB orb, String typeId, IORTemplateList iortemps, ObjectId id) { + this(orb, typeId); - this.iortemps = iortemps ; + this.iortemps = iortemps; - Iterator iter = iortemps.iterator() ; + Iterator iter = iortemps.iterator(); while (iter.hasNext()) { - IORTemplate iortemp = iter.next() ; - addTaggedProfiles( iortemp, id ) ; + IORTemplate iortemp = iter.next(); + addTaggedProfiles(iortemp, id); } - - makeImmutable() ; + + makeImmutable(); } - + // Note that orb is not always the ORB of is! - public IORImpl(ORB orb, InputStream is) - { - this( orb, is.read_string() ) ; + public IORImpl(ORB orb, InputStream is) { + this(orb, is.read_string()); - IdentifiableFactoryFinder finder = - factory.getTaggedProfileFactoryFinder() ; + IdentifiableFactoryFinder finder = factory.getTaggedProfileFactoryFinder(); - EncapsulationUtility.readIdentifiableSequence( this, finder, is ) ; + EncapsulationUtility.readIdentifiableSequence(this, finder, is); - makeImmutable() ; + makeImmutable(); } - - public String getTypeId() - { - return typeId ; + + public String getTypeId() { + return typeId; } - - public void write(OutputStream os) - { - os.write_string( typeId ) ; - EncapsulationUtility.writeIdentifiableSequence( this, os ) ; + + public void write(OutputStream os) { + os.write_string(typeId); + EncapsulationUtility.writeIdentifiableSequence(this, os); } - public String stringify() - { + public String stringify() { StringWriter bs; MarshalOutputStream s = OutputStreamFactory.newEncapsOutputStream(factory); s.putEndian(); - write( (OutputStream)s ); + write((OutputStream) s); bs = new StringWriter(); try { s.writeTo(new HexOutputStream(bs)); } catch (IOException ex) { - throw wrapper.stringifyWriteError( ex ) ; + throw wrapper.stringifyWriteError(ex); } return ORBConstants.STRINGIFY_PREFIX + bs; } @Override - public synchronized void makeImmutable() - { - makeElementsImmutable() ; + public synchronized void makeImmutable() { + makeElementsImmutable(); if (iortemps != null) { iortemps.makeImmutable(); } - super.makeImmutable() ; + super.makeImmutable(); } - - public org.omg.IOP.IOR getIOPIOR() { + + public org.omg.IOP.IOR getIOPIOR() { EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream(factory); write(os); InputStream is = (InputStream) (os.create_input_stream()); return org.omg.IOP.IORHelper.read(is); } - public boolean isNil() - { + public boolean isNil() { // // The check for typeId length of 0 below is commented out // as a workaround for a bug in ORBs which send a @@ -265,94 +249,85 @@ public boolean isNil() return ((size() == 0) /* && (typeId.length() == 0) */); } - public boolean isEquivalent(IOR ior) - { - Iterator myIterator = iterator() ; - Iterator otherIterator = ior.iterator() ; + public boolean isEquivalent(IOR ior) { + Iterator myIterator = iterator(); + Iterator otherIterator = ior.iterator(); while (myIterator.hasNext() && otherIterator.hasNext()) { - TaggedProfile myProfile = myIterator.next() ; - TaggedProfile otherProfile = otherIterator.next() ; - if (!myProfile.isEquivalent( otherProfile )) { + TaggedProfile myProfile = myIterator.next(); + TaggedProfile otherProfile = otherIterator.next(); + if (!myProfile.isEquivalent(otherProfile)) { return false; } } - return myIterator.hasNext() == otherIterator.hasNext() ; + return myIterator.hasNext() == otherIterator.hasNext(); } - private void initializeIORTemplateList() - { + private void initializeIORTemplateList() { // Maps ObjectKeyTemplate to IORTemplate - Map oktempToIORTemplate = - new HashMap() ; + Map oktempToIORTemplate = new HashMap(); - iortemps = IORFactories.makeIORTemplateList() ; - Iterator iter = iterator() ; - ObjectId oid = null ; // used to check that all profiles have the same oid. + iortemps = IORFactories.makeIORTemplateList(); + Iterator iter = iterator(); + ObjectId oid = null; // used to check that all profiles have the same oid. while (iter.hasNext()) { - TaggedProfile prof = iter.next() ; - TaggedProfileTemplate ptemp = prof.getTaggedProfileTemplate() ; - ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate() ; + TaggedProfile prof = iter.next(); + TaggedProfileTemplate ptemp = prof.getTaggedProfileTemplate(); + ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate(); // Check that all oids for all profiles are the same: if they are not, // throw exception. if (oid == null) { oid = prof.getObjectId(); - } else if (!oid.equals( prof.getObjectId() )) { + } else if (!oid.equals(prof.getObjectId())) { throw wrapper.badOidInIorTemplateList(); } // Find or create the IORTemplate for oktemp. - IORTemplate iortemp = oktempToIORTemplate.get( oktemp ) ; + IORTemplate iortemp = oktempToIORTemplate.get(oktemp); if (iortemp == null) { - iortemp = IORFactories.makeIORTemplate( oktemp ) ; - oktempToIORTemplate.put( oktemp, iortemp ) ; - iortemps.add( iortemp ) ; + iortemp = IORFactories.makeIORTemplate(oktemp); + oktempToIORTemplate.put(oktemp, iortemp); + iortemps.add(iortemp); } - iortemp.add( ptemp ) ; + iortemp.add(ptemp); } - iortemps.makeImmutable() ; + iortemps.makeImmutable(); } - /** Return the IORTemplateList for this IOR. Will throw - * exception if it is not possible to generate an IOR - * from the IORTemplateList that is equal to this IOR, - * which can only happen if not every TaggedProfile in the - * IOR has the same ObjectId. + /** + * Return the IORTemplateList for this IOR. Will throw exception if it is not possible to generate an IOR from the + * IORTemplateList that is equal to this IOR, which can only happen if not every TaggedProfile in the IOR has the same + * ObjectId. */ - public synchronized IORTemplateList getIORTemplates() - { + public synchronized IORTemplateList getIORTemplates() { if (iortemps == null) { initializeIORTemplateList(); } - return iortemps ; + return iortemps; } - /** Return the first IIOPProfile in this IOR. - * Originally we planned to remove this, because we planned to use - * multiple IIOP profiles. However, we really have no need for - * multiple profiles in the ORB, so we will probably never remove + /** + * Return the first IIOPProfile in this IOR. Originally we planned to remove this, because we planned to use multiple + * IIOP profiles. However, we really have no need for multiple profiles in the ORB, so we will probably never remove * this API. */ - public IIOPProfile getProfile() - { - IIOPProfile iop = null ; - Iterator iter = - iteratorById( TAG_INTERNET_IOP.value ) ; + public IIOPProfile getProfile() { + IIOPProfile iop = null; + Iterator iter = iteratorById(TAG_INTERNET_IOP.value); if (iter.hasNext()) { - iop = - IIOPProfile.class.cast(iter.next()); + iop = IIOPProfile.class.cast(iter.next()); } - + if (iop != null) { return iop; } - + // if we come to this point then no IIOP Profile - // is present. Therefore, throw an exception. - throw wrapper.iorMustHaveIiopProfile() ; + // is present. Therefore, throw an exception. + throw wrapper.iorMustHaveIiopProfile(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IORTemplateImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IORTemplateImpl.java index ded482410..627fe6b16 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IORTemplateImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IORTemplateImpl.java @@ -19,123 +19,109 @@ package com.sun.corba.ee.impl.ior; -import java.util.Iterator ; +import java.util.Iterator; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; +import org.omg.CORBA_2_3.portable.InputStream; -import com.sun.corba.ee.spi.ior.IdentifiableContainerBase ; -import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder ; -import com.sun.corba.ee.spi.ior.IORTemplate ; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.ee.spi.ior.TaggedProfileTemplate ; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.IORFactory ; +import com.sun.corba.ee.spi.ior.IdentifiableContainerBase; +import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder; +import com.sun.corba.ee.spi.ior.IORTemplate; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; +import com.sun.corba.ee.spi.ior.TaggedProfileTemplate; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.IORFactory; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; /** * This class is a container of TaggedProfileTemplates. */ -public class IORTemplateImpl - extends IdentifiableContainerBase - implements IORTemplate -{ - private ObjectKeyTemplate oktemp ; +public class IORTemplateImpl extends IdentifiableContainerBase implements IORTemplate { + private ObjectKeyTemplate oktemp; @Override public String toString() { - StringBuilder sb = new StringBuilder() ; - sb.append( "IORTemplate[oktemp=") ; - sb.append( oktemp.toString() ) ; - sb.append( " profile templates:") ; - sb.append( super.toString() ) ; - sb.append( ']' ) ; - return sb.toString() ; + StringBuilder sb = new StringBuilder(); + sb.append("IORTemplate[oktemp="); + sb.append(oktemp.toString()); + sb.append(" profile templates:"); + sb.append(super.toString()); + sb.append(']'); + return sb.toString(); } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (obj == null) - return false ; + return false; if (!(obj instanceof IORTemplateImpl)) - return false ; + return false; - IORTemplateImpl other = (IORTemplateImpl)obj ; + IORTemplateImpl other = (IORTemplateImpl) obj; - return super.equals( obj ) && oktemp.equals( other.getObjectKeyTemplate() ) ; + return super.equals(obj) && oktemp.equals(other.getObjectKeyTemplate()); } @Override - public int hashCode() - { - return super.hashCode() ^ oktemp.hashCode() ; + public int hashCode() { + return super.hashCode() ^ oktemp.hashCode(); } - public ObjectKeyTemplate getObjectKeyTemplate() - { - return oktemp ; + public ObjectKeyTemplate getObjectKeyTemplate() { + return oktemp; } - public IORTemplateImpl( ObjectKeyTemplate oktemp ) - { - this.oktemp = oktemp ; + public IORTemplateImpl(ObjectKeyTemplate oktemp) { + this.oktemp = oktemp; } - public IOR makeIOR( ORB orb, String typeid, ObjectId oid ) - { - return new IORImpl( orb, typeid, this, oid ) ; + public IOR makeIOR(ORB orb, String typeid, ObjectId oid) { + return new IORImpl(orb, typeid, this, oid); } - public boolean isEquivalent( IORFactory other ) - { + public boolean isEquivalent(IORFactory other) { if (!(other instanceof IORTemplate)) - return false ; + return false; - IORTemplate list = (IORTemplate)other ; + IORTemplate list = (IORTemplate) other; - Iterator thisIterator = iterator() ; - Iterator listIterator = list.iterator() ; + Iterator thisIterator = iterator(); + Iterator listIterator = list.iterator(); while (thisIterator.hasNext() && listIterator.hasNext()) { - TaggedProfileTemplate thisTemplate = thisIterator.next() ; - TaggedProfileTemplate listTemplate = listIterator.next() ; - if (!thisTemplate.isEquivalent( listTemplate )) - return false ; + TaggedProfileTemplate thisTemplate = thisIterator.next(); + TaggedProfileTemplate listTemplate = listIterator.next(); + if (!thisTemplate.isEquivalent(listTemplate)) + return false; } - return (thisIterator.hasNext() == listIterator.hasNext()) && - getObjectKeyTemplate().equals( list.getObjectKeyTemplate() ) ; + return (thisIterator.hasNext() == listIterator.hasNext()) && getObjectKeyTemplate().equals(list.getObjectKeyTemplate()); } - /** Ensure that this IORTemplate and all of its profiles can not be - * modified. This overrides the method inherited from - * FreezableList through IdentifiableContainerBase. - */ + /** + * Ensure that this IORTemplate and all of its profiles can not be modified. This overrides the method inherited from + * FreezableList through IdentifiableContainerBase. + */ @Override - public void makeImmutable() - { - makeElementsImmutable() ; - super.makeImmutable() ; + public void makeImmutable() { + makeElementsImmutable(); + super.makeImmutable(); } - public void write( OutputStream os ) - { - oktemp.write( os ) ; - EncapsulationUtility.writeIdentifiableSequence( this, os ) ; + public void write(OutputStream os) { + oktemp.write(os); + EncapsulationUtility.writeIdentifiableSequence(this, os); } - public IORTemplateImpl( InputStream is ) - { - ORB orb = (ORB)(is.orb()) ; - IdentifiableFactoryFinder finder = - orb.getTaggedProfileTemplateFactoryFinder() ; + public IORTemplateImpl(InputStream is) { + ORB orb = (ORB) (is.orb()); + IdentifiableFactoryFinder finder = orb.getTaggedProfileTemplateFactoryFinder(); - oktemp = orb.getObjectKeyFactory().createTemplate( is ) ; - EncapsulationUtility.readIdentifiableSequence( this, finder, is ) ; + oktemp = orb.getObjectKeyFactory().createTemplate(is); + EncapsulationUtility.readIdentifiableSequence(this, finder, is); - makeImmutable() ; + makeImmutable(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IORTemplateListImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IORTemplateListImpl.java index 599a66e39..06ea9742c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IORTemplateListImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IORTemplateListImpl.java @@ -19,77 +19,69 @@ package com.sun.corba.ee.impl.ior; -import java.util.ArrayList ; -import java.util.Iterator ; +import java.util.ArrayList; +import java.util.Iterator; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.IORTemplateList ; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.IORTemplate ; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.IORFactory ; -import com.sun.corba.ee.spi.ior.IORFactories ; +import com.sun.corba.ee.spi.ior.IORTemplateList; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.IORTemplate; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.IORFactory; +import com.sun.corba.ee.spi.ior.IORFactories; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -public class IORTemplateListImpl extends FreezableList - implements IORTemplateList -{ - public IORTemplateListImpl() - { - super( new ArrayList() ) ; +public class IORTemplateListImpl extends FreezableList implements IORTemplateList { + public IORTemplateListImpl() { + super(new ArrayList()); } - public IORTemplateListImpl( InputStream is ) - { - this() ; - int size = is.read_long() ; - for (int ctr=0; ctr thisIterator = iterator() ; - Iterator listIterator = list.iterator() ; + Iterator thisIterator = iterator(); + Iterator listIterator = list.iterator(); while (thisIterator.hasNext() && listIterator.hasNext()) { - IORTemplate thisTemplate = thisIterator.next() ; - IORTemplate listTemplate = listIterator.next() ; - if (!thisTemplate.isEquivalent( listTemplate )) - return false ; + IORTemplate thisTemplate = thisIterator.next(); + IORTemplate listTemplate = listIterator.next(); + if (!thisTemplate.isEquivalent(listTemplate)) + return false; } - return thisIterator.hasNext() == listIterator.hasNext() ; + return thisIterator.hasNext() == listIterator.hasNext(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IdentifiableFactoryFinderBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IdentifiableFactoryFinderBase.java index b5e7381eb..b7a9d4f3a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IdentifiableFactoryFinderBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/IdentifiableFactoryFinderBase.java @@ -17,47 +17,40 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; +package com.sun.corba.ee.impl.ior; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -import java.util.Map ; -import java.util.HashMap ; +import java.util.Map; +import java.util.HashMap; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.Identifiable ; -import com.sun.corba.ee.spi.ior.IdentifiableFactory ; -import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder ; +import com.sun.corba.ee.spi.ior.Identifiable; +import com.sun.corba.ee.spi.ior.IdentifiableFactory; +import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder; -import com.sun.corba.ee.spi.logging.IORSystemException ; +import com.sun.corba.ee.spi.logging.IORSystemException; -public abstract class IdentifiableFactoryFinderBase - implements IdentifiableFactoryFinder -{ - protected static final IORSystemException wrapper = - IORSystemException.self ; +public abstract class IdentifiableFactoryFinderBase implements IdentifiableFactoryFinder { + protected static final IORSystemException wrapper = IORSystemException.self; - private ORB orb ; - private Map> map ; + private ORB orb; + private Map> map; - protected IdentifiableFactoryFinderBase( ORB orb ) - { - map = new HashMap>() ; - this.orb = orb ; + protected IdentifiableFactoryFinderBase(ORB orb) { + map = new HashMap>(); + this.orb = orb; } - protected IdentifiableFactory getFactory(int id) - { - return map.get( id ) ; + protected IdentifiableFactory getFactory(int id) { + return map.get(id); } - public abstract E handleMissingFactory( int id, - InputStream is ) ; - - public E create(int id, InputStream is) - { - IdentifiableFactory factory = getFactory( id ) ; + public abstract E handleMissingFactory(int id, InputStream is); + + public E create(int id, InputStream is) { + IdentifiableFactory factory = getFactory(id); if (factory != null) { return factory.create(orb, is); @@ -65,9 +58,8 @@ public E create(int id, InputStream is) return handleMissingFactory(id, is); } } - - public void registerFactory(IdentifiableFactory factory) - { - map.put( factory.getId(), factory ) ; + + public void registerFactory(IdentifiableFactory factory) { + map.put(factory.getId(), factory); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/JIDLObjectKeyTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/JIDLObjectKeyTemplate.java index b98d6bd0c..23f417fe6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/JIDLObjectKeyTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/JIDLObjectKeyTemplate.java @@ -19,64 +19,59 @@ package com.sun.corba.ee.impl.ior; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA.OctetSeqHolder ; - -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; +import org.omg.CORBA.OctetSeqHolder; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; /** * @author Ken Cavanaugh */ -public final class JIDLObjectKeyTemplate extends NewObjectKeyTemplateBase -{ - /** This constructor reads the template ONLY from the stream. +public final class JIDLObjectKeyTemplate extends NewObjectKeyTemplateBase { + /** + * This constructor reads the template ONLY from the stream. + * * @param orb ORB to use * @param magic Magic number * @param scid ID of template * @param is stream to read from - */ - public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is ) - { - super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID ); + */ + public JIDLObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is) { + super(orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID); - setORBVersion( is ) ; + setORBVersion(is); } - /** This constructor reads a complete ObjectKey (template and Id) - * from the stream. - * @param orb ORB to use + /** + * This constructor reads a complete ObjectKey (template and Id) from the stream. + * + * @param orb ORB to use * @param magic Magic number * @param scid ID of the Object * @param is Stream to read from * @param osh Holder for Octet - */ - public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is, - OctetSeqHolder osh ) - { - super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID ); + */ + public JIDLObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is, OctetSeqHolder osh) { + super(orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID); - osh.value = readObjectKey( is ) ; + osh.value = readObjectKey(is); - setORBVersion( is ) ; + setORBVersion(is); } - - public JIDLObjectKeyTemplate( ORB orb, int scid, int serverid ) - { - super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, - JIDL_ORB_ID, JIDL_OAID ) ; - setORBVersion( ORBVersionFactory.getORBVersion() ) ; + public JIDLObjectKeyTemplate(ORB orb, int scid, int serverid) { + super(orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, JIDL_ORB_ID, JIDL_OAID); + + setORBVersion(ORBVersionFactory.getORBVersion()); } - + @Override - protected void writeTemplate( OutputStream os ) - { - os.write_long( getMagic() ) ; - os.write_long( getSubcontractId() ) ; - os.write_long( getServerId() ) ; + protected void writeTemplate(OutputStream os) { + os.write_long(getMagic()); + os.write_long(getSubcontractId()); + os.write_long(getServerId()); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/NewObjectKeyTemplateBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/NewObjectKeyTemplateBase.java index b6dc97802..b966665ea 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/NewObjectKeyTemplateBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/NewObjectKeyTemplateBase.java @@ -19,48 +19,40 @@ package com.sun.corba.ee.impl.ior; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersion; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; - -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersion ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; - -public abstract class NewObjectKeyTemplateBase extends ObjectKeyTemplateBase -{ - public NewObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid, - String orbid, ObjectAdapterId oaid ) - { - super( orb, magic, scid, serverid, orbid, oaid ) ; +public abstract class NewObjectKeyTemplateBase extends ObjectKeyTemplateBase { + public NewObjectKeyTemplateBase(ORB orb, int magic, int scid, int serverid, String orbid, ObjectAdapterId oaid) { + super(orb, magic, scid, serverid, orbid, oaid); // subclass must set the version, since we don't have the object key here. if (magic != ObjectKeyFactoryImpl.JAVAMAGIC_NEWER) { throw wrapper.badMagic(magic); } } - + @Override - public void write(ObjectId objectId, OutputStream os) - { - super.write( objectId, os ) ; - getORBVersion().write( os ) ; + public void write(ObjectId objectId, OutputStream os) { + super.write(objectId, os); + getORBVersion().write(os); } @Override - public void write(OutputStream os) - { - super.write( os ) ; - getORBVersion().write( os ) ; + public void write(OutputStream os) { + super.write(os); + getORBVersion().write(os); } - protected void setORBVersion( InputStream is ) - { - ORBVersion version = ORBVersionFactory.create( is ) ; - setORBVersion( version ) ; + protected void setORBVersion(InputStream is) { + ORBVersion version = ORBVersionFactory.create(is); + setORBVersion(version); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdArray.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdArray.java index bc43eb835..ed73c9f95 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdArray.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdArray.java @@ -17,55 +17,51 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; +package com.sun.corba.ee.impl.ior; -import java.util.Iterator ; -import java.util.Arrays ; +import java.util.Iterator; +import java.util.Arrays; public class ObjectAdapterIdArray extends ObjectAdapterIdBase { - private final String[] objectAdapterId ; + private final String[] objectAdapterId; @Override - public boolean equals( Object obj ) { + public boolean equals(Object obj) { // Note that the superclass equals method is correct and general, - // because it tests for equality using the iterator. The state of + // because it tests for equality using the iterator. The state of // the derived classes simply implements the iterator. // This equals method is added here to appease findbugs. - return super.equals( obj ) ; + return super.equals(obj); } - public ObjectAdapterIdArray( String[] objectAdapterId ) - { - this.objectAdapterId = (String[])objectAdapterId.clone() ; + public ObjectAdapterIdArray(String[] objectAdapterId) { + this.objectAdapterId = (String[]) objectAdapterId.clone(); } - /** + /** * Special constructor used for OA IDs of length 2. + * * @param name1 First name part * @param name2 Second name part */ - public ObjectAdapterIdArray( String name1, String name2 ) - { - objectAdapterId = new String[2] ; - objectAdapterId[0] = name1 ; - objectAdapterId[1] = name2 ; + public ObjectAdapterIdArray(String name1, String name2) { + objectAdapterId = new String[2]; + objectAdapterId[0] = name1; + objectAdapterId[1] = name2; } @Override - public int getNumLevels() - { - return objectAdapterId.length ; + public int getNumLevels() { + return objectAdapterId.length; } @Override - public Iterator iterator() - { - return Arrays.asList( objectAdapterId ).iterator() ; + public Iterator iterator() { + return Arrays.asList(objectAdapterId).iterator(); } @Override - public String[] getAdapterName() - { - return (String[])objectAdapterId.clone() ; + public String[] getAdapterName() { + return (String[]) objectAdapterId.clone(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdBase.java index da5a12dbc..95e5aadfe 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdBase.java @@ -17,69 +17,69 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; +package com.sun.corba.ee.impl.ior; -import java.util.Iterator ; +import java.util.Iterator; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; abstract class ObjectAdapterIdBase implements ObjectAdapterId { @Override - public boolean equals( Object other ) { + public boolean equals(Object other) { if (!(other instanceof ObjectAdapterId)) - return false ; + return false; - ObjectAdapterId theOther = (ObjectAdapterId)other ; + ObjectAdapterId theOther = (ObjectAdapterId) other; - Iterator iter1 = iterator() ; - Iterator iter2 = theOther.iterator() ; + Iterator iter1 = iterator(); + Iterator iter2 = theOther.iterator(); while (iter1.hasNext() && iter2.hasNext()) { - String str1 = iter1.next() ; - String str2 = iter2.next() ; + String str1 = iter1.next(); + String str2 = iter2.next(); - if (!str1.equals( str2 )) - return false ; + if (!str1.equals(str2)) + return false; } - return iter1.hasNext() == iter2.hasNext() ; + return iter1.hasNext() == iter2.hasNext(); } @Override public int hashCode() { - int result = 17 ; + int result = 17; for (String str : this) { - result = 37*result + str.hashCode() ; + result = 37 * result + str.hashCode(); } - return result ; + return result; } @Override public String toString() { - StringBuilder buff = new StringBuilder() ; - buff.append( "ObjectAdapterID[" ) ; + StringBuilder buff = new StringBuilder(); + buff.append("ObjectAdapterID["); - boolean first = true ; + boolean first = true; for (String str : this) { if (first) - first = false ; + first = false; else - buff.append( "/" ) ; + buff.append("/"); - buff.append( str ) ; + buff.append(str); } - buff.append( "]" ) ; + buff.append("]"); - return buff.toString() ; + return buff.toString(); } - public void write( OutputStream os ) { - os.write_long( getNumLevels() ) ; + public void write(OutputStream os) { + os.write_long(getNumLevels()); for (String str : this) { - os.write_string( str ) ; + os.write_string(str); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdNumber.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdNumber.java index 427d05ce4..b88edb56b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdNumber.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectAdapterIdNumber.java @@ -17,25 +17,22 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; +package com.sun.corba.ee.impl.ior; -/** ObjectAdapterIdNumber is used to represent pre-JDK 1.4 POA adapter - * IDs. The POA ID was simply represented as a single integer, which was - * mapped to the actual POA instance. Here, we just represent these - * internally as arrays of the form { "OldRootPOA", "<number>" }, - * and provide an extra method to get the number back. +/** + * ObjectAdapterIdNumber is used to represent pre-JDK 1.4 POA adapter IDs. The POA ID was simply represented as a single + * integer, which was mapped to the actual POA instance. Here, we just represent these internally as arrays of the form + * { "OldRootPOA", "<number>" }, and provide an extra method to get the number back. */ public class ObjectAdapterIdNumber extends ObjectAdapterIdArray { - private int poaid ; + private int poaid; - public ObjectAdapterIdNumber( int poaid ) - { - super( "OldRootPOA", Integer.toString( poaid ) ) ; - this.poaid = poaid ; + public ObjectAdapterIdNumber(int poaid) { + super("OldRootPOA", Integer.toString(poaid)); + this.poaid = poaid; } - public int getOldPOAId() - { - return poaid ; + public int getOldPOAId() { + return poaid; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectIdImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectIdImpl.java index 5f81a2e7e..8e96d2289 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectIdImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectIdImpl.java @@ -19,63 +19,57 @@ package com.sun.corba.ee.impl.ior; -import java.util.Arrays ; -import com.sun.corba.ee.spi.ior.ObjectId ; -import org.omg.CORBA_2_3.portable.OutputStream ; -import com.sun.corba.ee.impl.misc.ORBUtility ; +import java.util.Arrays; +import com.sun.corba.ee.spi.ior.ObjectId; +import org.omg.CORBA_2_3.portable.OutputStream; +import com.sun.corba.ee.impl.misc.ORBUtility; /** * @author Ken Cavanaugh */ -public final class ObjectIdImpl implements ObjectId -{ +public final class ObjectIdImpl implements ObjectId { private byte[] id; - + @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (!(obj instanceof ObjectIdImpl)) - return false ; + return false; - ObjectIdImpl other = (ObjectIdImpl)obj ; + ObjectIdImpl other = (ObjectIdImpl) obj; - return Arrays.equals( this.id, other.id ) ; + return Arrays.equals(this.id, other.id); } @Override - public int hashCode() - { - int result = 17 ; - for (int ctr=0; ctr= ORBConstants.FIRST_POA_SCID) && - (scid <= ORBConstants.MAX_POA_SCID)) { - if (magic >= JAVAMAGIC_NEWER) { - oktemp = new POAObjectKeyTemplate(orb, magic, scid, - is, osh); - } else { - oktemp = new OldPOAObjectKeyTemplate(orb, magic, scid, - is, osh); - } - } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) { - if (magic >= JAVAMAGIC_NEWER) { - oktemp = - new JIDLObjectKeyTemplate(orb, magic, scid, - is, osh); - } else { - oktemp = - new OldJIDLObjectKeyTemplate(orb, magic, scid, - is, osh); - } + public ObjectKeyTemplate handle(int magic, int scid, InputStream is, OctetSeqHolder osh) { + ObjectKeyTemplate oktemp = null; + + if ((scid >= ORBConstants.FIRST_POA_SCID) && (scid <= ORBConstants.MAX_POA_SCID)) { + if (magic >= JAVAMAGIC_NEWER) { + oktemp = new POAObjectKeyTemplate(orb, magic, scid, is, osh); + } else { + oktemp = new OldPOAObjectKeyTemplate(orb, magic, scid, is, osh); + } + } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) { + if (magic >= JAVAMAGIC_NEWER) { + oktemp = new JIDLObjectKeyTemplate(orb, magic, scid, is, osh); + } else { + oktemp = new OldJIDLObjectKeyTemplate(orb, magic, scid, is, osh); } - - return oktemp ; } - } ; - /** This handler reads only the oktemp. - */ + return oktemp; + } + }; + + /** + * This handler reads only the oktemp. + */ private Handler oktempOnly = new Handler() { - public ObjectKeyTemplate handle( int magic, int scid, - InputStream is, OctetSeqHolder osh ) { - ObjectKeyTemplate oktemp = null ; - - if ((scid >= ORBConstants.FIRST_POA_SCID) && - (scid <= ORBConstants.MAX_POA_SCID)) { - if (magic >= JAVAMAGIC_NEWER) { - oktemp = new POAObjectKeyTemplate(orb, magic, scid, is); - } else { - oktemp = - new OldPOAObjectKeyTemplate(orb, magic, scid, is); - } - } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) { - if (magic >= JAVAMAGIC_NEWER) { - oktemp = - new JIDLObjectKeyTemplate(orb, magic, scid, is); - } else { - oktemp = - new OldJIDLObjectKeyTemplate(orb, magic, scid, is); - } + public ObjectKeyTemplate handle(int magic, int scid, InputStream is, OctetSeqHolder osh) { + ObjectKeyTemplate oktemp = null; + + if ((scid >= ORBConstants.FIRST_POA_SCID) && (scid <= ORBConstants.MAX_POA_SCID)) { + if (magic >= JAVAMAGIC_NEWER) { + oktemp = new POAObjectKeyTemplate(orb, magic, scid, is); + } else { + oktemp = new OldPOAObjectKeyTemplate(orb, magic, scid, is); + } + } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) { + if (magic >= JAVAMAGIC_NEWER) { + oktemp = new JIDLObjectKeyTemplate(orb, magic, scid, is); + } else { + oktemp = new OldJIDLObjectKeyTemplate(orb, magic, scid, is); } - - return oktemp ; } - } ; - - /** Returns true iff magic is in the range of valid magic numbers - * for our ORB. - */ - private boolean validMagic( int magic ) - { - return (magic >= MAGIC_BASE) && (magic <= MAX_MAGIC) ; + + return oktemp; + } + }; + + /** + * Returns true iff magic is in the range of valid magic numbers for our ORB. + */ + private boolean validMagic(int magic) { + return (magic >= MAGIC_BASE) && (magic <= MAX_MAGIC); } - /** Creates an ObjectKeyTemplate from the InputStream. Most of the - * decoding is done inside the handler. - */ - private ObjectKeyTemplate create( InputStream is, Handler handler, - OctetSeqHolder osh ) - { - ObjectKeyTemplate oktemp = null ; - + /** + * Creates an ObjectKeyTemplate from the InputStream. Most of the decoding is done inside the handler. + */ + private ObjectKeyTemplate create(InputStream is, Handler handler, OctetSeqHolder osh) { + ObjectKeyTemplate oktemp = null; + try { - int magic = is.read_long() ; - - if (validMagic( magic )) { - int scid = is.read_long() ; - oktemp = handler.handle( magic, scid, is, osh ) ; + int magic = is.read_long(); + + if (validMagic(magic)) { + int scid = is.read_long(); + oktemp = handler.handle(magic, scid, is, osh); } } catch (MARSHAL mexc) { - wrapper.createMarshalError( mexc ) ; + wrapper.createMarshalError(mexc); } - return oktemp ; + return oktemp; } public ObjectKey create(byte[] key) { - + OctetSeqHolder osh = new OctetSeqHolder(); EncapsInputStream is = EncapsInputStreamFactory.newEncapsInputStream(orb, key, key.length); @@ -221,17 +203,16 @@ public ObjectKey create(byte[] key) { osh.value = key; } - ObjectId oid = new ObjectIdImpl( osh.value ) ; - return new ObjectKeyImpl( oktemp, oid ) ; + ObjectId oid = new ObjectIdImpl(osh.value); + return new ObjectKeyImpl(oktemp, oid); } - public ObjectKeyTemplate createTemplate( InputStream is ) - { - ObjectKeyTemplate oktemp = create( is, oktempOnly, null ) ; + public ObjectKeyTemplate createTemplate(InputStream is) { + ObjectKeyTemplate oktemp = create(is, oktempOnly, null); if (oktemp == null) { oktemp = orb.getWireObjectKeyTemplate(); // cached singleton } - return oktemp ; + return oktemp; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyImpl.java index 4f6e37360..83128a573 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyImpl.java @@ -19,40 +19,37 @@ package com.sun.corba.ee.impl.ior; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.ObjectKey ; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.ObjectKey; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; -import com.sun.corba.ee.impl.encoding.EncapsOutputStream ; +import com.sun.corba.ee.impl.encoding.EncapsOutputStream; import com.sun.corba.ee.impl.encoding.OutputStreamFactory; import com.sun.corba.ee.spi.logging.IORSystemException; /** - * @author Ken Cavanaugh + * @author Ken Cavanaugh */ -public class ObjectKeyImpl implements ObjectKey -{ - private static final IORSystemException wrapper = - IORSystemException.self ; +public class ObjectKeyImpl implements ObjectKey { + private static final IORSystemException wrapper = IORSystemException.self; private ObjectKeyTemplate oktemp; private ObjectId id; private byte[] array; - - public ObjectKeyImpl( ObjectKeyTemplate oktemp, ObjectId id) { - this.oktemp = oktemp ; - this.id = id ; + + public ObjectKeyImpl(ObjectKeyTemplate oktemp, ObjectId id) { + this.oktemp = oktemp; + this.id = id; } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (obj == null) { return false; } @@ -61,37 +58,31 @@ public boolean equals( Object obj ) return false; } - ObjectKeyImpl other = (ObjectKeyImpl)obj ; + ObjectKeyImpl other = (ObjectKeyImpl) obj; - return oktemp.equals( other.oktemp ) && - id.equals( other.id ) ; + return oktemp.equals(other.oktemp) && id.equals(other.id); } @Override - public int hashCode() - { - return oktemp.hashCode() ^ id.hashCode() ; + public int hashCode() { + return oktemp.hashCode() ^ id.hashCode(); } - public ObjectKeyTemplate getTemplate() - { - return oktemp ; + public ObjectKeyTemplate getTemplate() { + return oktemp; } - public ObjectId getId() - { - return id ; + public ObjectId getId() { + return id; } - public void write( OutputStream os ) - { - oktemp.write( id, os ) ; + public void write(OutputStream os) { + oktemp.write(id, os); } - public synchronized byte[] getBytes(org.omg.CORBA.ORB orb) - { - if (array == null) { - EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream((ORB)orb); + public synchronized byte[] getBytes(org.omg.CORBA.ORB orb) { + if (array == null) { + EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream((ORB) orb); try { write(os); array = os.toByteArray(); @@ -99,16 +90,15 @@ public synchronized byte[] getBytes(org.omg.CORBA.ORB orb) try { os.close(); } catch (java.io.IOException e) { - wrapper.ioexceptionDuringStreamClose(e); + wrapper.ioexceptionDuringStreamClose(e); } } } - return array.clone() ; + return array.clone(); } - public ServerRequestDispatcher getServerRequestDispatcher() - { - return oktemp.getServerRequestDispatcher( id ) ; + public ServerRequestDispatcher getServerRequestDispatcher() { + return oktemp.getServerRequestDispatcher(id); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyTemplateBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyTemplateBase.java index 4a285886d..0ac820ad6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyTemplateBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectKeyTemplateBase.java @@ -19,58 +19,54 @@ package com.sun.corba.ee.impl.ior; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersion; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersion ; - - -import com.sun.corba.ee.spi.logging.IORSystemException ; +import com.sun.corba.ee.spi.logging.IORSystemException; /** * @author Ken Cavanaugh */ -public abstract class ObjectKeyTemplateBase implements ObjectKeyTemplate -{ - protected static final IORSystemException wrapper = - IORSystemException.self ; +public abstract class ObjectKeyTemplateBase implements ObjectKeyTemplate { + protected static final IORSystemException wrapper = IORSystemException.self; // Fixed constants for Java IDL object key template forms - public static final String JIDL_ORB_ID = "" ; - private static final String[] JIDL_OAID_STRINGS = { "TransientObjectAdapter" } ; - public static final ObjectAdapterId JIDL_OAID = new ObjectAdapterIdArray( JIDL_OAID_STRINGS ) ; + public static final String JIDL_ORB_ID = ""; + private static final String[] JIDL_OAID_STRINGS = { "TransientObjectAdapter" }; + public static final ObjectAdapterId JIDL_OAID = new ObjectAdapterIdArray(JIDL_OAID_STRINGS); - private ORB orb ; - private ORBVersion version ; - private int magic ; - private int scid ; - private int serverid ; - private String orbid ; - private ObjectAdapterId oaid ; + private ORB orb; + private ORBVersion version; + private int magic; + private int scid; + private int serverid; + private String orbid; + private ObjectAdapterId oaid; - private byte[] adapterId ; + private byte[] adapterId; public String toString() { - StringBuilder sb = new StringBuilder() ; - sb.append( "ObjectKeyTemplate[magic=") ; - sb.append( Integer.toHexString( magic ) ) ; - sb.append( " scid=" ) ; - sb.append( scid ) ; - sb.append( " serverid=") ; - sb.append( serverid ) ; - sb.append( " orbid=") ; - sb.append( orbid ) ; - sb.append( " oaid=" ) ; - sb.append( oaid.toString() ) ; - return sb.toString() ; + StringBuilder sb = new StringBuilder(); + sb.append("ObjectKeyTemplate[magic="); + sb.append(Integer.toHexString(magic)); + sb.append(" scid="); + sb.append(scid); + sb.append(" serverid="); + sb.append(serverid); + sb.append(" orbid="); + sb.append(orbid); + sb.append(" oaid="); + sb.append(oaid.toString()); + return sb.toString(); } public synchronized byte[] getAdapterId() { @@ -78,126 +74,119 @@ public synchronized byte[] getAdapterId() { adapterId = computeAdapterId(); } - return (byte[])(adapterId.clone()) ; + return (byte[]) (adapterId.clone()); } - private byte[] computeAdapterId() - { + private byte[] computeAdapterId() { // write out serverid, orbid, oaid - ByteBuffer buff = new ByteBuffer() ; + ByteBuffer buff = new ByteBuffer(); - buff.append( getServerId() ) ; - buff.append( orbid ) ; + buff.append(getServerId()); + buff.append(orbid); - buff.append( oaid.getNumLevels() ) ; + buff.append(oaid.getNumLevels()); for (String comp : oaid) { - buff.append( comp ) ; + buff.append(comp); } - buff.trimToSize() ; + buff.trimToSize(); - return buff.toArray() ; + return buff.toArray(); } - /** - * This constructor reads a complete ObjectKey (template and Id) - * from the stream. - * @param orb ORB to use + /** + * This constructor reads a complete ObjectKey (template and Id) from the stream. + * + * @param orb ORB to use * @param magic Magic number * @param scid ID of the Object * @param serverid server ID * @param orbid orbid * @param oaid oaid - */ - public ObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid, - String orbid, ObjectAdapterId oaid ) - { - this.orb = orb ; - this.magic = magic ; - this.scid = scid ; - this.serverid = serverid ; - this.orbid = orbid ; - this.oaid = oaid ; + */ + public ObjectKeyTemplateBase(ORB orb, int magic, int scid, int serverid, String orbid, ObjectAdapterId oaid) { + this.orb = orb; + this.magic = magic; + this.scid = scid; + this.serverid = serverid; + this.orbid = orbid; + this.oaid = oaid; adapterId = null; } @Override - public boolean equals( Object obj ) { + public boolean equals(Object obj) { if (!(obj instanceof ObjectKeyTemplateBase)) - return false ; + return false; - ObjectKeyTemplateBase other = (ObjectKeyTemplateBase)obj ; + ObjectKeyTemplateBase other = (ObjectKeyTemplateBase) obj; - return (magic == other.magic) && (scid == other.scid) && - (serverid == other.serverid) && (version.equals( other.version ) && - orbid.equals( other.orbid ) && oaid.equals( other.oaid )) ; + return (magic == other.magic) && (scid == other.scid) && (serverid == other.serverid) + && (version.equals(other.version) && orbid.equals(other.orbid) && oaid.equals(other.oaid)); } - + public int hashCode() { - int result = 17 ; - result = 37*result + magic ; - result = 37*result + scid ; - result = 37*result + serverid ; - result = 37*result + version.hashCode() ; - result = 37*result + orbid.hashCode() ; - result = 37*result + oaid.hashCode() ; - return result ; + int result = 17; + result = 37 * result + magic; + result = 37 * result + scid; + result = 37 * result + serverid; + result = 37 * result + version.hashCode(); + result = 37 * result + orbid.hashCode(); + result = 37 * result + oaid.hashCode(); + return result; } public int getSubcontractId() { - return scid ; + return scid; } public int getServerId() { - return serverid ; + return serverid; } public String getORBId() { - return orbid ; + return orbid; } public ObjectAdapterId getObjectAdapterId() { - return oaid ; + return oaid; } public void write(ObjectId objectId, OutputStream os) { - writeTemplate( os ) ; - objectId.write( os ) ; + writeTemplate(os); + objectId.write(os); } - public void write( OutputStream os ) - { - writeTemplate( os ) ; + public void write(OutputStream os) { + writeTemplate(os); } - abstract protected void writeTemplate( OutputStream os ) ; - + abstract protected void writeTemplate(OutputStream os); + protected int getMagic() { - return magic ; + return magic; } // All subclasses should set the version in their constructors. // Public so it can be used in a white-box test. - public void setORBVersion( ORBVersion version ) { - this.version = version ; + public void setORBVersion(ORBVersion version) { + this.version = version; } public ORBVersion getORBVersion() { - return version ; + return version; } - protected byte[] readObjectKey( InputStream is ) { - int len = is.read_long() ; - byte[] result = new byte[len] ; - is.read_octet_array( result, 0, len ) ; - return result ; + protected byte[] readObjectKey(InputStream is) { + int len = is.read_long(); + byte[] result = new byte[len]; + is.read_octet_array(result, 0, len); + return result; } - public ServerRequestDispatcher getServerRequestDispatcher( - ObjectId id ) { + public ServerRequestDispatcher getServerRequestDispatcher(ObjectId id) { - return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( - scid ) ; + return orb.getRequestDispatcherRegistry().getServerRequestDispatcher(scid); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceFactoryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceFactoryImpl.java index 3ef7d951e..342eb0531 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceFactoryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceFactoryImpl.java @@ -17,115 +17,97 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; +package com.sun.corba.ee.impl.ior; -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; -import org.omg.CORBA.portable.StreamableValue ; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.StreamableValue; -import org.omg.CORBA.TypeCode ; - -import org.omg.PortableInterceptor.ObjectReferenceFactory ; -import org.omg.PortableInterceptor.ObjectReferenceFactoryHelper ; +import org.omg.CORBA.TypeCode; +import org.omg.PortableInterceptor.ObjectReferenceFactory; +import org.omg.PortableInterceptor.ObjectReferenceFactoryHelper; import com.sun.corba.ee.spi.ior.IORFactory; import com.sun.corba.ee.spi.ior.IORTemplateList; import com.sun.corba.ee.spi.ior.IORFactories; -import com.sun.corba.ee.spi.orb.ORB ; - -/** This is an implementation of the ObjectReferenceFactory abstract value -* type defined by the portable interceptors IDL. -* Note that this is a direct Java implementation -* of the abstract value type: there is no stateful value type defined in IDL, -* since defining the state in IDL is awkward and inefficient. The best way -* to define the state is to use internal data structures that can be written -* to and read from CORBA streams. -*/ -public class ObjectReferenceFactoryImpl extends ObjectReferenceProducerBase - implements ObjectReferenceFactory, StreamableValue -{ +import com.sun.corba.ee.spi.orb.ORB; + +/** + * This is an implementation of the ObjectReferenceFactory abstract value type defined by the portable interceptors IDL. + * Note that this is a direct Java implementation of the abstract value type: there is no stateful value type defined in + * IDL, since defining the state in IDL is awkward and inefficient. The best way to define the state is to use internal + * data structures that can be written to and read from CORBA streams. + */ +public class ObjectReferenceFactoryImpl extends ObjectReferenceProducerBase implements ObjectReferenceFactory, StreamableValue { // private static long serialVersionUID = 0 ; - transient private IORTemplateList iorTemplates ; + transient private IORTemplateList iorTemplates; - public ObjectReferenceFactoryImpl( InputStream is ) - { - super( (ORB)(is.orb()) ) ; - _read( is ) ; + public ObjectReferenceFactoryImpl(InputStream is) { + super((ORB) (is.orb())); + _read(is); } - public ObjectReferenceFactoryImpl( ORB orb, IORTemplateList iortemps ) - { - super( orb ) ; - iorTemplates = iortemps ; + public ObjectReferenceFactoryImpl(ORB orb, IORTemplateList iortemps) { + super(orb); + iorTemplates = iortemps; } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (!(obj instanceof ObjectReferenceFactoryImpl)) - return false ; + return false; - ObjectReferenceFactoryImpl other = (ObjectReferenceFactoryImpl)obj ; + ObjectReferenceFactoryImpl other = (ObjectReferenceFactoryImpl) obj; - return (iorTemplates != null) && - iorTemplates.equals( other.iorTemplates ) ; + return (iorTemplates != null) && iorTemplates.equals(other.iorTemplates); } @Override - public int hashCode() - { - return iorTemplates.hashCode() ; + public int hashCode() { + return iorTemplates.hashCode(); } // Note that this repository ID must reflect the implementation // of the abstract valuetype (that is, this class), not the // repository ID of the org.omg.PortableInterceptor.ObjectReferenceFactory - // class. This allows for multiple independent implementations + // class. This allows for multiple independent implementations // of the abstract valuetype, should that become necessary. - public static final String repositoryId = - "IDL:com/sun/corba/ee/impl/ior/ObjectReferenceFactoryImpl:1.0" ; + public static final String repositoryId = "IDL:com/sun/corba/ee/impl/ior/ObjectReferenceFactoryImpl:1.0"; - public String[] _truncatable_ids() - { - return new String[] { repositoryId } ; + public String[] _truncatable_ids() { + return new String[] { repositoryId }; } - public TypeCode _type() - { - return ObjectReferenceFactoryHelper.type() ; + public TypeCode _type() { + return ObjectReferenceFactoryHelper.type(); } - /** Read the data into a (presumably) empty ObjectReferenceFactoryImpl. - * This sets the orb to the ORB of the InputStream. - */ - public void _read( InputStream is ) - { - org.omg.CORBA_2_3.portable.InputStream istr = - (org.omg.CORBA_2_3.portable.InputStream)is ; + /** + * Read the data into a (presumably) empty ObjectReferenceFactoryImpl. This sets the orb to the ORB of the InputStream. + */ + public void _read(InputStream is) { + org.omg.CORBA_2_3.portable.InputStream istr = (org.omg.CORBA_2_3.portable.InputStream) is; - iorTemplates = IORFactories.makeIORTemplateList( istr ) ; + iorTemplates = IORFactories.makeIORTemplateList(istr); } - /** Write the state to the OutputStream. + /** + * Write the state to the OutputStream. */ - public void _write( OutputStream os ) - { - org.omg.CORBA_2_3.portable.OutputStream ostr = - (org.omg.CORBA_2_3.portable.OutputStream)os ; + public void _write(OutputStream os) { + org.omg.CORBA_2_3.portable.OutputStream ostr = (org.omg.CORBA_2_3.portable.OutputStream) os; - iorTemplates.write( ostr ) ; + iorTemplates.write(ostr); } - public IORFactory getIORFactory() - { - return iorTemplates ; + public IORFactory getIORFactory() { + return iorTemplates; } - public IORTemplateList getIORTemplateList() - { - return iorTemplates ; + public IORTemplateList getIORTemplateList() { + return iorTemplates; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceProducerBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceProducerBase.java index 5e209139a..1354ae2e9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceProducerBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceProducerBase.java @@ -17,44 +17,39 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; +package com.sun.corba.ee.impl.ior; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.IORFactory ; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.IORFactories ; -import com.sun.corba.ee.spi.ior.IORTemplateList ; -import com.sun.corba.ee.spi.ior.ObjectId ; +import com.sun.corba.ee.spi.ior.IORFactory; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.IORFactories; +import com.sun.corba.ee.spi.ior.IORTemplateList; +import com.sun.corba.ee.spi.ior.ObjectId; -import com.sun.corba.ee.impl.misc.ORBUtility ; +import com.sun.corba.ee.impl.misc.ORBUtility; import java.io.Serializable; - // Made this serializable so that derived class ObjectReferenceFactoryImpl // does not require a void constructor. Instead, this class is Serializable, // and Object is its superclass, so Object provides the void constructor. // This change cleans up a findbugs issue. public abstract class ObjectReferenceProducerBase implements Serializable { private static final long serialVersionUID = 6478965304620421549L; - transient protected ORB orb ; + transient protected ORB orb; - public abstract IORFactory getIORFactory() ; + public abstract IORFactory getIORFactory(); - public abstract IORTemplateList getIORTemplateList() ; + public abstract IORTemplateList getIORTemplateList(); - public ObjectReferenceProducerBase( ORB orb ) - { - this.orb = orb ; + public ObjectReferenceProducerBase(ORB orb) { + this.orb = orb; } - public org.omg.CORBA.Object make_object (String repositoryId, - byte[] objectId) - { - ObjectId oid = IORFactories.makeObjectId( objectId ) ; - IOR ior = getIORFactory().makeIOR( orb, repositoryId, oid ) ; + public org.omg.CORBA.Object make_object(String repositoryId, byte[] objectId) { + ObjectId oid = IORFactories.makeObjectId(objectId); + IOR ior = getIORFactory().makeIOR(orb, repositoryId, oid); - return ORBUtility.makeObjectReference( ior ) ; + return ORBUtility.makeObjectReference(ior); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceTemplateImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceTemplateImpl.java index 4b7269b02..86cd2b32a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceTemplateImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/ObjectReferenceTemplateImpl.java @@ -17,137 +17,113 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior ; +package com.sun.corba.ee.impl.ior; -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; -import org.omg.CORBA.portable.StreamableValue ; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.StreamableValue; -import org.omg.CORBA.TypeCode ; +import org.omg.CORBA.TypeCode; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper ; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; +import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper; - -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; import com.sun.corba.ee.spi.ior.IORFactory; import com.sun.corba.ee.spi.ior.IORTemplate; import com.sun.corba.ee.spi.ior.IORTemplateList; import com.sun.corba.ee.spi.ior.IORFactories; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.orb.ORB ; - -/** This is an implementation of the ObjectReferenceTemplate abstract value -* type defined by the portable interceptors IDL. -* Note that this is a direct Java implementation -* of the abstract value type: there is no stateful value type defined in IDL, -* since defining the state in IDL is awkward and inefficient. The best way -* to define the state is to use internal data structures that can be written -* to and read from CORBA streams. -*/ -public class ObjectReferenceTemplateImpl extends ObjectReferenceProducerBase - implements ObjectReferenceTemplate, StreamableValue -{ +/** + * This is an implementation of the ObjectReferenceTemplate abstract value type defined by the portable interceptors + * IDL. Note that this is a direct Java implementation of the abstract value type: there is no stateful value type + * defined in IDL, since defining the state in IDL is awkward and inefficient. The best way to define the state is to + * use internal data structures that can be written to and read from CORBA streams. + */ +public class ObjectReferenceTemplateImpl extends ObjectReferenceProducerBase implements ObjectReferenceTemplate, StreamableValue { private static final long serialVersionUID = 6441570404699638098L; - transient private IORTemplate iorTemplate ; + transient private IORTemplate iorTemplate; - public ObjectReferenceTemplateImpl( InputStream is ) - { - super( (ORB)(is.orb()) ) ; - _read( is ) ; + public ObjectReferenceTemplateImpl(InputStream is) { + super((ORB) (is.orb())); + _read(is); } - public ObjectReferenceTemplateImpl( ORB orb, IORTemplate iortemp ) - { - super( orb ) ; - iorTemplate = iortemp ; + public ObjectReferenceTemplateImpl(ORB orb, IORTemplate iortemp) { + super(orb); + iorTemplate = iortemp; } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (!(obj instanceof ObjectReferenceTemplateImpl)) { - return false ; + return false; } - ObjectReferenceTemplateImpl other = (ObjectReferenceTemplateImpl)obj ; + ObjectReferenceTemplateImpl other = (ObjectReferenceTemplateImpl) obj; - return (iorTemplate != null) && - iorTemplate.equals( other.iorTemplate ) ; + return (iorTemplate != null) && iorTemplate.equals(other.iorTemplate); } @Override - public int hashCode() - { - return iorTemplate.hashCode() ; + public int hashCode() { + return iorTemplate.hashCode(); } // Note that this repository ID must reflect the implementation // of the abstract valuetype (that is, this class), not the // repository ID of the org.omg.PortableInterceptor.ObjectReferenceTemplate - // class. This allows for multiple independent implementations + // class. This allows for multiple independent implementations // of the abstract valuetype, should that become necessary. - public static final String repositoryId = - "IDL:com/sun/corba/ee/impl/ior/ObjectReferenceTemplateImpl:1.0" ; + public static final String repositoryId = "IDL:com/sun/corba/ee/impl/ior/ObjectReferenceTemplateImpl:1.0"; - public String[] _truncatable_ids() - { - return new String[] { repositoryId } ; + public String[] _truncatable_ids() { + return new String[] { repositoryId }; } - public TypeCode _type() - { - return ObjectReferenceTemplateHelper.type() ; + public TypeCode _type() { + return ObjectReferenceTemplateHelper.type(); } - // Read the data into a (presumably) empty ORTImpl. This sets the + // Read the data into a (presumably) empty ORTImpl. This sets the // orb to the ORB of the InputStream. - public void _read( InputStream is ) - { - org.omg.CORBA_2_3.portable.InputStream istr = - (org.omg.CORBA_2_3.portable.InputStream)is ; - iorTemplate = IORFactories.makeIORTemplate( istr ) ; - orb = (ORB)(istr.orb()) ; + public void _read(InputStream is) { + org.omg.CORBA_2_3.portable.InputStream istr = (org.omg.CORBA_2_3.portable.InputStream) is; + iorTemplate = IORFactories.makeIORTemplate(istr); + orb = (ORB) (istr.orb()); } - public void _write( OutputStream os ) - { - org.omg.CORBA_2_3.portable.OutputStream ostr = - (org.omg.CORBA_2_3.portable.OutputStream)os ; + public void _write(OutputStream os) { + org.omg.CORBA_2_3.portable.OutputStream ostr = (org.omg.CORBA_2_3.portable.OutputStream) os; - iorTemplate.write( ostr ) ; + iorTemplate.write(ostr); } - public String server_id () - { - int val = iorTemplate.getObjectKeyTemplate().getServerId() ; - return Integer.toString( val ) ; + public String server_id() { + int val = iorTemplate.getObjectKeyTemplate().getServerId(); + return Integer.toString(val); } - public String orb_id () - { - return iorTemplate.getObjectKeyTemplate().getORBId() ; + public String orb_id() { + return iorTemplate.getObjectKeyTemplate().getORBId(); } - public String[] adapter_name() - { - ObjectAdapterId poaid = - iorTemplate.getObjectKeyTemplate().getObjectAdapterId() ; + public String[] adapter_name() { + ObjectAdapterId poaid = iorTemplate.getObjectKeyTemplate().getObjectAdapterId(); - return poaid.getAdapterName() ; + return poaid.getAdapterName(); } - public IORFactory getIORFactory() - { - return iorTemplate ; + public IORFactory getIORFactory() { + return iorTemplate; } - public IORTemplateList getIORTemplateList() - { - IORTemplateList tl = IORFactories.makeIORTemplateList() ; - tl.add( iorTemplate ) ; - tl.makeImmutable() ; - return tl ; + public IORTemplateList getIORTemplateList() { + IORTemplateList tl = IORFactories.makeIORTemplateList(); + tl.add(iorTemplate); + tl.makeImmutable(); + return tl; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldJIDLObjectKeyTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldJIDLObjectKeyTemplate.java index 834e87a37..e7da5cff8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldJIDLObjectKeyTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldJIDLObjectKeyTemplate.java @@ -19,57 +19,47 @@ package com.sun.corba.ee.impl.ior; -import org.omg.CORBA.OctetSeqHolder ; +import org.omg.CORBA.OctetSeqHolder; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.ObjectId ; +import com.sun.corba.ee.spi.ior.ObjectId; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; - -import com.sun.corba.ee.impl.encoding.CDRInputObject ; +import com.sun.corba.ee.impl.encoding.CDRInputObject; /** - * Handles object keys created by JDK ORBs from before JDK 1.4.0. + * Handles object keys created by JDK ORBs from before JDK 1.4.0. */ -public final class OldJIDLObjectKeyTemplate extends OldObjectKeyTemplateBase -{ +public final class OldJIDLObjectKeyTemplate extends OldObjectKeyTemplateBase { /** - * JDK 1.3.1 FCS did not include a version byte at the end of - * its object keys. JDK 1.3.1_01 included the byte with the - * value 1. Anything below 1 is considered an invalid value. + * JDK 1.3.1 FCS did not include a version byte at the end of its object keys. JDK 1.3.1_01 included the byte with the + * value 1. Anything below 1 is considered an invalid value. */ public static final byte NULL_PATCH_VERSION = 0; byte patchVersion = OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION; - public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid, - InputStream is, OctetSeqHolder osh ) - { - this( orb, magic, scid, is ); + public OldJIDLObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is, OctetSeqHolder osh) { + this(orb, magic, scid, is); + + osh.value = readObjectKey(is); - osh.value = readObjectKey( is ) ; - /** - * Beginning with JDK 1.3.1_01, a byte was placed at the end of - * the object key with a value indicating the patch version. - * JDK 1.3.1_01 had the value 1. If other patches are necessary - * which involve ORB versioning changes, they should increment - * the patch version. + * Beginning with JDK 1.3.1_01, a byte was placed at the end of the object key with a value indicating the patch + * version. JDK 1.3.1_01 had the value 1. If other patches are necessary which involve ORB versioning changes, they + * should increment the patch version. * - * Note that if we see a value greater than 1 in this code, we - * will treat it as if we're talking to the most recent ORB version. + * Note that if we see a value greater than 1 in this code, we will treat it as if we're talking to the most recent ORB + * version. * - * WARNING: This code is sensitive to changes in CDRInputStream - * getPosition. It assumes that the CDRInputStream is an - * encapsulation whose position can be compared to the object - * key array length. + * WARNING: This code is sensitive to changes in CDRInputStream getPosition. It assumes that the CDRInputStream is an + * encapsulation whose position can be compared to the object key array length. */ - if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW && - osh.value.length > ((CDRInputObject)is).getPosition()) { + if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW && osh.value.length > ((CDRInputObject) is).getPosition()) { patchVersion = is.read_octet(); @@ -82,28 +72,23 @@ public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid, } } } - - - public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid, int serverid) - { - super( orb, magic, scid, serverid, JIDL_ORB_ID, JIDL_OAID ) ; + + public OldJIDLObjectKeyTemplate(ORB orb, int magic, int scid, int serverid) { + super(orb, magic, scid, serverid, JIDL_ORB_ID, JIDL_OAID); } - - public OldJIDLObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is) - { - this( orb, magic, scid, is.read_long() ) ; + + public OldJIDLObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is) { + this(orb, magic, scid, is.read_long()); } - - protected void writeTemplate( OutputStream os ) - { - os.write_long( getMagic() ) ; - os.write_long( getSubcontractId() ) ; - os.write_long( getServerId() ) ; + + protected void writeTemplate(OutputStream os) { + os.write_long(getMagic()); + os.write_long(getSubcontractId()); + os.write_long(getServerId()); } @Override - public void write(ObjectId objectId, OutputStream os) - { + public void write(ObjectId objectId, OutputStream os) { super.write(objectId, os); if (patchVersion != OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldObjectKeyTemplateBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldObjectKeyTemplateBase.java index e487f51a5..79216d92e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldObjectKeyTemplateBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldObjectKeyTemplateBase.java @@ -19,32 +19,29 @@ package com.sun.corba.ee.impl.ior; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersion ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersion; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; -import com.sun.corba.ee.impl.ior.ObjectKeyFactoryImpl ; +import com.sun.corba.ee.impl.ior.ObjectKeyFactoryImpl; /** * @author Ken Cavanaugh */ -public abstract class OldObjectKeyTemplateBase extends ObjectKeyTemplateBase -{ - public OldObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid, - String orbid, ObjectAdapterId oaid ) - { - super( orb, magic, scid, serverid, orbid, oaid ) ; +public abstract class OldObjectKeyTemplateBase extends ObjectKeyTemplateBase { + public OldObjectKeyTemplateBase(ORB orb, int magic, int scid, int serverid, String orbid, ObjectAdapterId oaid) { + super(orb, magic, scid, serverid, orbid, oaid); // set version based on magic if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_OLD) - setORBVersion( ORBVersionFactory.getOLD() ) ; + setORBVersion(ORBVersionFactory.getOLD()); else if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW) - setORBVersion( ORBVersionFactory.getNEW() ) ; + setORBVersion(ORBVersionFactory.getNEW()); else // any other magic should not be here - throw wrapper.badMagic( Integer.valueOf( magic ) ) ; + throw wrapper.badMagic(Integer.valueOf(magic)); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldPOAObjectKeyTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldPOAObjectKeyTemplate.java index da5afbe8c..7a3e6e37b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldPOAObjectKeyTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/OldPOAObjectKeyTemplate.java @@ -20,81 +20,73 @@ package com.sun.corba.ee.impl.ior; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.OctetSeqHolder ; +import org.omg.CORBA.INTERNAL; +import org.omg.CORBA.OctetSeqHolder; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersion ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersion; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; /** * @author Ken Cavanaugh */ -public final class OldPOAObjectKeyTemplate extends OldObjectKeyTemplateBase -{ - /** This constructor reads the template ONLY from the stream +public final class OldPOAObjectKeyTemplate extends OldObjectKeyTemplateBase { + /** + * This constructor reads the template ONLY from the stream + * * @param orb ORB to use * @param magic Magic number * @param scid ID of template * @param is stream to read from - */ - public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is ) - { - this( orb, magic, scid, is.read_long(), is.read_long(), is.read_long() ) ; + */ + public OldPOAObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is) { + this(orb, magic, scid, is.read_long(), is.read_long(), is.read_long()); } - - /** This constructor reads a complete ObjectKey (template and Id) - * from the stream. - * @param orb ORB to use + + /** + * This constructor reads a complete ObjectKey (template and Id) from the stream. + * + * @param orb ORB to use * @param magic Magic number * @param scid ID of the Object * @param is Stream to read from * @param osh Holder for Octet - */ - public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is, - OctetSeqHolder osh ) - { - this( orb, magic, scid, is ) ; - osh.value = readObjectKey( is ) ; + */ + public OldPOAObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is, OctetSeqHolder osh) { + this(orb, magic, scid, is); + osh.value = readObjectKey(is); } - - public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, int serverid, - int orbid, int poaid) - { - super( orb, magic, scid, serverid, - Integer.toString( orbid ), - new ObjectAdapterIdNumber( poaid ) ) ; + + public OldPOAObjectKeyTemplate(ORB orb, int magic, int scid, int serverid, int orbid, int poaid) { + super(orb, magic, scid, serverid, Integer.toString(orbid), new ObjectAdapterIdNumber(poaid)); } - + @Override - public void writeTemplate(OutputStream os) - { - os.write_long( getMagic() ) ; - os.write_long( getSubcontractId() ) ; - os.write_long( getServerId() ) ; + public void writeTemplate(OutputStream os) { + os.write_long(getMagic()); + os.write_long(getSubcontractId()); + os.write_long(getServerId()); - int orbid = Integer.parseInt( getORBId() ) ; - os.write_long( orbid ) ; + int orbid = Integer.parseInt(getORBId()); + os.write_long(orbid); - ObjectAdapterIdNumber oaid = (ObjectAdapterIdNumber)(getObjectAdapterId()) ; - int poaid = oaid.getOldPOAId() ; - os.write_long( poaid ) ; + ObjectAdapterIdNumber oaid = (ObjectAdapterIdNumber) (getObjectAdapterId()); + int poaid = oaid.getOldPOAId(); + os.write_long(poaid); } - + @Override public ORBVersion getORBVersion() { switch (getMagic()) { - case ObjectKeyFactoryImpl.JAVAMAGIC_OLD: - return ORBVersionFactory.getOLD() ; - case ObjectKeyFactoryImpl.JAVAMAGIC_NEW: - return ORBVersionFactory.getNEW() ; - default: - throw new INTERNAL() ; + case ObjectKeyFactoryImpl.JAVAMAGIC_OLD: + return ORBVersionFactory.getOLD(); + case ObjectKeyFactoryImpl.JAVAMAGIC_NEW: + return ORBVersionFactory.getNEW(); + default: + throw new INTERNAL(); } } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/POAObjectKeyTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/POAObjectKeyTemplate.java index f6b6ea087..730775fd5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/POAObjectKeyTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/POAObjectKeyTemplate.java @@ -19,77 +19,70 @@ package com.sun.corba.ee.impl.ior; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA.OctetSeqHolder ; +import org.omg.CORBA.OctetSeqHolder; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; -public final class POAObjectKeyTemplate extends NewObjectKeyTemplateBase -{ - public static String[] readPOAName( - org.omg.CORBA.portable.InputStream istream) - { +public final class POAObjectKeyTemplate extends NewObjectKeyTemplateBase { + public static String[] readPOAName(org.omg.CORBA.portable.InputStream istream) { String value[] = null; int _len0 = istream.read_long(); value = new String[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) { + for (int _o1 = 0; _o1 < value.length; ++_o1) { value[_o1] = istream.read_string(); } return value; } - /** This constructor reads the template ONLY from the stream. + /** + * This constructor reads the template ONLY from the stream. + * * @param orb ORB to use * @param magic Magic number * @param scid ID of template * @param is stream to read from - */ - public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is ) - { - super( orb, magic, scid, is.read_long(), is.read_string(), - new ObjectAdapterIdArray( readPOAName( is ) ) ) ; + */ + public POAObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is) { + super(orb, magic, scid, is.read_long(), is.read_string(), new ObjectAdapterIdArray(readPOAName(is))); - setORBVersion( is ) ; + setORBVersion(is); } - /** This constructor reads a complete ObjectKey (template and Id) - * from the stream. - * @param orb ORB to use + /** + * This constructor reads a complete ObjectKey (template and Id) from the stream. + * + * @param orb ORB to use * @param magic Magic number * @param scid ID of the Object * @param is Stream to read from * @param osh Holder for Octet - */ - public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is, OctetSeqHolder osh ) { - super( orb, magic, scid, is.read_long(), is.read_string(), - new ObjectAdapterIdArray( readPOAName( is ) ) ) ; - - osh.value = readObjectKey( is ) ; + */ + public POAObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is, OctetSeqHolder osh) { + super(orb, magic, scid, is.read_long(), is.read_string(), new ObjectAdapterIdArray(readPOAName(is))); + + osh.value = readObjectKey(is); - setORBVersion( is ) ; + setORBVersion(is); } - - public POAObjectKeyTemplate( ORB orb, int scid, int serverid, String orbid, - ObjectAdapterId objectAdapterId) - { - super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid, - objectAdapterId ) ; - setORBVersion( ORBVersionFactory.getORBVersion() ) ; + public POAObjectKeyTemplate(ORB orb, int scid, int serverid, String orbid, ObjectAdapterId objectAdapterId) { + super(orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid, objectAdapterId); + + setORBVersion(ORBVersionFactory.getORBVersion()); } - + @Override - public void writeTemplate(OutputStream os) - { - os.write_long( getMagic() ) ; - os.write_long( getSubcontractId() ) ; - os.write_long( getServerId() ) ; - os.write_string( getORBId() ) ; - getObjectAdapterId().write( os ) ; + public void writeTemplate(OutputStream os) { + os.write_long(getMagic()); + os.write_long(getSubcontractId()); + os.write_long(getServerId()); + os.write_string(getORBId()); + getObjectAdapterId().write(os); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/StubIORImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/StubIORImpl.java index eb383aad5..a6a71efe3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/StubIORImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/StubIORImpl.java @@ -21,58 +21,54 @@ package com.sun.corba.ee.impl.ior; -import java.io.ObjectOutputStream ; -import java.io.IOException ; -import java.io.Serializable ; +import java.io.ObjectOutputStream; +import java.io.IOException; +import java.io.Serializable; -import java.util.Arrays ; +import java.util.Arrays; -import org.omg.CORBA.ORB ; +import org.omg.CORBA.ORB; -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; // Be very careful: com.sun.corba imports must not depend on // PEORB internal classes in ways that prevent portability to // other vendor's ORBs. -import com.sun.corba.ee.spi.presentation.rmi.StubAdapter ; +import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; import com.sun.corba.ee.impl.misc.ORBUtility; import com.sun.corba.ee.spi.misc.ORBConstants; /** - * This class implements a very simply IOR representation - * which must be completely ORBImpl free so that this class - * can be used in the implementation of a portable StubDelegateImpl. + * This class implements a very simply IOR representation which must be completely ORBImpl free so that this class can + * be used in the implementation of a portable StubDelegateImpl. */ -public class StubIORImpl implements Serializable -{ +public class StubIORImpl implements Serializable { private static final long serialVersionUID = -6261452601247416282L; // cached hash code - transient private int hashCode = 0 ; - + transient private int hashCode = 0; + // IOR components private byte[] typeData; private int[] profileTags; private byte[][] profileData; - public StubIORImpl() - { - typeData = null ; - profileTags = null ; - profileData = null ; + public StubIORImpl() { + typeData = null; + profileTags = null; + profileData = null; } - public String getRepositoryId() - { + public String getRepositoryId() { if (typeData == null) { - return null ; + return null; } - return new String( typeData ) ; + return new String(typeData); } - public StubIORImpl( org.omg.CORBA.Object obj ) { + public StubIORImpl(org.omg.CORBA.Object obj) { // All externally visible IOR representations must be handled // using the standard CDR encoding, irrespective of encoding setting. @@ -82,7 +78,7 @@ public StubIORImpl( org.omg.CORBA.Object obj ) { } try { - // write the IOR to an OutputStream and get an InputStream + // write the IOR to an OutputStream and get an InputStream OutputStream ostr = StubAdapter.getORB(obj).create_output_stream(); ostr.write_Object(obj); InputStream istr = ostr.create_input_stream(); @@ -97,8 +93,7 @@ public StubIORImpl( org.omg.CORBA.Object obj ) { for (int i = 0; i < numProfiles; i++) { profileTags[i] = istr.read_long(); profileData[i] = new byte[istr.read_long()]; - istr.read_octet_array(profileData[i], 0, - profileData[i].length); + istr.read_octet_array(profileData[i], 0, profileData[i].length); } } finally { @@ -108,7 +103,7 @@ public StubIORImpl( org.omg.CORBA.Object obj ) { } } - + public Delegate getDelegate(ORB orb) { // All externally visible IOR representations must be handled @@ -120,7 +115,7 @@ public Delegate getDelegate(ORB orb) { try { - // write IOR components to an org.omg.CORBA.portable.OutputStream + // write IOR components to an org.omg.CORBA.portable.OutputStream OutputStream ostr = orb.create_output_stream(); ostr.write_long(typeData.length); ostr.write_octet_array(typeData, 0, typeData.length); @@ -128,14 +123,13 @@ public Delegate getDelegate(ORB orb) { for (int i = 0; i < profileTags.length; i++) { ostr.write_long(profileTags[i]); ostr.write_long(profileData[i].length); - ostr.write_octet_array(profileData[i], 0, - profileData[i].length); + ostr.write_octet_array(profileData[i], 0, profileData[i].length); } - InputStream istr = ostr.create_input_stream() ; + InputStream istr = ostr.create_input_stream(); // read the IOR back from the stream org.omg.CORBA.Object obj = istr.read_Object(); - return StubAdapter.getDelegate( obj ) ; + return StubAdapter.getDelegate(obj); } finally { if (encodingVersion != ORBConstants.CDR_ENC_VERSION) { @@ -146,9 +140,7 @@ public Delegate getDelegate(ORB orb) { } // DO NOT MODIFY THIS METHOD - implements OMG standard behavior. - public void doRead( java.io.ObjectInputStream stream ) - throws IOException, ClassNotFoundException - { + public void doRead(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { // read the IOR from the ObjectInputStream int typeLength = stream.readInt(); typeData = new byte[typeLength]; @@ -164,9 +156,7 @@ public void doRead( java.io.ObjectInputStream stream ) } // DO NOT MODIFY THIS METHOD - implements OMG standard behavior. - public void doWrite( ObjectOutputStream stream ) - throws IOException - { + public void doWrite(ObjectOutputStream stream) throws IOException { // write the IOR to the ObjectOutputStream stream.writeInt(typeData.length); stream.write(typeData); @@ -179,13 +169,12 @@ public void doWrite( ObjectOutputStream stream ) } /** - * Returns a hash code value for the object which is the same for all stubs - * that represent the same remote object. + * Returns a hash code value for the object which is the same for all stubs that represent the same remote object. + * * @return the hash code value. */ @Override - public synchronized int hashCode() - { + public synchronized int hashCode() { if (hashCode == 0) { // compute the hash code @@ -201,72 +190,68 @@ public synchronized int hashCode() } } - return hashCode; + return hashCode; } - private boolean equalArrays( byte[][] data1, byte[][] data2 ) - { + private boolean equalArrays(byte[][] data1, byte[][] data2) { if (data1.length != data2.length) { - return false ; + return false; } - for (int ctr=0; ctr,[]data, ...]"} + * Returns a string representation of this stub. Returns the same string for all stubs that represent the same remote + * object. {@code "SimpleIORImpl[,[]data, ...]"} + * * @return a string representation of this stub. */ @Override - public String toString() - { - StringBuilder result = new StringBuilder() ; - result.append( "SimpleIORImpl[" ) ; - String repositoryId = new String( typeData ) ; - result.append( repositoryId ) ; - for (int ctr=0; ctr - implements TaggedComponentFactoryFinder -{ - public TaggedComponentFactoryFinderImpl( ORB orb ) - { - super( orb ) ; +public class TaggedComponentFactoryFinderImpl extends IdentifiableFactoryFinderBase + implements TaggedComponentFactoryFinder { + public TaggedComponentFactoryFinderImpl(ORB orb) { + super(orb); } - public TaggedComponent handleMissingFactory( int id, InputStream is ) { - return new GenericTaggedComponent( id, is ) ; + public TaggedComponent handleMissingFactory(int id, InputStream is) { + return new GenericTaggedComponent(id, is); } - public TaggedComponent create( org.omg.CORBA.ORB orb, - org.omg.IOP.TaggedComponent comp ) - { - EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream( (ORB)orb ) ; - org.omg.IOP.TaggedComponentHelper.write( os, comp ) ; - InputStream is = (InputStream)(os.create_input_stream() ) ; + public TaggedComponent create(org.omg.CORBA.ORB orb, org.omg.IOP.TaggedComponent comp) { + EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream((ORB) orb); + org.omg.IOP.TaggedComponentHelper.write(os, comp); + InputStream is = (InputStream) (os.create_input_stream()); // Skip the component ID: we just wrote it out above - is.read_ulong() ; + is.read_ulong(); - return (TaggedComponent)create( comp.tag, is ) ; + return (TaggedComponent) create(comp.tag, is); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/TaggedProfileFactoryFinderImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/TaggedProfileFactoryFinderImpl.java index 570f69306..1a3da8e30 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/TaggedProfileFactoryFinderImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/TaggedProfileFactoryFinderImpl.java @@ -19,23 +19,18 @@ package com.sun.corba.ee.impl.ior; -import com.sun.corba.ee.spi.ior.TaggedProfile ; +import com.sun.corba.ee.spi.ior.TaggedProfile; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; +import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.InputStream ; - -public class TaggedProfileFactoryFinderImpl extends - IdentifiableFactoryFinderBase -{ - public TaggedProfileFactoryFinderImpl( ORB orb ) - { - super( orb ) ; +public class TaggedProfileFactoryFinderImpl extends IdentifiableFactoryFinderBase { + public TaggedProfileFactoryFinderImpl(ORB orb) { + super(orb); } - public TaggedProfile handleMissingFactory( int id, InputStream is) - { - return new GenericTaggedProfile( id, is ) ; + public TaggedProfile handleMissingFactory(int id, InputStream is) { + return new GenericTaggedProfile(id, is); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java index 65aeeb26e..9f1ae2470 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java @@ -19,25 +19,21 @@ package com.sun.corba.ee.impl.ior; -import com.sun.corba.ee.spi.ior.TaggedProfileTemplate ; +import com.sun.corba.ee.spi.ior.TaggedProfileTemplate; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; /** * @author Ken Cavanaugh */ -public class TaggedProfileTemplateFactoryFinderImpl extends - IdentifiableFactoryFinderBase -{ - public TaggedProfileTemplateFactoryFinderImpl( ORB orb ) - { - super( orb ) ; +public class TaggedProfileTemplateFactoryFinderImpl extends IdentifiableFactoryFinderBase { + public TaggedProfileTemplateFactoryFinderImpl(ORB orb) { + super(orb); } - public TaggedProfileTemplate handleMissingFactory( int id, InputStream is) - { - throw wrapper.taggedProfileTemplateFactoryNotFound( id ) ; + public TaggedProfileTemplate handleMissingFactory(int id, InputStream is) { + throw wrapper.taggedProfileTemplateFactoryNotFound(id); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/WireObjectKeyTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/WireObjectKeyTemplate.java index ec6784a16..ae3930294 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/WireObjectKeyTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/WireObjectKeyTemplate.java @@ -19,115 +19,97 @@ package com.sun.corba.ee.impl.ior; +import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA_2_3.portable.OutputStream ; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersion; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersion ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; +import com.sun.corba.ee.spi.misc.ORBConstants; -import com.sun.corba.ee.spi.misc.ORBConstants ; - -import com.sun.corba.ee.spi.logging.IORSystemException ; +import com.sun.corba.ee.spi.logging.IORSystemException; /** * @author Ken Cavanaugh */ -public class WireObjectKeyTemplate implements ObjectKeyTemplate -{ - private ORB orb ; - private static final IORSystemException wrapper = - IORSystemException.self ; - private static ObjectAdapterId NULL_OBJECT_ADAPTER_ID = - new ObjectAdapterIdArray( new String[0] ) ; +public class WireObjectKeyTemplate implements ObjectKeyTemplate { + private ORB orb; + private static final IORSystemException wrapper = IORSystemException.self; + private static ObjectAdapterId NULL_OBJECT_ADAPTER_ID = new ObjectAdapterIdArray(new String[0]); @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (obj == null) { - return false ; + return false; } - return obj instanceof WireObjectKeyTemplate ; + return obj instanceof WireObjectKeyTemplate; } @Override - public int hashCode() - { - return 53 ; // All WireObjectKeyTemplates are the same, so they should - // have the same hashCode. + public int hashCode() { + return 53; // All WireObjectKeyTemplates are the same, so they should + // have the same hashCode. } - public WireObjectKeyTemplate( ORB orb ) - { - initORB( orb ) ; + public WireObjectKeyTemplate(ORB orb) { + initORB(orb); } - private void initORB( ORB orb ) - { - this.orb = orb ; + private void initORB(ORB orb) { + this.orb = orb; } - public void write( ObjectId id, OutputStream os ) - { - byte[] key = id.getId() ; - os.write_octet_array( key, 0, key.length ) ; + public void write(ObjectId id, OutputStream os) { + byte[] key = id.getId(); + os.write_octet_array(key, 0, key.length); } - public void write( OutputStream os ) - { + public void write(OutputStream os) { // Does nothing } - public int getSubcontractId() - { - return ORBConstants.DEFAULT_SCID ; + public int getSubcontractId() { + return ORBConstants.DEFAULT_SCID; } // While it might make sense to throw an exception here, this causes // problems since we need to check whether unusual object references - // are local or not. It seems that the easiest way to handle this is + // are local or not. It seems that the easiest way to handle this is // to return an invalid server id. - public int getServerId() - { - return -1 ; + public int getServerId() { + return -1; } - public String getORBId() - { - throw wrapper.orbIdNotAvailable() ; + public String getORBId() { + throw wrapper.orbIdNotAvailable(); } - public ObjectAdapterId getObjectAdapterId() - { - return NULL_OBJECT_ADAPTER_ID ; + public ObjectAdapterId getObjectAdapterId() { + return NULL_OBJECT_ADAPTER_ID; // throw wrapper.objectAdapterIdNotAvailable() ; } // Adapter ID is not available, since our // ORB did not implement the object carrying this key. - public byte[] getAdapterId() - { - throw wrapper.adapterIdNotAvailable() ; + public byte[] getAdapterId() { + throw wrapper.adapterIdNotAvailable(); } - public ORBVersion getORBVersion() - { - return ORBVersionFactory.getFOREIGN() ; + public ORBVersion getORBVersion() { + return ORBVersionFactory.getFOREIGN(); } - public ServerRequestDispatcher getServerRequestDispatcher( ObjectId id ) - { - byte[] bid = id.getId() ; - String str = new String( bid ) ; - return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( - str ) ; + public ServerRequestDispatcher getServerRequestDispatcher(ObjectId id) { + byte[] bid = id.getId(); + String str = new String(bid); + return orb.getRequestDispatcherRegistry().getServerRequestDispatcher(str); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java index 027c4c3f0..2adb2607e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java @@ -19,61 +19,51 @@ package com.sun.corba.ee.impl.ior.iiop; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.TaggedComponentBase ; +import com.sun.corba.ee.spi.ior.TaggedComponentBase; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.ee.spi.ior.iiop.AlternateIIOPAddressComponent ; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; +import com.sun.corba.ee.spi.ior.iiop.AlternateIIOPAddressComponent; -import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ; +import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS; /** * @author Ken Cavanaugh */ -public class AlternateIIOPAddressComponentImpl extends TaggedComponentBase - implements AlternateIIOPAddressComponent -{ - private IIOPAddress addr ; +public class AlternateIIOPAddressComponentImpl extends TaggedComponentBase implements AlternateIIOPAddressComponent { + private IIOPAddress addr; - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (!(obj instanceof AlternateIIOPAddressComponentImpl)) - return false ; + return false; - AlternateIIOPAddressComponentImpl other = - (AlternateIIOPAddressComponentImpl)obj ; + AlternateIIOPAddressComponentImpl other = (AlternateIIOPAddressComponentImpl) obj; - return addr.equals( other.addr ) ; + return addr.equals(other.addr); } - - public int hashCode() - { - return addr.hashCode() ; + + public int hashCode() { + return addr.hashCode(); } - public String toString() - { - return "AlternateIIOPAddressComponentImpl[addr=" + addr + "]" ; + public String toString() { + return "AlternateIIOPAddressComponentImpl[addr=" + addr + "]"; } - public AlternateIIOPAddressComponentImpl( IIOPAddress addr ) - { - this.addr = addr ; + public AlternateIIOPAddressComponentImpl(IIOPAddress addr) { + this.addr = addr; } - - public IIOPAddress getAddress() - { - return addr ; + + public IIOPAddress getAddress() { + return addr; } - public void writeContents(OutputStream os) - { - addr.write( os ) ; + public void writeContents(OutputStream os) { + addr.write(os); } - - public int getId() - { - return TAG_ALTERNATE_IIOP_ADDRESS.value ; // 3 in CORBA 2.3.1 13.6.3 + + public int getId() { + return TAG_ALTERNATE_IIOP_ADDRESS.value; // 3 in CORBA 2.3.1 13.6.3 } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/ClusterInstanceInfoComponentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/ClusterInstanceInfoComponentImpl.java index f62a57880..77531fb08 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/ClusterInstanceInfoComponentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/ClusterInstanceInfoComponentImpl.java @@ -28,52 +28,44 @@ import com.sun.corba.ee.spi.misc.ORBConstants; -public class ClusterInstanceInfoComponentImpl extends TaggedComponentBase - implements ClusterInstanceInfoComponent { +public class ClusterInstanceInfoComponentImpl extends TaggedComponentBase implements ClusterInstanceInfoComponent { private final ClusterInstanceInfo clusterInstanceInfoValue; @Override - public boolean equals(Object obj) - { + public boolean equals(Object obj) { if (!(obj instanceof ClusterInstanceInfoComponentImpl)) { return false; } - ClusterInstanceInfoComponentImpl other = - (ClusterInstanceInfoComponentImpl)obj ; + ClusterInstanceInfoComponentImpl other = (ClusterInstanceInfoComponentImpl) obj; - return clusterInstanceInfoValue.equals( - other.clusterInstanceInfoValue ) ; + return clusterInstanceInfoValue.equals(other.clusterInstanceInfoValue); } @Override public int hashCode() { - return clusterInstanceInfoValue.hashCode() ; + return clusterInstanceInfoValue.hashCode(); } @Override public String toString() { - return "ClusterInstanceInfoComponentImpl[clusterInstanceInfoValue=" - + clusterInstanceInfoValue + "]" ; + return "ClusterInstanceInfoComponentImpl[clusterInstanceInfoValue=" + clusterInstanceInfoValue + "]"; } - public ClusterInstanceInfoComponentImpl( - ClusterInstanceInfo theClusterInstanceInfoValue) { - clusterInstanceInfoValue = theClusterInstanceInfoValue ; + public ClusterInstanceInfoComponentImpl(ClusterInstanceInfo theClusterInstanceInfoValue) { + clusterInstanceInfoValue = theClusterInstanceInfoValue; } - public ClusterInstanceInfo getClusterInstanceInfo() - { + public ClusterInstanceInfo getClusterInstanceInfo() { return clusterInstanceInfoValue; } public void writeContents(OutputStream os) { clusterInstanceInfoValue.write(os); } - + public int getId() { - return ORBConstants.FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID ; + return ORBConstants.FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/CodeSetsComponentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/CodeSetsComponentImpl.java index 509a0fd86..c4013819f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/CodeSetsComponentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/CodeSetsComponentImpl.java @@ -19,76 +19,65 @@ package com.sun.corba.ee.impl.ior.iiop; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.TaggedComponentBase ; +import com.sun.corba.ee.spi.ior.TaggedComponentBase; -import com.sun.corba.ee.spi.ior.iiop.CodeSetsComponent ; +import com.sun.corba.ee.spi.ior.iiop.CodeSetsComponent; -import org.omg.IOP.TAG_CODE_SETS ; +import org.omg.IOP.TAG_CODE_SETS; -import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo ; -import com.sun.corba.ee.impl.encoding.MarshalOutputStream ; -import com.sun.corba.ee.impl.encoding.MarshalInputStream ; +import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; +import com.sun.corba.ee.impl.encoding.MarshalOutputStream; +import com.sun.corba.ee.impl.encoding.MarshalInputStream; -public class CodeSetsComponentImpl extends TaggedComponentBase - implements CodeSetsComponent -{ - CodeSetComponentInfo csci ; - - public boolean equals( Object obj ) - { - if (!(obj instanceof CodeSetsComponentImpl)) - return false ; +public class CodeSetsComponentImpl extends TaggedComponentBase implements CodeSetsComponent { + CodeSetComponentInfo csci; - CodeSetsComponentImpl other = (CodeSetsComponentImpl)obj ; + public boolean equals(Object obj) { + if (!(obj instanceof CodeSetsComponentImpl)) + return false; - return csci.equals( other.csci ) ; + CodeSetsComponentImpl other = (CodeSetsComponentImpl) obj; + + return csci.equals(other.csci); } - public int hashCode() - { - return csci.hashCode() ; + public int hashCode() { + return csci.hashCode(); } - public String toString() - { - return "CodeSetsComponentImpl[csci=" + csci + "]" ; + public String toString() { + return "CodeSetsComponentImpl[csci=" + csci + "]"; } - public CodeSetsComponentImpl() - { + public CodeSetsComponentImpl() { // Uses our default code sets (see CodeSetComponentInfo) - csci = new CodeSetComponentInfo() ; + csci = new CodeSetComponentInfo(); } - public CodeSetsComponentImpl( InputStream is ) - { - csci = new CodeSetComponentInfo() ; - csci.read( (MarshalInputStream)is ) ; + public CodeSetsComponentImpl(InputStream is) { + csci = new CodeSetComponentInfo(); + csci.read((MarshalInputStream) is); } - public CodeSetsComponentImpl(com.sun.corba.ee.spi.orb.ORB orb) - { + public CodeSetsComponentImpl(com.sun.corba.ee.spi.orb.ORB orb) { if (orb == null) csci = new CodeSetComponentInfo(); else csci = orb.getORBData().getCodeSetComponentInfo(); } - - public CodeSetComponentInfo getCodeSetComponentInfo() - { - return csci ; + + public CodeSetComponentInfo getCodeSetComponentInfo() { + return csci; } - public void writeContents(OutputStream os) - { - csci.write( (MarshalOutputStream)os ) ; + public void writeContents(OutputStream os) { + csci.write((MarshalOutputStream) os); } - - public int getId() - { - return TAG_CODE_SETS.value ; // 1 in CORBA 2.3.1 13.6.3 + + public int getId() { + return TAG_CODE_SETS.value; // 1 in CORBA 2.3.1 13.6.3 } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressBase.java index 1672330d1..a6ae356b9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressBase.java @@ -17,62 +17,54 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.ior.iiop ; +package com.sun.corba.ee.impl.ior.iiop; -import org.omg.CORBA.BAD_PARAM ; +import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; -abstract class IIOPAddressBase implements IIOPAddress -{ - // Ports are marshalled as shorts on the wire. The IDL +abstract class IIOPAddressBase implements IIOPAddress { + // Ports are marshalled as shorts on the wire. The IDL // type is unsigned short, which lacks a convenient representation - // in Java in the 32768-65536 range. So, we treat ports as + // in Java in the 32768-65536 range. So, we treat ports as // ints throught this code, except that marshalling requires a - // scaling conversion. intToShort and shortToInt are provided + // scaling conversion. intToShort and shortToInt are provided // for this purpose. - protected short intToShort( int value ) - { + protected short intToShort(int value) { if (value > 32767) - return (short)(value - 65536) ; - return (short)value ; + return (short) (value - 65536); + return (short) value; } - protected int shortToInt( short value ) - { + protected int shortToInt(short value) { if (value < 0) - return value + 65536 ; - return value ; + return value + 65536; + return value; } - public void write( OutputStream os ) - { - os.write_string( getHost() ) ; - int port = getPort() ; - os.write_short( intToShort( port ) ) ; + public void write(OutputStream os) { + os.write_string(getHost()); + int port = getPort(); + os.write_short(intToShort(port)); } - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (!(obj instanceof IIOPAddress)) - return false ; + return false; - IIOPAddress other = (IIOPAddress)obj ; + IIOPAddress other = (IIOPAddress) obj; - return getHost().equals(other.getHost()) && - (getPort() == other.getPort()) ; + return getHost().equals(other.getHost()) && (getPort() == other.getPort()); } - public int hashCode() - { - return getHost().hashCode() ^ getPort() ; + public int hashCode() { + return getHost().hashCode() ^ getPort(); } - public String toString() - { - return "IIOPAddress[" + getHost() + "," + getPort() + "]" ; + public String toString() { + return "IIOPAddress[" + getHost() + "," + getPort() + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressClosureImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressClosureImpl.java index 2e625f9b8..de3ccfef4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressClosureImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressClosureImpl.java @@ -21,24 +21,20 @@ import org.glassfish.pfl.basic.func.NullaryFunction; -public final class IIOPAddressClosureImpl extends IIOPAddressBase -{ +public final class IIOPAddressClosureImpl extends IIOPAddressBase { private NullaryFunction host; private NullaryFunction port; - - public IIOPAddressClosureImpl( NullaryFunction host, - NullaryFunction port ) { - this.host = host ; - this.port = port ; + + public IIOPAddressClosureImpl(NullaryFunction host, NullaryFunction port) { + this.host = host; + this.port = port; } - public String getHost() - { - return host.evaluate() ; + public String getHost() { + return host.evaluate(); } - public int getPort() - { - return port.evaluate() ; + public int getPort() { + return port.evaluate(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressImpl.java index 5e1df7ec8..a5c18bf13 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPAddressImpl.java @@ -19,47 +19,41 @@ package com.sun.corba.ee.impl.ior.iiop; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.logging.IORSystemException ; +import com.sun.corba.ee.spi.logging.IORSystemException; /** * @author Ken Cavanaugh */ -public final class IIOPAddressImpl extends IIOPAddressBase -{ - private static final IORSystemException wrapper = - IORSystemException.self ; +public final class IIOPAddressImpl extends IIOPAddressBase { + private static final IORSystemException wrapper = IORSystemException.self; private String host; private int port; - - public IIOPAddressImpl( String host, int port ) - { + + public IIOPAddressImpl(String host, int port) { if ((port < 0) || (port > 65535)) { throw wrapper.badIiopAddressPort(port); } - this.host = host ; - this.port = port ; + this.host = host; + this.port = port; } - public IIOPAddressImpl( InputStream is ) - { - host = is.read_string() ; - short thePort = is.read_short() ; - port = shortToInt( thePort ) ; + public IIOPAddressImpl(InputStream is) { + host = is.read_string(); + short thePort = is.read_short(); + port = shortToInt(thePort); } - public String getHost() - { - return host ; + public String getHost() { + return host; } - public int getPort() - { - return port ; + public int getPort() { + return port; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileImpl.java index 2930429c1..628d72a36 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileImpl.java @@ -58,30 +58,28 @@ import java.util.Iterator; @IsLocal -public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile -{ - private static final IORSystemException wrapper = - IORSystemException.self ; +public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile { + private static final IORSystemException wrapper = IORSystemException.self; - private ORB orb ; + private ORB orb; private ObjectId oid; private IIOPProfileTemplate proftemp; - private ObjectKeyTemplate oktemp ; + private ObjectKeyTemplate oktemp; private ObjectKey objectKey; // Cached lookups - protected String codebase = null ; + protected String codebase = null; protected boolean cachedCodebase = false; - private boolean checkedIsLocal = false ; - private boolean cachedIsLocal = false ; + private boolean checkedIsLocal = false; + private boolean cachedIsLocal = false; // initialize-on-demand holder private static class LocalCodeBaseSingletonHolder { - public static JavaCodebaseComponent comp ; + public static JavaCodebaseComponent comp; static { - String localCodebase = JDKBridge.getLocalCodebase() ; + String localCodebase = JDKBridge.getLocalCodebase(); if (localCodebase == null) { comp = null; } else { @@ -93,188 +91,164 @@ private static class LocalCodeBaseSingletonHolder { private GIOPVersion giopVersion = null; public String toString() { - StringBuilder sb = new StringBuilder() ; - sb.append( "IIOPProfileImpl[proftemp=") ; - sb.append( proftemp.toString() ) ; - sb.append( " oktemp=" ) ; - sb.append( oktemp.toString() ) ; - sb.append( " oid=" ) ; - sb.append( oid.toString() ) ; - return sb.toString() ; + StringBuilder sb = new StringBuilder(); + sb.append("IIOPProfileImpl[proftemp="); + sb.append(proftemp.toString()); + sb.append(" oktemp="); + sb.append(oktemp.toString()); + sb.append(" oid="); + sb.append(oid.toString()); + return sb.toString(); } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (!(obj instanceof IIOPProfileImpl)) { return false; } - IIOPProfileImpl other = (IIOPProfileImpl)obj ; + IIOPProfileImpl other = (IIOPProfileImpl) obj; - return oid.equals( other.oid ) && proftemp.equals( other.proftemp ) && - oktemp.equals( other.oktemp ) ; + return oid.equals(other.oid) && proftemp.equals(other.proftemp) && oktemp.equals(other.oktemp); } @Override - public int hashCode() - { - return oid.hashCode() ^ proftemp.hashCode() ^ oktemp.hashCode() ; + public int hashCode() { + return oid.hashCode() ^ proftemp.hashCode() ^ oktemp.hashCode(); } - public ObjectId getObjectId() - { - return oid ; + public ObjectId getObjectId() { + return oid; } - public TaggedProfileTemplate getTaggedProfileTemplate() - { - return proftemp ; + public TaggedProfileTemplate getTaggedProfileTemplate() { + return proftemp; } - public ObjectKeyTemplate getObjectKeyTemplate() - { - return oktemp ; + public ObjectKeyTemplate getObjectKeyTemplate() { + return oktemp; } - private IIOPProfileImpl( ORB orb ) - { - this.orb = orb ; + private IIOPProfileImpl(ORB orb) { + this.orb = orb; } - public IIOPProfileImpl( ORB orb, ObjectKeyTemplate oktemp, ObjectId oid, - IIOPProfileTemplate proftemp ) - { - this( orb ) ; - this.oktemp = oktemp ; - this.oid = oid ; - this.proftemp = proftemp ; + public IIOPProfileImpl(ORB orb, ObjectKeyTemplate oktemp, ObjectId oid, IIOPProfileTemplate proftemp) { + this(orb); + this.oktemp = oktemp; + this.oid = oid; + this.proftemp = proftemp; } - public IIOPProfileImpl( InputStream is ) - { - this( (ORB)(is.orb()) ) ; - init( is ) ; + public IIOPProfileImpl(InputStream is) { + this((ORB) (is.orb())); + init(is); } - public IIOPProfileImpl( ORB orb, org.omg.IOP.TaggedProfile profile) - { - this( orb ) ; + public IIOPProfileImpl(ORB orb, org.omg.IOP.TaggedProfile profile) { + this(orb); - if (profile == null || profile.tag != TAG_INTERNET_IOP.value || - profile.profile_data == null) { - throw wrapper.invalidTaggedProfile() ; + if (profile == null || profile.tag != TAG_INTERNET_IOP.value || profile.profile_data == null) { + throw wrapper.invalidTaggedProfile(); } - EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream(orb, profile.profile_data, - profile.profile_data.length); + EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream(orb, profile.profile_data, profile.profile_data.length); istr.consumeEndian(); - init( istr ) ; + init(istr); } - private void init( InputStream istr ) - { + private void init(InputStream istr) { // First, read all of the IIOP IOR data - GIOPVersion version = new GIOPVersion() ; - version.read( istr ) ; - IIOPAddress primary = new IIOPAddressImpl( istr ) ; - byte[] key = EncapsulationUtility.readOctets( istr ) ; + GIOPVersion version = new GIOPVersion(); + version.read(istr); + IIOPAddress primary = new IIOPAddressImpl(istr); + byte[] key = EncapsulationUtility.readOctets(istr); - ObjectKey okey = orb.getObjectKeyFactory().create( key ) ; - oktemp = okey.getTemplate() ; - oid = okey.getId() ; + ObjectKey okey = orb.getObjectKeyFactory().create(key); + oktemp = okey.getTemplate(); + oid = okey.getId(); - proftemp = IIOPFactories.makeIIOPProfileTemplate( orb, - version, primary ) ; + proftemp = IIOPFactories.makeIIOPProfileTemplate(orb, version, primary); // Handle any tagged components (if applicable) if (version.getMinor() > 0) { - EncapsulationUtility.readIdentifiableSequence(proftemp, - orb.getTaggedComponentFactoryFinder(), istr); + EncapsulationUtility.readIdentifiableSequence(proftemp, orb.getTaggedComponentFactoryFinder(), istr); } // If there is no codebase in this IOR and there IS a // java.rmi.server.codebase property set, we need to - // update the IOR with the local codebase. Note that + // update the IOR with the local codebase. Note that // there is only one instance of the local codebase, but it // can be safely shared in multiple IORs since it is immutable. if (uncachedGetCodeBase() == null) { - JavaCodebaseComponent jcc = LocalCodeBaseSingletonHolder.comp ; + JavaCodebaseComponent jcc = LocalCodeBaseSingletonHolder.comp; if (jcc != null) { if (version.getMinor() > 0) { proftemp.add(jcc); } - codebase = jcc.getURLs() ; + codebase = jcc.getURLs(); } // Whether codebase is null or not, we have it, // and so getCodebase ned never call uncachedGetCodebase. cachedCodebase = true; } - } + } - public void writeContents(OutputStream os) - { - proftemp.write( oktemp, oid, os ) ; + public void writeContents(OutputStream os) { + proftemp.write(oktemp, oid, os); } - public int getId() - { - return proftemp.getId() ; + public int getId() { + return proftemp.getId(); } - public boolean isEquivalent( TaggedProfile prof ) - { + public boolean isEquivalent(TaggedProfile prof) { if (!(prof instanceof IIOPProfile)) { return false; } - IIOPProfile other = (IIOPProfile)prof ; + IIOPProfile other = (IIOPProfile) prof; - return oid.equals( other.getObjectId() ) && - proftemp.isEquivalent( other.getTaggedProfileTemplate() ) && - oktemp.equals( other.getObjectKeyTemplate() ) ; + return oid.equals(other.getObjectId()) && proftemp.isEquivalent(other.getTaggedProfileTemplate()) + && oktemp.equals(other.getObjectKeyTemplate()); } - public synchronized ObjectKey getObjectKey() - { + public synchronized ObjectKey getObjectKey() { if (objectKey == null) { - objectKey = IORFactories.makeObjectKey( oktemp, oid ) ; + objectKey = IORFactories.makeObjectKey(oktemp, oid); } - return objectKey ; + return objectKey; } - public org.omg.IOP.TaggedProfile getIOPProfile() - { - EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream( orb ) ; - os.write_long( getId() ) ; - write( os ) ; - InputStream is = (InputStream)(os.create_input_stream()) ; - return org.omg.IOP.TaggedProfileHelper.read( is ) ; + public org.omg.IOP.TaggedProfile getIOPProfile() { + EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream(orb); + os.write_long(getId()); + write(os); + InputStream is = (InputStream) (os.create_input_stream()); + return org.omg.IOP.TaggedProfileHelper.read(is); } private String uncachedGetCodeBase() { - Iterator iter = - proftemp.iteratorById( TAG_JAVA_CODEBASE.value ) ; + Iterator iter = proftemp.iteratorById(TAG_JAVA_CODEBASE.value); if (iter.hasNext()) { - JavaCodebaseComponent jcbc = - JavaCodebaseComponent.class.cast( iter.next() ) ; - return jcbc.getURLs() ; + JavaCodebaseComponent jcbc = JavaCodebaseComponent.class.cast(iter.next()); + return jcbc.getURLs(); } - return null ; + return null; } public synchronized String getCodebase() { if (!cachedCodebase) { - cachedCodebase = true ; - codebase = uncachedGetCodeBase() ; + cachedCodebase = true; + codebase = uncachedGetCodeBase(); } - return codebase ; + return codebase; } /** @@ -285,85 +259,80 @@ public ORBVersion getORBVersion() { } @InfoMethod - private void computingIsLocal( String host, int scid, int sid, int port ) {} + private void computingIsLocal(String host, int scid, int sid, int port) { + } @InfoMethod - private void isLocalResults( boolean isLocalHost, boolean isLocalServerId, - boolean isLocalPort ) {} + private void isLocalResults(boolean isLocalHost, boolean isLocalServerId, boolean isLocalPort) { + } @IsLocal - public synchronized boolean isLocal() - { + public synchronized boolean isLocal() { if (!checkedIsLocal) { - checkedIsLocal = true ; - if (isForeignObject()) return false; + checkedIsLocal = true; + if (isForeignObject()) + return false; final int port = proftemp.getPrimaryAddress().getPort(); - final String host = proftemp.getPrimaryAddress().getHost() ; - final int scid = oktemp.getSubcontractId() ; - final int sid = oktemp.getServerId() ; - computingIsLocal( host, scid, sid, port ) ; + final String host = proftemp.getPrimaryAddress().getHost(); + final int scid = oktemp.getSubcontractId(); + final int sid = oktemp.getServerId(); + computingIsLocal(host, scid, sid, port); - final boolean isLocalHost = orb.isLocalHost( host ) ; - final boolean isLocalServerId = (sid == -1) || orb.isLocalServerId( scid, sid ) ; - final boolean isLocalServerPort = orb.getLegacyServerSocketManager().legacyIsLocalServerPort( port ) ; - isLocalResults( isLocalHost, isLocalServerId, isLocalServerPort ) ; + final boolean isLocalHost = orb.isLocalHost(host); + final boolean isLocalServerId = (sid == -1) || orb.isLocalServerId(scid, sid); + final boolean isLocalServerPort = orb.getLegacyServerSocketManager().legacyIsLocalServerPort(port); + isLocalResults(isLocalHost, isLocalServerId, isLocalServerPort); - cachedIsLocal = isLocalHost && isLocalServerId && isLocalServerPort ; + cachedIsLocal = isLocalHost && isLocalServerId && isLocalServerPort; } - return cachedIsLocal ; + return cachedIsLocal; } private boolean isForeignObject() { return oktemp.getORBVersion() == ORBVersionImpl.FOREIGN; } - /** Return the servant for this IOR, if it is local AND if the OA that - * implements this objref supports direct access to servants outside of an - * invocation. + /** + * Return the servant for this IOR, if it is local AND if the OA that implements this objref supports direct access to + * servants outside of an invocation. */ @IsLocal - public java.lang.Object getServant() - { + public java.lang.Object getServant() { if (!isLocal()) { return null; } - RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ; - ObjectAdapterFactory oaf = scr.getObjectAdapterFactory( - oktemp.getSubcontractId() ) ; + RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry(); + ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(oktemp.getSubcontractId()); - ObjectAdapterId oaid = oktemp.getObjectAdapterId() ; - ObjectAdapter oa = null ; + ObjectAdapterId oaid = oktemp.getObjectAdapterId(); + ObjectAdapter oa = null; try { - oa = oaf.find( oaid ) ; + oa = oaf.find(oaid); } catch (SystemException exc) { // Could not find the OA, so just return null. // This usually happens when POAs are being deleted, // and the POA always return null for getLocalServant anyway. - wrapper.getLocalServantFailure( exc, oaid ) ; - return null ; + wrapper.getLocalServantFailure(exc, oaid); + return null; } - byte[] boid = oid.getId() ; - java.lang.Object servant = oa.getLocalServant( boid ) ; - return servant ; + byte[] boid = oid.getId(); + java.lang.Object servant = oa.getLocalServant(boid); + return servant; } /** - * Return GIOPVersion for this IOR. - * Requests created against this IOR will be of the - * return Version. + * Return GIOPVersion for this IOR. Requests created against this IOR will be of the return Version. */ - public synchronized GIOPVersion getGIOPVersion() - { - return proftemp.getGIOPVersion() ; + public synchronized GIOPVersion getGIOPVersion() { + return proftemp.getGIOPVersion(); } - public void makeImmutable() - { - proftemp.makeImmutable() ; + public void makeImmutable() { + proftemp.makeImmutable(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileTemplateImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileTemplateImpl.java index 9b6f51081..083a9cfde 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileTemplateImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileTemplateImpl.java @@ -19,93 +19,82 @@ package com.sun.corba.ee.impl.ior.iiop; -import java.util.Iterator ; +import java.util.Iterator; import com.sun.corba.ee.spi.ior.iiop.JavaCodebaseComponent; import com.sun.corba.ee.spi.transport.SocketInfo; -import org.omg.IOP.TAG_INTERNET_IOP ; +import org.omg.IOP.TAG_INTERNET_IOP; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.TaggedComponent ; -import com.sun.corba.ee.spi.ior.TaggedProfile ; -import com.sun.corba.ee.spi.ior.TaggedProfileTemplate ; -import com.sun.corba.ee.spi.ior.TaggedProfileTemplateBase ; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.ee.spi.ior.ObjectId ; +import com.sun.corba.ee.spi.ior.TaggedComponent; +import com.sun.corba.ee.spi.ior.TaggedProfile; +import com.sun.corba.ee.spi.ior.TaggedProfileTemplate; +import com.sun.corba.ee.spi.ior.TaggedProfileTemplateBase; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; +import com.sun.corba.ee.spi.ior.ObjectId; -import com.sun.corba.ee.impl.ior.EncapsulationUtility ; +import com.sun.corba.ee.impl.ior.EncapsulationUtility; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.ee.spi.ior.iiop.IIOPFactories ; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; +import com.sun.corba.ee.spi.ior.iiop.IIOPFactories; import com.sun.corba.ee.impl.encoding.OutputStreamFactory; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; +import com.sun.corba.ee.spi.orb.ORB; /** - * @author - * If getMinorVersion==0, this does not contain any tagged components + * @author If getMinorVersion==0, this does not contain any tagged components */ -public class IIOPProfileTemplateImpl extends TaggedProfileTemplateBase - implements IIOPProfileTemplate, SocketInfo -{ - private ORB orb ; - private GIOPVersion giopVersion ; - private IIOPAddress primary ; - +public class IIOPProfileTemplateImpl extends TaggedProfileTemplateBase implements IIOPProfileTemplate, SocketInfo { + private ORB orb; + private GIOPVersion giopVersion; + private IIOPAddress primary; + public Iterator getTaggedComponents() { - return iterator() ; + return iterator(); } @Override public String toString() { - return String.format("IIOPProfileTemplateImpl[giopVersion=%d.%d primary=%s:%d]", - giopVersion.getMajor(), giopVersion.getMinor(), primary.getHost(), primary.getPort()); + return String.format("IIOPProfileTemplateImpl[giopVersion=%d.%d primary=%s:%d]", giopVersion.getMajor(), giopVersion.getMinor(), + primary.getHost(), primary.getPort()); } - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (!(obj instanceof IIOPProfileTemplateImpl)) - return false ; + return false; - IIOPProfileTemplateImpl other = (IIOPProfileTemplateImpl)obj ; + IIOPProfileTemplateImpl other = (IIOPProfileTemplateImpl) obj; - return super.equals( obj ) && giopVersion.equals( other.giopVersion ) && - primary.equals( other.primary ) ; + return super.equals(obj) && giopVersion.equals(other.giopVersion) && primary.equals(other.primary); } - public int hashCode() - { - return super.hashCode() ^ giopVersion.hashCode() ^ primary.hashCode() ; + public int hashCode() { + return super.hashCode() ^ giopVersion.hashCode() ^ primary.hashCode(); } - public TaggedProfile create( ObjectKeyTemplate oktemp, ObjectId id ) - { - return IIOPFactories.makeIIOPProfile( orb, oktemp, id, this ) ; + public TaggedProfile create(ObjectKeyTemplate oktemp, ObjectId id) { + return IIOPFactories.makeIIOPProfile(orb, oktemp, id, this); } - public GIOPVersion getGIOPVersion() - { - return giopVersion ; + public GIOPVersion getGIOPVersion() { + return giopVersion; } - public IIOPAddress getPrimaryAddress() - { - return primary ; + public IIOPAddress getPrimaryAddress() { + return primary; } @Override - public SocketInfo getPrimarySocketInfo() - { + public SocketInfo getPrimarySocketInfo() { return this; } @Override - public String getType() - { + public String getType() { return stream().anyMatch(this::isSslTaggedComponent) ? SocketInfo.SSL_PREFIX : SocketInfo.IIOP_CLEAR_TEXT; } @@ -114,87 +103,78 @@ private boolean isSslTaggedComponent(TaggedComponent component) { } @Override - public String getHost() - { + public String getHost() { return primary.getHost(); } @Override - public int getPort() - { + public int getPort() { return primary.getPort(); } - public IIOPProfileTemplateImpl( ORB orb, GIOPVersion version, IIOPAddress primary ) - { - this.orb = orb ; - this.giopVersion = version ; - this.primary = primary ; + public IIOPProfileTemplateImpl(ORB orb, GIOPVersion version, IIOPAddress primary) { + this.orb = orb; + this.giopVersion = version; + this.primary = primary; if (giopVersion.getMinor() == 0) // Adding tagged components is not allowed for IIOP 1.0, // so this template is complete and should be made immutable. - makeImmutable() ; + makeImmutable(); } - public IIOPProfileTemplateImpl( InputStream istr ) - { - byte major = istr.read_octet() ; - byte minor = istr.read_octet() ; - giopVersion = GIOPVersion.getInstance( major, minor ) ; - primary = new IIOPAddressImpl( istr ) ; - orb = (ORB)(istr.orb()) ; + public IIOPProfileTemplateImpl(InputStream istr) { + byte major = istr.read_octet(); + byte minor = istr.read_octet(); + giopVersion = GIOPVersion.getInstance(major, minor); + primary = new IIOPAddressImpl(istr); + orb = (ORB) (istr.orb()); // Handle any tagged components (if applicable) - if (minor > 0) - EncapsulationUtility.readIdentifiableSequence( - this, orb.getTaggedComponentFactoryFinder(), istr ) ; + if (minor > 0) + EncapsulationUtility.readIdentifiableSequence(this, orb.getTaggedComponentFactoryFinder(), istr); - makeImmutable() ; + makeImmutable(); } - - public void write( ObjectKeyTemplate okeyTemplate, ObjectId id, OutputStream os) - { - giopVersion.write( os ) ; - primary.write( os ) ; + + public void write(ObjectKeyTemplate okeyTemplate, ObjectId id, OutputStream os) { + giopVersion.write(os); + primary.write(os); // Note that this is NOT an encapsulation: do not marshal - // the endianness flag. However, the length is required. + // the endianness flag. However, the length is required. // Note that this cannot be accomplished with a codec! // Use the byte order of the given stream - OutputStream encapsulatedOS = OutputStreamFactory.newEncapsOutputStream( (ORB)os.orb() - ) ; + OutputStream encapsulatedOS = OutputStreamFactory.newEncapsOutputStream((ORB) os.orb()); - okeyTemplate.write( id, encapsulatedOS ) ; - EncapsulationUtility.writeOutputStream( encapsulatedOS, os ) ; + okeyTemplate.write(id, encapsulatedOS); + EncapsulationUtility.writeOutputStream(encapsulatedOS, os); - if (giopVersion.getMinor() > 0) - EncapsulationUtility.writeIdentifiableSequence( this, os ) ; + if (giopVersion.getMinor() > 0) + EncapsulationUtility.writeIdentifiableSequence(this, os); } - - /** Write out this IIOPProfileTemplateImpl only. - */ - public void writeContents( OutputStream os) - { - giopVersion.write( os ) ; - primary.write( os ) ; - if (giopVersion.getMinor() > 0) - EncapsulationUtility.writeIdentifiableSequence( this, os ) ; + /** + * Write out this IIOPProfileTemplateImpl only. + */ + public void writeContents(OutputStream os) { + giopVersion.write(os); + primary.write(os); + + if (giopVersion.getMinor() > 0) + EncapsulationUtility.writeIdentifiableSequence(this, os); } - - public int getId() - { - return TAG_INTERNET_IOP.value ; + + public int getId() { + return TAG_INTERNET_IOP.value; } - public boolean isEquivalent( TaggedProfileTemplate temp ) - { + public boolean isEquivalent(TaggedProfileTemplate temp) { if (!(temp instanceof IIOPProfileTemplateImpl)) - return false ; + return false; - IIOPProfileTemplateImpl tempimp = (IIOPProfileTemplateImpl)temp ; + IIOPProfileTemplateImpl tempimp = (IIOPProfileTemplateImpl) temp; - return primary.equals( tempimp.primary ) ; + return primary.equals(tempimp.primary); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/JavaCodebaseComponentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/JavaCodebaseComponentImpl.java index 8ec43bc87..5511c1d3b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/JavaCodebaseComponentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/JavaCodebaseComponentImpl.java @@ -19,59 +19,50 @@ package com.sun.corba.ee.impl.ior.iiop; -import org.omg.IOP.TAG_JAVA_CODEBASE ; +import org.omg.IOP.TAG_JAVA_CODEBASE; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.TaggedComponentBase ; +import com.sun.corba.ee.spi.ior.TaggedComponentBase; -import com.sun.corba.ee.spi.ior.iiop.JavaCodebaseComponent ; +import com.sun.corba.ee.spi.ior.iiop.JavaCodebaseComponent; -public class JavaCodebaseComponentImpl extends TaggedComponentBase - implements JavaCodebaseComponent -{ - private String URLs ; +public class JavaCodebaseComponentImpl extends TaggedComponentBase implements JavaCodebaseComponent { + private String URLs; - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (obj == null) - return false ; + return false; if (!(obj instanceof JavaCodebaseComponentImpl)) - return false ; + return false; - JavaCodebaseComponentImpl other = (JavaCodebaseComponentImpl)obj ; + JavaCodebaseComponentImpl other = (JavaCodebaseComponentImpl) obj; - return URLs.equals( other.getURLs() ) ; + return URLs.equals(other.getURLs()); } - public int hashCode() - { - return URLs.hashCode() ; + public int hashCode() { + return URLs.hashCode(); } - public String toString() - { - return "JavaCodebaseComponentImpl[URLs=" + URLs + "]" ; + public String toString() { + return "JavaCodebaseComponentImpl[URLs=" + URLs + "]"; } - public String getURLs() - { - return URLs ; + public String getURLs() { + return URLs; } - public JavaCodebaseComponentImpl( String URLs ) - { - this.URLs = URLs ; + public JavaCodebaseComponentImpl(String URLs) { + this.URLs = URLs; } - - public void writeContents(OutputStream os) - { - os.write_string( URLs ) ; + + public void writeContents(OutputStream os) { + os.write_string(URLs); } - - public int getId() - { - return TAG_JAVA_CODEBASE.value ; // 25 in CORBA 2.3.1 13.6.3 + + public int getId() { + return TAG_JAVA_CODEBASE.value; // 25 in CORBA 2.3.1 13.6.3 } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/JavaSerializationComponent.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/JavaSerializationComponent.java index 5765e9f96..d78c9a50c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/JavaSerializationComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/JavaSerializationComponent.java @@ -28,14 +28,12 @@ import com.sun.corba.ee.spi.ior.TaggedComponentBase; /** - * Tagged component that contains a value that indicates the Java - * serialization version supported by the ORB. + * Tagged component that contains a value that indicates the Java serialization version supported by the ORB. * - * ORB Java serialization uses IIOP as the transport protocol, but uses - * Java serialization mechanism and its accompanying encodings, instead - * of IIOP CDR serialization mechanism. Java serialization is generally - * observed to be faster than CDR. - */ + * ORB Java serialization uses IIOP as the transport protocol, but uses Java serialization mechanism and its + * accompanying encodings, instead of IIOP CDR serialization mechanism. Java serialization is generally observed to be + * faster than CDR. + */ public class JavaSerializationComponent extends TaggedComponentBase { private byte version; @@ -43,8 +41,7 @@ public class JavaSerializationComponent extends TaggedComponentBase { private static JavaSerializationComponent singleton; static { - singleton = new JavaSerializationComponent( - ORBConstants.JAVA_ENC_VERSION); + singleton = new JavaSerializationComponent(ORBConstants.JAVA_ENC_VERSION); } public static JavaSerializationComponent singleton() { @@ -62,7 +59,7 @@ public byte javaSerializationVersion() { public void writeContents(OutputStream os) { os.write_octet(version); } - + public int getId() { return ORBConstants.TAG_JAVA_SERIALIZATION_ID; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/LoadBalancingComponentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/LoadBalancingComponentImpl.java index 655f83c56..fb38f424f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/LoadBalancingComponentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/LoadBalancingComponentImpl.java @@ -24,72 +24,58 @@ import com.sun.corba.ee.spi.ior.TaggedComponentBase; import com.sun.corba.ee.spi.ior.iiop.LoadBalancingComponent; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.spi.misc.ORBConstants; -public class LoadBalancingComponentImpl extends TaggedComponentBase - implements LoadBalancingComponent -{ +public class LoadBalancingComponentImpl extends TaggedComponentBase implements LoadBalancingComponent { - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static ORBUtilSystemException wrapper = ORBUtilSystemException.self; private int loadBalancingValue; @Override - public boolean equals(Object obj) - { + public boolean equals(Object obj) { if (!(obj instanceof LoadBalancingComponentImpl)) { return false; } - LoadBalancingComponentImpl other = - (LoadBalancingComponentImpl)obj ; + LoadBalancingComponentImpl other = (LoadBalancingComponentImpl) obj; - return loadBalancingValue == other.loadBalancingValue ; + return loadBalancingValue == other.loadBalancingValue; } @Override - public int hashCode() - { + public int hashCode() { return loadBalancingValue; } @Override - public String toString() - { - return "LoadBalancingComponentImpl[loadBalancingValue=" + loadBalancingValue + "]" ; + public String toString() { + return "LoadBalancingComponentImpl[loadBalancingValue=" + loadBalancingValue + "]"; } - public LoadBalancingComponentImpl() - { + public LoadBalancingComponentImpl() { loadBalancingValue = 0; } public LoadBalancingComponentImpl(int theLoadBalancingValue) { - if (theLoadBalancingValue < ORBConstants.FIRST_LOAD_BALANCING_VALUE || - theLoadBalancingValue > ORBConstants.LAST_LOAD_BALANCING_VALUE) { - throw wrapper.invalidLoadBalancingComponentValue( - theLoadBalancingValue, - ORBConstants.FIRST_LOAD_BALANCING_VALUE, - ORBConstants.LAST_LOAD_BALANCING_VALUE ); + if (theLoadBalancingValue < ORBConstants.FIRST_LOAD_BALANCING_VALUE + || theLoadBalancingValue > ORBConstants.LAST_LOAD_BALANCING_VALUE) { + throw wrapper.invalidLoadBalancingComponentValue(theLoadBalancingValue, ORBConstants.FIRST_LOAD_BALANCING_VALUE, + ORBConstants.LAST_LOAD_BALANCING_VALUE); } loadBalancingValue = theLoadBalancingValue; } - public int getLoadBalancingValue() - { + public int getLoadBalancingValue() { return loadBalancingValue; } - public void writeContents(OutputStream os) - { + public void writeContents(OutputStream os) { os.write_ulong(loadBalancingValue); } - - public int getId() - { + + public int getId() { return ORBConstants.TAG_LOAD_BALANCING_ID; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java index d9170baf9..d53910798 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java @@ -34,37 +34,29 @@ // Java to IDL ptc 02-01-12 1.4.11 // TAG_RMI_CUSTOM_MAX_STREAM_FORMAT -public class MaxStreamFormatVersionComponentImpl extends TaggedComponentBase - implements MaxStreamFormatVersionComponent -{ +public class MaxStreamFormatVersionComponentImpl extends TaggedComponentBase implements MaxStreamFormatVersionComponent { private byte version; - public static final MaxStreamFormatVersionComponentImpl singleton - = new MaxStreamFormatVersionComponentImpl(); + public static final MaxStreamFormatVersionComponentImpl singleton = new MaxStreamFormatVersionComponentImpl(); - public boolean equals(Object obj) - { + public boolean equals(Object obj) { if (!(obj instanceof MaxStreamFormatVersionComponentImpl)) - return false ; + return false; - MaxStreamFormatVersionComponentImpl other = - (MaxStreamFormatVersionComponentImpl)obj ; + MaxStreamFormatVersionComponentImpl other = (MaxStreamFormatVersionComponentImpl) obj; - return version == other.version ; + return version == other.version; } - public int hashCode() - { - return version ; + public int hashCode() { + return version; } - public String toString() - { - return "MaxStreamFormatVersionComponentImpl[version=" + version + "]" ; + public String toString() { + return "MaxStreamFormatVersionComponentImpl[version=" + version + "]"; } - public MaxStreamFormatVersionComponentImpl() - { + public MaxStreamFormatVersionComponentImpl() { version = ORBUtility.getMaxStreamFormatVersion(); } @@ -72,18 +64,15 @@ public MaxStreamFormatVersionComponentImpl(byte streamFormatVersion) { version = streamFormatVersion; } - public byte getMaxStreamFormatVersion() - { + public byte getMaxStreamFormatVersion() { return version; } - public void writeContents(OutputStream os) - { + public void writeContents(OutputStream os) { os.write_octet(version); } - - public int getId() - { + + public int getId() { return TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/ORBTypeComponentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/ORBTypeComponentImpl.java index 50cfeba32..32e117140 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/ORBTypeComponentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/ORBTypeComponentImpl.java @@ -19,59 +19,50 @@ package com.sun.corba.ee.impl.ior.iiop; -import org.omg.IOP.TAG_ORB_TYPE ; +import org.omg.IOP.TAG_ORB_TYPE; -import com.sun.corba.ee.spi.ior.TaggedComponentBase ; +import com.sun.corba.ee.spi.ior.TaggedComponentBase; -import com.sun.corba.ee.spi.ior.iiop.ORBTypeComponent ; +import com.sun.corba.ee.spi.ior.iiop.ORBTypeComponent; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; /** * @author Ken Cavanaugh */ -public class ORBTypeComponentImpl extends TaggedComponentBase - implements ORBTypeComponent -{ +public class ORBTypeComponentImpl extends TaggedComponentBase implements ORBTypeComponent { private int ORBType; - - public boolean equals( Object obj ) - { + + public boolean equals(Object obj) { if (!(obj instanceof ORBTypeComponentImpl)) - return false ; + return false; - ORBTypeComponentImpl other = (ORBTypeComponentImpl)obj ; + ORBTypeComponentImpl other = (ORBTypeComponentImpl) obj; - return ORBType == other.ORBType ; + return ORBType == other.ORBType; } - public int hashCode() - { - return ORBType ; + public int hashCode() { + return ORBType; } - public String toString() - { - return "ORBTypeComponentImpl[ORBType=" + ORBType + "]" ; + public String toString() { + return "ORBTypeComponentImpl[ORBType=" + ORBType + "]"; } - public ORBTypeComponentImpl(int ORBType) - { - this.ORBType = ORBType ; + public ORBTypeComponentImpl(int ORBType) { + this.ORBType = ORBType; } - - public int getId() - { - return TAG_ORB_TYPE.value ; // 0 in CORBA 2.3.1 13.6.3 + + public int getId() { + return TAG_ORB_TYPE.value; // 0 in CORBA 2.3.1 13.6.3 } - - public int getORBType() - { - return ORBType ; + + public int getORBType() { + return ORBType; } - - public void writeContents(OutputStream os) - { - os.write_ulong( ORBType ) ; + + public void writeContents(OutputStream os) { + os.write_ulong(ORBType); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/RequestPartitioningComponentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/RequestPartitioningComponentImpl.java index 2cae062e6..47d659d90 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/RequestPartitioningComponentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/ior/iiop/RequestPartitioningComponentImpl.java @@ -24,70 +24,57 @@ import com.sun.corba.ee.spi.ior.TaggedComponentBase; import com.sun.corba.ee.spi.ior.iiop.RequestPartitioningComponent; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.spi.misc.ORBConstants; -public class RequestPartitioningComponentImpl extends TaggedComponentBase - implements RequestPartitioningComponent -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class RequestPartitioningComponentImpl extends TaggedComponentBase implements RequestPartitioningComponent { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private int partitionToUse; @Override - public boolean equals(Object obj) - { + public boolean equals(Object obj) { if (!(obj instanceof RequestPartitioningComponentImpl)) { return false; } - RequestPartitioningComponentImpl other = - (RequestPartitioningComponentImpl)obj ; + RequestPartitioningComponentImpl other = (RequestPartitioningComponentImpl) obj; - return partitionToUse == other.partitionToUse ; + return partitionToUse == other.partitionToUse; } @Override - public int hashCode() - { + public int hashCode() { return partitionToUse; } @Override - public String toString() - { - return "RequestPartitioningComponentImpl[partitionToUse=" + partitionToUse + "]" ; + public String toString() { + return "RequestPartitioningComponentImpl[partitionToUse=" + partitionToUse + "]"; } - public RequestPartitioningComponentImpl() - { + public RequestPartitioningComponentImpl() { partitionToUse = 0; } public RequestPartitioningComponentImpl(int thePartitionToUse) { - if (thePartitionToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID || - thePartitionToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { - throw wrapper.invalidRequestPartitioningComponentValue( - thePartitionToUse, - ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID, + if (thePartitionToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID + || thePartitionToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { + throw wrapper.invalidRequestPartitioningComponentValue(thePartitionToUse, ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID, ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID); } partitionToUse = thePartitionToUse; } - public int getRequestPartitioningId() - { + public int getRequestPartitioningId() { return partitionToUse; } - public void writeContents(OutputStream os) - { + public void writeContents(OutputStream os) { os.write_ulong(partitionToUse); } - - public int getId() - { + + public int getId() { return ORBConstants.TAG_REQUEST_PARTITIONING_ID; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/CORBA/StubDelegateImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/CORBA/StubDelegateImpl.java index 5dcaba218..c1586166c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/CORBA/StubDelegateImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/CORBA/StubDelegateImpl.java @@ -26,76 +26,68 @@ import org.omg.CORBA.ORB; -import com.sun.corba.ee.impl.ior.StubIORImpl ; -import com.sun.corba.ee.impl.presentation.rmi.StubConnectImpl ; +import com.sun.corba.ee.impl.ior.StubIORImpl; +import com.sun.corba.ee.impl.presentation.rmi.StubConnectImpl; -import com.sun.corba.ee.spi.logging.UtilSystemException ; +import com.sun.corba.ee.spi.logging.UtilSystemException; /** * Base class from which all static RMI-IIOP stubs must inherit. */ -public class StubDelegateImpl implements javax.rmi.CORBA.StubDelegate -{ - private static final UtilSystemException wrapper = - UtilSystemException.self ; +public class StubDelegateImpl implements javax.rmi.CORBA.StubDelegate { + private static final UtilSystemException wrapper = UtilSystemException.self; - private StubIORImpl ior ; + private StubIORImpl ior; - public synchronized StubIORImpl getIOR() - { - return ior ; + public synchronized StubIORImpl getIOR() { + return ior; } - - public synchronized void setIOR( StubIORImpl ior ) - { - this.ior = ior ; + + public synchronized void setIOR(StubIORImpl ior) { + this.ior = ior; } - public StubDelegateImpl() - { - ior = null ; + public StubDelegateImpl() { + ior = null; } /** * Sets the IOR components if not already set. */ - private synchronized void init (javax.rmi.CORBA.Stub self) - { + private synchronized void init(javax.rmi.CORBA.Stub self) { // If the Stub is not connected to an ORB, BAD_OPERATION exception // will be raised by the code below. if (ior == null) { ior = new StubIORImpl(self); } } - + /** - * Returns a hash code value for the object which is the same for all stubs - * that represent the same remote object. + * Returns a hash code value for the object which is the same for all stubs that represent the same remote object. + * * @return the hash code value. */ - public synchronized int hashCode(javax.rmi.CORBA.Stub self) - { + public synchronized int hashCode(javax.rmi.CORBA.Stub self) { init(self); - return ior.hashCode() ; + return ior.hashCode(); } /** - * Compares two stubs for equality. Returns true when used to compare stubs - * that represent the same remote object, and false otherwise. + * Compares two stubs for equality. Returns true when used to compare stubs that represent the same remote + * object, and false otherwise. + * * @param obj the reference object with which to compare. - * @return true if this object is the same as the obj - * argument; false otherwise. + * @return true if this object is the same as the obj argument; false otherwise. */ - public synchronized boolean equals(javax.rmi.CORBA.Stub self, java.lang.Object obj) - { + public synchronized boolean equals(javax.rmi.CORBA.Stub self, java.lang.Object obj) { if (self == obj) { - return true; + return true; } - + if (!(obj instanceof javax.rmi.CORBA.Stub)) { - return false; + return false; } - + // no need to call init() because of calls to hashCode() below javax.rmi.CORBA.Stub other = (javax.rmi.CORBA.Stub) obj; @@ -105,15 +97,14 @@ public synchronized boolean equals(javax.rmi.CORBA.Stub self, java.lang.Object o // hashCodes being the same does not mean equality. The stubs still // could be pointing to different IORs. So, do a literal comparison. - // Apparently the ONLY way to do this (other than using private + // Apparently the ONLY way to do this (other than using private // reflection) is toString, because it is not possible to directly // access the StubDelegateImpl from the Stub. - return self.toString().equals( other.toString() ) ; + return self.toString().equals(other.toString()); } @Override - public synchronized boolean equals( Object obj ) - { + public synchronized boolean equals(Object obj) { if (this == obj) { return true; } @@ -122,7 +113,7 @@ public synchronized boolean equals( Object obj ) return false; } - StubDelegateImpl other = (StubDelegateImpl)obj ; + StubDelegateImpl other = (StubDelegateImpl) obj; if (ior == null) { return ior == other.ior; @@ -141,61 +132,54 @@ public synchronized int hashCode() { } /** - * Returns a string representation of this stub. Returns the same string - * for all stubs that represent the same remote object. + * Returns a string representation of this stub. Returns the same string for all stubs that represent the same remote + * object. + * * @return a string representation of this stub. */ - public synchronized String toString(javax.rmi.CORBA.Stub self) - { + public synchronized String toString(javax.rmi.CORBA.Stub self) { if (ior == null) { return null; } else { return ior.toString(); } } - + /** - * Connects this stub to an ORB. Required after the stub is deserialized - * but not after it is demarshalled by an ORB stream. If an unconnected - * stub is passed to an ORB stream for marshalling, it is implicitly - * connected to that ORB. Application code should not call this method - * directly, but should call the portable wrapper method + * Connects this stub to an ORB. Required after the stub is deserialized but not after it is demarshalled by an ORB + * stream. If an unconnected stub is passed to an ORB stream for marshalling, it is implicitly connected to that ORB. + * Application code should not call this method directly, but should call the portable wrapper method * {@link javax.rmi.PortableRemoteObject#connect}. + * * @param orb the ORB to connect to. - * @exception RemoteException if the stub is already connected to a different - * ORB, or if the stub does not represent an exported remote or local object. + * @exception RemoteException if the stub is already connected to a different ORB, or if the stub does not represent an + * exported remote or local object. */ - public synchronized void connect(javax.rmi.CORBA.Stub self, ORB orb) - throws RemoteException - { - ior = StubConnectImpl.connect( ior, self, self, orb ) ; + public synchronized void connect(javax.rmi.CORBA.Stub self, ORB orb) throws RemoteException { + ior = StubConnectImpl.connect(ior, self, self, orb); } /** * Serialization method to restore the IOR state. */ - public synchronized void readObject(javax.rmi.CORBA.Stub self, - java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException - { + public synchronized void readObject(javax.rmi.CORBA.Stub self, java.io.ObjectInputStream stream) + throws IOException, ClassNotFoundException { if (ior == null) { ior = new StubIORImpl(); } - ior.doRead( stream ) ; + ior.doRead(stream); } /** * Serialization method to save the IOR state. - * @serialData The length of the IOR type ID (int), followed by the IOR type ID - * (byte array encoded using ISO8859-1), followed by the number of IOR profiles - * (int), followed by the IOR profiles. Each IOR profile is written as a - * profile tag (int), followed by the length of the profile data (int), followed - * by the profile data (byte array). + * + * @serialData The length of the IOR type ID (int), followed by the IOR type ID (byte array encoded using ISO8859-1), + * followed by the number of IOR profiles (int), followed by the IOR profiles. Each IOR profile is written as a profile + * tag (int), followed by the length of the profile data (int), followed by the profile data (byte array). */ - public synchronized void writeObject(javax.rmi.CORBA.Stub self, - java.io.ObjectOutputStream stream) throws IOException - { + public synchronized void writeObject(javax.rmi.CORBA.Stub self, java.io.ObjectOutputStream stream) throws IOException { init(self); - ior.doWrite( stream ) ; + ior.doWrite(stream); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/CORBA/Util.java b/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/CORBA/Util.java index fd2bac94b..a48f887a0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/CORBA/Util.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/CORBA/Util.java @@ -71,20 +71,18 @@ // must only occur in contexts that also handle the non-Sun case. /** - * Provides utility methods that can be used by stubs and ties to - * perform common operations. + * Provides utility methods that can be used by stubs and ties to perform common operations. */ -public class Util implements javax.rmi.CORBA.UtilDelegate -{ +public class Util implements javax.rmi.CORBA.UtilDelegate { // Runs as long as there are exportedServants private static KeepAlive keepAlive = null; // Maps targets to ties. - private static final IdentityHashMap exportedServants = new IdentityHashMap<>(); + private static final IdentityHashMap exportedServants = new IdentityHashMap<>(); - private static ValueHandler valueHandlerSingleton; + private static ValueHandler valueHandlerSingleton; - private static final UtilSystemException utilWrapper = UtilSystemException.self ; + private static final UtilSystemException utilWrapper = UtilSystemException.self; private static Util instance = null; @@ -96,7 +94,7 @@ public class Util implements javax.rmi.CORBA.UtilDelegate static { // Note: there uses to be code here to use the JDK value handler for embedded - // web logic. I removed it after 3.1.0-b008. + // web logic. I removed it after 3.1.0-b008. valueHandlerSingleton = SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl(); } @@ -104,35 +102,35 @@ public class Util implements javax.rmi.CORBA.UtilDelegate // It is only called from getInstance and javax.rmi.CORBA.Util.createDelegateIfSpecified (in // the newInstance call). // - // Note that it is possible to construct more than one instance of Util. This can happen + // Note that it is possible to construct more than one instance of Util. This can happen // if we both do something to javax.rmi.CORBA.Util that causes the delegate to be initialized - // AND we call getInstance inside the ORB. This MAY cause problems with ORB shutdown and - // the unexport. I tried to modify this class to guarantee that only one copy gets created. + // AND we call getInstance inside the ORB. This MAY cause problems with ORB shutdown and + // the unexport. I tried to modify this class to guarantee that only one copy gets created. // That resulted in Issue 3080 filed against GlassFish v2 b49, where an ORB client called // new InitialContext, which initialized the se version of the UtilDelegate, which consequently caused - // every call to getInstance to return null. BAD BUG! As it is currently (5/30/07) very + // every call to getInstance to return null. BAD BUG! As it is currently (5/30/07) very // close to the end of the development cycle for GFv2, I am reverting this change back to the // previous version, which has worked well in GF. - public Util() { } + public Util() { + } public static synchronized Util getInstance() { if (instance == null) { - instance = new Util() ; + instance = new Util(); } - return instance ; + return instance; } // Used by TOAFactory.shutdown to unexport all targets for this - // particular ORB. This happens during ORB shutdown. - public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) - { - // Copy exportedServants set we don't get a + // particular ORB. This happens during ORB shutdown. + public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) { + // Copy exportedServants set we don't get a // ConcurrentModificationException. - Map copy = new IdentityHashMap<>(exportedServants) ; + Map copy = new IdentityHashMap<>(exportedServants); - for (Remote key : copy.keySet() ) { - Remote target = key instanceof Tie ? ((Tie)key).getTarget() : key ; + for (Remote key : copy.keySet()) { + Remote target = key instanceof Tie ? ((Tie) key).getTarget() : key; // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set. // We can ignore this because it means the tie is not connected to an ORB. @@ -140,7 +138,7 @@ public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) if (orb == getTie(target).orb()) { try { unexportObject(target); - } catch( java.rmi.NoSuchObjectException ex ) { + } catch (java.rmi.NoSuchObjectException ex) { // We neglect this exception if at all if it is // raised. It is not harmful. } @@ -151,20 +149,19 @@ public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) } } - /** + /** * Maps a SystemException to a RemoteException. + * * @param ex the SystemException to map. * @return the mapped exception. */ - public RemoteException mapSystemException(SystemException ex) - { + public RemoteException mapSystemException(SystemException ex) { if (ex instanceof UnknownException) { - Throwable orig = ((UnknownException)ex).originalEx; + Throwable orig = ((UnknownException) ex).originalEx; if (orig instanceof Error) { - return new ServerError("Error occurred in server thread",(Error)orig); + return new ServerError("Error occurred in server thread", (Error) orig); } else if (orig instanceof RemoteException) { - return new ServerException("RemoteException occurred in server thread", - (Exception)orig); + return new ServerException("RemoteException occurred in server thread", (Exception) orig); } else if (orig instanceof RuntimeException) { throw (RuntimeException) orig; } @@ -172,21 +169,21 @@ public RemoteException mapSystemException(SystemException ex) // Build the message string... String name = ex.getClass().getName(); - String corbaName = name.substring(name.lastIndexOf('.')+1); + String corbaName = name.substring(name.lastIndexOf('.') + 1); String status; switch (ex.completed.value()) { - case CompletionStatus._COMPLETED_YES: - status = "Yes"; - break; - case CompletionStatus._COMPLETED_NO: - status = "No"; - break; - case CompletionStatus._COMPLETED_MAYBE: - default: - status = "Maybe"; - break; + case CompletionStatus._COMPLETED_YES: + status = "Yes"; + break; + case CompletionStatus._COMPLETED_NO: + status = "No"; + break; + case CompletionStatus._COMPLETED_MAYBE: + default: + status = "Maybe"; + break; } - + String message = "CORBA " + corbaName + " " + ex.minor + " " + status; // Now map to the correct RemoteException type... @@ -220,9 +217,8 @@ public RemoteException mapSystemException(SystemException ex) Exception inner = ex; // Pre-Merlin Sun ORBs used the incorrect minor code for - // this case. See Java to IDL ptc-00-01-08 1.4.8. - if (ex.minor == ORBConstants.LEGACY_SUN_NOT_SERIALIZABLE || - ex.minor == OMGSystemException.NOT_SERIALIZABLE) { + // this case. See Java to IDL ptc-00-01-08 1.4.8. + if (ex.minor == ORBConstants.LEGACY_SUN_NOT_SERIALIZABLE || ex.minor == OMGSystemException.NOT_SERIALIZABLE) { if (ex.getMessage() != null) { inner = new NotSerializableException(ex.getMessage()); @@ -230,10 +226,10 @@ public RemoteException mapSystemException(SystemException ex) inner = new NotSerializableException(); } - inner.initCause( ex ) ; + inner.initCause(ex); } - return new MarshalException(message,inner); + return new MarshalException(message, inner); } // Just map to a generic RemoteException... @@ -242,12 +238,11 @@ public RemoteException mapSystemException(SystemException ex) /** * Writes any java.lang.Object as a CORBA any. + * * @param out the stream in which to write the any. * @param obj the object to write as an any. */ - public void writeAny( org.omg.CORBA.portable.OutputStream out, - java.lang.Object obj) - { + public void writeAny(org.omg.CORBA.portable.OutputStream out, java.lang.Object obj) { org.omg.CORBA.ORB orb = out.orb(); // Make sure we have a connected object... @@ -257,10 +252,9 @@ public void writeAny( org.omg.CORBA.portable.OutputStream out, // Typecode implementations, as they are not necessary for // serialization using Java. Further, the current Typecode IO // stream objects are error-prone, and they tend to use encoding - // specific details such as indirections, etc. + // specific details such as indirections, etc. if (ORBUtility.getEncodingVersion() != ORBConstants.CDR_ENC_VERSION) { - ((org.omg.CORBA_2_3.portable.OutputStream)out). - write_abstract_interface(newObj); + ((org.omg.CORBA_2_3.portable.OutputStream) out).write_abstract_interface(newObj); return; } @@ -268,7 +262,7 @@ public void writeAny( org.omg.CORBA.portable.OutputStream out, Any any = orb.create_any(); if (newObj instanceof org.omg.CORBA.Object) { - any.insert_Object((org.omg.CORBA.Object)newObj); + any.insert_Object((org.omg.CORBA.Object) newObj); } else { if (newObj == null) { // Handle the null case, including backwards @@ -278,7 +272,7 @@ public void writeAny( org.omg.CORBA.portable.OutputStream out, if (newObj instanceof Serializable) { // If they're our Any and ORB implementations, // we may want to do type code related versioning. - TypeCode tc = createTypeCode((Serializable)newObj, any, orb); + TypeCode tc = createTypeCode((Serializable) newObj, any, orb); if (tc == null) { any.insert_Value((Serializable) newObj); } else { @@ -296,31 +290,24 @@ public void writeAny( org.omg.CORBA.portable.OutputStream out, } /** - * When using our own ORB and Any implementations, we need to get - * the ORB version and create the type code appropriately. This is - * to overcome a bug in which the JDK 1.3.x ORBs used a tk_char - * rather than a tk_wchar to describe a Java char field. + * When using our own ORB and Any implementations, we need to get the ORB version and create the type code + * appropriately. This is to overcome a bug in which the JDK 1.3.x ORBs used a tk_char rather than a tk_wchar to + * describe a Java char field. * - * This only works in RMI-IIOP with Util.writeAny since we actually - * know what ORB and stream we're writing with when we insert - * the value. + * This only works in RMI-IIOP with Util.writeAny since we actually know what ORB and stream we're writing with when we + * insert the value. * - * Returns null if it wasn't possible to create the TypeCode (means - * it wasn't our ORB or Any implementation). + * Returns null if it wasn't possible to create the TypeCode (means it wasn't our ORB or Any implementation). * * This does not handle null objs. */ - private TypeCode createTypeCode(Serializable obj, - org.omg.CORBA.Any any, - org.omg.CORBA.ORB orb) { + private TypeCode createTypeCode(Serializable obj, org.omg.CORBA.Any any, org.omg.CORBA.ORB orb) { - if (any instanceof com.sun.corba.ee.impl.corba.AnyImpl && - orb instanceof ORB) { + if (any instanceof com.sun.corba.ee.impl.corba.AnyImpl && orb instanceof ORB) { - com.sun.corba.ee.impl.corba.AnyImpl anyImpl - = (com.sun.corba.ee.impl.corba.AnyImpl)any; + com.sun.corba.ee.impl.corba.AnyImpl anyImpl = (com.sun.corba.ee.impl.corba.AnyImpl) any; - ORB ourORB = (ORB)orb; + ORB ourORB = (ORB) orb; return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB); } else { @@ -328,26 +315,23 @@ private TypeCode createTypeCode(Serializable obj, } } - /** - * This is used to create the TypeCode for a null reference. - * It also handles backwards compatibility with JDK 1.3.x. + * This is used to create the TypeCode for a null reference. It also handles backwards compatibility with JDK 1.3.x. * * This method will not return null. */ - private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb) - { + private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb) { if (orb instanceof ORB) { - ORB ourORB = (ORB)orb; + ORB ourORB = (ORB) orb; // Preserve backwards compatibility with Kestrel and Ladybird // by not fully implementing interop issue resolution 3857, // and returning a null TypeCode with a tk_value TCKind. // If we're not talking to Kestrel or Ladybird, fall through // to the abstract interface case (also used for foreign ORBs). - if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) && - ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) { + if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) + && ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) { return orb.get_primitive_tc(TCKind.tk_value); } @@ -363,23 +347,22 @@ private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb) /** * Reads a java.lang.Object as a CORBA any. + * * @param in the stream from which to read the any. * @return the object read from the stream. */ - public Object readAny(InputStream in) - { + public Object readAny(InputStream in) { // In JSG (Java Serialization with GIOP) we avoid using Any and // Typecode implementations, as they are not necessary for // serialization using Java. Further, the current Typecode IO // stream objects are error-prone, and they tend to use encoding - // specific details such as indirections, etc. + // specific details such as indirections, etc. if (ORBUtility.getEncodingVersion() != ORBConstants.CDR_ENC_VERSION) { - return ((org.omg.CORBA_2_3.portable.InputStream)in). - read_abstract_interface(); + return ((org.omg.CORBA_2_3.portable.InputStream) in).read_abstract_interface(); } Any any = in.read_any(); - if ( any.type().kind().value() == TCKind._tk_objref ) { + if (any.type().kind().value() == TCKind._tk_objref) { return any.extract_Object(); } else { return any.extract_Value(); @@ -387,81 +370,74 @@ public Object readAny(InputStream in) } /** - * Writes a java.lang.Object as a CORBA Object. If obj is - * an exported RMI-IIOP server object, the tie is found - * and wired to obj, then written to out.write_Object(org.omg.CORBA.Object). - * If obj is a CORBA Object, it is written to - * out.write_Object(org.omg.CORBA.Object). + * Writes a java.lang.Object as a CORBA Object. If obj is an exported RMI-IIOP server object, the tie is + * found and wired to obj, then written to out.write_Object(org.omg.CORBA.Object). If + * obj is a CORBA Object, it is written to out.write_Object(org.omg.CORBA.Object). + * * @param out the stream in which to write the object. * @param obj the object to write. */ - public void writeRemoteObject(OutputStream out, java.lang.Object obj) - { + public void writeRemoteObject(OutputStream out, java.lang.Object obj) { // Make sure we have a connected object, then // write it out... - - Object newObj = Utility.autoConnect(obj,out.orb(),false); - out.write_Object((org.omg.CORBA.Object)newObj); + + Object newObj = Utility.autoConnect(obj, out.orb(), false); + out.write_Object((org.omg.CORBA.Object) newObj); } - + /** - * Writes a java.lang.Object as either a value or a CORBA Object. - * If obj is a value object or a stub object, it is written to - * out.write_abstract_interface(java.lang.Object). If obj is an exported - * RMI-IIOP server object, the tie is found and wired to obj, - * then written to out.write_abstract_interface(java.lang.Object). + * Writes a java.lang.Object as either a value or a CORBA Object. If obj is a value object or a stub + * object, it is written to out.write_abstract_interface(java.lang.Object). If obj is an + * exported RMI-IIOP server object, the tie is found and wired to obj, then written to + * out.write_abstract_interface(java.lang.Object). + * * @param out the stream in which to write the object. * @param obj the object to write. */ - public void writeAbstractObject( OutputStream out, java.lang.Object obj ) - { + public void writeAbstractObject(OutputStream out, java.lang.Object obj) { // Make sure we have a connected object, then // write it out... - - Object newObj = Utility.autoConnect(obj,out.orb(),false); - ((org.omg.CORBA_2_3.portable.OutputStream)out).write_abstract_interface(newObj); + + Object newObj = Utility.autoConnect(obj, out.orb(), false); + ((org.omg.CORBA_2_3.portable.OutputStream) out).write_abstract_interface(newObj); } - + /** - * Registers a target for a tie. Adds the tie to an internal table and calls - * {@link Tie#setTarget} on the tie object. + * Registers a target for a tie. Adds the tie to an internal table and calls {@link Tie#setTarget} on the tie object. + * * @param tie the tie to register. * @param target the target for the tie. */ @SuppressWarnings("unchecked") - public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target) - { + public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target) { synchronized (exportedServants) { // Do we already have this target registered? if (lookupTie(target) == null) { // No, so register it and set the target... - exportedServants.put(target,tie); + exportedServants.put(target, tie); tie.setTarget(target); - + // Do we need to instantiate our keep-alive thread? if (keepAlive == null) { // Yes. Instantiate our keep-alive thread and start // it up... - keepAlive = (KeepAlive)AccessController.doPrivileged( - new PrivilegedAction() { - public java.lang.Object run() { - return new KeepAlive(); - } - }); + keepAlive = (KeepAlive) AccessController.doPrivileged(new PrivilegedAction() { + public java.lang.Object run() { + return new KeepAlive(); + } + }); keepAlive.start(); } } } } - + /** - * Removes the associated tie from an internal table and calls {@link Tie#deactivate} - * to deactivate the object. + * Removes the associated tie from an internal table and calls {@link Tie#deactivate} to deactivate the object. + * * @param target the object to unexport. */ - public void unexportObject(java.rmi.Remote target) - throws java.rmi.NoSuchObjectException - { + public void unexportObject(java.rmi.Remote target) throws java.rmi.NoSuchObjectException { synchronized (exportedServants) { Tie cachedTie = lookupTie(target); if (cachedTie != null) { @@ -476,31 +452,29 @@ public void unexportObject(java.rmi.Remote target) // This can happen when the target was never associated with a POA. // We can safely ignore this case. } - + // Is it time to shut down our keep alive thread? if (exportedServants.isEmpty()) { keepAlive.quit(); keepAlive = null; } } else { - throw new java.rmi.NoSuchObjectException("Tie not found" ); + throw new java.rmi.NoSuchObjectException("Tie not found"); } } } - protected void cleanUpTie(Tie cachedTie) - throws java.rmi.NoSuchObjectException - { + protected void cleanUpTie(Tie cachedTie) throws java.rmi.NoSuchObjectException { cachedTie.setTarget(null); cachedTie.deactivate(); } - + /** * Returns the tie (if any) for a given target object. + * * @return the tie or null if no tie is registered for the given target. */ - public Tie getTie (Remote target) - { + public Tie getTie(Remote target) { synchronized (exportedServants) { return lookupTie(target); } @@ -509,34 +483,33 @@ public Tie getTie (Remote target) /** * An unsynchronized version of getTie() for internal use. */ - private static Tie lookupTie (Remote target) - { + private static Tie lookupTie(Remote target) { Tie result = exportedServants.get(target); if (result == null && target instanceof Tie) { if (exportedServants.containsKey(target)) { - result = (Tie)target; + result = (Tie) target; } } return result; } /** - * Returns a singleton instance of a class that implements the - * {@link ValueHandler} interface. + * Returns a singleton instance of a class that implements the {@link ValueHandler} interface. + * * @return a class which implements the ValueHandler interface. */ - public ValueHandler createValueHandler() - { + public ValueHandler createValueHandler() { return valueHandlerSingleton; } /** - * Returns the codebase, if any, for the given class. + * Returns the codebase, if any, for the given class. + * * @param clz the class to get a codebase for. * @return a space-separated list of URLs, or null. */ public String getCodebase(java.lang.Class clz) { - String annot ; + String annot; synchronized (annotObj) { annot = annotationMap.get(clz); } @@ -545,7 +518,7 @@ public String getCodebase(java.lang.Class clz) { // This can be an expensive operation, so don't hold the lock here. annot = RMIClassLoader.getClassAnnotation(clz); - synchronized( annotObj ) { + synchronized (annotObj) { annotationMap.put(clz, annot); } } @@ -554,238 +527,221 @@ public String getCodebase(java.lang.Class clz) { } /** - * Returns a class instance for the specified class. + * Returns a class instance for the specified class. + * * @param className the name of the class. - * @param remoteCodebase a space-separated list of URLs at which - * the class might be found. May be null. - * @param loader a ClassLoader who may be used to - * load the class if all other methods fail. + * @param remoteCodebase a space-separated list of URLs at which the class might be found. May be null. + * @param loader a ClassLoader who may be used to load the class if all other methods fail. * @return the Class object representing the loaded class. * @exception ClassNotFoundException if class cannot be loaded. */ - public Class loadClass( String className, String remoteCodebase, - ClassLoader loader) throws ClassNotFoundException - { - return JDKBridge.loadClass(className,remoteCodebase,loader); + public Class loadClass(String className, String remoteCodebase, ClassLoader loader) throws ClassNotFoundException { + return JDKBridge.loadClass(className, remoteCodebase, loader); } /** - * The isLocal method has the same semantics as the - * ObjectImpl._is_local method, except that it can throw a RemoteException. - * (no it doesn't but the spec says it should.) - * - * The _is_local() method is provided so that stubs may determine - * if a particular object is implemented by a local servant and hence local - * invocation APIs may be used. + * The isLocal method has the same semantics as the ObjectImpl._is_local method, except that it can throw a + * RemoteException. (no it doesn't but the spec says it should.) + * + * The _is_local() method is provided so that stubs may determine if a particular object is implemented by a + * local servant and hence local invocation APIs may be used. * * @param stub the stub to test. * - * @return The _is_local() method returns true if - * the servant incarnating the object is located in the same process as - * the stub and they both share the same ORB instance. The _is_local() - * method returns false otherwise. The default behavior of _is_local() is - * to return false. + * @return The _is_local() method returns true if the servant incarnating the object is located in the same + * process as the stub and they both share the same ORB instance. The _is_local() method returns false + * otherwise. The default behavior of _is_local() is to return false. * - * @throws RemoteException The Java to IDL specification does to - * specify the conditions that cause a RemoteException to be thrown. + * @throws RemoteException The Java to IDL specification does to specify the conditions that cause a RemoteException to + * be thrown. */ - public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException - { - boolean result = false ; + public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException { + boolean result = false; try { - org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ; + org.omg.CORBA.portable.Delegate delegate = stub._get_delegate(); if (delegate instanceof ClientDelegate) { // For the Sun ORB - ClientDelegate cdel = (ClientDelegate)delegate ; - ContactInfoList cil = cdel.getContactInfoList() ; - LocalClientRequestDispatcher lcs = - cil.getLocalClientRequestDispatcher() ; - result = lcs.useLocalInvocation( null ) ; + ClientDelegate cdel = (ClientDelegate) delegate; + ContactInfoList cil = cdel.getContactInfoList(); + LocalClientRequestDispatcher lcs = cil.getLocalClientRequestDispatcher(); + result = lcs.useLocalInvocation(null); } else { // For a non-Sun ORB - result = delegate.is_local( stub ) ; + result = delegate.is_local(stub); } } catch (SystemException e) { throw mapSystemException(e); } - return result ; + return result; } - + /** - * Wraps an exception thrown by an implementation - * method. It returns the corresponding client-side exception. + * Wraps an exception thrown by an implementation method. It returns the corresponding client-side exception. + * * @param orig the exception to wrap. * @return the wrapped exception. */ - public RemoteException wrapException(Throwable orig) - { + public RemoteException wrapException(Throwable orig) { if (orig instanceof SystemException) { - return mapSystemException((SystemException)orig); + return mapSystemException((SystemException) orig); } - + if (orig instanceof Error) { - return new ServerError("Error occurred in server thread",(Error)orig); + return new ServerError("Error occurred in server thread", (Error) orig); } else if (orig instanceof RemoteException) { - return new ServerException("RemoteException occurred in server thread", - (Exception)orig); + return new ServerException("RemoteException occurred in server thread", (Exception) orig); } else if (orig instanceof RuntimeException) { throw (RuntimeException) orig; - } - + } + if (orig instanceof Exception) { - return new UnexpectedException(orig.toString(), - (Exception) orig); + return new UnexpectedException(orig.toString(), (Exception) orig); } else { return new UnexpectedException(orig.toString()); } } /** - * Copies or connects an array of objects. Used by local stubs - * to copy any number of actual parameters, preserving sharing - * across parameters as necessary to support RMI semantics. + * Copies or connects an array of objects. Used by local stubs to copy any number of actual parameters, preserving + * sharing across parameters as necessary to support RMI semantics. + * * @param obj the objects to copy or connect. * @param orb the ORB. * @return the copied or connected objects. * @exception RemoteException if any object could not be copied or connected. */ - public Object[] copyObjects (Object[] obj, org.omg.CORBA.ORB orb) - throws RemoteException - { + public Object[] copyObjects(Object[] obj, org.omg.CORBA.ORB orb) throws RemoteException { if (obj == null) { throw new NullPointerException(); } - Class compType = obj.getClass().getComponentType() ; - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( compType ) ; + Class compType = obj.getClass().getComponentType(); + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(compType); if (cinfo.isARemote(compType) && cinfo.isInterface()) { - // obj is an array of remote impl types. This + // obj is an array of remote impl types. This // causes problems with stream copier, so we copy // it over to an array of Remotes instead. - Remote[] result = new Remote[obj.length] ; - System.arraycopy( (Object)obj, 0, (Object)result, 0, obj.length ) ; - return (Object[])copyObject( result, orb ) ; + Remote[] result = new Remote[obj.length]; + System.arraycopy((Object) obj, 0, (Object) result, 0, obj.length); + return (Object[]) copyObject(result, orb); } else { - return (Object[]) copyObject( obj, orb ); + return (Object[]) copyObject(obj, orb); } } /** - * Copies or connects an object. Used by local stubs to copy - * an actual parameter, result object, or exception. + * Copies or connects an object. Used by local stubs to copy an actual parameter, result object, or exception. + * * @param obj the object to copy. * @param orb the ORB. * @return the copy or connected object. * @exception RemoteException if the object could not be copied or connected. */ - public Object copyObject (Object obj, org.omg.CORBA.ORB orb) - throws RemoteException - { + public Object copyObject(Object obj, org.omg.CORBA.ORB orb) throws RemoteException { try { - if (((ORB)orb).operationTraceDebugFlag) { - OperationTracer.enable() ; + if (((ORB) orb).operationTraceDebugFlag) { + OperationTracer.enable(); } - OperationTracer.begin( "copyObject") ; + OperationTracer.begin("copyObject"); if (orb instanceof ORB) { - ORB lorb = (ORB)orb ; + ORB lorb = (ORB) orb; try { try { // This gets the copier for the current invocation, which was // previously set by preinvoke. - return lorb.peekInvocationInfo().getCopierFactory().make().copy( obj ) ; + return lorb.peekInvocationInfo().getCopierFactory().make().copy(obj); } catch (java.util.EmptyStackException exc) { // copyObject was invoked outside of an invocation, probably by - // a test. Get the default copier from the ORB. - CopierManager cm = lorb.getCopierManager() ; - ObjectCopier copier = cm.getDefaultObjectCopierFactory().make() ; - return copier.copy( obj ) ; + // a test. Get the default copier from the ORB. + CopierManager cm = lorb.getCopierManager(); + ObjectCopier copier = cm.getDefaultObjectCopierFactory().make(); + return copier.copy(obj); } } catch (ReflectiveCopyException exc) { - RemoteException rexc = new RemoteException() ; - rexc.initCause( exc ) ; - throw rexc ; + RemoteException rexc = new RemoteException(); + rexc.initCause(exc); + throw rexc; } } else { if (obj instanceof Remote) { // Make sure obj is connected and converted to a stub, // if necessary. - return Utility.autoConnect( obj, orb, true ) ; + return Utility.autoConnect(obj, orb, true); } - org.omg.CORBA_2_3.portable.OutputStream out = - (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream(); - out.write_value((Serializable)obj); - org.omg.CORBA_2_3.portable.InputStream in = - (org.omg.CORBA_2_3.portable.InputStream)out.create_input_stream(); + org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) orb.create_output_stream(); + out.write_value((Serializable) obj); + org.omg.CORBA_2_3.portable.InputStream in = (org.omg.CORBA_2_3.portable.InputStream) out.create_input_stream(); return in.read_value(); } } finally { OperationTracer.disable(); - OperationTracer.finish(); + OperationTracer.finish(); } } - + /** - * Tries to find the correct remote exception to instantiate depending on whether - * javax.transaction or jakarta.transaction is on the classpath + * Tries to find the correct remote exception to instantiate depending on whether javax.transaction or + * jakarta.transaction is on the classpath + * * @param className Base class name of the exception * @param message Message to add to the exception - * @return + * @return */ - private RemoteException createTransactionException(String className, String message){ - + private RemoteException createTransactionException(String className, String message) { + Class clazz = null; RemoteException ex = new RemoteException(message); try { - clazz = (Class) Class.forName("jakarta.transaction."+ className, true, Thread.currentThread().getContextClassLoader()); + clazz = (Class) Class.forName("jakarta.transaction." + className, true, + Thread.currentThread().getContextClassLoader()); } catch (ClassNotFoundException ex1) { try { - clazz = (Class) Class.forName("javax.transaction." + className, true, Thread.currentThread().getContextClassLoader()); + clazz = (Class) Class.forName("javax.transaction." + className, true, + Thread.currentThread().getContextClassLoader()); } catch (ClassNotFoundException ex2) { // we can't find either on the classpath return a general Remote Exception - return new RemoteException(message); + return new RemoteException(message); } } - + try { // construct an instance of the exception Constructor constructor = clazz.getDeclaredConstructor(String.class); ex = constructor.newInstance(message); return ex; - } catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException | InvocationTargetException ex1) { + } catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException + | InvocationTargetException ex1) { // there is a problem creating an exception instance so return a general RemoteException return new RemoteException(message); } } } -class KeepAlive extends Thread -{ +class KeepAlive extends Thread { boolean quit = false; - - public KeepAlive () - { + + public KeepAlive() { setDaemon(false); } - + @Override - public synchronized void run () - { + public synchronized void run() { while (!quit) { try { wait(); - } catch (InterruptedException e) {} + } catch (InterruptedException e) { + } } } - - public synchronized void quit () - { + + public synchronized void quit() { quit = true; notifyAll(); - } + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/PortableRemoteObject.java b/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/PortableRemoteObject.java index 0e82a2ff0..a88d86bb3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/PortableRemoteObject.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/javax/rmi/PortableRemoteObject.java @@ -18,7 +18,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.javax.rmi; +package com.sun.corba.ee.impl.javax.rmi; import javax.rmi.CORBA.Tie; @@ -38,137 +38,124 @@ import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; /** - * Server implementation objects may either inherit from - * javax.rmi.PortableRemoteObject or they may implement a remote interface - * and then use the exportObject method to register themselves as a server object. - * The toStub method takes a server implementation and returns a stub that - * can be used to access that server object. - * The connect method makes a Remote object ready for remote communication. - * The unexportObject method is used to deregister a server object, allowing it to become - * available for garbage collection. - * The narrow method takes an object reference or abstract interface type and - * attempts to narrow it to conform to - * the given interface. If the operation is successful the result will be an - * object of the specified type, otherwise an exception will be thrown. + * Server implementation objects may either inherit from javax.rmi.PortableRemoteObject or they may implement a remote + * interface and then use the exportObject method to register themselves as a server object. The toStub method takes a + * server implementation and returns a stub that can be used to access that server object. The connect method makes a + * Remote object ready for remote communication. The unexportObject method is used to deregister a server object, + * allowing it to become available for garbage collection. The narrow method takes an object reference or abstract + * interface type and attempts to narrow it to conform to the given interface. If the operation is successful the result + * will be an object of the specified type, otherwise an exception will be thrown. */ -public class PortableRemoteObject - implements javax.rmi.CORBA.PortableRemoteObjectDelegate { +public class PortableRemoteObject implements javax.rmi.CORBA.PortableRemoteObjectDelegate { /** - * Makes a server object ready to receive remote calls. Note - * that subclasses of PortableRemoteObject do not need to call this - * method, as it is called by the constructor. + * Makes a server object ready to receive remote calls. Note that subclasses of PortableRemoteObject do not need to call + * this method, as it is called by the constructor. + * * @param obj the server object to export. * @exception RemoteException if export fails. */ - public void exportObject(Remote obj) - throws RemoteException { + public void exportObject(Remote obj) throws RemoteException { if (obj == null) { throw new NullPointerException("invalid argument"); } - + // Has this object already been exported to IIOP? - + if (Util.getInstance().getTie(obj) != null) { - + // Yes, so this is an error... - - throw new ExportException (obj.getClass().getName() + " already exported"); + + throw new ExportException(obj.getClass().getName() + " already exported"); } - + // Can we load a Tie? - + Tie theTie = Utility.loadTie(obj); - + if (theTie != null) { - + // Yes, so export it to IIOP... - - Util.getInstance().registerTarget(theTie,obj); - + + Util.getInstance().registerTarget(theTie, obj); + } else { - + // No, so export to JRMP. If this is called twice for the // same object, it will throw an ExportException... - + UnicastRemoteObject.exportObject(obj); } } - + /** * Returns a stub for the given server object. - * @param obj the server object for which a stub is required. Must either be a subclass - * of PortableRemoteObject or have been previously the target of a call to - * {@link #exportObject}. + * + * @param obj the server object for which a stub is required. Must either be a subclass of PortableRemoteObject or have + * been previously the target of a call to {@link #exportObject}. * @return the most derived stub for the object. * @exception NoSuchObjectException if a stub cannot be located for the given server object. */ - public Remote toStub (Remote obj) - throws NoSuchObjectException - { + public Remote toStub(Remote obj) throws NoSuchObjectException { Remote result = null; if (obj == null) { throw new NullPointerException("invalid argument"); } - + // If the class is already an IIOP stub then return it. - if (StubAdapter.isStub( obj )) { + if (StubAdapter.isStub(obj)) { return obj; } - + // If the class is already a JRMP stub then return it. if (obj instanceof java.rmi.server.RemoteStub) { return obj; } - + // Has it been exported to IIOP? Tie theTie = Util.getInstance().getTie(obj); - + if (theTie != null) { - result = Utility.loadStub(theTie,null,null,true); + result = Utility.loadStub(theTie, null, null, true); } else { if (Utility.loadTie(obj) == null) { result = java.rmi.server.RemoteObject.toStub(obj); } } - + if (result == null) { throw new NoSuchObjectException("object not exported"); } - + return result; } /** - * Deregisters a server object from the runtime, allowing the object to become - * available for garbage collection. + * Deregisters a server object from the runtime, allowing the object to become available for garbage collection. + * * @param obj the object to unexport. - * @exception NoSuchObjectException if the remote object is not - * currently exported. + * @exception NoSuchObjectException if the remote object is not currently exported. */ - public void unexportObject(Remote obj) - throws NoSuchObjectException { - + public void unexportObject(Remote obj) throws NoSuchObjectException { + if (obj == null) { throw new NullPointerException("invalid argument"); } - - if (StubAdapter.isStub(obj) || - obj instanceof java.rmi.server.RemoteStub) { - throw new NoSuchObjectException( - "Can only unexport a server object."); + + if (StubAdapter.isStub(obj) || obj instanceof java.rmi.server.RemoteStub) { + throw new NoSuchObjectException("Can only unexport a server object."); } - + Tie theTie = Util.getInstance().getTie(obj); if (theTie != null) { Util.getInstance().unexportObject(obj); } else { if (Utility.loadTie(obj) == null) { - UnicastRemoteObject.unexportObject(obj,true); + UnicastRemoteObject.unexportObject(obj, true); } else { throw new NoSuchObjectException("Object not exported."); } @@ -176,103 +163,88 @@ public void unexportObject(Remote obj) } /** - * Checks to ensure that an object of a remote or abstract interface type - * can be cast to a desired type. + * Checks to ensure that an object of a remote or abstract interface type can be cast to a desired type. + * * @param narrowFrom the object to check. * @param narrowTo the desired type. * @return an object which can be cast to the desired type. * @throws ClassCastException if narrowFrom cannot be cast to narrowTo. */ - public java.lang.Object narrow ( java.lang.Object narrowFrom, - java.lang.Class narrowTo) throws ClassCastException - { + public java.lang.Object narrow(java.lang.Object narrowFrom, java.lang.Class narrowTo) throws ClassCastException { java.lang.Object result = null; if (narrowFrom == null) return null; - if (narrowTo == null) + if (narrowTo == null) throw new NullPointerException("invalid argument"); - try { - if (narrowTo.isAssignableFrom(narrowFrom.getClass())) + try { + if (narrowTo.isAssignableFrom(narrowFrom.getClass())) return narrowFrom; // Is narrowTo an interface that might be // implemented by a servant running on iiop? - if (ClassInfoCache.get( narrowTo ).isInterface() && - narrowTo != java.io.Serializable.class && - narrowTo != java.io.Externalizable.class) { - - org.omg.CORBA.Object narrowObj - = (org.omg.CORBA.Object) narrowFrom; - + if (ClassInfoCache.get(narrowTo).isInterface() && narrowTo != java.io.Serializable.class + && narrowTo != java.io.Externalizable.class) { + + org.omg.CORBA.Object narrowObj = (org.omg.CORBA.Object) narrowFrom; + // Create an id from the narrowTo type... String id = RepositoryId.createForAnyType(narrowTo); - + if (narrowObj._is_a(id)) { - return Utility.loadStub(narrowObj,narrowTo); + return Utility.loadStub(narrowObj, narrowTo); } else { - throw new ClassCastException( "Object is not of remote type " + - narrowTo.getName() ) ; + throw new ClassCastException("Object is not of remote type " + narrowTo.getName()); } } else { - throw new ClassCastException( "Class " + narrowTo.getName() + - " is not a valid remote interface" ) ; + throw new ClassCastException("Class " + narrowTo.getName() + " is not a valid remote interface"); } - } catch(Exception error) { - ClassCastException cce = new ClassCastException() ; - cce.initCause( error ) ; - throw cce ; + } catch (Exception error) { + ClassCastException cce = new ClassCastException(); + cce.initCause(error); + throw cce; } } - + /** - * Makes a Remote object ready for remote communication. This normally - * happens implicitly when the object is sent or received as an argument - * on a remote method call, but in some circumstances it is useful to - * perform this action by making an explicit call. See the - * {@link javax.rmi.CORBA.Stub#connect(org.omg.CORBA.ORB)} method for more information. + * Makes a Remote object ready for remote communication. This normally happens implicitly when the object is sent or + * received as an argument on a remote method call, but in some circumstances it is useful to perform this action by + * making an explicit call. See the {@link javax.rmi.CORBA.Stub#connect(org.omg.CORBA.ORB)} method for more information. + * * @param target the object to connect. * @param source a previously connected object. - * @throws RemoteException if source is not connected - * or if target is already connected to a different ORB than - * source. + * @throws RemoteException if source is not connected or if target is already connected to a + * different ORB than source. */ - public void connect (Remote target, Remote source) - throws RemoteException - { + public void connect(Remote target, Remote source) throws RemoteException { if (target == null || source == null) { throw new NullPointerException("invalid argument"); } - + ORB orb = null; try { - if (StubAdapter.isStub( source )) { - orb = StubAdapter.getORB( source ) ; + if (StubAdapter.isStub(source)) { + orb = StubAdapter.getORB(source); } else { // Is this a servant that was exported to iiop? Tie tie = Util.getInstance().getTie(source); if (tie == null) { - /* loadTie always succeeds for dynamic RMI-IIOP - // No, can we get a tie for it? If not, - // assume that source is a JRMP object... - if (Utility.loadTie(source) != null) { - // Yes, so it is an iiop object which - // has not been exported... - throw new RemoteException( - "'source' object not exported"); - } - */ + /* + * loadTie always succeeds for dynamic RMI-IIOP // No, can we get a tie for it? If not, // assume that source is a JRMP + * object... if (Utility.loadTie(source) != null) { // Yes, so it is an iiop object which // has not been exported... + * throw new RemoteException( "'source' object not exported"); } + */ } else { orb = tie.orb(); } } } catch (SystemException e) { - throw new RemoteException("'source' object not connected", e ); + throw new RemoteException("'source' object not connected", e); } - boolean targetIsIIOP = false ; + boolean targetIsIIOP = false; Tie targetTie = null; if (StubAdapter.isStub(target)) { targetIsIIOP = true; @@ -281,60 +253,56 @@ public void connect (Remote target, Remote source) if (targetTie != null) { targetIsIIOP = true; } else { - /* loadTie always succeeds for dynamic RMI-IIOP - if (Utility.loadTie(target) != null) { - throw new RemoteException("'target' servant not exported"); - } - */ + /* + * loadTie always succeeds for dynamic RMI-IIOP if (Utility.loadTie(target) != null) { throw new + * RemoteException("'target' servant not exported"); } + */ } } if (!targetIsIIOP) { - // Yes. Do we have an ORB from the source object? + // Yes. Do we have an ORB from the source object? // If not, we're done - there is nothing to do to // connect a JRMP object. If so, it is an error because // the caller mixed JRMP and IIOP... if (orb != null) { - throw new RemoteException( - "'source' object exported to IIOP, 'target' is JRMP"); + throw new RemoteException("'source' object exported to IIOP, 'target' is JRMP"); } } else { // The target object is IIOP. Make sure we have a // valid ORB from the source object... if (orb == null) { - throw new RemoteException( - "'source' object is JRMP, 'target' is IIOP"); + throw new RemoteException("'source' object is JRMP, 'target' is IIOP"); } - + // And, finally, connect it up... try { if (targetTie != null) { // Is the tie already connected? try { ORB existingOrb = targetTie.orb(); - - // Yes. Is it the same orb? + + // Yes. Is it the same orb? if (existingOrb == orb) { - + // Yes, so nothing to do... return; } else { // No, so this is an error... - throw new RemoteException( - "'target' object was already connected"); + throw new RemoteException("'target' object was already connected"); } - } catch (SystemException e) {} - + } catch (SystemException e) { + } + // No, so do it... targetTie.orb(orb); } else { - StubAdapter.connect( target, orb ) ; + StubAdapter.connect(target, orb); } } catch (SystemException e) { - + // The stub or tie was already connected... - throw new RemoteException( - "'target' object was already connected", e ); + throw new RemoteException("'target' object was already connected", e); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/DefaultSocketFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/DefaultSocketFactory.java index 612d32bde..548ccd0a1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/DefaultSocketFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/DefaultSocketFactory.java @@ -29,8 +29,8 @@ import org.omg.CORBA.ORB; import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; import com.sun.corba.ee.spi.legacy.connection.GetEndPointInfoAgainException; import com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory; import com.sun.corba.ee.spi.transport.SocketInfo; @@ -39,36 +39,26 @@ import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.impl.misc.ORBUtility; -public class DefaultSocketFactory - implements - ORBSocketFactory -{ +public class DefaultSocketFactory implements ORBSocketFactory { private com.sun.corba.ee.spi.orb.ORB orb; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - public DefaultSocketFactory() - { + public DefaultSocketFactory() { } - public void setORB(com.sun.corba.ee.spi.orb.ORB orb) - { + public void setORB(com.sun.corba.ee.spi.orb.ORB orb) { this.orb = orb; } - public ServerSocket createServerSocket(String type, int port) - throws - IOException - { - if (! type.equals(ORBSocketFactory.IIOP_CLEAR_TEXT)) { - throw wrapper.defaultCreateServerSocketGivenNonIiopClearText( type ) ; + public ServerSocket createServerSocket(String type, int port) throws IOException { + if (!type.equals(ORBSocketFactory.IIOP_CLEAR_TEXT)) { + throw wrapper.defaultCreateServerSocketGivenNonIiopClearText(type); } ServerSocket serverSocket; if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) { - ServerSocketChannel serverSocketChannel = - ServerSocketChannel.open(); + ServerSocketChannel serverSocketChannel = ServerSocketChannel.open(); serverSocket = serverSocketChannel.socket(); } else { serverSocket = new ServerSocket(); @@ -77,46 +67,32 @@ public ServerSocket createServerSocket(String type, int port) return serverSocket; } - public SocketInfo getEndPointInfo(ORB orb, - IOR ior, - SocketInfo socketInfo) - { - IIOPProfileTemplate temp = - (IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate() ; - IIOPAddress primary = temp.getPrimaryAddress() ; - - return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT, - primary.getPort(), - primary.getHost().toLowerCase()); + public SocketInfo getEndPointInfo(ORB orb, IOR ior, SocketInfo socketInfo) { + IIOPProfileTemplate temp = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate(); + IIOPAddress primary = temp.getPrimaryAddress(); + + return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT, primary.getPort(), primary.getHost().toLowerCase()); } - public Socket createSocket(SocketInfo socketInfo) - throws - IOException, - GetEndPointInfoAgainException - { + public Socket createSocket(SocketInfo socketInfo) throws IOException, GetEndPointInfoAgainException { Socket socket; if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) { - InetSocketAddress address = - new InetSocketAddress(socketInfo.getHost(), - socketInfo.getPort()); + InetSocketAddress address = new InetSocketAddress(socketInfo.getHost(), socketInfo.getPort()); SocketChannel socketChannel = ORBUtility.openSocketChannel(address); socket = socketChannel.socket(); } else { - socket = new Socket(socketInfo.getHost(), - socketInfo.getPort()); + socket = new Socket(socketInfo.getHost(), socketInfo.getPort()); } // REVISIT - this is done in SocketOrChannelConnectionImpl try { socket.setTcpNoDelay(true); } catch (Exception e) { - wrapper.couldNotSetTcpNoDelay( e ) ; + wrapper.couldNotSetTcpNoDelay(e); } return socket; } } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/EndPointInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/EndPointInfoImpl.java index 8d9533506..79b007909 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/EndPointInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/EndPointInfoImpl.java @@ -22,11 +22,7 @@ import com.sun.corba.ee.spi.legacy.connection.LegacyServerSocketEndPointInfo; import com.sun.corba.ee.spi.transport.SocketInfo; -public class EndPointInfoImpl - implements - SocketInfo, - LegacyServerSocketEndPointInfo -{ +public class EndPointInfoImpl implements SocketInfo, LegacyServerSocketEndPointInfo { protected String type; protected String hostname; @@ -58,18 +54,15 @@ public int getPort() { return port; } - public int getLocatorPort () - { + public int getLocatorPort() { return locatorPort; } - public void setLocatorPort (int port) - { + public void setLocatorPort(int port) { locatorPort = port; } - public String getName() - { + public String getName() { return name; } @@ -81,7 +74,7 @@ public boolean equals(Object obj) { if (!(obj instanceof EndPointInfoImpl)) { return false; } - EndPointInfoImpl other = (EndPointInfoImpl)obj; + EndPointInfoImpl other = (EndPointInfoImpl) obj; if (type == null) { if (other.type != null) { return false; @@ -98,13 +91,8 @@ public boolean equals(Object obj) { return true; } - public String toString () - { - return - type + " " + - name + " " + - hostname + " " + - port; + public String toString() { + return type + " " + name + " " + hostname + " " + port; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/LegacyServerSocketManagerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/LegacyServerSocketManagerImpl.java index 5a0d1128c..7623cb004 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/LegacyServerSocketManagerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/LegacyServerSocketManagerImpl.java @@ -25,7 +25,6 @@ import org.omg.CORBA.INTERNAL; import org.omg.CORBA.CompletionStatus; - import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.legacy.connection.LegacyServerSocketEndPointInfo; import com.sun.corba.ee.spi.legacy.connection.LegacyServerSocketManager; @@ -33,14 +32,10 @@ import com.sun.corba.ee.impl.misc.ORBUtility; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -public class LegacyServerSocketManagerImpl - implements - LegacyServerSocketManager -{ +public class LegacyServerSocketManagerImpl implements LegacyServerSocketManager { protected ORB orb; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + public LegacyServerSocketManagerImpl(ORB orb) { this.orb = orb; } @@ -51,14 +46,12 @@ public LegacyServerSocketManagerImpl(ORB orb) { // // Only used in ServerManagerImpl. - public int legacyGetTransientServerPort(String type) - { + public int legacyGetTransientServerPort(String type) { return legacyGetServerPort(type, false); } // Only used by POAPolicyMediatorBase. - public synchronized int legacyGetPersistentServerPort(String socketType) - { + public synchronized int legacyGetPersistentServerPort(String socketType) { if (orb.getORBData().getServerIsORBActivated()) { // this server is activated by orbd return legacyGetServerPort(socketType, true); @@ -71,20 +64,14 @@ public synchronized int legacyGetPersistentServerPort(String socketType) } // Only used by PI IORInfoImpl. - public synchronized int legacyGetTransientOrPersistentServerPort( - String socketType) - { - return legacyGetServerPort(socketType, - orb.getORBData() - .getServerIsORBActivated()); + public synchronized int legacyGetTransientOrPersistentServerPort(String socketType) { + return legacyGetServerPort(socketType, orb.getORBData().getServerIsORBActivated()); } // Used in RepositoryImpl, ServerManagerImpl, POAImpl, // POAPolicyMediatorBase, TOAImpl. // To get either default or bootnaming endpoint. - public synchronized LegacyServerSocketEndPointInfo legacyGetEndpoint( - String name) - { + public synchronized LegacyServerSocketEndPointInfo legacyGetEndpoint(String name) { Iterator iterator = getAcceptorIterator(); while (iterator.hasNext()) { LegacyServerSocketEndPointInfo endPoint = cast(iterator.next()); @@ -97,17 +84,16 @@ public synchronized LegacyServerSocketEndPointInfo legacyGetEndpoint( // Check to see if the given port is equal to any of the ORB Server Ports. // Used in IIOPProfileImpl, ORBImpl. - public boolean legacyIsLocalServerPort(int port) - { + public boolean legacyIsLocalServerPort(int port) { // If port is 0 (which signifies in CSIv2 that clear text // communication is not allowed), we must return true, because // this check is not meaningful. if (port == 0) { - return true ; + return true; } Iterator iterator = getAcceptorIterator(); - while (iterator.hasNext()) { + while (iterator.hasNext()) { LegacyServerSocketEndPointInfo endPoint = cast(iterator.next()); if (endPoint != null && endPoint.getPort() == port) { return true; @@ -121,8 +107,7 @@ public boolean legacyIsLocalServerPort(int port) // Implementation. // - private int legacyGetServerPort (String socketType, boolean isPersistent) - { + private int legacyGetServerPort(String socketType, boolean isPersistent) { Iterator endpoints = getAcceptorIterator(); while (endpoints.hasNext()) { LegacyServerSocketEndPointInfo ep = cast(endpoints.next()); @@ -137,31 +122,25 @@ private int legacyGetServerPort (String socketType, boolean isPersistent) return -1; } - private Iterator getAcceptorIterator() - { - Collection acceptors = - orb.getCorbaTransportManager().getAcceptors(null, null); + private Iterator getAcceptorIterator() { + Collection acceptors = orb.getCorbaTransportManager().getAcceptors(null, null); if (acceptors != null) { return acceptors.iterator(); } - throw wrapper.getServerPortCalledBeforeEndpointsInitialized() ; + throw wrapper.getServerPortCalledBeforeEndpointsInitialized(); } - private LegacyServerSocketEndPointInfo cast(Object o) - { + private LegacyServerSocketEndPointInfo cast(Object o) { if (o instanceof LegacyServerSocketEndPointInfo) { return (LegacyServerSocketEndPointInfo) o; } return null; } - protected void dprint(String msg) - { + protected void dprint(String msg) { ORBUtility.dprint("LegacyServerSocketManagerImpl", msg); } } // End of file. - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryAcceptorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryAcceptorImpl.java index 65ab45648..95beac1b2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryAcceptorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryAcceptorImpl.java @@ -19,7 +19,7 @@ package com.sun.corba.ee.impl.legacy.connection; -import java.util.Iterator ; +import java.util.Iterator; import com.sun.corba.ee.spi.ior.IORTemplate; import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; @@ -33,29 +33,22 @@ * @author Harold Carr */ @Transport -public class SocketFactoryAcceptorImpl - extends - AcceptorImpl -{ - public SocketFactoryAcceptorImpl(ORB orb, int port, - String name, String type) - { +public class SocketFactoryAcceptorImpl extends AcceptorImpl { + public SocketFactoryAcceptorImpl(ORB orb, int port, String name, String type) { super(orb, port, name, type); } @Transport @Override - public boolean initialize() - { + public boolean initialize() { if (initialized) { return false; } try { - serverSocket = orb.getORBData() - .getLegacySocketFactory().createServerSocket(type, port); + serverSocket = orb.getORBData().getLegacySocketFactory().createServerSocket(type, port); internalInitialize(); } catch (Throwable t) { - throw wrapper.createListenerFailed( t, "localhost", port ) ; + throw wrapper.createListenerFailed(t, "localhost", port); } initialized = true; return true; @@ -67,8 +60,7 @@ public boolean initialize() // @Override - protected String toStringName() - { + protected String toStringName() { return "SocketFactoryAcceptorImpl"; } @@ -80,16 +72,12 @@ protected String toStringName() // However, this method MUST add an IIOPProfileTemplate if one is // not already present. @Override - public void addToIORTemplate( IORTemplate iorTemplate, - Policies policies, String codebase ) - { - Iterator iterator = iorTemplate.iteratorById( - org.omg.IOP.TAG_INTERNET_IOP.value); + public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, String codebase) { + Iterator iterator = iorTemplate.iteratorById(org.omg.IOP.TAG_INTERNET_IOP.value); if (!iterator.hasNext()) { // If this is the first call, create the IIOP profile template. - IIOPProfileTemplate iiopProfile = makeIIOPProfileTemplate( - policies, codebase ) ; + IIOPProfileTemplate iiopProfile = makeIIOPProfileTemplate(policies, codebase); iorTemplate.add(iiopProfile); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryConnectionImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryConnectionImpl.java index 81796b68e..843f9e943 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryConnectionImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryConnectionImpl.java @@ -19,9 +19,6 @@ package com.sun.corba.ee.impl.legacy.connection; - - - import com.sun.corba.ee.spi.legacy.connection.GetEndPointInfoAgainException; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.transport.ContactInfo; @@ -35,19 +32,13 @@ * @author Harold Carr */ @Transport -public class SocketFactoryConnectionImpl - extends - ConnectionImpl -{ +public class SocketFactoryConnectionImpl extends ConnectionImpl { @Transport - private void connectionCreated( Socket socket ) { } + private void connectionCreated(Socket socket) { + } // Socket-factory client constructor. - public SocketFactoryConnectionImpl(ORB orb, - ContactInfo contactInfo, - boolean useSelectThreadToWait, - boolean useWorkerThread) - { + public SocketFactoryConnectionImpl(ORB orb, ContactInfo contactInfo, boolean useSelectThreadToWait, boolean useWorkerThread) { super(orb, useSelectThreadToWait, useWorkerThread); // REVISIT - probably need a contact info for both @@ -55,34 +46,23 @@ public SocketFactoryConnectionImpl(ORB orb, this.contactInfo = contactInfo; SocketInfo socketInfo = - // REVISIT - case - needs interface method - ((SocketFactoryContactInfoImpl)contactInfo).socketInfo; + // REVISIT - case - needs interface method + ((SocketFactoryContactInfoImpl) contactInfo).socketInfo; try { defineSocket(useSelectThreadToWait, orb.getORBData().getLegacySocketFactory().createSocket(socketInfo)); - connectionCreated( socket ) ; + connectionCreated(socket); } catch (GetEndPointInfoAgainException ex) { - throw wrapper.connectFailure( - ex, socketInfo.getType(), socketInfo.getHost(), - Integer.toString(socketInfo.getPort())) ; + throw wrapper.connectFailure(ex, socketInfo.getType(), socketInfo.getHost(), Integer.toString(socketInfo.getPort())); } catch (Exception ex) { - throw wrapper.connectFailure( - ex, socketInfo.getType(), socketInfo.getHost(), - Integer.toString(socketInfo.getPort())) ; + throw wrapper.connectFailure(ex, socketInfo.getType(), socketInfo.getHost(), Integer.toString(socketInfo.getPort())); } setState(OPENING); } - public String toString() - { - synchronized ( stateEvent ){ - return - "SocketFactoryConnectionImpl[" + " " - + (socketChannel == null ? - socket.toString() : socketChannel.toString()) + " " - + getStateString(getState()) + " " - + shouldUseSelectThreadToWait() + " " - + shouldUseWorkerThreadForEvent() - + "]" ; + public String toString() { + synchronized (stateEvent) { + return "SocketFactoryConnectionImpl[" + " " + (socketChannel == null ? socket.toString() : socketChannel.toString()) + " " + + getStateString(getState()) + " " + shouldUseSelectThreadToWait() + " " + shouldUseWorkerThreadForEvent() + "]"; } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoImpl.java index 3b72415d3..c3ce8c84f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoImpl.java @@ -29,40 +29,27 @@ import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.impl.transport.ContactInfoImpl; - /** * @author Harold Carr */ -public class SocketFactoryContactInfoImpl - extends - ContactInfoImpl -{ - protected static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class SocketFactoryContactInfoImpl extends ContactInfoImpl { + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; protected SocketInfo socketInfo; - // XREVISIT + // XREVISIT // See SocketOrChannelAcceptorImpl.createMessageMediator // See SocketFactoryContactInfoImpl.constructor() // See SocketOrChannelContactInfoImpl.constructor() - public SocketFactoryContactInfoImpl() - { + public SocketFactoryContactInfoImpl() { } - public SocketFactoryContactInfoImpl( - ORB orb, - ContactInfoList contactInfoList, - IOR effectiveTargetIOR, - short addressingDisposition, - SocketInfo cookie) - { + public SocketFactoryContactInfoImpl(ORB orb, ContactInfoList contactInfoList, IOR effectiveTargetIOR, short addressingDisposition, + SocketInfo cookie) { super(orb, contactInfoList); this.effectiveTargetIOR = effectiveTargetIOR; this.addressingDisposition = addressingDisposition; - socketInfo = - orb.getORBData().getLegacySocketFactory() - .getEndPointInfo(orb, effectiveTargetIOR, cookie); + socketInfo = orb.getORBData().getLegacySocketFactory().getEndPointInfo(orb, effectiveTargetIOR, cookie); socketType = socketInfo.getType(); hostname = socketInfo.getHost(); @@ -70,12 +57,8 @@ public SocketFactoryContactInfoImpl( } @Override - public Connection createConnection() - { - Connection connection = - new SocketFactoryConnectionImpl( - orb, this, - orb.getORBData().connectionSocketUseSelectThreadToWait(), + public Connection createConnection() { + Connection connection = new SocketFactoryConnectionImpl(orb, this, orb.getORBData().connectionSocketUseSelectThreadToWait(), orb.getORBData().connectionSocketUseWorkerThreadForEvent()); return connection; } @@ -86,14 +69,8 @@ public Connection createConnection() // @Override - public String toString() - { - return - "SocketFactoryContactInfoImpl[" - + socketType + " " - + hostname + " " - + port - + "]"; + public String toString() { + return "SocketFactoryContactInfoImpl[" + socketType + " " + hostname + " " + port + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoListImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoListImpl.java index b15fbc9e8..fa136f871 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoListImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoListImpl.java @@ -29,23 +29,17 @@ /** * @author Harold Carr */ -public class SocketFactoryContactInfoListImpl - extends - ContactInfoListImpl -{ +public class SocketFactoryContactInfoListImpl extends ContactInfoListImpl { // XREVISIT - is this used? - public SocketFactoryContactInfoListImpl(ORB orb) - { + public SocketFactoryContactInfoListImpl(ORB orb) { super(orb); } - public SocketFactoryContactInfoListImpl(ORB orb, IOR targetIOR) - { + public SocketFactoryContactInfoListImpl(ORB orb, IOR targetIOR) { super(orb, targetIOR); } - public Iterator iterator() - { + public Iterator iterator() { return new SocketFactoryContactInfoListIteratorImpl(orb, this); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java index 0c27798a7..b47499617 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java @@ -34,15 +34,10 @@ import com.sun.corba.ee.spi.trace.IsLocal; @IsLocal -public class SocketFactoryContactInfoListIteratorImpl - extends ContactInfoListIteratorImpl -{ +public class SocketFactoryContactInfoListIteratorImpl extends ContactInfoListIteratorImpl { private SocketInfo socketInfoCookie; - public SocketFactoryContactInfoListIteratorImpl( - ORB orb, - ContactInfoList corbaContactInfoList) - { + public SocketFactoryContactInfoListIteratorImpl(ORB orb, ContactInfoList corbaContactInfoList) { super(orb, corbaContactInfoList, null, null, false); } @@ -53,58 +48,43 @@ public SocketFactoryContactInfoListIteratorImpl( @Override @IsLocal - public boolean hasNext() - { + public boolean hasNext() { return true; } @Override @IsLocal - public ContactInfo next() - { - if (contactInfoList.getEffectiveTargetIOR().getProfile().isLocal()){ - return new SharedCDRContactInfoImpl( - orb, contactInfoList, - contactInfoList.getEffectiveTargetIOR(), - orb.getORBData().getGIOPAddressDisposition()); + public ContactInfo next() { + if (contactInfoList.getEffectiveTargetIOR().getProfile().isLocal()) { + return new SharedCDRContactInfoImpl(orb, contactInfoList, contactInfoList.getEffectiveTargetIOR(), + orb.getORBData().getGIOPAddressDisposition()); } else { // REVISIT: // on comm_failure maybe need to give IOR instead of located. - return new SocketFactoryContactInfoImpl( - orb, contactInfoList, - contactInfoList.getEffectiveTargetIOR(), - orb.getORBData().getGIOPAddressDisposition(), - socketInfoCookie); + return new SocketFactoryContactInfoImpl(orb, contactInfoList, contactInfoList.getEffectiveTargetIOR(), + orb.getORBData().getGIOPAddressDisposition(), socketInfoCookie); } } @Override - public boolean reportException(ContactInfo contactInfo, - RuntimeException ex) - { + public boolean reportException(ContactInfo contactInfo, RuntimeException ex) { this.failureException = ex; if (ex instanceof org.omg.CORBA.COMM_FAILURE) { SystemException se = (SystemException) ex; - if (se.minor == ORBUtilSystemException.CONNECTION_REBIND) - { + if (se.minor == ORBUtilSystemException.CONNECTION_REBIND) { return true; } else { if (ex.getCause() instanceof GetEndPointInfoAgainException) { - socketInfoCookie = - ((GetEndPointInfoAgainException) ex.getCause()) - .getEndPointInfo(); + socketInfoCookie = ((GetEndPointInfoAgainException) ex.getCause()).getEndPointInfo(); return true; } if (se.completed == CompletionStatus.COMPLETED_NO) { - if (contactInfoList.getEffectiveTargetIOR() != - contactInfoList.getTargetIOR()) - { + if (contactInfoList.getEffectiveTargetIOR() != contactInfoList.getTargetIOR()) { // retry from root ior - contactInfoList.setEffectiveTargetIOR( - contactInfoList.getTargetIOR()); + contactInfoList.setEffectiveTargetIOR(contactInfoList.getTargetIOR()); return true; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/USLPort.java b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/USLPort.java index ea262a83b..288f957e3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/USLPort.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/legacy/connection/USLPort.java @@ -19,33 +19,36 @@ package com.sun.corba.ee.impl.legacy.connection; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.ManagedAttribute ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.ManagedAttribute; @ManagedData -@Description( "An address of a transport endpoint that the ORB " - + "uses for listening to incoming requests" ) -public class USLPort -{ +@Description("An address of a transport endpoint that the ORB " + "uses for listening to incoming requests") +public class USLPort { private String type; - private int port; + private int port; - public USLPort (String type, int port) - { + public USLPort(String type, int port) { this.type = type; this.port = port; } @ManagedAttribute - @Description( "The type of the port (e.g. plain text vs. SSL)" ) - public String getType () { return type; } + @Description("The type of the port (e.g. plain text vs. SSL)") + public String getType() { + return type; + } @ManagedAttribute - @Description( "The TCP port number" ) - public int getPort () { return port; } - public String toString () { return type + ":" + port; } + @Description("The TCP port number") + public int getPort() { + return port; + } + + public String toString() { + return type + ":" + port; + } } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ByteArrayWrapper.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ByteArrayWrapper.java index 767fb75e7..4b89d185f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ByteArrayWrapper.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ByteArrayWrapper.java @@ -33,12 +33,12 @@ public byte[] getObjKey() { return objKey; } - public boolean equals( Object obj ) { + public boolean equals(Object obj) { if (obj == null) - return false ; + return false; - if (obj instanceof ByteArrayWrapper) { - return Arrays.equals(objKey, ((ByteArrayWrapper)obj).getObjKey()); + if (obj instanceof ByteArrayWrapper) { + return Arrays.equals(objKey, ((ByteArrayWrapper) obj).getObjKey()); } else { return false; } @@ -49,5 +49,4 @@ public int hashCode() { } - } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/CacheTable.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/CacheTable.java index 6b155c2f6..8a30bc765 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/CacheTable.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/CacheTable.java @@ -25,15 +25,13 @@ import com.sun.corba.ee.spi.trace.Cdr; -/** This is a hash table implementation that simultaneously maps key to value - * and value to key. It is used for marshalling and unmarshalling value types, - * where it is necessary to track the correspondence between object instances - * and their offsets in a stream. It is also used for tracking indirections for - * Strings that represent codebases and repositoryids. - * Since the offset is always non-negative, - * only non-negative values should be stored here (and storing -1 will cause - * failures). Also note that the same key (Object) may be stored with multiple - * values (int offsets) due to the way readResolve works (see also GlassFish issue 1605). +/** + * This is a hash table implementation that simultaneously maps key to value and value to key. It is used for + * marshalling and unmarshalling value types, where it is necessary to track the correspondence between object instances + * and their offsets in a stream. It is also used for tracking indirections for Strings that represent codebases and + * repositoryids. Since the offset is always non-negative, only non-negative values should be stored here (and storing + * -1 will cause failures). Also note that the same key (Object) may be stored with multiple values (int offsets) due to + * the way readResolve works (see also GlassFish issue 1605). * * @since 1.1 * @@ -41,43 +39,43 @@ */ @Cdr public class CacheTable { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private class Entry { private K key; private int val; - private Entry next; // this chains the collision list of table "map" + private Entry next; // this chains the collision list of table "map" private Entry rnext; // this chains the collision list of table "rmap" + public Entry(K k, int v) { key = k; val = v; next = null; rnext = null; - } + } } private boolean noReverseMap; - private String cacheType ; + private String cacheType; // size must be power of 2 - private static final int INITIAL_SIZE = 64 ; + private static final int INITIAL_SIZE = 64; private static final int MAX_SIZE = 1 << 30; - private static final int INITIAL_THRESHHOLD = 48 ; + private static final int INITIAL_THRESHHOLD = 48; private int size; - private int threshhold ; + private int threshhold; private int entryCount; private Entry[] map; private Entry[] rmap; - + private ORB orb; - public CacheTable(String cacheType, ORB orb, boolean u) { + public CacheTable(String cacheType, ORB orb, boolean u) { this.orb = orb; - this.cacheType = cacheType ; + this.cacheType = cacheType; noReverseMap = u; size = INITIAL_SIZE; - threshhold = INITIAL_THRESHHOLD ; + threshhold = INITIAL_THRESHHOLD; entryCount = 0; initTables(); } @@ -99,7 +97,7 @@ private void grow() { Entry[] oldMap = map; int oldSize = size; size <<= 1; - threshhold <<= 1 ; + threshhold <<= 1; initTables(); // now rehash the entries into the new table @@ -113,11 +111,11 @@ private void grow() { private int hashModTableSize(int h) { // This is taken from the hash method in the JDK 6 HashMap. // This is used for both the - // key and the value side of the mapping. It's not clear + // key and the value side of the mapping. It's not clear // how useful this is in this application, as the low-order - // bits change a lot for both sides. - h ^= (h >>> 20) ^ (h >>> 12) ; - return (h ^ (h >>> 7) ^ (h >>> 4)) & (size - 1) ; + // bits change a lot for both sides. + h ^= (h >>> 20) ^ (h >>> 12); + return (h ^ (h >>> 7) ^ (h >>> 4)) & (size - 1); } private int hash(K key) { @@ -128,10 +126,10 @@ private int hash(int val) { return hashModTableSize(val); } - /** Store the (key,val) pair in the hash table, unless - * (key,val) is already present. Returns true if a new (key,val) - * pair was added, else false. val must be non-negative, but - * this is not checked. + /** + * Store the (key,val) pair in the hash table, unless (key,val) is already present. Returns true if a new (key,val) pair + * was added, else false. val must be non-negative, but this is not checked. + * * @param key Key for table * @param val Non-negative value */ @@ -152,20 +150,20 @@ private boolean put_table(K key, int val) { if (e.key == key) { if (e.val != val) { // duplicateIndirectionOffset error here is not an error: - // A serializable/externalizable class that defines + // A serializable/externalizable class that defines // a readResolve method that creates a canonical representation - // of a value can legally have the same key occuring at - // multiple values. This is GlassFish issue 1605. + // of a value can legally have the same key occuring at + // multiple values. This is GlassFish issue 1605. // Note: we store this anyway, so that getVal can find the key. wrapper.duplicateIndirectionOffset(); - } else { + } else { // if we get here we are trying to put in the same key/val pair // this is a no-op, so we just return return false; } } } - + Entry newEntry = new Entry(key, val); newEntry.next = map[index]; map[index] = newEntry; @@ -182,7 +180,9 @@ public final boolean containsKey(K key) { return (getVal(key) != -1); } - /** Returns some int val where (key,val) is in this CacheTable. + /** + * Returns some int val where (key,val) is in this CacheTable. + * * @param key Key to lookup * @return Value found */ @@ -198,10 +198,12 @@ public final int getVal(K key) { } public final boolean containsVal(int val) { - return (getKey(val) != null); + return (getKey(val) != null); } - /** Return the key where (key,val) is present in the map. + /** + * Return the key where (key,val) is present in the map. + * * @param val Value to lookup * @return Key for the value */ diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ClassInfoCache.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ClassInfoCache.java index 7eb9260b9..e71a7521e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ClassInfoCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ClassInfoCache.java @@ -19,51 +19,46 @@ package com.sun.corba.ee.impl.misc; -import java.lang.reflect.Proxy ; +import java.lang.reflect.Proxy; -import java.io.Serializable ; -import java.io.Externalizable ; +import java.io.Serializable; +import java.io.Externalizable; -import java.rmi.Remote ; -import java.rmi.RemoteException ; +import java.rmi.Remote; +import java.rmi.RemoteException; -import java.util.Map ; -import java.util.WeakHashMap ; +import java.util.Map; +import java.util.WeakHashMap; -import org.omg.CORBA.UserException ; +import org.omg.CORBA.UserException; -import org.omg.CORBA.portable.ObjectImpl ; -import org.omg.CORBA.portable.Streamable ; -import org.omg.CORBA.portable.StreamableValue ; -import org.omg.CORBA.portable.CustomValue ; -import org.omg.CORBA.portable.ValueBase ; -import org.omg.CORBA.portable.IDLEntity ; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.Streamable; +import org.omg.CORBA.portable.StreamableValue; +import org.omg.CORBA.portable.CustomValue; +import org.omg.CORBA.portable.ValueBase; +import org.omg.CORBA.portable.IDLEntity; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -/** This class caches information about classes that is somewhat expensive - * to obtain, notably the results of isInterface(), isArray(), and isAssignableFrom. - * A user simply calls ClassInfoCache.get( Class ) to get the information about - * a class. +/** + * This class caches information about classes that is somewhat expensive to obtain, notably the results of + * isInterface(), isArray(), and isAssignableFrom. A user simply calls ClassInfoCache.get( Class ) to get the + * information about a class. *

- * All of the isA methods on ClassInfo need to be passed the same Class that was - * used in the get call! This is an awkward interface, but the alternative is - * to store the class in the ClassInfo, which would create a strong reference from - * the value to the key, making the WeakHashMap useless. It also appears to be - * difficult to use a weak or soft reference here, because I can't handle the - * case of an empty reference to the class inside the ClassInfo object. - * If ClassInfoCache supported the methods directly, we could work around this, - * but then we would in some case be doing multiple lookups for a class to get - * class information, which would slow things down significantly (the get call - * is a significant cost in the benchmarks). + * All of the isA methods on ClassInfo need to be passed the same Class that was used in the get call! This is an + * awkward interface, but the alternative is to store the class in the ClassInfo, which would create a strong reference + * from the value to the key, making the WeakHashMap useless. It also appears to be difficult to use a weak or soft + * reference here, because I can't handle the case of an empty reference to the class inside the ClassInfo object. If + * ClassInfoCache supported the methods directly, we could work around this, but then we would in some case be doing + * multiple lookups for a class to get class information, which would slow things down significantly (the get call is a + * significant cost in the benchmarks). *

- * XXX There is a better solution: add MORE information to the cache. In - * particular, use a ClassAnalyzer to construct the linearized inheritance - * chain (order doesn't matter in this case, but we already have the implementation) - * and implement all of the isA methods by a simple check on whether the class - * is in the chain (or perhaps convert to Set). We can statically fill the cache - * with all of the basic objects (e.g. Streamable, Serializable, etc.) needs - * in a static initializer. + * XXX There is a better solution: add MORE information to the cache. In particular, use a ClassAnalyzer to construct + * the linearized inheritance chain (order doesn't matter in this case, but we already have the implementation) and + * implement all of the isA methods by a simple check on whether the class is in the chain (or perhaps convert to Set). + * We can statically fill the cache with all of the basic objects (e.g. Streamable, Serializable, etc.) needs in a + * static initializer. */ public class ClassInfoCache { @@ -72,76 +67,64 @@ public class ClassInfoCache { public static class ClassInfo { public static class LazyWrapper { - Class isAClass ; - boolean initialized ; - boolean value ; - - public LazyWrapper( Class isAClass ) { - this.isAClass = isAClass ; - this.initialized = false ; - this.value = false ; + Class isAClass; + boolean initialized; + boolean value; + + public LazyWrapper(Class isAClass) { + this.isAClass = isAClass; + this.initialized = false; + this.value = false; } - synchronized boolean get( Class cls ) { + synchronized boolean get(Class cls) { if (!initialized) { - initialized = true ; - value = isAClass.isAssignableFrom( cls ) ; + initialized = true; + value = isAClass.isAssignableFrom(cls); } - return value ; + return value; } } - private boolean isAValueBase ; - private boolean isAString ; - private boolean isAIDLEntity ; - - private LazyWrapper isARemote = new LazyWrapper( - Remote.class ) ; - private LazyWrapper isARemoteException = new LazyWrapper( - RemoteException.class ) ; - private LazyWrapper isAUserException = new LazyWrapper( - UserException.class ) ; - private LazyWrapper isAObjectImpl = new LazyWrapper( - ObjectImpl.class ) ; - private LazyWrapper isAORB = new LazyWrapper( - ORB.class ) ; - private LazyWrapper isAStreamable = new LazyWrapper( - Streamable.class ) ; - private LazyWrapper isAStreamableValue = new LazyWrapper( - StreamableValue.class ) ; - private LazyWrapper isACustomValue = new LazyWrapper( - CustomValue.class ) ; - private LazyWrapper isACORBAObject = new LazyWrapper( - org.omg.CORBA.Object.class ) ; - private LazyWrapper isASerializable = new LazyWrapper( - Serializable.class ) ; - private LazyWrapper isAExternalizable = new LazyWrapper( - Externalizable.class ) ; - private LazyWrapper isAClass = new LazyWrapper( - Class.class ) ; - - private String repositoryId = null ; - - private boolean isArray ; - private boolean isEnum ; - private boolean isInterface ; - private boolean isProxyClass ; - private ClassInfo superInfo ; - - ClassInfo( Class cls ) { - isArray = cls.isArray() ; - isEnum = isEnum(cls) ; - isInterface = cls.isInterface() ; - isProxyClass = Proxy.isProxyClass( cls ) ; - - isAValueBase = ValueBase.class.isAssignableFrom( cls ) ; - isAString = String.class.isAssignableFrom( cls ) ; - isAIDLEntity = IDLEntity.class.isAssignableFrom( cls ) ; - - Class superClass = cls.getSuperclass() ; + private boolean isAValueBase; + private boolean isAString; + private boolean isAIDLEntity; + + private LazyWrapper isARemote = new LazyWrapper(Remote.class); + private LazyWrapper isARemoteException = new LazyWrapper(RemoteException.class); + private LazyWrapper isAUserException = new LazyWrapper(UserException.class); + private LazyWrapper isAObjectImpl = new LazyWrapper(ObjectImpl.class); + private LazyWrapper isAORB = new LazyWrapper(ORB.class); + private LazyWrapper isAStreamable = new LazyWrapper(Streamable.class); + private LazyWrapper isAStreamableValue = new LazyWrapper(StreamableValue.class); + private LazyWrapper isACustomValue = new LazyWrapper(CustomValue.class); + private LazyWrapper isACORBAObject = new LazyWrapper(org.omg.CORBA.Object.class); + private LazyWrapper isASerializable = new LazyWrapper(Serializable.class); + private LazyWrapper isAExternalizable = new LazyWrapper(Externalizable.class); + private LazyWrapper isAClass = new LazyWrapper(Class.class); + + private String repositoryId = null; + + private boolean isArray; + private boolean isEnum; + private boolean isInterface; + private boolean isProxyClass; + private ClassInfo superInfo; + + ClassInfo(Class cls) { + isArray = cls.isArray(); + isEnum = isEnum(cls); + isInterface = cls.isInterface(); + isProxyClass = Proxy.isProxyClass(cls); + + isAValueBase = ValueBase.class.isAssignableFrom(cls); + isAString = String.class.isAssignableFrom(cls); + isAIDLEntity = IDLEntity.class.isAssignableFrom(cls); + + Class superClass = cls.getSuperclass(); if (superClass != null) { - superInfo = ClassInfoCache.get( superClass ) ; + superInfo = ClassInfoCache.get(superClass); } } @@ -149,138 +132,156 @@ private boolean isEnum(Class cls) { // Issue 11681 // This ugly method is needed because isEnum returns FALSE // on enum.getClass().isEnum() if enum has an abstract method, - // which results in another subclass. So for us, a class is an + // which results in another subclass. So for us, a class is an // enum if any superclass is java.lang.Enum. - Class current = cls ; + Class current = cls; while (current != null) { - if (current.equals( Enum.class )) { - return true ; + if (current.equals(Enum.class)) { + return true; } - current = current.getSuperclass() ; + current = current.getSuperclass(); } - return false ; + return false; } - + public synchronized String getRepositoryId() { - return repositoryId ; + return repositoryId; } - public synchronized void setRepositoryId( String repositoryId ) { - this.repositoryId = repositoryId ; + public synchronized void setRepositoryId(String repositoryId) { + this.repositoryId = repositoryId; } - public boolean isARemote( Class cls ) { - return isARemote.get(cls) ; + public boolean isARemote(Class cls) { + return isARemote.get(cls); } - public boolean isARemoteException( Class cls ) { - return isARemoteException.get(cls) ; + + public boolean isARemoteException(Class cls) { + return isARemoteException.get(cls); } - public boolean isAUserException( Class cls ) { - return isAUserException.get(cls) ; + + public boolean isAUserException(Class cls) { + return isAUserException.get(cls); } - public boolean isAObjectImpl( Class cls ) { - return isAObjectImpl.get(cls) ; + + public boolean isAObjectImpl(Class cls) { + return isAObjectImpl.get(cls); } - public boolean isAORB( Class cls ) { - return isAORB.get(cls) ; + + public boolean isAORB(Class cls) { + return isAORB.get(cls); } - public boolean isAIDLEntity( Class cls ) { - return isAIDLEntity ; + + public boolean isAIDLEntity(Class cls) { + return isAIDLEntity; } - public boolean isAStreamable( Class cls ) { - return isAStreamable.get(cls) ; + + public boolean isAStreamable(Class cls) { + return isAStreamable.get(cls); } - public boolean isAStreamableValue( Class cls ) { - return isAStreamableValue.get(cls) ; + + public boolean isAStreamableValue(Class cls) { + return isAStreamableValue.get(cls); } - public boolean isACustomValue( Class cls ) { - return isACustomValue.get(cls) ; + + public boolean isACustomValue(Class cls) { + return isACustomValue.get(cls); } - public boolean isAValueBase( Class cls ) { - return isAValueBase ; + + public boolean isAValueBase(Class cls) { + return isAValueBase; } - public boolean isACORBAObject( Class cls ) { - return isACORBAObject.get(cls) ; + + public boolean isACORBAObject(Class cls) { + return isACORBAObject.get(cls); } - public boolean isASerializable( Class cls ) { - return isASerializable.get(cls) ; + + public boolean isASerializable(Class cls) { + return isASerializable.get(cls); } - public boolean isAExternalizable( Class cls ) { - return isAExternalizable.get(cls) ; + + public boolean isAExternalizable(Class cls) { + return isAExternalizable.get(cls); } - public boolean isAString( Class cls ) { - return isAString ; + + public boolean isAString(Class cls) { + return isAString; } - public boolean isAClass( Class cls ) { - return isAClass.get(cls) ; + + public boolean isAClass(Class cls) { + return isAClass.get(cls); } - public boolean isArray() { return isArray ; } - public boolean isEnum() { return isEnum ; } - public boolean isInterface() { return isInterface ; } - public boolean isProxyClass() { return isProxyClass ; } - public ClassInfo getSuper() { return superInfo ; } + public boolean isArray() { + return isArray; + } + + public boolean isEnum() { + return isEnum; + } + + public boolean isInterface() { + return isInterface; + } + + public boolean isProxyClass() { + return isProxyClass; + } + + public ClassInfo getSuper() { + return superInfo; + } } // This shows up as a locking hotspot in heavy marshaling tests. // Ideally we need a WeakConcurrentMap, which is not available in // the JDK (Google's MapMaker can easily construct such a class). - /* Version using ConcurrentMap for testing ONLY - * (This would pin Classes (and thus ClassLoaders), leading to - * App server deployment memory leaks. - - private static ConcurrentMap classData = - new ConcurrentHashMap() ; - - public static ClassInfo get( Class cls ) { - ClassInfo result = classData.get( cls ) ; - if (result == null) { - final ClassInfo cinfo = new ClassInfo( cls ) ; - final ClassInfo putResult = classData.putIfAbsent( cls, cinfo ) ; - if (putResult == null) { - result = cinfo ; - } else { - result = putResult ; - } - } - - return result ; - } - */ + /* + * Version using ConcurrentMap for testing ONLY (This would pin Classes (and thus ClassLoaders), leading to App server + * deployment memory leaks. + * + * private static ConcurrentMap classData = new ConcurrentHashMap() ; + * + * public static ClassInfo get( Class cls ) { ClassInfo result = classData.get( cls ) ; if (result == null) { final + * ClassInfo cinfo = new ClassInfo( cls ) ; final ClassInfo putResult = classData.putIfAbsent( cls, cinfo ) ; if + * (putResult == null) { result = cinfo ; } else { result = putResult ; } } + * + * return result ; } + */ - private static Map classData = new WeakHashMap() ; + private static Map classData = new WeakHashMap(); - public static synchronized ClassInfo get( Class cls ) { - ClassInfo result = classData.get( cls ) ; + public static synchronized ClassInfo get(Class cls) { + ClassInfo result = classData.get(cls); if (result == null && cls != null) { - result = new ClassInfo( cls ) ; - classData.put( cls, result ) ; + result = new ClassInfo(cls); + classData.put(cls, result); } - return result ; + return result; } - /** Find the class that is an enum in the superclass chain starting at cls. - * cinfo MUST be the ClassInfo for cls. + /** + * Find the class that is an enum in the superclass chain starting at cls. cinfo MUST be the ClassInfo for cls. + * * @param cinfo ClassInfo for cls * @param cls Class which may have java.lang.Enum in its superclass chain. - * @return A class for which isEnum() is true, or null if no such class - * exists in the superclass chain of cls. + * @return A class for which isEnum() is true, or null if no such class exists in the superclass chain of cls. */ - public static Class getEnumClass( ClassInfo cinfo, Class cls ) { - ClassInfo currInfo = cinfo ; - Class currClass = cls ; - while (currClass != null) { + public static Class getEnumClass(ClassInfo cinfo, Class cls) { + ClassInfo currInfo = cinfo; + Class currClass = cls; + while (currClass != null) { if (currClass.isEnum()) { - break ; + break; } - currClass = currClass.getSuperclass() ; - currInfo = currInfo.getSuper() ; + currClass = currClass.getSuperclass(); + currInfo = currInfo.getSuper(); } - return currClass ; + return currClass; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/CorbaResourceUtil.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/CorbaResourceUtil.java index 06292894d..3a393b391 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/CorbaResourceUtil.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/CorbaResourceUtil.java @@ -43,27 +43,25 @@ public static String getText(String key) { return message; } - public static String getText(String key, Object... args ) - { + public static String getText(String key, Object... args) { String format = getString(key); if (format == null) { - StringBuilder sb = new StringBuilder( - "no text found: key = \"" ) ; - sb.append( key ) ; - sb.append( "\", arguments = " ) ; - - for (int ctr=0; ctr fields = null; - LegacyHookGetFields(Hashtable fields){ + LegacyHookGetFields(Hashtable fields) { this.fields = fields; } @@ -37,126 +37,124 @@ class LegacyHookGetFields extends ObjectInputStream.GetField { public java.io.ObjectStreamClass getObjectStreamClass() { return null; } - + /** - * Return true if the named field is defaulted and has no value - * in this stream. + * Return true if the named field is defaulted and has no value in this stream. */ @Override - public boolean defaulted(String name) - throws IOException, IllegalArgumentException { + public boolean defaulted(String name) throws IOException, IllegalArgumentException { return (!fields.containsKey(name)); } - + /** * Get the value of the named boolean field from the persistent field. */ @Override - public boolean get(String name, boolean defvalue) - throws IOException, IllegalArgumentException { + public boolean get(String name, boolean defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return ((Boolean)fields.get(name)); - } - + else + return ((Boolean) fields.get(name)); + } + /** * Get the value of the named char field from the persistent fields. */ @Override - public char get(String name, char defvalue) - throws IOException, IllegalArgumentException { + public char get(String name, char defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return ((Character)fields.get(name)); + else + return ((Character) fields.get(name)); } - + /** * Get the value of the named byte field from the persistent fields. */ @Override - public byte get(String name, byte defvalue) - throws IOException, IllegalArgumentException { + public byte get(String name, byte defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return ((Byte)fields.get(name)); + else + return ((Byte) fields.get(name)); } - + /** * Get the value of the named short field from the persistent fields. */ @Override - public short get(String name, short defvalue) - throws IOException, IllegalArgumentException { + public short get(String name, short defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return ((Short)fields.get(name)); + else + return ((Short) fields.get(name)); } - + /** * Get the value of the named int field from the persistent fields. */ @Override - public int get(String name, int defvalue) - throws IOException, IllegalArgumentException { + public int get(String name, int defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return ((Integer)fields.get(name)); + else + return ((Integer) fields.get(name)); } - + /** * Get the value of the named long field from the persistent fields. */ @Override - public long get(String name, long defvalue) - throws IOException, IllegalArgumentException { + public long get(String name, long defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return ((Long)fields.get(name)); + else + return ((Long) fields.get(name)); } - + /** * Get the value of the named float field from the persistent fields. */ @Override - public float get(String name, float defvalue) - throws IOException, IllegalArgumentException { + public float get(String name, float defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return ((Float)fields.get(name)); + else + return ((Float) fields.get(name)); } - + /** * Get the value of the named double field from the persistent field. */ @Override - public double get(String name, double defvalue) - throws IOException, IllegalArgumentException { + public double get(String name, double defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return ((Double)fields.get(name)).doubleValue(); + else + return ((Double) fields.get(name)).doubleValue(); } - + /** * Get the value of the named Object field from the persistent field. */ @Override - public Object get(String name, Object defvalue) - throws IOException, IllegalArgumentException { + public Object get(String name, Object defvalue) throws IOException, IllegalArgumentException { if (defaulted(name)) return defvalue; - else return fields.get(name); + else + return fields.get(name); } - + @Override - public String toString(){ + public String toString() { return fields.toString(); } -} +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/LegacyHookPutFields.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/LegacyHookPutFields.java index ab4d18976..819347933 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/LegacyHookPutFields.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/LegacyHookPutFields.java @@ -26,81 +26,80 @@ import java.util.Map; /** - * Since ObjectOutputStream.PutField methods specify no exceptions, - * we are not checking for null parameters on put methods. + * Since ObjectOutputStream.PutField methods specify no exceptions, we are not checking for null parameters on put + * methods. */ -class LegacyHookPutFields extends ObjectOutputStream.PutField -{ +class LegacyHookPutFields extends ObjectOutputStream.PutField { private Map fields = new HashMap(); /** * Put the value of the named boolean field into the persistent field. */ - public void put(String name, boolean value){ + public void put(String name, boolean value) { fields.put(name, Boolean.valueOf(value)); } - + /** * Put the value of the named char field into the persistent fields. */ - public void put(String name, char value){ + public void put(String name, char value) { fields.put(name, Character.valueOf(value)); } - + /** * Put the value of the named byte field into the persistent fields. */ - public void put(String name, byte value){ + public void put(String name, byte value) { fields.put(name, Byte.valueOf(value)); } - + /** * Put the value of the named short field into the persistent fields. */ - public void put(String name, short value){ + public void put(String name, short value) { fields.put(name, Short.valueOf(value)); } - + /** * Put the value of the named int field into the persistent fields. */ - public void put(String name, int value){ + public void put(String name, int value) { fields.put(name, Integer.valueOf(value)); } - + /** * Put the value of the named long field into the persistent fields. */ - public void put(String name, long value){ + public void put(String name, long value) { fields.put(name, Long.valueOf(value)); } - + /** * Put the value of the named float field into the persistent fields. * */ - public void put(String name, float value){ + public void put(String name, float value) { fields.put(name, Float.valueOf(value)); } - + /** * Put the value of the named double field into the persistent field. */ - public void put(String name, double value){ + public void put(String name, double value) { fields.put(name, Double.valueOf(value)); } - + /** * Put the value of the named Object field into the persistent field. */ - public void put(String name, Object value){ + public void put(String name, Object value) { fields.put(name, value); } - + /** * Write the data and fields to the specified ObjectOutput stream. */ public void write(ObjectOutput out) throws IOException { out.writeObject(fields); } -} +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/LogKeywords.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/LogKeywords.java index 5e4f0adb4..09cfbd096 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/LogKeywords.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/LogKeywords.java @@ -18,32 +18,24 @@ */ package com.sun.corba.ee.impl.misc; + /** - * All the Keywords that will be used in Logging Messages for CORBA need to - * be defined here. The LogKeywords will be useful for searching log messages - * based on the standard keywords, it is also useful to work with LogAnalyzing - * tools. + * All the Keywords that will be used in Logging Messages for CORBA need to be defined here. The LogKeywords will be + * useful for searching log messages based on the standard keywords, it is also useful to work with LogAnalyzing tools. * We will try to standardize these keywords in JSR 117 Logging */ public class LogKeywords { - /** - ** Keywords for Lifecycle Loggers. - ** _REVISIT_ After it is clearly defined in JSR 117 + /** + ** Keywords for Lifecycle Loggers. _REVISIT_ After it is clearly defined in JSR 117 **/ - public final static String LIFECYCLE_CREATE = "<>"; + public final static String LIFECYCLE_CREATE = "<>"; public final static String LIFECYCLE_INITIALIZE = "<>"; - public final static String LIFECYCLE_SHUTDOWN = "<>"; - public final static String LIFECYCLE_DESTROY = "<>"; - public final static String NAMING_RESOLVE = "<>"; - public final static String NAMING_LIST = "<>"; - public final static String NAMING_BIND = "<>"; - public final static String NAMING_UNBIND = "<>"; - public final static String NAMING_REBIND = "<>"; + public final static String LIFECYCLE_SHUTDOWN = "<>"; + public final static String LIFECYCLE_DESTROY = "<>"; + public final static String NAMING_RESOLVE = "<>"; + public final static String NAMING_LIST = "<>"; + public final static String NAMING_BIND = "<>"; + public final static String NAMING_UNBIND = "<>"; + public final static String NAMING_REBIND = "<>"; } - - - - - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ORBUtility.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ORBUtility.java index 879d1aab2..a918754b1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ORBUtility.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/ORBUtility.java @@ -31,85 +31,84 @@ import java.util.StringTokenizer; import java.util.NoSuchElementException; -import java.io.PrintStream ; -import java.io.IOException ; +import java.io.PrintStream; +import java.io.IOException; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; -import java.net.SocketAddress ; +import java.net.SocketAddress; -import java.nio.channels.SocketChannel ; +import java.nio.channels.SocketChannel; import javax.rmi.CORBA.ValueHandler; import javax.rmi.CORBA.ValueHandlerMultiFormat; -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.SystemException ; -import org.omg.CORBA.CompletionStatus ; -import org.omg.CORBA.TypeCodePackage.BadKind ; -import org.omg.CORBA.portable.OutputStream ; -import org.omg.CORBA.portable.InputStream ; - -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.presentation.rmi.StubAdapter ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; -import com.sun.corba.ee.spi.protocol.ClientDelegate ; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.InputStream; + +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; +import com.sun.corba.ee.spi.protocol.ClientDelegate; import com.sun.corba.ee.spi.protocol.MessageMediator; -import com.sun.corba.ee.spi.transport.ContactInfoList ; +import com.sun.corba.ee.spi.transport.ContactInfoList; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; import com.sun.corba.ee.spi.ior.iiop.IIOPProfile; import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; import com.sun.corba.ee.spi.misc.ORBClassLoader; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.misc.ORBConstants; -import com.sun.corba.ee.impl.corba.CORBAObjectImpl ; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; -import com.sun.corba.ee.spi.logging.OMGSystemException ; +import com.sun.corba.ee.impl.corba.CORBAObjectImpl; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; +import com.sun.corba.ee.spi.logging.OMGSystemException; import com.sun.corba.ee.impl.ior.iiop.JavaSerializationComponent; import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; /** - * Handy class full of static functions that don't belong in util.Utility for pure ORB reasons. + * Handy class full of static functions that don't belong in util.Utility for pure ORB reasons. */ public final class ORBUtility { - /** Utility method for working around leak in SocketChannel.open( SocketAddress ) - * method. + /** + * Utility method for working around leak in SocketChannel.open( SocketAddress ) method. + * * @param sa address to connect to * @return The opened channel * @throws java.io.IOException If an I/O error occurs * @see SocketChannel#connect(java.net.SocketAddress) */ - public static SocketChannel openSocketChannel( SocketAddress sa ) - throws IOException { + public static SocketChannel openSocketChannel(SocketAddress sa) throws IOException { - SocketChannel sc = SocketChannel.open() ; + SocketChannel sc = SocketChannel.open(); try { - sc.connect( sa ) ; - return sc ; - } catch (RuntimeException | IOException exc ) { + sc.connect(sa); + return sc; + } catch (RuntimeException | IOException exc) { try { - sc.close() ; + sc.close(); } catch (IOException ioe) { // Ignore this: close exceptions are useless. } - throw exc ; + throw exc; } - + } - private static final ThreadLocal> encVersionThreadLocal = - new ThreadLocal>() { - @Override - protected LinkedList initialValue() { - return new LinkedList<>(); - } - }; + private static final ThreadLocal> encVersionThreadLocal = new ThreadLocal>() { + @Override + protected LinkedList initialValue() { + return new LinkedList<>(); + } + }; public static void pushEncVersionToThreadLocalState(byte value) { LinkedList stack = encVersionThreadLocal.get(); @@ -129,7 +128,7 @@ public static byte getEncodingVersion() { // LinkedList allows a null object to be added to the list if (last != null) { encodingVersion = last.byteValue(); - } // if null, return default CDR_ENC_VERSION + } // if null, return default CDR_ENC_VERSION } // if nothing on list, use default encoding return encodingVersion; } @@ -138,8 +137,7 @@ public static byte[] getByteBufferArray(ByteBuffer byteBuffer) { if (byteBuffer.hasArray()) { byte[] buf = new byte[byteBuffer.limit()]; - System.arraycopy(byteBuffer.array(), byteBuffer.arrayOffset(), - buf, 0, buf.length); + System.arraycopy(byteBuffer.array(), byteBuffer.arrayOffset(), buf, 0, buf.length); // NOTE: Cannot simply do return byteBuffer.array() since byteBuffer // could be a view buffer / sliced ByteBuffer. View buffers / // sliced ByteBuffer will return the entired backed array. @@ -162,8 +160,7 @@ public static byte[] getByteBufferArray(ByteBuffer byteBuffer) { * @param gv The maximum GIOP version supported * @return the Java serialization encoding version. */ - public static byte chooseEncodingVersion(ORB orb, IOR ior, - GIOPVersion gv) { + public static byte chooseEncodingVersion(ORB orb, IOR ior, GIOPVersion gv) { // Is Java serialization enabled? // Check the JavaSerializationComponent (tagged component) @@ -172,16 +169,12 @@ public static byte chooseEncodingVersion(ORB orb, IOR ior, // In such a case, use Java serialization, iff the java serialization // versions match. - if (orb.getORBData().isJavaSerializationEnabled() && - !(gv.lessThan(GIOPVersion.V1_2))) { + if (orb.getORBData().isJavaSerializationEnabled() && !(gv.lessThan(GIOPVersion.V1_2))) { IIOPProfile prof = ior.getProfile(); - IIOPProfileTemplate profTemp = - (IIOPProfileTemplate) prof.getTaggedProfileTemplate(); - java.util.Iterator iter = profTemp.iteratorById( - ORBConstants.TAG_JAVA_SERIALIZATION_ID); + IIOPProfileTemplate profTemp = (IIOPProfileTemplate) prof.getTaggedProfileTemplate(); + java.util.Iterator iter = profTemp.iteratorById(ORBConstants.TAG_JAVA_SERIALIZATION_ID); if (iter.hasNext()) { - JavaSerializationComponent jc = - (JavaSerializationComponent) iter.next(); + JavaSerializationComponent jc = (JavaSerializationComponent) iter.next(); byte jcVersion = jc.javaSerializationVersion(); if (jcVersion >= ORBConstants.JAVA_ENC_VERSION) { return ORBConstants.JAVA_ENC_VERSION; @@ -196,16 +189,15 @@ public static byte chooseEncodingVersion(ORB orb, IOR ior, return ORBConstants.CDR_ENC_VERSION; // default } - private ORBUtility() {} + private ORBUtility() { + } - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - private static OMGSystemException omgWrapper = - OMGSystemException.self ; + private static ORBUtilSystemException wrapper = ORBUtilSystemException.self; + private static OMGSystemException omgWrapper = OMGSystemException.self; private static StructMember[] members = null; - private synchronized static StructMember[] systemExceptionMembers (ORB orb) { + private synchronized static StructMember[] systemExceptionMembers(ORB orb) { if (members == null) { members = new StructMember[3]; members[0] = new StructMember("id", orb.create_string_tc(0), null); @@ -224,11 +216,10 @@ private static TypeCode getSystemExceptionTypeCode(ORB orb, String repID, String private static boolean isSystemExceptionTypeCode(TypeCode type, ORB orb) { StructMember[] systemExceptionMembers = systemExceptionMembers(orb); try { - return (type.kind().value() == TCKind._tk_except && - type.member_count() == 3 && - type.member_type(0).equal(systemExceptionMembers[0].type) && - type.member_type(1).equal(systemExceptionMembers[1].type) && - type.member_type(2).equal(systemExceptionMembers[2].type)); + return (type.kind().value() == TCKind._tk_except && type.member_count() == 3 + && type.member_type(0).equal(systemExceptionMembers[0].type) + && type.member_type(1).equal(systemExceptionMembers[1].type) + && type.member_type(2).equal(systemExceptionMembers[2].type)); } catch (BadKind | org.omg.CORBA.TypeCodePackage.Bounds ex) { return false; } @@ -236,35 +227,35 @@ private static boolean isSystemExceptionTypeCode(TypeCode type, ORB orb) { /** * Static method for writing a CORBA standard exception to an Any. + * * @param ex Exception to write * @param any The Any to write the SystemException into. */ public static void insertSystemException(SystemException ex, Any any) { OutputStream out = any.create_output_stream(); - ORB orb = (ORB)(out.orb()); + ORB orb = (ORB) (out.orb()); String name = ex.getClass().getName(); String repID = ORBUtility.repositoryIdOf(name); out.write_string(repID); out.write_long(ex.minor); out.write_long(ex.completed.value()); - any.read_value(out.create_input_stream(), - getSystemExceptionTypeCode(orb, repID, name)); + any.read_value(out.create_input_stream(), getSystemExceptionTypeCode(orb, repID, name)); } public static SystemException extractSystemException(Any any) { InputStream in = any.create_input_stream(); - ORB orb = (ORB)(in.orb()); - if ( ! isSystemExceptionTypeCode(any.type(), orb)) { + ORB orb = (ORB) (in.orb()); + if (!isSystemExceptionTypeCode(any.type(), orb)) { throw wrapper.unknownDsiSysex(); } return ORBUtility.readSystemException(in); } - private static ValueHandler vhandler = - Util.getInstance().createValueHandler(); - + private static ValueHandler vhandler = Util.getInstance().createValueHandler(); + /** * Gets the ValueHandler from Util.createValueHandler. + * * @return gets the ValueHandler */ public static ValueHandler createValueHandler() { @@ -272,25 +263,24 @@ public static ValueHandler createValueHandler() { } /** - * Creates the correct ValueHandler. The parameter - * is ignored + * Creates the correct ValueHandler. The parameter is ignored + * * @param orb ignored * @return The correct ValueHandler - * @see #createValueHandler() + * @see #createValueHandler() */ public static ValueHandler createValueHandler(ORB orb) { return vhandler; } /** - * Returns true if it was accurately determined that the remote ORB is - * a foreign (non-JavaSoft) ORB. Note: If passed the ORBSingleton, this - * will return false. + * Returns true if it was accurately determined that the remote ORB is a foreign (non-JavaSoft) ORB. Note: If passed the + * ORBSingleton, this will return false. + * * @param orb ORB to test * @return If the ORB is foreign */ - public static boolean isForeignORB(ORB orb) - { + public static boolean isForeignORB(ORB orb) { if (orb == null) { return false; } @@ -302,52 +292,51 @@ public static boolean isForeignORB(ORB orb) } } - /** Unmarshal a byte array to an integer. - Assume the bytes are in BIGENDIAN order. - i.e. array[offset] is the most-significant-byte - and array[offset+3] is the least-significant-byte. - @param array The array of bytes. - @param offset The offset from which to start unmarshalling. - @return Unmarshalled integer - */ - public static int bytesToInt(byte[] array, int offset) - { + /** + * Unmarshal a byte array to an integer. Assume the bytes are in BIGENDIAN order. i.e. array[offset] is the + * most-significant-byte and array[offset+3] is the least-significant-byte. + * + * @param array The array of bytes. + * @param offset The offset from which to start unmarshalling. + * @return Unmarshalled integer + */ + public static int bytesToInt(byte[] array, int offset) { int b1, b2, b3, b4; b1 = (array[offset++] << 24) & 0xFF000000; b2 = (array[offset++] << 16) & 0x00FF0000; - b3 = (array[offset++] << 8) & 0x0000FF00; - b4 = (array[offset++] << 0) & 0x000000FF; + b3 = (array[offset++] << 8) & 0x0000FF00; + b4 = (array[offset++] << 0) & 0x000000FF; return (b1 | b2 | b3 | b4); } - /** Marshal an integer to a byte array. - The bytes are in BIGENDIAN order. - i.e. array[offset] is the most-significant-byte - and array[offset+3] is the least-significant-byte. - @param value Integer to marshal - @param array The array of bytes. - @param offset The offset from which to start marshalling. - */ - public static void intToBytes(int value, byte[] array, int offset) - { - array[offset++] = (byte)((value >>> 24) & 0xFF); - array[offset++] = (byte)((value >>> 16) & 0xFF); - array[offset++] = (byte)((value >>> 8) & 0xFF); - array[offset++] = (byte)((value >>> 0) & 0xFF); + /** + * Marshal an integer to a byte array. The bytes are in BIGENDIAN order. i.e. array[offset] is the most-significant-byte + * and array[offset+3] is the least-significant-byte. + * + * @param value Integer to marshal + * @param array The array of bytes. + * @param offset The offset from which to start marshalling. + */ + public static void intToBytes(int value, byte[] array, int offset) { + array[offset++] = (byte) ((value >>> 24) & 0xFF); + array[offset++] = (byte) ((value >>> 16) & 0xFF); + array[offset++] = (byte) ((value >>> 8) & 0xFF); + array[offset++] = (byte) ((value >>> 0) & 0xFF); } - /** Converts an Ascii Character into Hexadecimal digit + /** + * Converts an Ascii Character into Hexadecimal digit + * * @param x ASCII character to convert * @return Hexadecimal digit */ - public static int hexOf( char x ) - { + public static int hexOf(char x) { int val; val = x - '0'; - if (val >=0 && val <= 9) { + if (val >= 0 && val <= 9) { return val; } @@ -361,18 +350,18 @@ public static int hexOf( char x ) return val; } - throw wrapper.badHexDigit() ; + throw wrapper.badHexDigit(); } // method moved from util.Utility /** * Static method for writing a CORBA standard exception to a stream. + * * @param ex Exception to write to stream * @param strm The OutputStream to use for marshaling. */ - public static void writeSystemException(SystemException ex, OutputStream strm) - { + public static void writeSystemException(SystemException ex, OutputStream strm) { String s; s = repositoryIdOf(ex.getClass().getName()); @@ -383,34 +372,31 @@ public static void writeSystemException(SystemException ex, OutputStream strm) /** * Static method for reading a CORBA standard exception from a stream. + * * @param strm The InputStream to use for unmarshalling. * @return Exception in stream */ - public static SystemException readSystemException(InputStream strm) - { + public static SystemException readSystemException(InputStream strm) { try { String name = classNameOf(strm.read_string()); - SystemException ex - = (SystemException)ORBClassLoader.loadClass(name).newInstance(); + SystemException ex = (SystemException) ORBClassLoader.loadClass(name).newInstance(); ex.minor = strm.read_long(); ex.completed = CompletionStatus.from_int(strm.read_long()); return ex; - } catch ( Exception ex ) { - throw wrapper.unknownSysex( ex ); + } catch (Exception ex) { + throw wrapper.unknownSysex(ex); } } /** - * Get the class name corresponding to a particular repository Id. - * This is used by the system to unmarshal (instantiate) the - * appropriate exception class for an marshaled as the value of - * its repository Id. + * Get the class name corresponding to a particular repository Id. This is used by the system to unmarshal (instantiate) + * the appropriate exception class for an marshaled as the value of its repository Id. + * * @param repositoryId The repository Id for which we want a class name. * @return Corresponding class name */ - public static String classNameOf(String repositoryId) - { - String className=null; + public static String classNameOf(String repositoryId) { + String className = null; className = (String) exceptionClassNames.get(repositoryId); if (className == null) { @@ -422,26 +408,25 @@ public static String classNameOf(String repositoryId) /** * Return true if this repositoryId is a SystemException. + * * @param repositoryId The repository Id to check. * @return if ID is a SystemException */ - public static boolean isSystemException(String repositoryId) - { - String className=null; + public static boolean isSystemException(String repositoryId) { + String className = null; className = (String) exceptionClassNames.get(repositoryId); - return className != null ; + return className != null; } - + /** - * Get the repository id corresponding to a particular class. - * This is used by the system to write the - * appropriate repository id for a system exception. + * Get the repository id corresponding to a particular class. This is used by the system to write the appropriate + * repository id for a system exception. + * * @param name The class name of the system exception. * @return Repository ID */ - public static String repositoryIdOf(String name) - { + public static String repositoryIdOf(String name) { String id; id = (String) exceptionRepositoryIds.get(name); @@ -460,95 +445,55 @@ public static String repositoryIdOf(String name) // // construct repositoryId -> className hashtable // - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_CONTEXT:1.0", - "org.omg.CORBA.BAD_CONTEXT"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_INV_ORDER:1.0", - "org.omg.CORBA.BAD_INV_ORDER"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_OPERATION:1.0", - "org.omg.CORBA.BAD_OPERATION"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_PARAM:1.0", - "org.omg.CORBA.BAD_PARAM"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_TYPECODE:1.0", - "org.omg.CORBA.BAD_TYPECODE"); - exceptionClassNames.put("IDL:omg.org/CORBA/COMM_FAILURE:1.0", - "org.omg.CORBA.COMM_FAILURE"); - exceptionClassNames.put("IDL:omg.org/CORBA/DATA_CONVERSION:1.0", - "org.omg.CORBA.DATA_CONVERSION"); - exceptionClassNames.put("IDL:omg.org/CORBA/IMP_LIMIT:1.0", - "org.omg.CORBA.IMP_LIMIT"); - exceptionClassNames.put("IDL:omg.org/CORBA/INTF_REPOS:1.0", - "org.omg.CORBA.INTF_REPOS"); - exceptionClassNames.put("IDL:omg.org/CORBA/INTERNAL:1.0", - "org.omg.CORBA.INTERNAL"); - exceptionClassNames.put("IDL:omg.org/CORBA/INV_FLAG:1.0", - "org.omg.CORBA.INV_FLAG"); - exceptionClassNames.put("IDL:omg.org/CORBA/INV_IDENT:1.0", - "org.omg.CORBA.INV_IDENT"); - exceptionClassNames.put("IDL:omg.org/CORBA/INV_OBJREF:1.0", - "org.omg.CORBA.INV_OBJREF"); - exceptionClassNames.put("IDL:omg.org/CORBA/MARSHAL:1.0", - "org.omg.CORBA.MARSHAL"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_MEMORY:1.0", - "org.omg.CORBA.NO_MEMORY"); - exceptionClassNames.put("IDL:omg.org/CORBA/FREE_MEM:1.0", - "org.omg.CORBA.FREE_MEM"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_IMPLEMENT:1.0", - "org.omg.CORBA.NO_IMPLEMENT"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_PERMISSION:1.0", - "org.omg.CORBA.NO_PERMISSION"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_RESOURCES:1.0", - "org.omg.CORBA.NO_RESOURCES"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_RESPONSE:1.0", - "org.omg.CORBA.NO_RESPONSE"); - exceptionClassNames.put("IDL:omg.org/CORBA/OBJ_ADAPTER:1.0", - "org.omg.CORBA.OBJ_ADAPTER"); - exceptionClassNames.put("IDL:omg.org/CORBA/INITIALIZE:1.0", - "org.omg.CORBA.INITIALIZE"); - exceptionClassNames.put("IDL:omg.org/CORBA/PERSIST_STORE:1.0", - "org.omg.CORBA.PERSIST_STORE"); - exceptionClassNames.put("IDL:omg.org/CORBA/TRANSIENT:1.0", - "org.omg.CORBA.TRANSIENT"); - exceptionClassNames.put("IDL:omg.org/CORBA/UNKNOWN:1.0", - "org.omg.CORBA.UNKNOWN"); - exceptionClassNames.put("IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0", - "org.omg.CORBA.OBJECT_NOT_EXIST"); + exceptionClassNames.put("IDL:omg.org/CORBA/BAD_CONTEXT:1.0", "org.omg.CORBA.BAD_CONTEXT"); + exceptionClassNames.put("IDL:omg.org/CORBA/BAD_INV_ORDER:1.0", "org.omg.CORBA.BAD_INV_ORDER"); + exceptionClassNames.put("IDL:omg.org/CORBA/BAD_OPERATION:1.0", "org.omg.CORBA.BAD_OPERATION"); + exceptionClassNames.put("IDL:omg.org/CORBA/BAD_PARAM:1.0", "org.omg.CORBA.BAD_PARAM"); + exceptionClassNames.put("IDL:omg.org/CORBA/BAD_TYPECODE:1.0", "org.omg.CORBA.BAD_TYPECODE"); + exceptionClassNames.put("IDL:omg.org/CORBA/COMM_FAILURE:1.0", "org.omg.CORBA.COMM_FAILURE"); + exceptionClassNames.put("IDL:omg.org/CORBA/DATA_CONVERSION:1.0", "org.omg.CORBA.DATA_CONVERSION"); + exceptionClassNames.put("IDL:omg.org/CORBA/IMP_LIMIT:1.0", "org.omg.CORBA.IMP_LIMIT"); + exceptionClassNames.put("IDL:omg.org/CORBA/INTF_REPOS:1.0", "org.omg.CORBA.INTF_REPOS"); + exceptionClassNames.put("IDL:omg.org/CORBA/INTERNAL:1.0", "org.omg.CORBA.INTERNAL"); + exceptionClassNames.put("IDL:omg.org/CORBA/INV_FLAG:1.0", "org.omg.CORBA.INV_FLAG"); + exceptionClassNames.put("IDL:omg.org/CORBA/INV_IDENT:1.0", "org.omg.CORBA.INV_IDENT"); + exceptionClassNames.put("IDL:omg.org/CORBA/INV_OBJREF:1.0", "org.omg.CORBA.INV_OBJREF"); + exceptionClassNames.put("IDL:omg.org/CORBA/MARSHAL:1.0", "org.omg.CORBA.MARSHAL"); + exceptionClassNames.put("IDL:omg.org/CORBA/NO_MEMORY:1.0", "org.omg.CORBA.NO_MEMORY"); + exceptionClassNames.put("IDL:omg.org/CORBA/FREE_MEM:1.0", "org.omg.CORBA.FREE_MEM"); + exceptionClassNames.put("IDL:omg.org/CORBA/NO_IMPLEMENT:1.0", "org.omg.CORBA.NO_IMPLEMENT"); + exceptionClassNames.put("IDL:omg.org/CORBA/NO_PERMISSION:1.0", "org.omg.CORBA.NO_PERMISSION"); + exceptionClassNames.put("IDL:omg.org/CORBA/NO_RESOURCES:1.0", "org.omg.CORBA.NO_RESOURCES"); + exceptionClassNames.put("IDL:omg.org/CORBA/NO_RESPONSE:1.0", "org.omg.CORBA.NO_RESPONSE"); + exceptionClassNames.put("IDL:omg.org/CORBA/OBJ_ADAPTER:1.0", "org.omg.CORBA.OBJ_ADAPTER"); + exceptionClassNames.put("IDL:omg.org/CORBA/INITIALIZE:1.0", "org.omg.CORBA.INITIALIZE"); + exceptionClassNames.put("IDL:omg.org/CORBA/PERSIST_STORE:1.0", "org.omg.CORBA.PERSIST_STORE"); + exceptionClassNames.put("IDL:omg.org/CORBA/TRANSIENT:1.0", "org.omg.CORBA.TRANSIENT"); + exceptionClassNames.put("IDL:omg.org/CORBA/UNKNOWN:1.0", "org.omg.CORBA.UNKNOWN"); + exceptionClassNames.put("IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0", "org.omg.CORBA.OBJECT_NOT_EXIST"); // SystemExceptions from OMG Transactions Service Spec - exceptionClassNames.put("IDL:omg.org/CORBA/INVALID_TRANSACTION:1.0", - "org.omg.CORBA.INVALID_TRANSACTION"); - exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_REQUIRED:1.0", - "org.omg.CORBA.TRANSACTION_REQUIRED"); - exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_ROLLEDBACK:1.0", - "org.omg.CORBA.TRANSACTION_ROLLEDBACK"); + exceptionClassNames.put("IDL:omg.org/CORBA/INVALID_TRANSACTION:1.0", "org.omg.CORBA.INVALID_TRANSACTION"); + exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_REQUIRED:1.0", "org.omg.CORBA.TRANSACTION_REQUIRED"); + exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_ROLLEDBACK:1.0", "org.omg.CORBA.TRANSACTION_ROLLEDBACK"); // from portability RTF 98-07-01.txt - exceptionClassNames.put("IDL:omg.org/CORBA/INV_POLICY:1.0", - "org.omg.CORBA.INV_POLICY"); + exceptionClassNames.put("IDL:omg.org/CORBA/INV_POLICY:1.0", "org.omg.CORBA.INV_POLICY"); // from orbrev/00-09-01 (CORBA 2.4 Draft Specification) - exceptionClassNames. - put("IDL:omg.org/CORBA/TRANSACTION_UNAVAILABLE:1.0", - "org.omg.CORBA.TRANSACTION_UNAVAILABLE"); - exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_MODE:1.0", - "org.omg.CORBA.TRANSACTION_MODE"); + exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_UNAVAILABLE:1.0", "org.omg.CORBA.TRANSACTION_UNAVAILABLE"); + exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_MODE:1.0", "org.omg.CORBA.TRANSACTION_MODE"); // Exception types introduced between CORBA 2.4 and 3.0 - exceptionClassNames.put("IDL:omg.org/CORBA/CODESET_INCOMPATIBLE:1.0", - "org.omg.CORBA.CODESET_INCOMPATIBLE"); - exceptionClassNames.put("IDL:omg.org/CORBA/REBIND:1.0", - "org.omg.CORBA.REBIND"); - exceptionClassNames.put("IDL:omg.org/CORBA/TIMEOUT:1.0", - "org.omg.CORBA.TIMEOUT"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_QOS:1.0", - "org.omg.CORBA.BAD_QOS"); + exceptionClassNames.put("IDL:omg.org/CORBA/CODESET_INCOMPATIBLE:1.0", "org.omg.CORBA.CODESET_INCOMPATIBLE"); + exceptionClassNames.put("IDL:omg.org/CORBA/REBIND:1.0", "org.omg.CORBA.REBIND"); + exceptionClassNames.put("IDL:omg.org/CORBA/TIMEOUT:1.0", "org.omg.CORBA.TIMEOUT"); + exceptionClassNames.put("IDL:omg.org/CORBA/BAD_QOS:1.0", "org.omg.CORBA.BAD_QOS"); // Exception types introduced in CORBA 3.0 - exceptionClassNames.put("IDL:omg.org/CORBA/INVALID_ACTIVITY:1.0", - "org.omg.CORBA.INVALID_ACTIVITY"); - exceptionClassNames.put("IDL:omg.org/CORBA/ACTIVITY_COMPLETED:1.0", - "org.omg.CORBA.ACTIVITY_COMPLETED"); - exceptionClassNames.put("IDL:omg.org/CORBA/ACTIVITY_REQUIRED:1.0", - "org.omg.CORBA.ACTIVITY_REQUIRED"); + exceptionClassNames.put("IDL:omg.org/CORBA/INVALID_ACTIVITY:1.0", "org.omg.CORBA.INVALID_ACTIVITY"); + exceptionClassNames.put("IDL:omg.org/CORBA/ACTIVITY_COMPLETED:1.0", "org.omg.CORBA.ACTIVITY_COMPLETED"); + exceptionClassNames.put("IDL:omg.org/CORBA/ACTIVITY_REQUIRED:1.0", "org.omg.CORBA.ACTIVITY_REQUIRED"); // // construct className -> repositoryId hashtable @@ -557,29 +502,31 @@ public static String repositoryIdOf(String name) String rId; String cName; - try{ + try { while (keys.hasMoreElements()) { rId = keys.nextElement(); cName = exceptionClassNames.get(rId); exceptionRepositoryIds.put(cName, rId); } - } catch (NoSuchElementException e) { } + } catch (NoSuchElementException e) { + } } - /** Parse a version string such as "1.1.6" or "jdk1.2fcs" into - a version array of integers {1, 1, 6} or {1, 2}. - A string of "n." or "n..m" is equivalent to "n.0" or "n.0.m" respectively. + /** + * Parse a version string such as "1.1.6" or "jdk1.2fcs" into a version array of integers {1, 1, 6} or {1, 2}. A string + * of "n." or "n..m" is equivalent to "n.0" or "n.0.m" respectively. + * * @param version Java version * @return Array of version parts - */ + */ public static int[] parseVersion(String version) { if (version == null) { return new int[0]; } char[] s = version.toCharArray(); - //find the maximum span of the string "n.n.n..." where n is an integer + // find the maximum span of the string "n.n.n..." where n is an integer int start = 0; - for (; start < s.length && (s[start] < '0' || s[start] > '9'); ++start) { + for (; start < s.length && (s[start] < '0' || s[start] > '9'); ++start) { if (start == s.length) { return new int[0]; } @@ -601,22 +548,22 @@ public static int[] parseVersion(String version) { } if (start >= dot) { val[i] = 0; - } //convert equivalent to "n.0" or "n.0.m" + } // convert equivalent to "n.0" or "n.0.m" else { - val[i] = - Integer.parseInt(version.substring(start, dot)); + val[i] = Integer.parseInt(version.substring(start, dot)); } start = dot + 1; } return val; } - /** Compare two version arrays. - Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2. + /** + * Compare two version arrays. Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2. + * * @param v1 first version * @param v2 second version * @return 1, 0 or -1 if v1 is greater than, equal to, or less than v2. - */ + */ public static int compareVersion(int[] v1, int[] v2) { if (v1 == null) { v1 = new int[0]; @@ -635,33 +582,32 @@ public static int compareVersion(int[] v1, int[] v2) { return v1.length == v2.length ? 0 : -1; } - /** Compare two version strings. - Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2. + /** + * Compare two version strings. Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2. + * * @param v1 first version string * @param v2 second version string * @return 1, 0 or -1 if v1 is greater than, equal to, or less than v2. - * @see #compareVersion(int[], int[]) - */ + * @see #compareVersion(int[], int[]) + */ public static synchronized int compareVersion(String v1, String v2) { return compareVersion(parseVersion(v1), parseVersion(v2)); } - private static String compressClassName( String name ) - { + private static String compressClassName(String name) { // Note that this must end in . in order to be renamed correctly. - String prefix = "com.sun.corba.ee." ; - if (name.startsWith( prefix ) ) { - return "(ORB)." + name.substring( prefix.length() ) ; + String prefix = "com.sun.corba.ee."; + if (name.startsWith(prefix)) { + return "(ORB)." + name.substring(prefix.length()); } else { return name; } } - // Return a compressed representation of the thread name. This is particularly + // Return a compressed representation of the thread name. This is particularly // useful on the server side, where there are many SelectReaderThreads, and // we need a short unambiguous name for such threads. - public static String getThreadName( Thread thr ) - { + public static String getThreadName(Thread thr) { if (thr == null) { return "null"; } @@ -670,42 +616,39 @@ public static String getThreadName( Thread thr ) // Pattern for SelectReaderThreads: // SelectReaderThread CorbaConnectionImpl[ ] // Any other pattern in the Thread's name is just returned. - String name = thr.getName() ; - StringTokenizer st = new StringTokenizer( name ) ; - int numTokens = st.countTokens() ; + String name = thr.getName(); + StringTokenizer st = new StringTokenizer(name); + int numTokens = st.countTokens(); if (numTokens != 5) { return name; } - String[] tokens = new String[numTokens] ; - for (int ctr=0; ctr= 0 ? - "(" + ste.getFileName() + ":" + ste.getLineNumber() + ")" : - (ste.getFileName() != null ? "("+ste.getFileName()+")" : "(Unknown Source)"))); + private static String formatStackTraceElement(StackTraceElement ste) { + return compressClassName(ste.getClassName()) + "." + ste.getMethodName() + + (ste.isNativeMethod() ? "(Native Method)" + : (ste.getFileName() != null && ste.getLineNumber() >= 0 ? "(" + ste.getFileName() + ":" + ste.getLineNumber() + ")" + : (ste.getFileName() != null ? "(" + ste.getFileName() + ")" : "(Unknown Source)"))); } - private static void printStackTrace( StackTraceElement[] trace ) - { - System.out.println( " Stack Trace:" ) ; + private static void printStackTrace(StackTraceElement[] trace) { + System.out.println(" Stack Trace:"); // print the stack trace, ommitting the zeroth element, which is // always this method. - for ( int ctr = 1; ctr < trace.length; ctr++ ) { - System.out.print( " >" ) ; - System.out.println( formatStackTraceElement( trace[ctr] ) ) ; + for (int ctr = 1; ctr < trace.length; ctr++) { + System.out.print(" >"); + System.out.println(formatStackTraceElement(trace[ctr])); } } @@ -713,15 +656,11 @@ private static void printStackTrace( StackTraceElement[] trace ) // Implements all dprint calls in this package. // public static synchronized void dprint(java.lang.Object obj, String msg) { - System.out.println( - compressClassName( obj.getClass().getName() ) + "(" + - getThreadName( Thread.currentThread() ) + "): " + msg); + System.out.println(compressClassName(obj.getClass().getName()) + "(" + getThreadName(Thread.currentThread()) + "): " + msg); } public static synchronized void dprint(String className, String msg) { - System.out.println( - compressClassName( className ) + "(" + - getThreadName( Thread.currentThread() ) + "): " + msg); + System.out.println(compressClassName(className) + "(" + getThreadName(Thread.currentThread()) + "): " + msg); } public synchronized void dprint(String msg) { @@ -731,52 +670,45 @@ public synchronized void dprint(String msg) { public static synchronized void dprintTrace(Object obj, String msg) { ORBUtility.dprint(obj, msg); - Throwable thr = new Throwable() ; - printStackTrace( thr.getStackTrace() ) ; + Throwable thr = new Throwable(); + printStackTrace(thr.getStackTrace()); } - public static synchronized void dprint(java.lang.Object caller, - String msg, Throwable t) - { - System.out.println( - compressClassName( caller.getClass().getName() ) + - '(' + Thread.currentThread() + "): " + msg); + public static synchronized void dprint(java.lang.Object caller, String msg, Throwable t) { + System.out.println(compressClassName(caller.getClass().getName()) + '(' + Thread.currentThread() + "): " + msg); if (t != null) { printStackTrace(t.getStackTrace()); } } - public static String[] concatenateStringArrays( String[] arr1, String[] arr2 ) - { - String[] result = new String[ - arr1.length + arr2.length ] ; + public static String[] concatenateStringArrays(String[] arr1, String[] arr2) { + String[] result = new String[arr1.length + arr2.length]; System.arraycopy(arr1, 0, result, 0, arr1.length); System.arraycopy(arr2, 0, result, arr1.length, arr2.length); - return result ; + return result; } /** * Throws the CORBA equivalent of a java.io.NotSerializableException * - * Duplicated from util/Utility for Pure ORB reasons. There are two - * reasons for this: + * Duplicated from util/Utility for Pure ORB reasons. There are two reasons for this: * - * 1) We can't introduce dependencies on the util version from outside - * of the io/util packages since it will not exist in the pure ORB - * build running on JDK 1.3.x. + * 1) We can't introduce dependencies on the util version from outside of the io/util packages since it will not exist + * in the pure ORB build running on JDK 1.3.x. * * 2) We need to pick up the correct minor code from OMGSystemException. + * * @param className Class that is not {@link Serializable} */ public static void throwNotSerializableForCorba(String className) { - throw omgWrapper.notSerializable( className ) ; + throw omgWrapper.notSerializable(className); } /** - * Returns the maximum stream format version supported by our - * ValueHandler. + * Returns the maximum stream format version supported by our ValueHandler. + * * @return he maximum stream format version */ public static byte getMaxStreamFormatVersion() { @@ -789,52 +721,49 @@ public static byte getMaxStreamFormatVersion() { } } - public static ClientDelegate makeClientDelegate( IOR ior ) - { - ORB orb = ior.getORB() ; - ContactInfoList ccil = orb.getCorbaContactInfoListFactory().create( ior ) ; + public static ClientDelegate makeClientDelegate(IOR ior) { + ORB orb = ior.getORB(); + ContactInfoList ccil = orb.getCorbaContactInfoListFactory().create(ior); ClientDelegate del = orb.getClientDelegateFactory().create(ccil); - return del ; + return del; } - /** This method is used to create untyped object references. + /** + * This method is used to create untyped object references. + * * @param ior object to make reference of * @return Object pointing to the IOR - */ - public static org.omg.CORBA.Object makeObjectReference( IOR ior ) - { - ClientDelegate del = makeClientDelegate( ior ) ; - org.omg.CORBA.Object objectImpl = new CORBAObjectImpl() ; - StubAdapter.setDelegate( objectImpl, del ) ; - return objectImpl ; + */ + public static org.omg.CORBA.Object makeObjectReference(IOR ior) { + ClientDelegate del = makeClientDelegate(ior); + org.omg.CORBA.Object objectImpl = new CORBAObjectImpl(); + StubAdapter.setDelegate(objectImpl, del); + return objectImpl; } - public static void setDaemon(Thread thread) - { + public static void setDaemon(Thread thread) { // Catch exceptions since setDaemon can cause a // security exception to be thrown under netscape // in the Applet mode final Thread finalThread = thread; try { AccessController.doPrivileged(new PrivilegedAction() { - public java.lang.Object run() { - finalThread.setDaemon(true); - return null; - } - }); + public java.lang.Object run() { + finalThread.setDaemon(true); + return null; + } + }); } catch (Exception e) { // REVISIT: Object to get static method. Ignore it. dprint(new Object(), "setDaemon: Exception: " + e); } } - public static String operationNameAndRequestId(MessageMediator m) - { + public static String operationNameAndRequestId(MessageMediator m) { return "op/" + m.getOperationName() + " id/" + m.getRequestId(); } - public static boolean isPrintable(char c) - { + public static boolean isPrintable(char c) { if (Character.isJavaIdentifierStart(c)) { // Letters and $ _ return true; @@ -843,57 +772,63 @@ public static boolean isPrintable(char c) return true; } switch (Character.getType(c)) { - case Character.MODIFIER_SYMBOL : return true; // ` ^ - case Character.DASH_PUNCTUATION : return true; // - - case Character.MATH_SYMBOL : return true; // = ~ + | < > - case Character.OTHER_PUNCTUATION : return true; // !@#%&*;':",./? - case Character.START_PUNCTUATION : return true; // ( [ { - case Character.END_PUNCTUATION : return true; // ) ] } + case Character.MODIFIER_SYMBOL: + return true; // ` ^ + case Character.DASH_PUNCTUATION: + return true; // - + case Character.MATH_SYMBOL: + return true; // = ~ + | < > + case Character.OTHER_PUNCTUATION: + return true; // !@#%&*;':",./? + case Character.START_PUNCTUATION: + return true; // ( [ { + case Character.END_PUNCTUATION: + return true; // ) ] } } return false; } - /** Given some hex data, extract it and put it into a byte buffer. - * The data must follow the following structure: + /** + * Given some hex data, extract it and put it into a byte buffer. The data must follow the following structure: *

    *
  1. All characters in a line after a "#" are ignored. *
  2. All non-whitespace characters before a "#" are treated as hex data. *
  3. All whitespace is ignored. *
  4. Only whitespace and 0-9a-fA-F may occur before a "#" in any line. - *
  5. Each data line must contain an even number of non-whitespace - * characters. + *
  6. Each data line must contain an even number of non-whitespace characters. *
+ * * @param data data to extract * @return byte array containing the data */ - public static byte[] getBuffer( String[] data ) { + public static byte[] getBuffer(String[] data) { // Estimate size of result - int numChar = 0 ; + int numChar = 0; for (String str : data) { numChar += str.length(); } // Maximum result size is 1/2 the number of characters. // Usually smaller due to comments and white space. - int maxSize = numChar/2 ; + int maxSize = numChar / 2; - byte[] result = new byte[maxSize] ; - int index = 0 ; + byte[] result = new byte[maxSize]; + int index = 0; int value = 0; - boolean startByte = true ; + boolean startByte = true; - for (String str : data ) { - for (int ctr = 0; ctr> ....) // (java.io.FilePermission /export0/sunwappserv/lib/- ...) // ... other permissions ... - // Domain ProtectionDomain (file:/export0/sunwappserv/lib-) + // Domain ProtectionDomain (file:/export0/sunwappserv/lib-) // java.security.Permissions@141fedb ( // (java.io.FilePermission <> ...) // (java.io.FilePermission /var/tmp//- ...) - String result = - (String)AccessController.doPrivileged(new PrivilegedAction() { - public java.lang.Object run() { - StringBuilder sb = new StringBuilder(500); - ProtectionDomain pd = cl.getProtectionDomain(); - Policy policy = Policy.getPolicy(); - PermissionCollection pc = policy.getPermissions(pd); - sb.append("\nPermissionCollection "); - sb.append(pc.toString()); - // Don't need to add 'Protection Domain' string, it's - // in ProtectionDomain.toString() already. - sb.append(pd.toString()); - return sb.toString(); - } - }); + String result = (String) AccessController.doPrivileged(new PrivilegedAction() { + public java.lang.Object run() { + StringBuilder sb = new StringBuilder(500); + ProtectionDomain pd = cl.getProtectionDomain(); + Policy policy = Policy.getPolicy(); + PermissionCollection pc = policy.getPermissions(pd); + sb.append("\nPermissionCollection "); + sb.append(pc.toString()); + // Don't need to add 'Protection Domain' string, it's + // in ProtectionDomain.toString() already. + sb.append(pd.toString()); + return sb.toString(); + } + }); return result; } - public static String formatStringArray(String[] a) - { + public static String formatStringArray(String[] a) { if (a == null) { return "null"; } - StringBuilder result = new StringBuilder() ; - result.append( "[" ) ; + StringBuilder result = new StringBuilder(); + result.append("["); for (int i = 0; i < a.length; ++i) { - result.append( a[i] ) ; - result.append( " " ) ; + result.append(a[i]); + result.append(" "); } - result.append( "]" ) ; - return result.toString() ; + result.append("]"); + return result.toString(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepIdDelegator.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepIdDelegator.java index 20543096d..83d84eb11 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepIdDelegator.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepIdDelegator.java @@ -19,55 +19,41 @@ package com.sun.corba.ee.impl.misc; - import java.io.Serializable; - import java.net.MalformedURLException; import com.sun.corba.ee.impl.io.TypeMismatchException; import com.sun.corba.ee.impl.util.RepositoryId; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; /** - * Delegates to the current RepositoryId implementation in - * com.sun.corba.ee.impl.util. This is necessary to - * overcome the fact that many of RepositoryId's methods - * are static. + * Delegates to the current RepositoryId implementation in com.sun.corba.ee.impl.util. This is necessary to overcome the + * fact that many of RepositoryId's methods are static. */ -public final class RepIdDelegator - implements RepositoryIdStrings, - RepositoryIdUtility, - RepositoryIdInterface -{ +public final class RepIdDelegator implements RepositoryIdStrings, RepositoryIdUtility, RepositoryIdInterface { // RepositoryIdFactory methods public String createForAnyType(Class type) { return RepositoryId.createForAnyType(type); } - public String createForAnyType(Class type, ClassInfoCache.ClassInfo cinfo ) { + public String createForAnyType(Class type, ClassInfoCache.ClassInfo cinfo) { return RepositoryId.createForAnyType(type, cinfo); } - public String createForJavaType(Serializable ser) - throws TypeMismatchException - { + public String createForJavaType(Serializable ser) throws TypeMismatchException { return RepositoryId.createForJavaType(ser); } - - public String createForJavaType(Class clz) - throws TypeMismatchException - { + + public String createForJavaType(Class clz) throws TypeMismatchException { return RepositoryId.createForJavaType(clz); } - public String createForJavaType(Class clz, ClassInfoCache.ClassInfo cinfo ) - throws TypeMismatchException - { - return RepositoryId.createForJavaType(clz,cinfo); + public String createForJavaType(Class clz, ClassInfoCache.ClassInfo cinfo) throws TypeMismatchException { + return RepositoryId.createForJavaType(clz, cinfo); } public String createSequenceRepID(java.lang.Object ser) { @@ -83,7 +69,7 @@ public RepositoryIdInterface getFromString(String repIdString) { } // RepositoryIdUtility methods - + public boolean isChunkedEncoding(int valueTag) { return RepositoryId.isChunkedEncoding(valueTag); } @@ -142,16 +128,11 @@ public Class getClassFromType() throws ClassNotFoundException { return delegate.getClassFromType(); } - public Class getClassFromType(String codebaseURL) - throws ClassNotFoundException, MalformedURLException - { + public Class getClassFromType(String codebaseURL) throws ClassNotFoundException, MalformedURLException { return delegate.getClassFromType(codebaseURL); } - public Class getClassFromType(Class expectedType, - String codebaseURL) - throws ClassNotFoundException, MalformedURLException - { + public Class getClassFromType(Class expectedType, String codebaseURL) throws ClassNotFoundException, MalformedURLException { return delegate.getClassFromType(expectedType, codebaseURL); } @@ -160,9 +141,10 @@ public String getClassName() { } // Constructor used for factory/utility cases - public RepIdDelegator() {} + public RepIdDelegator() { + } - // Constructor used by getIdFromString. All non-static + // Constructor used by getIdFromString. All non-static // RepositoryId methods will use the provided delegate. private RepIdDelegator(RepositoryId _delegate) { this.delegate = _delegate; @@ -185,6 +167,6 @@ public boolean equals(Object obj) { } public int hashCode() { - return delegate.hashCode() ; + return delegate.hashCode(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdFactory.java index c5126ef59..a868ad0a0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdFactory.java @@ -25,48 +25,44 @@ /** * Holds a {@link RepIdDelegator} */ -public abstract class RepositoryIdFactory -{ - private static final RepIdDelegator currentDelegator - = new RepIdDelegator(); +public abstract class RepositoryIdFactory { + private static final RepIdDelegator currentDelegator = new RepIdDelegator(); /** * Returns the latest version RepositoryIdStrings instance + * * @return the delegate */ - public static RepositoryIdStrings getRepIdStringsFactory() - { + public static RepositoryIdStrings getRepIdStringsFactory() { return currentDelegator; } /** - * Checks the version of the ORB and returns the appropriate - * RepositoryIdStrings instance. + * Checks the version of the ORB and returns the appropriate RepositoryIdStrings instance. + * * @param orb ignored * @return the delegate */ - public static RepositoryIdStrings getRepIdStringsFactory(ORB orb) - { + public static RepositoryIdStrings getRepIdStringsFactory(ORB orb) { return currentDelegator; } /** * Returns the latest version RepositoryIdUtility instance + * * @return the delegate */ - public static RepositoryIdUtility getRepIdUtility() - { + public static RepositoryIdUtility getRepIdUtility() { return currentDelegator; } /** - * Checks the version of the ORB and returns the appropriate - * RepositoryIdUtility instance. + * Checks the version of the ORB and returns the appropriate RepositoryIdUtility instance. + * * @param orb ORB to get version * @return the delegate */ - public static RepositoryIdUtility getRepIdUtility(ORB orb) - { + public static RepositoryIdUtility getRepIdUtility(ORB orb) { return currentDelegator; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdInterface.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdInterface.java index 633410fdd..e383b7edf 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdInterface.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdInterface.java @@ -24,19 +24,14 @@ import java.net.MalformedURLException; /** - * Methods on specific instances of RepositoryId. Hides - * versioning of our RepositoryId class. + * Methods on specific instances of RepositoryId. Hides versioning of our RepositoryId class. */ -public interface RepositoryIdInterface -{ +public interface RepositoryIdInterface { Class getClassFromType() throws ClassNotFoundException; - Class getClassFromType(String codebaseURL) - throws ClassNotFoundException, MalformedURLException; + Class getClassFromType(String codebaseURL) throws ClassNotFoundException, MalformedURLException; - Class getClassFromType(Class expectedType, - String codebaseURL) - throws ClassNotFoundException, MalformedURLException; + Class getClassFromType(Class expectedType, String codebaseURL) throws ClassNotFoundException, MalformedURLException; String getClassName(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdStrings.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdStrings.java index 1629ac370..6c0c65dd8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdStrings.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdStrings.java @@ -22,33 +22,29 @@ import java.io.Serializable; import com.sun.corba.ee.impl.io.TypeMismatchException; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; /** - * Factory methods for creating various repository ID strings - * and instances. + * Factory methods for creating various repository ID strings and instances. */ -public interface RepositoryIdStrings -{ +public interface RepositoryIdStrings { String createForAnyType(Class type); - String createForAnyType(Class type, ClassInfoCache.ClassInfo cinfo ); - - String createForJavaType(Serializable ser) - throws TypeMismatchException; - - String createForJavaType(Class clz) - throws TypeMismatchException; - - String createForJavaType(Class clz, ClassInfoCache.ClassInfo cinfo ) - throws TypeMismatchException; - + String createForAnyType(Class type, ClassInfoCache.ClassInfo cinfo); + + String createForJavaType(Serializable ser) throws TypeMismatchException; + + String createForJavaType(Class clz) throws TypeMismatchException; + + String createForJavaType(Class clz, ClassInfoCache.ClassInfo cinfo) throws TypeMismatchException; + String createSequenceRepID(java.lang.Object ser); - + String createSequenceRepID(java.lang.Class clazz); - + RepositoryIdInterface getFromString(String repIdString); String getClassDescValueRepId(); + String getWStringValueRepId(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdUtility.java b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdUtility.java index 8213e84ef..5e4ee1009 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdUtility.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/misc/RepositoryIdUtility.java @@ -25,9 +25,9 @@ /** * Utility methods for working with repository IDs. */ -public interface RepositoryIdUtility -{ +public interface RepositoryIdUtility { boolean isChunkedEncoding(int valueTag); + boolean isCodeBasePresent(int valueTag); // These are currently the same in both RepositoryId and @@ -43,11 +43,18 @@ public interface RepositoryIdUtility // Accessors for precomputed value tags int getStandardRMIChunkedNoRepStrId(); + int getCodeBaseRMIChunkedNoRepStrId(); + int getStandardRMIChunkedId(); + int getCodeBaseRMIChunkedId(); + int getStandardRMIUnchunkedId(); + int getCodeBaseRMIUnchunkedId(); + int getStandardRMIUnchunkedNoRepStrId(); + int getCodeBaseRMIUnchunkedNoRepStrId(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/BindingIteratorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/BindingIteratorImpl.java index 5554a86e0..c0dfa9019 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/BindingIteratorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/BindingIteratorImpl.java @@ -29,89 +29,73 @@ import org.omg.CORBA.BAD_PARAM; /** - * Class BindingIteratorImpl implements the org.omg.CosNaming::BindingIterator - * interface, but does not implement the method to retrieve the next - * binding in the NamingContext for which it was created. This is left - * to a subclass, which is why this class is abstract; BindingIteratorImpl - * provides an implementation of the interface operations on top of two - * subclass methods, allowing multiple implementations of iterators that - * differ in storage and access to the contents of a NamingContext - * implementation. + * Class BindingIteratorImpl implements the org.omg.CosNaming::BindingIterator interface, but does not implement the + * method to retrieve the next binding in the NamingContext for which it was created. This is left to a subclass, which + * is why this class is abstract; BindingIteratorImpl provides an implementation of the interface operations on top of + * two subclass methods, allowing multiple implementations of iterators that differ in storage and access to the + * contents of a NamingContext implementation. *

- * The operation next_one() is implemented by the subclass, whereas - * next_n() is implemented on top of the next_one() implementation. - * Destroy must also be implemented by the subclass. + * The operation next_one() is implemented by the subclass, whereas next_n() is implemented on top of the next_one() + * implementation. Destroy must also be implemented by the subclass. *

- * A subclass must implement NextOne() and Destroy(); these - * methods are invoked from synchronized methods and need therefore - * not be synchronized themselves. + * A subclass must implement NextOne() and Destroy(); these methods are invoked from synchronized methods and need + * therefore not be synchronized themselves. */ -public abstract class BindingIteratorImpl extends BindingIteratorPOA -{ - protected ORB orb ; +public abstract class BindingIteratorImpl extends BindingIteratorPOA { + protected ORB orb; /** - * Create a binding iterator servant. - * runs the super constructor. + * Create a binding iterator servant. runs the super constructor. + * * @param orb an ORB object. - * @exception java.lang.Exception a Java exception. + * @exception java.lang.Exception a Java exception. */ - public BindingIteratorImpl(ORB orb) - throws java.lang.Exception - { + public BindingIteratorImpl(ORB orb) throws java.lang.Exception { super(); - this.orb = orb ; + this.orb = orb; } - + /** - * Return the next binding. It also returns true or false, indicating - * whether there were more bindings. + * Return the next binding. It also returns true or false, indicating whether there were more bindings. + * * @param b The Binding as an out parameter. * @return true if there were more bindings. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #nextOneImpl */ @Override - public synchronized boolean next_one(org.omg.CosNaming.BindingHolder b) - { + public synchronized boolean next_one(org.omg.CosNaming.BindingHolder b) { // NextOne actually returns the next one return nextOneImpl(b); } - + /** - * Return the next n bindings. It also returns true or false, indicating - * whether there were more bindings. + * Return the next n bindings. It also returns true or false, indicating whether there were more bindings. + * * @param how_many The number of requested bindings in the BindingList. * @param blh The BindingList as an out parameter. * @return true if there were more bindings. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ - public synchronized boolean next_n(int how_many, - org.omg.CosNaming.BindingListHolder blh) - { - if( how_many == 0 ) { - throw new BAD_PARAM( " 'how_many' parameter is set to 0 which is" + - " invalid" ); - } - return list( how_many, blh ); + public synchronized boolean next_n(int how_many, org.omg.CosNaming.BindingListHolder blh) { + if (how_many == 0) { + throw new BAD_PARAM(" 'how_many' parameter is set to 0 which is" + " invalid"); + } + return list(how_many, blh); } /** - * lists next n bindings. It returns true or false, indicating - * whether there were more bindings. This method has the package private - * scope, It will be called from NamingContext.list() operation or - * this.next_n(). + * lists next n bindings. It returns true or false, indicating whether there were more bindings. This method has the + * package private scope, It will be called from NamingContext.list() operation or this.next_n(). + * * @param how_many The number of requested bindings in the BindingList. * @param blh The BindingList as an out parameter. * @return true if there were more bindings. */ - public boolean list( int how_many, org.omg.CosNaming.BindingListHolder blh) - { + public boolean list(int how_many, org.omg.CosNaming.BindingListHolder blh) { // Take the smallest of what's left and what's being asked for - int numberToGet = Math.min(remainingElementsImpl(),how_many); - + int numberToGet = Math.min(remainingElementsImpl(), how_many); + // Create a resulting BindingList Binding[] bl = new Binding[numberToGet]; BindingHolder bh = new BindingHolder(); @@ -130,46 +114,41 @@ public boolean list( int how_many, org.omg.CosNaming.BindingListHolder blh) // Set into holder blh.value = bl; - + return true; } - - - /** - * Destroy this BindingIterator object. The object corresponding to this - * object reference is destroyed. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * Destroy this BindingIterator object. The object corresponding to this object reference is destroyed. + * + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #destroyImpl - */ + */ @Override - public synchronized void destroy() - { + public synchronized void destroy() { // Destroy actually destroys this.destroyImpl(); } /** - * Abstract method for returning the next binding in the NamingContext - * for which this BindingIterator was created. + * Abstract method for returning the next binding in the NamingContext for which this BindingIterator was created. + * * @param b The Binding as an out parameter. * @return true if there were more bindings. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ protected abstract boolean nextOneImpl(org.omg.CosNaming.BindingHolder b); /** * Abstract method for destroying this BindingIterator. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ protected abstract void destroyImpl(); /** * Abstract method for returning the remaining number of elements. + * * @return the remaining number of elements in the iterator. */ protected abstract int remainingElementsImpl(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InterOperableNamingImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InterOperableNamingImpl.java index 78195dec5..f86459af0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InterOperableNamingImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InterOperableNamingImpl.java @@ -25,374 +25,316 @@ import org.omg.CosNaming.NameComponent; import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress; - /** - * Class InteroperableNamingImpl implements the methods defined - * for NamingContextExt which is part of Interoperable Naming - * Service specifications. This class is added for doing more - * of Parsing and Building of Stringified names according to INS - * Spec. + * Class InteroperableNamingImpl implements the methods defined for NamingContextExt which is part of Interoperable + * Naming Service specifications. This class is added for doing more of Parsing and Building of Stringified names + * according to INS Spec. */ -public class InterOperableNamingImpl -{ - /** - * Method which stringifies the Name Components given as the input - * parameter. +public class InterOperableNamingImpl { + /** + * Method which stringifies the Name Components given as the input parameter. * - * @param theNameComponents Array of Name Components (Simple or Compound - * Names) + * @param theNameComponents Array of Name Components (Simple or Compound Names) * @return string which is the stringified reference. */ - public String convertToString( org.omg.CosNaming.NameComponent[] - theNameComponents ) - { - boolean first = true ; - final StringBuffer sb = new StringBuffer() ; + public String convertToString(org.omg.CosNaming.NameComponent[] theNameComponents) { + boolean first = true; + final StringBuffer sb = new StringBuffer(); for (NameComponent nc : theNameComponents) { - final String temp = convertNameComponentToString( nc ) ; - sb.append( temp ) ; + final String temp = convertNameComponentToString(nc); + sb.append(temp); if (first) { - first = false ; + first = false; } else { - sb.append( '/' ) ; + sb.append('/'); } } - return sb.toString() ; + return sb.toString(); } - private boolean isEmpty( String str ) { - return str==null || str.length() == 0 ; + private boolean isEmpty(String str) { + return str == null || str.length() == 0; } - private boolean contains( String str, char ch ) { - return str.indexOf( ch ) != -1 ; + private boolean contains(String str, char ch) { + return str.indexOf(ch) != -1; } - /** This method converts a single Namecomponent to String, By adding Escapes - * If neccessary. - */ - private String convertNameComponentToString( - org.omg.CosNaming.NameComponent theNameComponent ) - { - final String id = addEscape( theNameComponent.id ) ; - final String kind = addEscape( theNameComponent.kind ) ; - final StringBuffer sb = new StringBuffer() ; + /** + * This method converts a single Namecomponent to String, By adding Escapes If neccessary. + */ + private String convertNameComponentToString(org.omg.CosNaming.NameComponent theNameComponent) { + final String id = addEscape(theNameComponent.id); + final String kind = addEscape(theNameComponent.kind); + final StringBuffer sb = new StringBuffer(); if (!isEmpty(id)) { - sb.append( id ) ; + sb.append(id); } - sb.append( '.' ) ; + sb.append('.'); if (!isEmpty(kind)) { - sb.append(kind) ; + sb.append(kind); } - return sb.toString() ; + return sb.toString(); } - - /** This method adds escape '\' for the Namecomponent if neccessary - */ - private String addEscape( String value ) - { - if ((value != null) && (contains( value, '.' ) || - contains( value, '/' ))) { - final StringBuffer theNewValue = new StringBuffer() ; - for( int i = 0; i < value.length( ); i++ ) { - char c = value.charAt( i ); + /** + * This method adds escape '\' for the Namecomponent if neccessary + */ + private String addEscape(String value) { + if ((value != null) && (contains(value, '.') || contains(value, '/'))) { + final StringBuffer theNewValue = new StringBuffer(); + for (int i = 0; i < value.length(); i++) { + char c = value.charAt(i); if ((c == '.') || (c == '/')) { - theNewValue.append( '\\' ); + theNewValue.append('\\'); } // Adding escape for the "." - theNewValue.append( c ); + theNewValue.append(c); } - return theNewValue.toString() ; + return theNewValue.toString(); } else { return value; } - } + } - /** + /** * Method which converts the Stringified name into Array of Name Components. * * @param theStringifiedName which is the stringified name. - * @return Array of Name Components (Simple or Compound Names) - * @throws org.omg.CosNaming.NamingContextPackage.InvalidName if the stringified name is invalid + * @return Array of Name Components (Simple or Compound Names) + * @throws org.omg.CosNaming.NamingContextPackage.InvalidName if the stringified name is invalid */ - public org.omg.CosNaming.NameComponent[] convertToNameComponent( - String theStringifiedName ) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - { - String[] components = breakStringToNameComponents( theStringifiedName ); - if (( components == null ) || (components.length == 0)) { + public org.omg.CosNaming.NameComponent[] convertToNameComponent(String theStringifiedName) + throws org.omg.CosNaming.NamingContextPackage.InvalidName { + String[] components = breakStringToNameComponents(theStringifiedName); + if ((components == null) || (components.length == 0)) { return null; - } + } NameComponent[] theNameComponents = new NameComponent[components.length]; - for( int i = 0; i < components.length; i++ ) { - theNameComponents[i] = createNameComponentFromString( - components[i] ); + for (int i = 0; i < components.length; i++) { + theNameComponents[i] = createNameComponentFromString(components[i]); } return theNameComponents; - } + } - /** Step1 in converting Stringified name into array of Name Component - * is breaking the String into multiple name components + /** + * Step1 in converting Stringified name into array of Name Component is breaking the String into multiple name + * components */ - private String[] breakStringToNameComponents( final String sname ) { - int[] theIndices = new int[100]; - int theIndicesIndex = 0; + private String[] breakStringToNameComponents(final String sname) { + int[] theIndices = new int[100]; + int theIndicesIndex = 0; - for(int index = 0; index <= sname.length(); ) { - theIndices[theIndicesIndex] = sname.indexOf( '/', - index ); - if( theIndices[theIndicesIndex] == -1 ) { - // This is the end of all the occurence of '/' and hence come - // out of the loop - index = sname.length()+1; - } - else { - // If the '/' is found, first check whether it is - // preceded by escape '\' - // If not then set theIndices and increment theIndicesIndex - // and also set the index else just ignore the '/' - if( (theIndices[theIndicesIndex] > 0 ) - && (sname.charAt( - theIndices[theIndicesIndex]-1) == '\\') ) - { - index = theIndices[theIndicesIndex] + 1; - theIndices[theIndicesIndex] = -1; - } - else { - index = theIndices[theIndicesIndex] + 1; - theIndicesIndex++; - } - } + for (int index = 0; index <= sname.length();) { + theIndices[theIndicesIndex] = sname.indexOf('/', index); + if (theIndices[theIndicesIndex] == -1) { + // This is the end of all the occurence of '/' and hence come + // out of the loop + index = sname.length() + 1; + } else { + // If the '/' is found, first check whether it is + // preceded by escape '\' + // If not then set theIndices and increment theIndicesIndex + // and also set the index else just ignore the '/' + if ((theIndices[theIndicesIndex] > 0) && (sname.charAt(theIndices[theIndicesIndex] - 1) == '\\')) { + index = theIndices[theIndicesIndex] + 1; + theIndices[theIndicesIndex] = -1; + } else { + index = theIndices[theIndicesIndex] + 1; + theIndicesIndex++; + } + } } - if( theIndicesIndex == 0 ) { + if (theIndicesIndex == 0) { String[] tempString = new String[1]; tempString[0] = sname; return tempString; } - if( theIndicesIndex != 0 ) { + if (theIndicesIndex != 0) { theIndicesIndex++; } - return StringComponentsFromIndices( theIndices, theIndicesIndex, - sname ); - } + return StringComponentsFromIndices(theIndices, theIndicesIndex, sname); + } - /** This method breaks one big String into multiple substrings based - * on the array of index passed in. - */ - private String[] StringComponentsFromIndices( int[] theIndices, - int indicesCount, String theStringifiedName ) - { - String[] theStringComponents = new String[indicesCount]; - int firstIndex = 0; - int lastIndex = theIndices[0]; - for( int i = 0; i < indicesCount; i++ ) { - theStringComponents[i] = theStringifiedName.substring( firstIndex, - lastIndex ); - if( ( theIndices[i] < theStringifiedName.length() - 1 ) - &&( theIndices[i] != -1 ) ) - { - firstIndex = theIndices[i]+1; - } - else { - firstIndex = 0; - i = indicesCount; - } - if( (i+1 < theIndices.length) - && (theIndices[i+1] < (theStringifiedName.length() - 1)) - && (theIndices[i+1] != -1) ) - { - lastIndex = theIndices[i+1]; - } - else { - i = indicesCount; - } - // This is done for the last component - if( firstIndex != 0 && i == indicesCount ) { - theStringComponents[indicesCount-1] = - theStringifiedName.substring( firstIndex ); - } - } - return theStringComponents; - } + /** + * This method breaks one big String into multiple substrings based on the array of index passed in. + */ + private String[] StringComponentsFromIndices(int[] theIndices, int indicesCount, String theStringifiedName) { + String[] theStringComponents = new String[indicesCount]; + int firstIndex = 0; + int lastIndex = theIndices[0]; + for (int i = 0; i < indicesCount; i++) { + theStringComponents[i] = theStringifiedName.substring(firstIndex, lastIndex); + if ((theIndices[i] < theStringifiedName.length() - 1) && (theIndices[i] != -1)) { + firstIndex = theIndices[i] + 1; + } else { + firstIndex = 0; + i = indicesCount; + } + if ((i + 1 < theIndices.length) && (theIndices[i + 1] < (theStringifiedName.length() - 1)) && (theIndices[i + 1] != -1)) { + lastIndex = theIndices[i + 1]; + } else { + i = indicesCount; + } + // This is done for the last component + if (firstIndex != 0 && i == indicesCount) { + theStringComponents[indicesCount - 1] = theStringifiedName.substring(firstIndex); + } + } + return theStringComponents; + } - /** Step 2: After Breaking the Stringified name into set of NameComponent - * Strings, The next step is to create Namecomponents from the substring - * by removing the escapes if there are any. - */ - private NameComponent createNameComponentFromString( - String theStringifiedNameComponent ) - throws org.omg.CosNaming.NamingContextPackage.InvalidName + /** + * Step 2: After Breaking the Stringified name into set of NameComponent Strings, The next step is to create + * Namecomponents from the substring by removing the escapes if there are any. + */ + private NameComponent createNameComponentFromString(String theStringifiedNameComponent) + throws org.omg.CosNaming.NamingContextPackage.InvalidName - { + { String id = null; String kind = null; - if( ( theStringifiedNameComponent == null ) - || ( theStringifiedNameComponent.length( ) == 0) - || ( theStringifiedNameComponent.endsWith(".") ) ) - { + if ((theStringifiedNameComponent == null) || (theStringifiedNameComponent.length() == 0) + || (theStringifiedNameComponent.endsWith("."))) { // If any of the above is true, then we create an invalid Name // Component to indicate that it is an invalid name. - throw new org.omg.CosNaming.NamingContextPackage.InvalidName( ); + throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); } - int index = theStringifiedNameComponent.indexOf( '.', 0 ); + int index = theStringifiedNameComponent.indexOf('.', 0); // The format could be XYZ (Without kind) - if( index == -1 ) { + if (index == -1) { id = theStringifiedNameComponent; } // The format is .XYZ (Without ID) - else if( index == 0 ) { - // This check is for the Namecomponent which is just "." meaning Id + else if (index == 0) { + // This check is for the Namecomponent which is just "." meaning Id // and Kinds are null - if( theStringifiedNameComponent.length( ) != 1 ) { + if (theStringifiedNameComponent.length() != 1) { kind = theStringifiedNameComponent.substring(1); } - } - else - { - if( theStringifiedNameComponent.charAt(index-1) != '\\' ) { - id = theStringifiedNameComponent.substring( 0, index); - kind = theStringifiedNameComponent.substring( index + 1 ); - } - else { + } else { + if (theStringifiedNameComponent.charAt(index - 1) != '\\') { + id = theStringifiedNameComponent.substring(0, index); + kind = theStringifiedNameComponent.substring(index + 1); + } else { boolean kindfound = false; - while( (index < theStringifiedNameComponent.length() ) - &&( kindfound != true ) ) - { - index = theStringifiedNameComponent.indexOf( '.',index + 1); - if( index > 0 ) { - if( theStringifiedNameComponent.charAt( - index - 1 ) != '\\' ) - { + while ((index < theStringifiedNameComponent.length()) && (kindfound != true)) { + index = theStringifiedNameComponent.indexOf('.', index + 1); + if (index > 0) { + if (theStringifiedNameComponent.charAt(index - 1) != '\\') { kindfound = true; } - } - else - { + } else { // No more '.', which means there is no Kind index = theStringifiedNameComponent.length(); } } - if( kindfound == true ) { - id = theStringifiedNameComponent.substring( 0, index); - kind = theStringifiedNameComponent.substring(index + 1 ); - } - else { + if (kindfound == true) { + id = theStringifiedNameComponent.substring(0, index); + kind = theStringifiedNameComponent.substring(index + 1); + } else { id = theStringifiedNameComponent; } } } - id = cleanEscapeCharacter( id ); - kind = cleanEscapeCharacter( kind ); - if( id == null ) { - id = ""; + id = cleanEscapeCharacter(id); + kind = cleanEscapeCharacter(kind); + if (id == null) { + id = ""; } - if( kind == null ) { - kind = ""; + if (kind == null) { + kind = ""; } - return new NameComponent( id, kind ); - } + return new NameComponent(id, kind); + } - - /** This method cleans the escapes in the Stringified name and returns the - * correct String + /** + * This method cleans the escapes in the Stringified name and returns the correct String */ - private String cleanEscapeCharacter( String theString ) - { - if( ( theString == null ) || (theString.length() == 0 ) ) { - return theString; - } - int index = theString.indexOf( '\\' ); - if( index == 0 ) { + private String cleanEscapeCharacter(String theString) { + if ((theString == null) || (theString.length() == 0)) { return theString; } - else { + int index = theString.indexOf('\\'); + if (index == 0) { + return theString; + } else { String src = theString; StringBuilder dest = new StringBuilder(); char c; - for( int i = 0; i < theString.length( ); i++ ) { - c = src.charAt( i ); - if( c != '\\' ) { - dest.append( c ); + for (int i = 0; i < theString.length(); i++) { + c = src.charAt(i); + if (c != '\\') { + dest.append(c); } else { - if( i+1 < theString.length() ) { - char d = src.charAt( i + 1 ); + if (i + 1 < theString.length()) { + char d = src.charAt(i + 1); // If there is a AlphaNumeric character after a \ // then include slash, as it is not intended as an // escape character. - if( Character.isLetterOrDigit(d) ) { - dest.append( c ); + if (Character.isLetterOrDigit(d)) { + dest.append(c); } } } } return new String(dest); } - } + } - /** - * Method which converts the Stringified name and Host Name Address into - * a URL based Name + /** + * Method which converts the Stringified name and Host Name Address into a URL based Name * * @param address which is ip based host name * @param name which is the stringified name. - * @return url based Name. + * @return url based Name. * @throws InvalidAddress if the address is invalid */ - public String createURLBasedAddress( String address, String name ) - throws InvalidAddress - { + public String createURLBasedAddress(String address, String name) throws InvalidAddress { String theurl = null; - if( ( address == null ) - ||( address.length() == 0 ) ) { + if ((address == null) || (address.length() == 0)) { throw new InvalidAddress(); - } - else { - theurl = "corbaname:" + address + "#" + encode( name ); + } else { + theurl = "corbaname:" + address + "#" + encode(name); } return theurl; } - /** Encodes the string according to RFC 2396 IETF spec required by INS. + /** + * Encodes the string according to RFC 2396 IETF spec required by INS. */ - private String encode( String stringToEncode ) { + private String encode(String stringToEncode) { StringWriter theStringAfterEscape = new StringWriter(); int byteCount = 0; - for( int i = 0; i < stringToEncode.length(); i++ ) - { - char c = stringToEncode.charAt( i ) ; - if( Character.isLetterOrDigit( c ) ) { - theStringAfterEscape.write( c ); + for (int i = 0; i < stringToEncode.length(); i++) { + char c = stringToEncode.charAt(i); + if (Character.isLetterOrDigit(c)) { + theStringAfterEscape.write(c); } // Do no Escape for characters in this list // RFC 2396 - else if((c == ';') || (c == '/') || (c == '?') - || (c == ':') || (c == '@') || (c == '&') || (c == '=') - || (c == '+') || (c == '$') || (c == ';') || (c == '-') - || (c == '_') || (c == '.') || (c == '!') || (c == '~') - || (c == '*') || (c == ' ') || (c == '(') || (c == ')') ) - { - theStringAfterEscape.write( c ); - } - else { + else if ((c == ';') || (c == '/') || (c == '?') || (c == ':') || (c == '@') || (c == '&') || (c == '=') || (c == '+') + || (c == '$') || (c == ';') || (c == '-') || (c == '_') || (c == '.') || (c == '!') || (c == '~') || (c == '*') + || (c == ' ') || (c == '(') || (c == ')')) { + theStringAfterEscape.write(c); + } else { // Add escape - theStringAfterEscape.write( '%' ); - String hexString = Integer.toHexString( (int) c ); - theStringAfterEscape.write( hexString ); + theStringAfterEscape.write('%'); + String hexString = Integer.toHexString((int) c); + theStringAfterEscape.write(hexString); } } return theStringAfterEscape.toString(); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InternalBindingKey.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InternalBindingKey.java index eead722a6..90fc1a9ba 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InternalBindingKey.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InternalBindingKey.java @@ -22,14 +22,11 @@ import org.omg.CosNaming.NameComponent; /** - * Class InternalBindingKey implements the necessary wrapper code - * around the org.omg.CosNaming::NameComponent class to implement the proper - * equals() method and the hashCode() method for use in a hash table. - * It computes the hashCode once and stores it, and also precomputes - * the lengths of the id and kind strings for faster comparison. + * Class InternalBindingKey implements the necessary wrapper code around the org.omg.CosNaming::NameComponent class to + * implement the proper equals() method and the hashCode() method for use in a hash table. It computes the hashCode once + * and stores it, and also precomputes the lengths of the id and kind strings for faster comparison. */ -public class InternalBindingKey -{ +public class InternalBindingKey { // A key contains a name public NameComponent name; private int idLen; @@ -37,11 +34,11 @@ public class InternalBindingKey private int hashVal; // Default Constructor - public InternalBindingKey() {} + public InternalBindingKey() { + } // Normal constructor - public InternalBindingKey(NameComponent n) - { + public InternalBindingKey(NameComponent n) { idLen = 0; kindLen = 0; setup(n); @@ -51,10 +48,10 @@ public InternalBindingKey(NameComponent n) protected void setup(NameComponent n) { this.name = n; // Precompute lengths and values since they will not change - if( this.name.id != null ) { + if (this.name.id != null) { idLen = this.name.id.length(); } - if( this.name.kind != null ) { + if (this.name.kind != null) { kindLen = this.name.kind.length(); } hashVal = 0; @@ -69,7 +66,7 @@ public boolean equals(java.lang.Object o) { if (o == null) return false; if (o instanceof InternalBindingKey) { - InternalBindingKey that = (InternalBindingKey)o; + InternalBindingKey that = (InternalBindingKey) o; // Both lengths must match if (this.idLen != that.idLen || this.kindLen != that.kindLen) { return false; @@ -88,9 +85,9 @@ public boolean equals(java.lang.Object o) { return false; } } + // Return precomputed value public int hashCode() { return this.hashVal; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InternalBindingValue.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InternalBindingValue.java index fb59ba672..cf72f6275 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InternalBindingValue.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/InternalBindingValue.java @@ -24,18 +24,17 @@ import org.omg.CosNaming.NameComponent; /** - * Class InternalBindingKey acts as a container for two objects, namely - * a org.omg.CosNaming::Binding and an CORBA object reference, which are the two - * components associated with the binding. + * Class InternalBindingKey acts as a container for two objects, namely a org.omg.CosNaming::Binding and an CORBA object + * reference, which are the two components associated with the binding. */ -public class InternalBindingValue -{ +public class InternalBindingValue { public Binding theBinding; public String strObjectRef; public org.omg.CORBA.Object theObjectRef; - + // Default constructor - public InternalBindingValue() {} + public InternalBindingValue() { + } // Normal constructor public InternalBindingValue(Binding b, String o) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingContextDataStore.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingContextDataStore.java index 5baac7fc1..23277e5a0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingContextDataStore.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingContextDataStore.java @@ -32,79 +32,73 @@ import org.omg.PortableServer.POA; /** - * This interface defines a set of methods that must be implemented by the - * "data store" associated with a NamingContext implementation. - * It allows for different implementations of naming contexts that - * support the same API but differ in storage mechanism. - */ + * This interface defines a set of methods that must be implemented by the "data store" associated with a NamingContext + * implementation. It allows for different implementations of naming contexts that support the same API but differ in + * storage mechanism. + */ public interface NamingContextDataStore { /** - * Method which implements binding a name to an object as - * the specified binding type. - * @param n a NameComponent which is the name under which the object - * will be bound. + * Method which implements binding a name to an object as the specified binding type. + * + * @param n a NameComponent which is the name under which the object will be bound. * @param obj the object reference to be bound. * @param bt Type of binding (as object or as context). * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ - void bindImpl(NameComponent n, org.omg.CORBA.Object obj, BindingType bt) - throws org.omg.CORBA.SystemException; + void bindImpl(NameComponent n, org.omg.CORBA.Object obj, BindingType bt) throws org.omg.CORBA.SystemException; /** - * Method which implements resolving the specified name, - * returning the type of the binding and the bound object reference. - * If the id and kind of the NameComponent are both empty, the initial - * naming context (i.e., the local root) must be returned. + * Method which implements resolving the specified name, returning the type of the binding and the bound object + * reference. If the id and kind of the NameComponent are both empty, the initial naming context (i.e., the local root) + * must be returned. + * * @param n a NameComponent which is the name to be resolved. * @param bth the BindingType as an out parameter. * @return the object reference bound under the supplied name. * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ - org.omg.CORBA.Object resolveImpl(NameComponent n,BindingTypeHolder bth) - throws org.omg.CORBA.SystemException; + org.omg.CORBA.Object resolveImpl(NameComponent n, BindingTypeHolder bth) throws org.omg.CORBA.SystemException; /** * Method which implements unbinding a name. + * * @param name name to unbind. * @return the object reference bound to the name, or null if not found. * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ - org.omg.CORBA.Object unbindImpl(NameComponent name) - throws org.omg.CORBA.SystemException; + org.omg.CORBA.Object unbindImpl(NameComponent name) throws org.omg.CORBA.SystemException; /** - * Method which implements listing the contents of this - * NamingContext and return a binding list and a binding iterator. + * Method which implements listing the contents of this NamingContext and return a binding list and a binding iterator. + * * @param how_many The number of requested bindings in the BindingList. * @param bl The BindingList as an out parameter. * @param bi The BindingIterator as an out parameter. * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ - void listImpl(int how_many, BindingListHolder bl, BindingIteratorHolder bi) - throws org.omg.CORBA.SystemException; + void listImpl(int how_many, BindingListHolder bl, BindingIteratorHolder bi) throws org.omg.CORBA.SystemException; /** * Method which implements creating a new NamingContext. - * @return an object reference for a new NamingContext object implemented - * by this Name Server. + * + * @return an object reference for a new NamingContext object implemented by this Name Server. * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ - NamingContext newContextImpl() - throws org.omg.CORBA.SystemException; + NamingContext newContextImpl() throws org.omg.CORBA.SystemException; /** * Method which implements destroying this NamingContext. + * * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ - void destroyImpl() - throws org.omg.CORBA.SystemException; - + void destroyImpl() throws org.omg.CORBA.SystemException; + /** - * Method which returns whether this NamingContext is empty - * or not. + * Method which returns whether this NamingContext is empty or not. + * * @return true if this NamingContext contains no bindings. */ boolean isEmptyImpl(); - POA getNSPOA( ); + POA getNSPOA(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingContextImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingContextImpl.java index cabe1b18c..642bcd9fb 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingContextImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingContextImpl.java @@ -35,7 +35,7 @@ import org.omg.CosNaming.NamingContextPackage.NotFound; import com.sun.corba.ee.impl.naming.namingutil.INSURLHandler; -import com.sun.corba.ee.spi.logging.NamingSystemException ; +import com.sun.corba.ee.spi.logging.NamingSystemException; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.trace.Naming; @@ -46,314 +46,250 @@ import org.omg.CosNaming.NamingContextPackage.NotFoundReason; /** - * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext - * interface, but does not implement the methods associated with - * maintaining the "table" of current bindings in a NamingContext. - * Instead, this implementation assumes that the derived implementation - * implements the NamingContextDataStore interface, which has the necessary - * methods. This allows multiple - * NamingContext implementations that differ in storage of the bindings, - * as well as implementations of interfaces derived from - * CosNaming::NamingContext that still reuses the implementation. + * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext interface, but does not implement the methods + * associated with maintaining the "table" of current bindings in a NamingContext. Instead, this implementation assumes + * that the derived implementation implements the NamingContextDataStore interface, which has the necessary methods. + * This allows multiple NamingContext implementations that differ in storage of the bindings, as well as implementations + * of interfaces derived from CosNaming::NamingContext that still reuses the implementation. *

- * The operations bind(), rebind(), bind_context() and rebind_context() - * are all really implemented by doBind(). resolve() is really implemented - * by doResolve(), unbind() by doUnbind(). list(), new_context() and - * destroy() uses the NamingContextDataStore interface directly. All the - * doX() methods are public static. - * They synchronize on the NamingContextDataStore object. + * The operations bind(), rebind(), bind_context() and rebind_context() are all really implemented by doBind(). + * resolve() is really implemented by doResolve(), unbind() by doUnbind(). list(), new_context() and destroy() uses the + * NamingContextDataStore interface directly. All the doX() methods are public static. They synchronize on the + * NamingContextDataStore object. *

- * An implementation a NamingContext must extend this class and implement - * the NamingContextDataStore interface with the operations: - * Bind(), Resolve(), - * Unbind(), List(), NewContext() and Destroy(). Calls - * to these methods are synchronized; these methods should - * therefore not be synchronized. + * An implementation a NamingContext must extend this class and implement the NamingContextDataStore interface with the + * operations: Bind(), Resolve(), Unbind(), List(), NewContext() and Destroy(). Calls to these methods are synchronized; + * these methods should therefore not be synchronized. */ @Naming -public abstract class NamingContextImpl - extends NamingContextExtPOA - implements NamingContextDataStore -{ +public abstract class NamingContextImpl extends NamingContextExtPOA implements NamingContextDataStore { - protected ORB orb ; + protected ORB orb; protected POA nsPOA; - private static final NamingSystemException wrapper = - NamingSystemException.self ; + private static final NamingSystemException wrapper = NamingSystemException.self; // The grammer for Parsing and Building Interoperable Stringified Names // are implemented in this class - private InterOperableNamingImpl insImpl; + private InterOperableNamingImpl insImpl; + /** - * Create a naming context servant. - * Runs the super constructor. + * Create a naming context servant. Runs the super constructor. + * * @param orb an ORB object. * @param poa the POA. * @exception java.lang.Exception a Java exception. */ public NamingContextImpl(ORB orb, POA poa) throws java.lang.Exception { super(); - this.orb = orb ; - insImpl = new InterOperableNamingImpl( ); + this.orb = orb; + insImpl = new InterOperableNamingImpl(); this.nsPOA = poa; } - public POA getNSPOA( ) { + public POA getNSPOA() { return nsPOA; } - + /** - * Bind an object under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * An exception is thrown if a binding with the supplied name already - * exists. If the - * object to be bound is a NamingContext it will not participate in - * a recursive resolve. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. + * Bind an object under a name in this NamingContext. If the name contains multiple (n) components, n-1 will be resolved + * in this NamingContext and the object bound in resulting NamingContext. An exception is thrown if a binding with the + * supplied name already exists. If the object to be bound is a NamingContext it will not participate in a recursive + * resolve. + * + * @param n a sequence of NameComponents which is the name under which the object will be bound. * @param obj the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could - * not proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the n-1 components of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is already bound under the supplied name. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #doBind */ @Naming public void bind(NameComponent[] n, org.omg.CORBA.Object obj) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { - if( obj == null ) { - throw wrapper.objectIsNull() ; + throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, + org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.AlreadyBound { + if (obj == null) { + throw wrapper.objectIsNull(); } // doBind implements all four flavors of binding NamingContextDataStore impl = this; - doBind(impl,n,obj,false,BindingType.nobject); + doBind(impl, n, obj, false, BindingType.nobject); } - /** - * Bind a NamingContext under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * An exception is thrown if a binding with the supplied name already - * exists. The NamingContext will participate in recursive resolving. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. + * Bind a NamingContext under a name in this NamingContext. If the name contains multiple (n) components, n-1 will be + * resolved in this NamingContext and the object bound in resulting NamingContext. An exception is thrown if a binding + * with the supplied name already exists. The NamingContext will participate in recursive resolving. + * + * @param n a sequence of NameComponents which is the name under which the object will be bound. * @param nc the NamingContect object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could - * not proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the n-1 components of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is already bound under the supplied name. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #doBind */ @Naming public void bind_context(NameComponent[] n, NamingContext nc) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { - if( nc == null ) { - wrapper.objectIsNull() ; + throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, + org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.AlreadyBound { + if (nc == null) { + wrapper.objectIsNull(); } // doBind implements all four flavors of binding NamingContextDataStore impl = this; - doBind(impl,n,nc,false,BindingType.ncontext); + doBind(impl, n, nc, false, BindingType.ncontext); } - + /** - * Bind an object under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * If a binding under the supplied name already exists it will be - * unbound first. If the - * object to be bound is a NamingContext it will not participate in - * a recursive resolve. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. + * Bind an object under a name in this NamingContext. If the name contains multiple (n) components, n-1 will be resolved + * in this NamingContext and the object bound in resulting NamingContext. If a binding under the supplied name already + * exists it will be unbound first. If the object to be bound is a NamingContext it will not participate in a recursive + * resolve. + * + * @param n a sequence of NameComponents which is the name under which the object will be bound. * @param obj the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the n-1 components of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #doBind */ @Naming - public void rebind(NameComponent[] n, org.omg.CORBA.Object obj) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - if( obj == null ) { - throw wrapper.objectIsNull() ; + public void rebind(NameComponent[] n, org.omg.CORBA.Object obj) throws org.omg.CosNaming.NamingContextPackage.NotFound, + org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { + if (obj == null) { + throw wrapper.objectIsNull(); } try { // doBind implements all four flavors of binding NamingContextDataStore impl = this; - doBind(impl,n,obj,true,BindingType.nobject); + doBind(impl, n, obj, true, BindingType.nobject); } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) { - throw wrapper.namingCtxRebindAlreadyBound( ex ) ; + throw wrapper.namingCtxRebindAlreadyBound(ex); } } /** - * Bind a NamingContext under a name in this NamingContext. If the name - * contains multiple (n) components, the first n-1 components will be - * resolved in this NamingContext and the object bound in resulting - * NamingContext. If a binding under the supplied name already exists it - * will be unbound first. The NamingContext will participate in recursive - * resolving. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. + * Bind a NamingContext under a name in this NamingContext. If the name contains multiple (n) components, the first n-1 + * components will be resolved in this NamingContext and the object bound in resulting NamingContext. If a binding under + * the supplied name already exists it will be unbound first. The NamingContext will participate in recursive resolving. + * + * @param n a sequence of NameComponents which is the name under which the object will be bound. * @param nc the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the n-1 components of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #doBind */ @Naming - public void rebind_context(NameComponent[] n, NamingContext nc) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - if( nc == null ) { - throw wrapper.objectIsNull() ; + public void rebind_context(NameComponent[] n, NamingContext nc) throws org.omg.CosNaming.NamingContextPackage.NotFound, + org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { + if (nc == null) { + throw wrapper.objectIsNull(); } try { // doBind implements all four flavors of binding NamingContextDataStore impl = this; - doBind(impl,n,nc,true,BindingType.ncontext); - } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) { - throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ; + doBind(impl, n, nc, true, BindingType.ncontext); + } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) { + throw wrapper.namingCtxRebindctxAlreadyBound(ex); } } /** - * Resolve a name in this NamingContext and return the object reference - * bound to the name. If the name contains multiple (n) components, - * the first component will be resolved in this NamingContext and the - * remaining components resolved in the resulting NamingContext, provided - * that the NamingContext bound to the first component of the name was - * bound with bind_context(). + * Resolve a name in this NamingContext and return the object reference bound to the name. If the name contains multiple + * (n) components, the first component will be resolved in this NamingContext and the remaining components resolved in + * the resulting NamingContext, provided that the NamingContext bound to the first component of the name was bound with + * bind_context(). + * * @param n a sequence of NameComponents which is the name to be resolved. * @return the object reference bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the n-1 components of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #doResolve */ @Naming - public org.omg.CORBA.Object resolve(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { + public org.omg.CORBA.Object resolve(NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.NotFound, + org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { // doResolve actually resolves NamingContextDataStore impl = this; - return doResolve(impl,n); + return doResolve(impl, n); } - /** - * Remove a binding from this NamingContext. If the name contains - * multiple (n) components, the first n-1 components will be resolved - * from this NamingContext and the final component unbound in - * the resulting NamingContext. + * Remove a binding from this NamingContext. If the name contains multiple (n) components, the first n-1 components will + * be resolved from this NamingContext and the final component unbound in the resulting NamingContext. + * * @param n a sequence of NameComponents which is the name to be unbound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the n-1 components of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #doUnbind */ @Naming - public void unbind(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { + public void unbind(NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.NotFound, + org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { // doUnbind actually unbinds NamingContextDataStore impl = this; - doUnbind(impl,n); + doUnbind(impl, n); } /** - * List the contents of this NamingContest. A sequence of bindings - * is returned (a BindingList) containing up to the number of requested - * bindings, and a BindingIterator object reference is returned for - * iterating over the remaining bindings. + * List the contents of this NamingContest. A sequence of bindings is returned (a BindingList) containing up to the + * number of requested bindings, and a BindingIterator object reference is returned for iterating over the remaining + * bindings. + * * @param how_many The number of requested bindings in the BindingList. * @param bl The BindingList as an out parameter. * @param bi The BindingIterator as an out parameter. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see BindingListHolder * @see BindingIteratorImpl */ @Naming - public void list(int how_many, BindingListHolder bl, - BindingIteratorHolder bi) - { + public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi) { // List actually generates the list NamingContextDataStore impl = this; synchronized (impl) { - impl.listImpl(how_many,bl,bi); + impl.listImpl(how_many, bl, bi); } } /** * Create a NamingContext object and return its object reference. - * @return an object reference for a new NamingContext object implemented - * by this Name Server. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * + * @return an object reference for a new NamingContext object implemented by this Name Server. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ @Naming - public synchronized NamingContext new_context() - { + public synchronized NamingContext new_context() { NamingContextDataStore impl = this; synchronized (impl) { return impl.newContextImpl(); @@ -361,39 +297,33 @@ public synchronized NamingContext new_context() } /** - * Create a new NamingContext, bind it in this Naming Context and return - * its object reference. This is equivalent to using new_context() followed - * by bind_context() with the supplied name and the object reference for - * the newly created NamingContext. + * Create a new NamingContext, bind it in this Naming Context and return its object reference. This is equivalent to + * using new_context() followed by bind_context() with the supplied name and the object reference for the newly created + * NamingContext. + * * @param n a sequence of NameComponents which is the name to be unbound. - * @return an object reference for a new NamingContext object implemented - * by this Name Server, bound to the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @return an object reference for a new NamingContext object implemented by this Name Server, bound to the supplied + * name. + * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is already bound under the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the n-1 components of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #new_context * @see #bind_context */ @Naming - public NamingContext bind_new_context(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.AlreadyBound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { + public NamingContext bind_new_context(NameComponent[] n) + throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.AlreadyBound, + org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { NamingContext nc = null; NamingContext rnc = null; try { nc = this.new_context(); - this.bind_context(n,nc); + this.bind_context(n, nc); rnc = nc; nc = null; } finally { @@ -402,8 +332,7 @@ public NamingContext bind_new_context(NameComponent[] n) nc.destroy(); } } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) { - throw new CannotProceed( "Old naming context is not empty", - nc, n) ; + throw new CannotProceed("Old naming context is not empty", nc, n); } } @@ -411,17 +340,13 @@ public NamingContext bind_new_context(NameComponent[] n) } /** - * Destroy this NamingContext object. If this NamingContext contains - * no bindings, the NamingContext is deleted. - * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This - * NamingContext is not empty (i.e., contains bindings). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * Destroy this NamingContext object. If this NamingContext contains no bindings, the NamingContext is deleted. + * + * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext is not empty (i.e., contains bindings). + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ @Naming - public void destroy() - throws org.omg.CosNaming.NamingContextPackage.NotEmpty - { + public void destroy() throws org.omg.CosNaming.NamingContextPackage.NotEmpty { NamingContextDataStore impl = this; synchronized (impl) { if (impl.isEmptyImpl()) { @@ -434,32 +359,25 @@ public void destroy() } /** - * Implements all four flavors of binding. It uses Resolve() to - * check if a binding already exists (for bind and bind_context), and - * unbind() to ensure that a binding does not already exist. - * If the length of the name is 1, then Bind() is called with - * the name and the object to bind. Otherwise, the first component - * of the name is resolved in this NamingContext and the appropriate - * form of bind passed to the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. + * Implements all four flavors of binding. It uses Resolve() to check if a binding already exists (for bind and + * bind_context), and unbind() to ensure that a binding does not already exist. If the length of the name is 1, then + * Bind() is called with the name and the object to bind. Otherwise, the first component of the name is resolved in this + * NamingContext and the appropriate form of bind passed to the resulting NamingContext. This method is static for + * maximal reuse - even for extended naming context implementations where the recursive semantics still apply. + * * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. + * @param n a sequence of NameComponents which is the name under which the object will be bound. * @param obj the object reference to be bound. * @param rebind Replace an existing binding or not. * @param bt Type of binding (as object or as context). - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not * proceed - * in resolving the first component of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not * proceed in resolving the first component + * of the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is already bound under the supplied name. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. * @see #resolve * @see #unbind * @see #bind @@ -468,65 +386,57 @@ public void destroy() * @see #rebind_context */ @Naming - public static void doBind(NamingContextDataStore impl, - NameComponent[] n, - org.omg.CORBA.Object obj, - boolean rebind, - org.omg.CosNaming.BindingType bt) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { + public static void doBind(NamingContextDataStore impl, NameComponent[] n, org.omg.CORBA.Object obj, boolean rebind, + org.omg.CosNaming.BindingType bt) + throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, + org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.AlreadyBound { if (n.length < 1) { throw new InvalidName(); } - + if (n.length == 1) { - if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) { + if ((n[0].id.length() == 0) && (n[0].kind.length() == 0)) { throw new InvalidName(); } synchronized (impl) { BindingTypeHolder bth = new BindingTypeHolder(); if (rebind) { - org.omg.CORBA.Object objRef = impl.resolveImpl( n[0], bth ); - if( objRef != null ) { - // Refer Naming Service Doc:00-11-01 section 2.2.3.4 + org.omg.CORBA.Object objRef = impl.resolveImpl(n[0], bth); + if (objRef != null) { + // Refer Naming Service Doc:00-11-01 section 2.2.3.4 // If there is an object already bound with the name - // and the binding type is not ncontext a NotFound + // and the binding type is not ncontext a NotFound // Exception with a reason of not a context has to be // raised. // Fix for bug Id: 4384628 - if ( bth.value.value() == BindingType.nobject.value() ){ - if ( bt.value() == BindingType.ncontext.value() ) { - throw new NotFound( - NotFoundReason.not_context, n); + if (bth.value.value() == BindingType.nobject.value()) { + if (bt.value() == BindingType.ncontext.value()) { + throw new NotFound(NotFoundReason.not_context, n); } } else { // Previously a Context was bound and now trying to // bind Object. It is invalid. - if ( bt.value() == BindingType.nobject.value() ) { - throw new NotFound( - NotFoundReason.not_object, n); + if (bt.value() == BindingType.nobject.value()) { + throw new NotFound(NotFoundReason.not_object, n); } } impl.unbindImpl(n[0]); } } else { - if (impl.resolveImpl(n[0],bth) != null) { + if (impl.resolveImpl(n[0], bth) != null) { throw new AlreadyBound(); } } - + // Now there are no other bindings under this name - impl.bindImpl(n[0],obj,bt); + impl.bindImpl(n[0], obj, bt); } } else { - NamingContext context = resolveFirstAsContext(impl,n); + NamingContext context = resolveFirstAsContext(impl, n); NameComponent[] tail = new NameComponent[n.length - 1]; - System.arraycopy(n,1,tail,0,n.length-1); + System.arraycopy(n, 1, tail, 0, n.length - 1); switch (bt.value()) { case BindingType._nobject: @@ -537,121 +447,104 @@ public static void doBind(NamingContextDataStore impl, } break; case BindingType._ncontext: - NamingContext objContext = (NamingContext)obj; + NamingContext objContext = (NamingContext) obj; if (rebind) { - context.rebind_context(tail, objContext); - } - else { - context.bind_context(tail, objContext); - } + context.rebind_context(tail, objContext); + } else { + context.bind_context(tail, objContext); + } break; default: - throw wrapper.namingCtxBadBindingtype() ; + throw wrapper.namingCtxBadBindingtype(); } } } /** - * Implements resolving names in this NamingContext. The first component - * of the supplied name is resolved in this NamingContext by calling - * Resolve(). If there are no more components in the name, the - * resulting object reference is returned. Otherwise, the resulting object - * reference must have been bound as a context and be narrowable to - * a NamingContext. If this is the case, the remaining - * components of the name is resolved in the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. - * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name to be resolved. - * @return the object reference bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed - * in resolving the first component of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied - * name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system - * exceptions. - * @see #resolve - */ + * Implements resolving names in this NamingContext. The first component of the supplied name is resolved in this + * NamingContext by calling Resolve(). If there are no more components in the name, the resulting object reference is + * returned. Otherwise, the resulting object reference must have been bound as a context and be narrowable to a + * NamingContext. If this is the case, the remaining components of the name is resolved in the resulting NamingContext. + * This method is static for maximal reuse - even for extended naming context implementations where the recursive + * semantics still apply. + * + * @param impl an implementation of NamingContextDataStore + * @param n a sequence of NameComponents which is the name to be resolved. + * @return the object reference bound under the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the first component of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. + * @see #resolve + */ @Naming - public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl, - NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { + public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl, NameComponent[] n) + throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, + org.omg.CosNaming.NamingContextPackage.InvalidName { org.omg.CORBA.Object obj; BindingTypeHolder bth = new BindingTypeHolder(); - + if (n.length < 1) { throw new InvalidName(); } if (n.length == 1) { synchronized (impl) { - obj = impl.resolveImpl(n[0],bth); + obj = impl.resolveImpl(n[0], bth); } if (obj == null) { - throw new NotFound(NotFoundReason.missing_node,n); + throw new NotFound(NotFoundReason.missing_node, n); } return obj; } else { - if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0) ) { + if ((n[1].id.length() == 0) && (n[1].kind.length() == 0)) { throw new InvalidName(); } - NamingContext context = resolveFirstAsContext(impl,n); - NameComponent[] tail = new NameComponent[n.length -1]; - System.arraycopy(n,1,tail,0,n.length-1); + NamingContext context = resolveFirstAsContext(impl, n); + NameComponent[] tail = new NameComponent[n.length - 1]; + System.arraycopy(n, 1, tail, 0, n.length - 1); try { // First try to resolve using the local call, this should work // most of the time unless there are federated naming contexts. - Servant servant = impl.getNSPOA().reference_to_servant( - context ); - return doResolve(((NamingContextDataStore)servant), tail) ; - } catch( Exception e ) { + Servant servant = impl.getNSPOA().reference_to_servant(context); + return doResolve(((NamingContextDataStore) servant), tail); + } catch (Exception e) { return context.resolve(tail); } } } /** - * Implements unbinding bound names in this NamingContext. If the - * name contains only one component, the name is unbound in this - * NamingContext using Unbind(). Otherwise, the first component - * of the name is resolved in this NamingContext and - * unbind passed to the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. - * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name to be unbound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see #resolve - */ + * Implements unbinding bound names in this NamingContext. If the name contains only one component, the name is unbound + * in this NamingContext using Unbind(). Otherwise, the first component of the name is resolved in this NamingContext + * and unbind passed to the resulting NamingContext. This method is static for maximal reuse - even for extended naming + * context implementations where the recursive semantics still apply. + * + * @param impl an implementation of NamingContextDataStore + * @param n a sequence of NameComponents which is the name to be unbound. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple components was supplied, but the + * first component could not be resolved. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed in resolving the n-1 components of + * the supplied name. + * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name is invalid (i.e., has length less + * than 1). + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. + * @see #resolve + */ @Naming - public static void doUnbind(NamingContextDataStore impl, - NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { + public static void doUnbind(NamingContextDataStore impl, NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.NotFound, + org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { if (n.length < 1) { throw new InvalidName(); } if (n.length == 1) { - if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) { + if ((n[0].id.length() == 0) && (n[0].kind.length() == 0)) { throw new InvalidName(); } @@ -659,116 +552,105 @@ public static void doUnbind(NamingContextDataStore impl, synchronized (impl) { objRef = impl.unbindImpl(n[0]); } - + if (objRef == null) { throw new NotFound(NotFoundReason.missing_node, n); } } else { - NamingContext context = resolveFirstAsContext(impl,n); + NamingContext context = resolveFirstAsContext(impl, n); NameComponent[] tail = new NameComponent[n.length - 1]; - System.arraycopy(n,1,tail,0,n.length-1); + System.arraycopy(n, 1, tail, 0, n.length - 1); context.unbind(tail); } } /** - * Implements resolving a NameComponent in this context and - * narrowing it to CosNaming::NamingContext. It will throw appropriate - * exceptions if not found or not narrowable. - * @param impl an implementation of NamingContextDataStore - * @param n a NameComponents which is the name to be found. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound The - * first component could not be resolved. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see #resolve - * @return a naming context - */ + * Implements resolving a NameComponent in this context and narrowing it to CosNaming::NamingContext. It will throw + * appropriate exceptions if not found or not narrowable. + * + * @param impl an implementation of NamingContextDataStore + * @param n a NameComponents which is the name to be found. + * @exception org.omg.CosNaming.NamingContextPackage.NotFound The first component could not be resolved. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. + * @see #resolve + * @return a naming context + */ @Naming - protected static NamingContext resolveFirstAsContext( - NamingContextDataStore impl, NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound { + protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl, NameComponent[] n) + throws org.omg.CosNaming.NamingContextPackage.NotFound { org.omg.CORBA.Object topRef; BindingTypeHolder bth = new BindingTypeHolder(); NamingContext context; - + synchronized (impl) { - topRef = impl.resolveImpl(n[0],bth); + topRef = impl.resolveImpl(n[0], bth); if (topRef == null) { - throw new NotFound(NotFoundReason.missing_node,n); + throw new NotFound(NotFoundReason.missing_node, n); } } - + if (bth.value != BindingType.ncontext) { - throw new NotFound(NotFoundReason.not_context,n); + throw new NotFound(NotFoundReason.not_context, n); } - + try { context = NamingContextHelper.narrow(topRef); } catch (org.omg.CORBA.BAD_PARAM ex) { - throw new NotFound(NotFoundReason.not_context,n); + throw new NotFound(NotFoundReason.not_context, n); } return context; } - - /** - * This operation creates a stringified name from the array of Name - * components. - * @param n Name of the object - * @return the object name as a single string - * @throws org.omg.CosNaming.NamingContextPackage.InvalidName - * Indicates the name does not identify a binding. - * - */ + /** + * This operation creates a stringified name from the array of Name components. + * + * @param n Name of the object + * @return the object name as a single string + * @throws org.omg.CosNaming.NamingContextPackage.InvalidName Indicates the name does not identify a binding. + * + */ @Naming - public String to_string(org.omg.CosNaming.NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - { - if ( (n == null ) || (n.length == 0) ) { + public String to_string(org.omg.CosNaming.NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.InvalidName { + if ((n == null) || (n.length == 0)) { throw new InvalidName(); } - String theStringifiedName = insImpl.convertToString( n ); + String theStringifiedName = insImpl.convertToString(n); if (theStringifiedName == null) { throw new InvalidName(); } - + return theStringifiedName; } - - /** - * This operation converts a Stringified Name into an equivalent array - * of Name Components. - * @param sn Stringified Name of the object

- * @return an array of name components - * @throws org.omg.CosNaming.NamingContextPackage.InvalidName if the name is invalid - * - */ + /** + * This operation converts a Stringified Name into an equivalent array of Name Components. + * + * @param sn Stringified Name of the object + *

+ * @return an array of name components + * @throws org.omg.CosNaming.NamingContextPackage.InvalidName if the name is invalid + * + */ @Naming @Override - public org.omg.CosNaming.NameComponent[] to_name(String sn) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - { - if ((sn == null ) || (sn.length() == 0)) { + public org.omg.CosNaming.NameComponent[] to_name(String sn) throws org.omg.CosNaming.NamingContextPackage.InvalidName { + if ((sn == null) || (sn.length() == 0)) { throw new InvalidName(); } - org.omg.CosNaming.NameComponent[] theNameComponents = - insImpl.convertToNameComponent( sn ); - if (( theNameComponents == null ) || (theNameComponents.length == 0)) { + org.omg.CosNaming.NameComponent[] theNameComponents = insImpl.convertToNameComponent(sn); + if ((theNameComponents == null) || (theNameComponents.length == 0)) { throw new InvalidName(); } for (NameComponent theNameComponent : theNameComponents) { - if (((theNameComponent.id == null) - || (theNameComponent.id.length() == 0)) - && ((theNameComponent.kind == null) - || (theNameComponent.kind.length() == 0))) { + if (((theNameComponent.id == null) || (theNameComponent.id.length() == 0)) + && ((theNameComponent.kind == null) || (theNameComponent.kind.length() == 0))) { throw new InvalidName(); } } @@ -776,36 +658,35 @@ public org.omg.CosNaming.NameComponent[] to_name(String sn) return theNameComponents; } - /** - * This operation creates a URL based "iiopname://" format name - * from the Stringified Name of the object. - * @param addr internet based address of the host machine where - * Name Service is running

- * @param sn Stringified Name of the object

- * @return a url string - * @throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress if the provided address is invalid - * @throws org.omg.CosNaming.NamingContextPackage.InvalidName if the provided Name is invalid - * - */ + /** + * This operation creates a URL based "iiopname://" format name from the Stringified Name of the object. + * + * @param addr internet based address of the host machine where Name Service is running + *

+ * @param sn Stringified Name of the object + *

+ * @return a url string + * @throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress if the provided address is invalid + * @throws org.omg.CosNaming.NamingContextPackage.InvalidName if the provided Name is invalid + * + */ @Naming public String to_url(String addr, String sn) - throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - if ((sn == null ) || (sn.length() == 0)) { + throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress, org.omg.CosNaming.NamingContextPackage.InvalidName { + if ((sn == null) || (sn.length() == 0)) { throw new InvalidName(); } - if( addr == null ) { + if (addr == null) { throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress(); } String urlBasedAddress; - urlBasedAddress = insImpl.createURLBasedAddress( addr, sn ); + urlBasedAddress = insImpl.createURLBasedAddress(addr, sn); try { - INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress ); - } catch( BAD_PARAM e ) { + INSURLHandler.getINSURLHandler().parseURL(urlBasedAddress); + } catch (BAD_PARAM e) { throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress(); } @@ -813,36 +694,30 @@ public String to_url(String addr, String sn) } /** - * This operation resolves the Stringified name into the object - * reference. - * @param sn Stringified Name of the object - * @return an object - * @exception org.omg.CosNaming.NamingContextPackage.NotFound - * Indicates there is no object reference for the given name. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed - * Indicates that the given compound name is incorrect + * This operation resolves the Stringified name into the object reference. + * + * @param sn Stringified Name of the object + * @return an object + * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates there is no object reference for the given name. + * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the given compound name is incorrect * @throws org.omg.CosNaming.NamingContextPackage.InvalidName if the provided Name was invalid * */ @Naming - public org.omg.CORBA.Object resolve_str(String sn) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { + public org.omg.CORBA.Object resolve_str(String sn) throws org.omg.CosNaming.NamingContextPackage.NotFound, + org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { org.omg.CORBA.Object theObject; if ((sn == null) || (sn.length() == 0)) { throw new InvalidName(); } - org.omg.CosNaming.NameComponent[] theNameComponents = - insImpl.convertToNameComponent( sn ); + org.omg.CosNaming.NameComponent[] theNameComponents = insImpl.convertToNameComponent(sn); - if ((theNameComponents == null) || (theNameComponents.length == 0 )) { + if ((theNameComponents == null) || (theNameComponents.length == 0)) { throw new InvalidName(); } - theObject = resolve( theNameComponents ); + theObject = resolve(theNameComponents); return theObject; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingUtils.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingUtils.java index c78a70582..5ba26ea5f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingUtils.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/NamingUtils.java @@ -23,21 +23,21 @@ import java.io.*; import org.omg.CosNaming.NameComponent; - public class NamingUtils { // Do not instantiate this class - private NamingUtils() {}; + private NamingUtils() { + }; /** - * Debug flag which must be true for debug streams to be created and - * dprint output to be generated. - */ + * Debug flag which must be true for debug streams to be created and dprint output to be generated. + */ public static boolean debug = false; /** * Prints the message to the debug stream if debugging is enabled. + * * @param msg the debug message to print. - */ + */ public static void dprint(String msg) { if (debug && debugStream != null) debugStream.println(msg); @@ -45,8 +45,9 @@ public static void dprint(String msg) { /** * Prints the message to the error stream (System.err is default). + * * @param msg the error message to print. - */ + */ public static void errprint(String msg) { if (errStream != null) errStream.println(msg); @@ -56,6 +57,7 @@ public static void errprint(String msg) { /** * Prints the stacktrace of the supplied exception to the error stream. + * * @param e any Java exception. */ public static void printException(java.lang.Exception e) { @@ -67,52 +69,46 @@ public static void printException(java.lang.Exception e) { /** * Create a debug print stream to the supplied log file. + * * @param logFile the file to which debug output will go. * @exception IOException thrown if the file cannot be opened for output. - */ - public static void makeDebugStream(File logFile) - throws java.io.IOException { + */ + public static void makeDebugStream(File logFile) throws java.io.IOException { // Create an outputstream for debugging - java.io.OutputStream logOStream = - new java.io.FileOutputStream(logFile); - java.io.DataOutputStream logDStream = - new java.io.DataOutputStream(logOStream); + java.io.OutputStream logOStream = new java.io.FileOutputStream(logFile); + java.io.DataOutputStream logDStream = new java.io.DataOutputStream(logOStream); debugStream = new java.io.PrintStream(logDStream); - + // Emit first message debugStream.println("Debug Stream Enabled."); } - + /** * Create a error print stream to the supplied file. + * * @param errFile the file to which error messages will go. * @exception IOException thrown if the file cannot be opened for output. - */ - public static void makeErrStream(File errFile) - throws java.io.IOException { + */ + public static void makeErrStream(File errFile) throws java.io.IOException { if (debug) { // Create an outputstream for errors - java.io.OutputStream errOStream = - new java.io.FileOutputStream(errFile); - java.io.DataOutputStream errDStream = - new java.io.DataOutputStream(errOStream); + java.io.OutputStream errOStream = new java.io.FileOutputStream(errFile); + java.io.DataOutputStream errDStream = new java.io.DataOutputStream(errOStream); errStream = new java.io.PrintStream(errDStream); dprint("Error stream setup completed."); } - } - + } /** - * A utility method that takes Array of NameComponent and converts - * into a directory structured name in the format of /id1.kind1/id2.kind2.. - * This is used mainly for Logging. + * A utility method that takes Array of NameComponent and converts into a directory structured name in the format of + * /id1.kind1/id2.kind2.. This is used mainly for Logging. */ - static String getDirectoryStructuredName( NameComponent[] name ) { - StringBuilder directoryStructuredName = new StringBuilder("/"); + static String getDirectoryStructuredName(NameComponent[] name) { + StringBuilder directoryStructuredName = new StringBuilder("/"); for (NameComponent component : name) { directoryStructuredName.append(component.id).append(".").append(component.kind); } - return directoryStructuredName.toString( ); + return directoryStructuredName.toString(); } /** @@ -123,5 +119,5 @@ static String getDirectoryStructuredName( NameComponent[] name ) { /** * The error printstream. */ - public static java.io.PrintStream errStream; + public static java.io.PrintStream errStream; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientBindingIterator.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientBindingIterator.java index 2da98cfb9..b1923b6d7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientBindingIterator.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientBindingIterator.java @@ -35,48 +35,42 @@ import java.util.Iterator; /** - * Class TransientBindingIterator implements the abstract methods - * defined by BindingIteratorImpl, to use with the TransientNamingContext - * implementation of the NamingContextImpl. The TransientBindingIterator - * implementation receives a hash table of InternalBindingValues, and uses - * an Enumeration to iterate over the contents of the hash table. + * Class TransientBindingIterator implements the abstract methods defined by BindingIteratorImpl, to use with the + * TransientNamingContext implementation of the NamingContextImpl. The TransientBindingIterator implementation receives + * a hash table of InternalBindingValues, and uses an Enumeration to iterate over the contents of the hash table. + * * @see BindingIteratorImpl * @see TransientNamingContext */ -public class TransientBindingIterator extends BindingIteratorImpl -{ +public class TransientBindingIterator extends BindingIteratorImpl { // There is only one POA used for both TransientNamingContext and // TransientBindingIteraor servants. private POA nsPOA; + /** * Constructs a new TransientBindingIterator object. + * * @param orb a org.omg.CORBA.ORB object. - * @param aTable A hashtable containing InternalBindingValues which is - * the content of the TransientNamingContext. + * @param aTable A hashtable containing InternalBindingValues which is the content of the TransientNamingContext. * @param thePOA the POA to use. * @throws java.lang.Exception a Java exception. - */ - public TransientBindingIterator(ORB orb, - Map aTable, - POA thePOA ) - throws java.lang.Exception - { + */ + public TransientBindingIterator(ORB orb, Map aTable, POA thePOA) throws java.lang.Exception { super(orb); bindingMap = aTable; - bindingIterator = aTable.values().iterator() ; + bindingIterator = aTable.values().iterator(); currentSize = this.bindingMap.size(); this.nsPOA = thePOA; } /** - * Returns the next binding in the NamingContext. Uses the enumeration - * object to determine if there are more bindings and if so, returns - * the next binding from the InternalBindingValue. - * @param b The Binding as an out parameter. - * @return true if there were more bindings. - */ - final public boolean nextOneImpl(org.omg.CosNaming.BindingHolder b) - { + * Returns the next binding in the NamingContext. Uses the enumeration object to determine if there are more bindings + * and if so, returns the next binding from the InternalBindingValue. + * + * @param b The Binding as an out parameter. + * @return true if there were more bindings. + */ + final public boolean nextOneImpl(org.omg.CosNaming.BindingHolder b) { // If there are more elements get the next element boolean hasMore = bindingIterator.hasNext(); if (hasMore) { @@ -84,26 +78,24 @@ final public boolean nextOneImpl(org.omg.CosNaming.BindingHolder b) currentSize--; } else { // Return empty but marshalable binding - b.value = new Binding(new NameComponent[0],BindingType.nobject); + b.value = new Binding(new NameComponent[0], BindingType.nobject); } return hasMore; } /** * Destroys this BindingIterator by disconnecting from the ORB - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ - final public void destroyImpl() - { + final public void destroyImpl() { // Remove the object from the Active Object Map. try { - byte[] objectId = nsPOA.servant_to_id( this ); - if( objectId != null ) { - nsPOA.deactivate_object( objectId ); + byte[] objectId = nsPOA.servant_to_id(this); + if (objectId != null) { + nsPOA.deactivate_object(objectId); } - } - catch( Exception e ) { + } catch (Exception e) { NamingUtils.errprint("BindingIterator.Destroy():caught exception:"); NamingUtils.printException(e); } @@ -111,13 +103,14 @@ final public void destroyImpl() /** * Returns the remaining number of elements in the iterator. - * @return the remaining number of elements in the iterator. + * + * @return the remaining number of elements in the iterator. */ public final int remainingElementsImpl() { return currentSize; } private int currentSize; - private Map bindingMap; + private Map bindingMap; private Iterator bindingIterator; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientNameServer.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientNameServer.java index b23033af0..a60ed6da7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientNameServer.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientNameServer.java @@ -29,48 +29,43 @@ import com.sun.corba.ee.spi.trace.Naming; /** - * Class TransientNameServer is a standalone application which - * implements a transient name service. It uses the TransientNameService - * class for the name service implementation, and the BootstrapServer - * for implementing bootstrapping, i.e., to get the initial NamingContext. + * Class TransientNameServer is a standalone application which implements a transient name service. It uses the + * TransientNameService class for the name service implementation, and the BootstrapServer for implementing + * bootstrapping, i.e., to get the initial NamingContext. *

- * The BootstrapServer uses a Properties object specify the initial service - * object references supported; such as Properties object is created containing - * only a "NameService" entry together with the stringified object reference - * for the initial NamingContext. The BootstrapServer's listening port - * is set by first checking the supplied arguments to the name server - * (-ORBInitialPort), and if not set, defaults to the standard port number. - * The BootstrapServer is created supplying the Properties object, using no - * external File object for storage, and the derived initial port number. + * The BootstrapServer uses a Properties object specify the initial service object references supported; such as + * Properties object is created containing only a "NameService" entry together with the stringified object reference for + * the initial NamingContext. The BootstrapServer's listening port is set by first checking the supplied arguments to + * the name server (-ORBInitialPort), and if not set, defaults to the standard port number. The BootstrapServer is + * created supplying the Properties object, using no external File object for storage, and the derived initial port + * number. + * * @see com.sun.corba.se.internal.CosNaming.BootstrapServer */ @Naming -public class TransientNameServer -{ - static private boolean debug = false ; - private static final NamingSystemException wrapper = - NamingSystemException.self ; +public class TransientNameServer { + static private boolean debug = false; + private static final NamingSystemException wrapper = NamingSystemException.self; @Naming - private static org.omg.CORBA.Object initializeRootNamingContext( ORB orb ) { + private static org.omg.CORBA.Object initializeRootNamingContext(ORB orb) { org.omg.CORBA.Object rootContext = null; try { - com.sun.corba.ee.spi.orb.ORB coreORB = - (com.sun.corba.ee.spi.orb.ORB)orb ; - - TransientNameService tns = new TransientNameService(coreORB ); + com.sun.corba.ee.spi.orb.ORB coreORB = (com.sun.corba.ee.spi.orb.ORB) orb; + + TransientNameService tns = new TransientNameService(coreORB); return tns.initialNamingContext(); } catch (org.omg.CORBA.SystemException e) { - throw wrapper.transNsCannotCreateInitialNcSys( e ) ; + throw wrapper.transNsCannotCreateInitialNcSys(e); } catch (Exception e) { - throw wrapper.transNsCannotCreateInitialNc( e ) ; + throw wrapper.transNsCannotCreateInitialNc(e); } } /** - * Main startup routine. It instantiates a TransientNameService - * object and a BootstrapServer object, and then allows invocations to - * happen. + * Main startup routine. It instantiates a TransientNameService object and a BootstrapServer object, and then allows + * invocations to happen. + * * @param args an array of strings representing the startup arguments. */ @Naming @@ -82,119 +77,107 @@ public static void main(String args[]) { int initialPort = 0; try { // Create an ORB object - Properties props = System.getProperties() ; + Properties props = System.getProperties(); - props.put( ORBConstants.ORB_SERVER_ID_PROPERTY, - ORBConstants.NAME_SERVICE_SERVER_ID ) ; - props.put( "org.omg.CORBA.ORBClass", - "com.sun.corba.ee.impl.orb.ORBImpl" ); + props.put(ORBConstants.ORB_SERVER_ID_PROPERTY, ORBConstants.NAME_SERVICE_SERVER_ID); + props.put("org.omg.CORBA.ORBClass", "com.sun.corba.ee.impl.orb.ORBImpl"); - String ips = null ; + String ips = null; try { - ips = System.getProperty( ORBConstants.INITIAL_PORT_PROPERTY ) ; - if (ips != null && ips.length() > 0 ) { + ips = System.getProperty(ORBConstants.INITIAL_PORT_PROPERTY); + if (ips != null && ips.length() > 0) { initialPort = java.lang.Integer.parseInt(ips); - if( initialPort == 0 ) { + if (initialPort == 0) { orbInitialPort0 = true; - throw wrapper.transientNameServerBadPort() ; + throw wrapper.transientNameServerBadPort(); } } - String hostName = - System.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ; + String hostName = System.getProperty(ORBConstants.INITIAL_HOST_PROPERTY); - if( hostName != null ) { + if (hostName != null) { invalidHostOption = true; - throw wrapper.transientNameServerBadHost() ; + throw wrapper.transientNameServerBadHost(); } } catch (java.lang.NumberFormatException e) { - wrapper.badInitialPortValue( ips, e ) ; + wrapper.badInitialPortValue(ips, e); } // Let arguments override - for (int i=0;i * The TransientNameService creates the initial NamingContext object. + * * @see NamingContextImpl * @see BindingIteratorImpl * @see TransientNamingContext * @see TransientBindingIterator */ @Naming -public class TransientNameService -{ - private static final NamingSystemException wrapper = - NamingSystemException.self ; +public class TransientNameService { + private static final NamingSystemException wrapper = NamingSystemException.self; /** - * Constructs a new TransientNameService, and creates an initial - * NamingContext, whose object - * reference can be obtained by the initialNamingContext method. + * Constructs a new TransientNameService, and creates an initial NamingContext, whose object reference can be obtained + * by the initialNamingContext method. + * * @param orb The ORB object - * @exception org.omg.CORBA.INITIALIZE Thrown if - * the TransientNameService cannot initialize. + * @exception org.omg.CORBA.INITIALIZE Thrown if the TransientNameService cannot initialize. */ - public TransientNameService(com.sun.corba.ee.spi.orb.ORB orb ) - throws org.omg.CORBA.INITIALIZE - { + public TransientNameService(com.sun.corba.ee.spi.orb.ORB orb) throws org.omg.CORBA.INITIALIZE { // Default constructor uses "NameService" as the key for the Root Naming // Context. If default constructor is used then INS's object key for // Transient Name Service is "NameService" - initialize( orb, "NameService" ); + initialize(orb, "NameService"); } /** - * Constructs a new TransientNameService, and creates an initial - * NamingContext, whose object - * reference can be obtained by the initialNamingContext method. + * Constructs a new TransientNameService, and creates an initial NamingContext, whose object reference can be obtained + * by the initialNamingContext method. + * * @param orb The ORB object * @param serviceName Stringified key used for INS Service registry - * @exception org.omg.CORBA.INITIALIZE Thrown if - * the TransientNameService cannot initialize. + * @exception org.omg.CORBA.INITIALIZE Thrown if the TransientNameService cannot initialize. */ - public TransientNameService(com.sun.corba.ee.spi.orb.ORB orb, - String serviceName ) throws org.omg.CORBA.INITIALIZE - { + public TransientNameService(com.sun.corba.ee.spi.orb.ORB orb, String serviceName) throws org.omg.CORBA.INITIALIZE { // This constructor gives the flexibility of providing the Object Key // for the Root Naming Context that is registered with INS. - initialize( orb, serviceName ); + initialize(orb, serviceName); } - - /** - * This method initializes Transient Name Service by associating Root - * context with POA and registering the root context with INS Object Keymap. + /** + * This method initializes Transient Name Service by associating Root context with POA and registering the root context + * with INS Object Keymap. */ @Naming - private void initialize( com.sun.corba.ee.spi.orb.ORB orb, - String nameServiceName ) - throws org.omg.CORBA.INITIALIZE - { + private void initialize(com.sun.corba.ee.spi.orb.ORB orb, String nameServiceName) throws org.omg.CORBA.INITIALIZE { try { - POA rootPOA = (POA) orb.resolve_initial_references( - ORBConstants.ROOT_POA_NAME ); + POA rootPOA = (POA) orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME); rootPOA.the_POAManager().activate(); int i = 0; Policy[] poaPolicy = new Policy[3]; - poaPolicy[i++] = rootPOA.create_lifespan_policy( - LifespanPolicyValue.TRANSIENT); - poaPolicy[i++] = rootPOA.create_id_assignment_policy( - IdAssignmentPolicyValue.SYSTEM_ID); - poaPolicy[i++] = rootPOA.create_servant_retention_policy( - ServantRetentionPolicyValue.RETAIN); + poaPolicy[i++] = rootPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT); + poaPolicy[i++] = rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID); + poaPolicy[i++] = rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN); - POA nsPOA = rootPOA.create_POA( "TNameService", null, poaPolicy ); - ObjectAdapter.class.cast( nsPOA ).setNameService(true); + POA nsPOA = rootPOA.create_POA("TNameService", null, poaPolicy); + ObjectAdapter.class.cast(nsPOA).setNameService(true); nsPOA.the_POAManager().activate(); // Create an initial context - TransientNamingContext initialContext = - new TransientNamingContext(orb, null, nsPOA); - byte[] rootContextId = nsPOA.activate_object( initialContext ); - initialContext.localRoot = - nsPOA.id_to_reference( rootContextId ); + TransientNamingContext initialContext = new TransientNamingContext(orb, null, nsPOA); + byte[] rootContextId = nsPOA.activate_object(initialContext); + initialContext.localRoot = nsPOA.id_to_reference(rootContextId); theInitialNamingContext = initialContext.localRoot; - orb.register_initial_reference( nameServiceName, - theInitialNamingContext ); + orb.register_initial_reference(nameServiceName, theInitialNamingContext); } catch (org.omg.CORBA.SystemException e) { - throw wrapper.transNsCannotCreateInitialNcSys( e ) ; + throw wrapper.transNsCannotCreateInitialNcSys(e); } catch (Exception e) { - throw wrapper.transNsCannotCreateInitialNc( e ) ; - } + throw wrapper.transNsCannotCreateInitialNc(e); + } } - /** * Return the initial NamingContext. + * * @return the object reference for the initial NamingContext. */ - public org.omg.CORBA.Object initialNamingContext() - { + public org.omg.CORBA.Object initialNamingContext() { return theInitialNamingContext; } - // The initial naming context for this name service private org.omg.CORBA.Object theInitialNamingContext; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientNamingContext.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientNamingContext.java index 7feba0715..4e871b3c9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientNamingContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/cosnaming/TransientNamingContext.java @@ -36,29 +36,22 @@ import com.sun.corba.ee.spi.logging.NamingSystemException; import com.sun.corba.ee.spi.trace.Naming; - /** - * Class TransientNamingContext implements the methods defined - * by NamingContextDataStore, and extends the NamingContextImpl class to - * provide a servant implementation of CosNaming::NamingContext. - * The TransientNamingContext uses a hash table - * to store the mappings between bindings and object references and the - * hash table is not persistent; thereby the name "transient". - * This class should not be used directly; instead, the class - * TransientNameService should be instantiated. + * Class TransientNamingContext implements the methods defined by NamingContextDataStore, and extends the + * NamingContextImpl class to provide a servant implementation of CosNaming::NamingContext. The TransientNamingContext + * uses a hash table to store the mappings between bindings and object references and the hash table is not persistent; + * thereby the name "transient". This class should not be used directly; instead, the class TransientNameService should + * be instantiated. *

- * The keys in the hash table are InternalBindingKey objects, containing - * a single NameComponent and implementing the proper functions, i.e., - * equals() and hashCode() in an efficient manner. The values in the hash - * table are InternalBindingValues and store a org.omg.CosNaming::Binding and - * the object reference associated with the binding. For iteration, - * TransientBindingIterator objects are created, which are passed a cloned - * copy of the hashtable. Since elements are inserted and deleted and - * never modified, this provides stable iterators at the cost of cloning - * the hash table. + * The keys in the hash table are InternalBindingKey objects, containing a single NameComponent and implementing the + * proper functions, i.e., equals() and hashCode() in an efficient manner. The values in the hash table are + * InternalBindingValues and store a org.omg.CosNaming::Binding and the object reference associated with the binding. + * For iteration, TransientBindingIterator objects are created, which are passed a cloned copy of the hashtable. Since + * elements are inserted and deleted and never modified, this provides stable iterators at the cost of cloning the hash + * table. *

- * To create and destroy object references, the TransientNamingContext - * uses the orb.connect() and orb.disconnect() methods. + * To create and destroy object references, the TransientNamingContext uses the orb.connect() and orb.disconnect() + * methods. * * @see NamingContextImpl * @see NamingContextDataStore @@ -66,105 +59,86 @@ * @see TransientNameService */ @Naming -public class TransientNamingContext extends NamingContextImpl implements NamingContextDataStore -{ - private NamingSystemException wrapper ; +public class TransientNamingContext extends NamingContextImpl implements NamingContextDataStore { + private NamingSystemException wrapper; /** * Constructs a new TransientNamingContext object. + * * @param orb an orb object. * @param initial the initial naming context. * @param nsPOA the POA - * @exception Exception a Java exception thrown of the base class cannot - * initialize. + * @exception Exception a Java exception thrown of the base class cannot initialize. */ - public TransientNamingContext(com.sun.corba.ee.spi.orb.ORB orb, - org.omg.CORBA.Object initial, - POA nsPOA ) - throws java.lang.Exception - { + public TransientNamingContext(com.sun.corba.ee.spi.orb.ORB orb, org.omg.CORBA.Object initial, POA nsPOA) throws java.lang.Exception { super(orb, nsPOA); this.localRoot = initial; } /** - * Binds the object to the name component as the specified binding type. - * It creates a InternalBindingKey object and a InternalBindingValue - * object and inserts them in the hash table. - * @param n A single org.omg.CosNaming::NameComponent under which the - * object will be bound. + * Binds the object to the name component as the specified binding type. It creates a InternalBindingKey object and a + * InternalBindingValue object and inserts them in the hash table. + * + * @param n A single org.omg.CosNaming::NameComponent under which the object will be bound. * @param obj An object reference to be bound under the supplied name. * @param bt The type of the binding (i.e., as object or as context). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ @Naming - public final void bindImpl(NameComponent n, org.omg.CORBA.Object obj, - BindingType bt) - throws org.omg.CORBA.SystemException - { + public final void bindImpl(NameComponent n, org.omg.CORBA.Object obj, BindingType bt) throws org.omg.CORBA.SystemException { InternalBindingKey key = new InternalBindingKey(n); NameComponent[] name = new NameComponent[1]; name[0] = n; - Binding b = new Binding(name,bt); - InternalBindingValue value = new InternalBindingValue(b,null); + Binding b = new Binding(name, bt); + InternalBindingValue value = new InternalBindingValue(b, null); value.theObjectRef = obj; - InternalBindingValue oldValue = bindingMap.put(key,value); + InternalBindingValue oldValue = bindingMap.put(key, value); if (oldValue != null) { - throw wrapper.transNcBindAlreadyBound() ; + throw wrapper.transNcBindAlreadyBound(); } } /** - * Resolves the supplied name to an object reference and returns - * the type of the resolved binding. It creates a InternalBindingKey - * and uses the key for looking up in the hash table. If nothing - * is found an exception is thrown, otherwise the object reference - * is returned and the binding type set. + * Resolves the supplied name to an object reference and returns the type of the resolved binding. It creates a + * InternalBindingKey and uses the key for looking up in the hash table. If nothing is found an exception is thrown, + * otherwise the object reference is returned and the binding type set. + * * @param n a NameComponent which is the name to be resolved. * @param bth the BindingType as an out parameter. - * @return the object reference bound under the supplied name, null if not - * found. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @return the object reference bound under the supplied name, null if not found. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ @Naming - public final org.omg.CORBA.Object resolveImpl(NameComponent n, - BindingTypeHolder bth) - throws org.omg.CORBA.SystemException - { + public final org.omg.CORBA.Object resolveImpl(NameComponent n, BindingTypeHolder bth) throws org.omg.CORBA.SystemException { if ((n.id.length() == 0) && (n.kind.length() == 0)) { bth.value = BindingType.ncontext; return localRoot; } - + // Create a key and lookup the value InternalBindingKey key = new InternalBindingKey(n); InternalBindingValue value = bindingMap.get(key); if (value == null) { return null; } - + // Copy out binding type and object reference bth.value = value.theBinding.binding_type; return value.theObjectRef; } /** - * Deletes the binding with the supplied name. It creates a - * InternalBindingKey and uses it to remove the value associated - * with the key. If nothing is found an exception is thrown, otherwise - * the element is removed from the hash table. + * Deletes the binding with the supplied name. It creates a InternalBindingKey and uses it to remove the value + * associated with the key. If nothing is found an exception is thrown, otherwise the element is removed from the hash + * table. + * * @param n a NameComponent which is the name to unbind * @return the object reference bound to the name, or null if not found. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ @Naming - public final org.omg.CORBA.Object unbindImpl(NameComponent n) - throws org.omg.CORBA.SystemException - { + public final org.omg.CORBA.Object unbindImpl(NameComponent n) throws org.omg.CORBA.SystemException { // Create a key and remove it from the hashtable InternalBindingKey key = new InternalBindingKey(n); InternalBindingValue value = bindingMap.remove(key); @@ -174,110 +148,94 @@ public final org.omg.CORBA.Object unbindImpl(NameComponent n) return null; } else { return value.theObjectRef; - } - } + } + } /** - * List the contents of this NamingContext. It creates a new - * TransientBindingIterator object and passes it a clone of the - * hash table and an orb object. It then uses the - * newly created object to return the required number of bindings. + * List the contents of this NamingContext. It creates a new TransientBindingIterator object and passes it a clone of + * the hash table and an orb object. It then uses the newly created object to return the required number of bindings. + * * @param how_many The number of requested bindings in the BindingList. * @param bl The BindingList as an out parameter. * @param bi The BindingIterator as an out parameter. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ @Naming - public final void listImpl(int how_many, BindingListHolder bl, - BindingIteratorHolder bi) - throws org.omg.CORBA.SystemException - { + public final void listImpl(int how_many, BindingListHolder bl, BindingIteratorHolder bi) throws org.omg.CORBA.SystemException { try { - // Create a new binding iterator servant with a copy of this - // hashtable. nsPOA is passed to the object so that it can - // de-activate itself from the Active Object Map when + // Create a new binding iterator servant with a copy of this + // hashtable. nsPOA is passed to the object so that it can + // de-activate itself from the Active Object Map when // Binding Iterator.destroy is called. - Map copy = - new HashMap( bindingMap ) ; - TransientBindingIterator bindingIterator = - new TransientBindingIterator( this.orb, copy, nsPOA); - + Map copy = new HashMap(bindingMap); + TransientBindingIterator bindingIterator = new TransientBindingIterator(this.orb, copy, nsPOA); + // Have it set the binding list - bindingIterator.list(how_many,bl); - - byte[] objectId = nsPOA.activate_object( bindingIterator ); - org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId ); - + bindingIterator.list(how_many, bl); + + byte[] objectId = nsPOA.activate_object(bindingIterator); + org.omg.CORBA.Object obj = nsPOA.id_to_reference(objectId); + // Get the object reference for the binding iterator servant - org.omg.CosNaming.BindingIterator bindingRef = - org.omg.CosNaming.BindingIteratorHelper.narrow( obj ); - + org.omg.CosNaming.BindingIterator bindingRef = org.omg.CosNaming.BindingIteratorHelper.narrow(obj); + bi.value = bindingRef; } catch (org.omg.CORBA.SystemException e) { throw e; } catch (Exception e) { // Convert to a CORBA system exception - throw wrapper.transNcListGotExc( e ) ; + throw wrapper.transNcListGotExc(e); } } - + /** - * Create a new NamingContext. It creates a new TransientNamingContext - * object, passing it the orb object. - * @return an object reference for a new NamingContext object implemented - * by this Name Server. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * Create a new NamingContext. It creates a new TransientNamingContext object, passing it the orb object. + * + * @return an object reference for a new NamingContext object implemented by this Name Server. + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ @Naming - public final org.omg.CosNaming.NamingContext newContextImpl() - throws org.omg.CORBA.SystemException - { + public final org.omg.CosNaming.NamingContext newContextImpl() throws org.omg.CORBA.SystemException { try { // Create a new servant - TransientNamingContext transContext = - new TransientNamingContext( - (com.sun.corba.ee.spi.orb.ORB) orb,localRoot, nsPOA); + TransientNamingContext transContext = new TransientNamingContext((com.sun.corba.ee.spi.orb.ORB) orb, localRoot, nsPOA); - byte[] objectId = nsPOA.activate_object( transContext ); - org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId ); - return org.omg.CosNaming.NamingContextHelper.narrow( obj ); + byte[] objectId = nsPOA.activate_object(transContext); + org.omg.CORBA.Object obj = nsPOA.id_to_reference(objectId); + return org.omg.CosNaming.NamingContextHelper.narrow(obj); } catch (Exception e) { - throw wrapper.transNcNewctxGotExc( e ) ; + throw wrapper.transNcNewctxGotExc(e); } } /** * Destroys this NamingContext by disconnecting from the ORB. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. + * + * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. */ @Naming - public final void destroyImpl() - throws org.omg.CORBA.SystemException - { + public final void destroyImpl() throws org.omg.CORBA.SystemException { // Destroy the object reference by disconnecting from the ORB try { - byte[] objectId = nsPOA.servant_to_id( this ); - if( objectId != null ) { - nsPOA.deactivate_object( objectId ); + byte[] objectId = nsPOA.servant_to_id(this); + if (objectId != null) { + nsPOA.deactivate_object(objectId); } - } catch (Exception e) { - throw wrapper.transNcDestroyGotExc( e ) ; + } catch (Exception e) { + throw wrapper.transNcDestroyGotExc(e); } } /** * A Utility Method For Logging.. */ - private String getName( NameComponent n ) { + private String getName(NameComponent n) { return n.id + "." + n.kind; } /** - * Return whether this NamingContext contains any bindings. It forwards - * this request to the hash table. + * Return whether this NamingContext contains any bindings. It forwards this request to the hash table. + * * @return true if this NamingContext contains no bindings. */ public final boolean isEmptyImpl() { @@ -285,12 +243,10 @@ public final boolean isEmptyImpl() { } // A hashtable to store the bindings - private final Map bindingMap = - new HashMap(); + private final Map bindingMap = new HashMap(); /** * The local root naming context. */ public org.omg.CORBA.Object localRoot; } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/CorbalocURL.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/CorbalocURL.java index fa5b4fd59..acb0b1600 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/CorbalocURL.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/CorbalocURL.java @@ -21,246 +21,227 @@ import java.util.*; -/** - * The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's - * will be parsed and converted to this object. This object is capable of - * storing multiple Host profiles as defined in the CorbaLoc grammer. - * - * @author Hemanth +/** + * The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's will be parsed and converted to this + * object. This object is capable of storing multiple Host profiles as defined in the CorbaLoc grammer. + * + * @author Hemanth */ -public class CorbalocURL extends INSURLBase -{ +public class CorbalocURL extends INSURLBase { /** - * This constructor parses the URL and initializes all the variables. Once - * the URL Object is constructed it is immutable. URL parameter is a - * corbaloc: URL string with 'corbaloc:' prefix stripped. + * This constructor parses the URL and initializes all the variables. Once the URL Object is constructed it is + * immutable. URL parameter is a corbaloc: URL string with 'corbaloc:' prefix stripped. + * * @param aURL corbaloc URL as a String */ - public CorbalocURL( String aURL ) { + public CorbalocURL(String aURL) { String url = aURL; - if( url != null ) { + if (url != null) { try { // First Clean the URL Escapes if there are any - url = Utility.cleanEscapes( url ); - } catch( Exception e ) { + url = Utility.cleanEscapes(url); + } catch (Exception e) { // There is something wrong with the URL escapes used // so throw an exception - badAddress( e, aURL ); + badAddress(e, aURL); } - int endIndex = url.indexOf( '/' ); - if( endIndex == -1 ) { + int endIndex = url.indexOf('/'); + if (endIndex == -1) { // If there is no '/' then the endIndex is at the end of the URL endIndex = url.length(); } // _REVISIT_: Add a testcase to check 'corbaloc:/' - if( endIndex == 0 ) { + if (endIndex == 0) { // The url starts with a '/', it's an error - badAddress( aURL ); + badAddress(aURL); } // Anything between corbaloc: and / is the host,port information // of the server where the Service Object is located - StringTokenizer endpoints = new StringTokenizer( - url.substring( 0, endIndex ), "," ); + StringTokenizer endpoints = new StringTokenizer(url.substring(0, endIndex), ","); // NOTE: // There should be atleast one token, because there are checks - // to make sure that there is host information before the + // to make sure that there is host information before the // delimiter '/'. So no need to explicitly check for number of // tokens != 0 - while( endpoints.hasMoreTokens( ) ) { + while (endpoints.hasMoreTokens()) { String endpointInfo = endpoints.nextToken(); IIOPEndpointInfo iiopEndpointInfo = null; - if( endpointInfo.startsWith( "iiop:" ) ) { - iiopEndpointInfo = handleIIOPColon( endpointInfo ); - } else if( endpointInfo.startsWith( "rir:" ) ) { - handleRIRColon( endpointInfo ); + if (endpointInfo.startsWith("iiop:")) { + iiopEndpointInfo = handleIIOPColon(endpointInfo); + } else if (endpointInfo.startsWith("rir:")) { + handleRIRColon(endpointInfo); rirFlag = true; - } else if( endpointInfo.startsWith( ":" ) ) { - iiopEndpointInfo = handleColon( endpointInfo ); + } else if (endpointInfo.startsWith(":")) { + iiopEndpointInfo = handleColon(endpointInfo); } else { // Right now we are not allowing any other protocol // other than iiop:, rir: so raise exception indicating // that the URL is malformed - badAddress( aURL ); + badAddress(aURL); } - if ( rirFlag == false ) { + if (rirFlag == false) { // Add the Host information if RIR flag is set, // If RIR is set then it means use the internal Boot // Strap protocol for Key String resolution - if( theEndpointInfo == null ) { - theEndpointInfo = new java.util.ArrayList( ); + if (theEndpointInfo == null) { + theEndpointInfo = new java.util.ArrayList(); } - theEndpointInfo.add( iiopEndpointInfo ); + theEndpointInfo.add(iiopEndpointInfo); } } // If there is something after corbaloc:endpointInfo/ // then that is the keyString - if( url.length() > (endIndex + 1) ) { - theKeyString = url.substring( endIndex + 1 ); + if (url.length() > (endIndex + 1)) { + theKeyString = url.substring(endIndex + 1); } } } /** - * If there is 'iiop:' token in the URL, this method will parses - * and validates that host and port information. + * If there is 'iiop:' token in the URL, this method will parses and validates that host and port information. */ - private IIOPEndpointInfo handleIIOPColon( String iiopInfo ) - { - // Check the iiop syntax - iiopInfo = iiopInfo.substring( NamingConstants.IIOP_LENGTH ); - return handleColon( iiopInfo ); + private IIOPEndpointInfo handleIIOPColon(String iiopInfo) { + // Check the iiop syntax + iiopInfo = iiopInfo.substring(NamingConstants.IIOP_LENGTH); + return handleColon(iiopInfo); } /** - * This is to handle the case of host information with no 'iiop:' prefix. - * instead if ':' is specified then iiop is assumed. + * This is to handle the case of host information with no 'iiop:' prefix. instead if ':' is specified then iiop is + * assumed. */ - private IIOPEndpointInfo handleColon( String iiopInfo ) { - // String after ":" - iiopInfo = iiopInfo.substring( 1 ); - String hostandport = iiopInfo; - // The format can be 1.2@: - StringTokenizer tokenizer = new StringTokenizer( iiopInfo, "@" ); - IIOPEndpointInfo iiopEndpointInfo = new IIOPEndpointInfo( ); - int tokenCount = tokenizer.countTokens( ); - // There can be 1 or 2 tokens with '@' as the delimiter - // - if there is only 1 token then there is no GIOP version - // information. A Default GIOP version of 1.2 is used. - // - if there are 2 tokens then there is GIOP version is specified - // - if there are no tokens or more than 2 tokens, then that's an - // error - if( ( tokenCount == 0 ) - ||( tokenCount > 2 )) - { - badAddress( iiopInfo ); - } - if( tokenCount == 2 ) { + private IIOPEndpointInfo handleColon(String iiopInfo) { + // String after ":" + iiopInfo = iiopInfo.substring(1); + String hostandport = iiopInfo; + // The format can be 1.2@: + StringTokenizer tokenizer = new StringTokenizer(iiopInfo, "@"); + IIOPEndpointInfo iiopEndpointInfo = new IIOPEndpointInfo(); + int tokenCount = tokenizer.countTokens(); + // There can be 1 or 2 tokens with '@' as the delimiter + // - if there is only 1 token then there is no GIOP version + // information. A Default GIOP version of 1.2 is used. + // - if there are 2 tokens then there is GIOP version is specified + // - if there are no tokens or more than 2 tokens, then that's an + // error + if ((tokenCount == 0) || (tokenCount > 2)) { + badAddress(iiopInfo); + } + if (tokenCount == 2) { // There is VersionInformation after iiop: - String version = tokenizer.nextToken( ); + String version = tokenizer.nextToken(); int dot = version.indexOf('.'); // There is a version without ., which means // Malformed list if (dot == -1) { - badAddress( iiopInfo ); + badAddress(iiopInfo); } try { - iiopEndpointInfo.setVersion( - Integer.parseInt( version.substring( 0, dot )), - Integer.parseInt( version.substring(dot+1)) ); - hostandport = tokenizer.nextToken( ); - } catch( Throwable e ) { - badAddress( e, iiopInfo ); + iiopEndpointInfo.setVersion(Integer.parseInt(version.substring(0, dot)), Integer.parseInt(version.substring(dot + 1))); + hostandport = tokenizer.nextToken(); + } catch (Throwable e) { + badAddress(e, iiopInfo); + } + } + try { + // A Hack to differentiate IPV6 address + // from IPV4 address, Current Resolution + // is to use [ ] to differentiate ipv6 host + int squareBracketBeginIndex = hostandport.indexOf('['); + if (squareBracketBeginIndex != -1) { + // ipv6Host should be enclosed in + // [ ], if not it will result in a + // BAD_PARAM exception + String ipv6Port = getIPV6Port(hostandport); + if (ipv6Port != null) { + iiopEndpointInfo.setPort(Integer.parseInt(ipv6Port)); + } + iiopEndpointInfo.setHost(getIPV6Host(hostandport)); + return iiopEndpointInfo; } - } - try { - // A Hack to differentiate IPV6 address - // from IPV4 address, Current Resolution - // is to use [ ] to differentiate ipv6 host - int squareBracketBeginIndex = hostandport.indexOf ( '[' ); - if( squareBracketBeginIndex != -1 ) { - // ipv6Host should be enclosed in - // [ ], if not it will result in a - // BAD_PARAM exception - String ipv6Port = getIPV6Port( hostandport ); - if( ipv6Port != null ) { - iiopEndpointInfo.setPort( Integer.parseInt( ipv6Port )); - } - iiopEndpointInfo.setHost( getIPV6Host( hostandport )); - return iiopEndpointInfo; - } - tokenizer = new StringTokenizer( hostandport, ":" ); - // There are three possible cases here - // 1. Host and Port is explicitly specified by using ":" as a - // a separator - // 2. Only Host is specified without the port - // 3. HostAndPort info is null - if( tokenizer.countTokens( ) == 2 ) { - // Case 1: There is Host and Port Info - iiopEndpointInfo.setHost( tokenizer.nextToken( ) ); - iiopEndpointInfo.setPort( Integer.parseInt( - tokenizer.nextToken( ))); - } else { - if( ( hostandport != null ) - &&( hostandport.length() != 0 ) ) - { - // Case 2: Only Host is specified. iiopEndpointInfo is - // initialized to use the default INS port, if no port is - // specified - iiopEndpointInfo.setHost( hostandport ); - } - // Case 3: If no Host and Port info is provided then we use the - // the default LocalHost and INSPort. iiopEndpointInfo is - // already initialized with this info. - } - } catch( Throwable e ) { - // Any kind of Exception is bad here. - // Possible causes: A Number Format exception because port info is - // malformed - badAddress( e, iiopInfo ); - } - Utility.validateGIOPVersion( iiopEndpointInfo ); - return iiopEndpointInfo; + tokenizer = new StringTokenizer(hostandport, ":"); + // There are three possible cases here + // 1. Host and Port is explicitly specified by using ":" as a + // a separator + // 2. Only Host is specified without the port + // 3. HostAndPort info is null + if (tokenizer.countTokens() == 2) { + // Case 1: There is Host and Port Info + iiopEndpointInfo.setHost(tokenizer.nextToken()); + iiopEndpointInfo.setPort(Integer.parseInt(tokenizer.nextToken())); + } else { + if ((hostandport != null) && (hostandport.length() != 0)) { + // Case 2: Only Host is specified. iiopEndpointInfo is + // initialized to use the default INS port, if no port is + // specified + iiopEndpointInfo.setHost(hostandport); + } + // Case 3: If no Host and Port info is provided then we use the + // the default LocalHost and INSPort. iiopEndpointInfo is + // already initialized with this info. + } + } catch (Throwable e) { + // Any kind of Exception is bad here. + // Possible causes: A Number Format exception because port info is + // malformed + badAddress(e, iiopInfo); + } + Utility.validateGIOPVersion(iiopEndpointInfo); + return iiopEndpointInfo; } /** - * Validate 'rir:' case. + * Validate 'rir:' case. */ - private void handleRIRColon( String rirInfo ) - { - if( rirInfo.length() != NamingConstants.RIRCOLON_LENGTH ) { - badAddress( rirInfo ); + private void handleRIRColon(String rirInfo) { + if (rirInfo.length() != NamingConstants.RIRCOLON_LENGTH) { + badAddress(rirInfo); } } /** - * Returns an IPV6 Port that is after []:. There is no validation - * done here, if it is an incorrect port then the request through - * this URL results in a COMM_FAILURE, otherwise malformed list will - * result in BAD_PARAM exception thrown in checkcorbalocGrammer. - */ - private String getIPV6Port( String endpointInfo ) - { - int squareBracketEndIndex = endpointInfo.indexOf ( ']' ); - // If there is port information, then it has to be after ] bracket - // indexOf returns the count from the index of zero as the base, so - // equality check requires squareBracketEndIndex + 1. - if( (squareBracketEndIndex + 1) != (endpointInfo.length( )) ) { - if( endpointInfo.charAt( squareBracketEndIndex + 1 ) != ':' ) { - throw new RuntimeException( - "Host and Port is not separated by ':'" ); - } - // PortInformation should be after ']:' delimiter - // If there is an exception then it will be caught in - // checkcorbaGrammer method and rethrown as BAD_PARAM - return endpointInfo.substring( squareBracketEndIndex + 2 ); - } - return null; - } - + * Returns an IPV6 Port that is after []:. There is no validation done here, if it is an incorrect port then the + * request through this URL results in a COMM_FAILURE, otherwise malformed list will result in BAD_PARAM exception + * thrown in checkcorbalocGrammer. + */ + private String getIPV6Port(String endpointInfo) { + int squareBracketEndIndex = endpointInfo.indexOf(']'); + // If there is port information, then it has to be after ] bracket + // indexOf returns the count from the index of zero as the base, so + // equality check requires squareBracketEndIndex + 1. + if ((squareBracketEndIndex + 1) != (endpointInfo.length())) { + if (endpointInfo.charAt(squareBracketEndIndex + 1) != ':') { + throw new RuntimeException("Host and Port is not separated by ':'"); + } + // PortInformation should be after ']:' delimiter + // If there is an exception then it will be caught in + // checkcorbaGrammer method and rethrown as BAD_PARAM + return endpointInfo.substring(squareBracketEndIndex + 2); + } + return null; + } - /** - * Returns an IPV6 Host that is inside [ ] tokens. There is no validation - * done here, if it is an incorrect IPV6 address then the request through - * this URL results in a COMM_FAILURE, otherwise malformed list will - * result in BAD_PARAM exception thrown in checkcorbalocGrammer. - */ - private String getIPV6Host( String endpointInfo ) { - // ipv6Host should be enclosed in - // [ ], if not it will result in a - // BAD_PARAM exception - int squareBracketEndIndex = endpointInfo.indexOf ( ']' ); - // get the host between [ ] - String ipv6Host = endpointInfo.substring( 1, squareBracketEndIndex ); - return ipv6Host; + /** + * Returns an IPV6 Host that is inside [ ] tokens. There is no validation done here, if it is an incorrect IPV6 address + * then the request through this URL results in a COMM_FAILURE, otherwise malformed list will result in BAD_PARAM + * exception thrown in checkcorbalocGrammer. + */ + private String getIPV6Host(String endpointInfo) { + // ipv6Host should be enclosed in + // [ ], if not it will result in a + // BAD_PARAM exception + int squareBracketEndIndex = endpointInfo.indexOf(']'); + // get the host between [ ] + String ipv6Host = endpointInfo.substring(1, squareBracketEndIndex); + return ipv6Host; } /** * Will be true only in CorbanameURL class. - */ - public boolean isCorbanameURL( ) { + */ + public boolean isCorbanameURL() { return false; } - } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/CorbanameURL.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/CorbanameURL.java index 6860e4e12..8c002de61 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/CorbanameURL.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/CorbanameURL.java @@ -19,73 +19,67 @@ package com.sun.corba.ee.impl.naming.namingutil; -/** - * The corbaname: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's - * will be stored in this object. This object is capable of storing CorbaLoc - * profiles as defined in the CorbaName grammer. +/** + * The corbaname: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's will be stored in this object. This + * object is capable of storing CorbaLoc profiles as defined in the CorbaName grammer. * - * @author Hemanth + * @author Hemanth */ -public class CorbanameURL extends INSURLBase -{ +public class CorbanameURL extends INSURLBase { /** - * This constructor takes a corbaname: url with 'corbaname:' prefix stripped - * and initializes all the variables accordingly. If there are any parsing - * errors then BAD_PARAM exception is raised. + * This constructor takes a corbaname: url with 'corbaname:' prefix stripped and initializes all the variables + * accordingly. If there are any parsing errors then BAD_PARAM exception is raised. + * * @param aURL corbaname URL as a String */ - public CorbanameURL( String aURL ) { + public CorbanameURL(String aURL) { String url = aURL; - + // First Clean the URL Escapes if there are any try { - url = Utility.cleanEscapes( url ); - } catch( Exception e ) { - badAddress( e, aURL ); + url = Utility.cleanEscapes(url); + } catch (Exception e) { + badAddress(e, aURL); } - int delimiterIndex = url.indexOf( '#' ); + int delimiterIndex = url.indexOf('#'); String corbalocString = null; - if( delimiterIndex != -1 ) { - corbalocString = "corbaloc:" + url.substring( 0, delimiterIndex ) ; + if (delimiterIndex != -1) { + corbalocString = "corbaloc:" + url.substring(0, delimiterIndex); } else { - corbalocString = "corbaloc:" + url ; + corbalocString = "corbaloc:" + url; } try { // Check the corbaloc grammar and set the returned corbaloc // object to the CorbaName Object - INSURL insURL = - INSURLHandler.getINSURLHandler().parseURL( corbalocString ); - copyINSURL( insURL ); + INSURL insURL = INSURLHandler.getINSURLHandler().parseURL(corbalocString); + copyINSURL(insURL); // String after '#' is the Stringified name used to resolve // the Object reference from the rootnaming context. If // the String is null then the Root Naming context is passed // back - if((delimiterIndex > -1) && - (delimiterIndex < (aURL.length() - 1))) - { - int start = delimiterIndex + 1 ; - String result = url.substring(start) ; - theStringifiedName = result ; - } - } catch( Exception e ) { - badAddress( e, aURL ); + if ((delimiterIndex > -1) && (delimiterIndex < (aURL.length() - 1))) { + int start = delimiterIndex + 1; + String result = url.substring(start); + theStringifiedName = result; + } + } catch (Exception e) { + badAddress(e, aURL); } } /** - * A Utility method to copy all the variables from CorbalocURL object to - * this instance. + * A Utility method to copy all the variables from CorbalocURL object to this instance. */ - private void copyINSURL( INSURL url ) { - rirFlag = url.getRIRFlag( ); - theEndpointInfo = (java.util.ArrayList) url.getEndpointInfo( ); - theKeyString = url.getKeyString( ); - theStringifiedName = url.getStringifiedName( ); + private void copyINSURL(INSURL url) { + rirFlag = url.getRIRFlag(); + theEndpointInfo = (java.util.ArrayList) url.getEndpointInfo(); + theKeyString = url.getKeyString(); + theStringifiedName = url.getStringifiedName(); } - public boolean isCorbanameURL( ) { + public boolean isCorbanameURL() { return true; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/IIOPEndpointInfo.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/IIOPEndpointInfo.java index 83be9558d..ef8db1c9b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/IIOPEndpointInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/IIOPEndpointInfo.java @@ -21,15 +21,13 @@ import com.sun.corba.ee.spi.misc.ORBConstants; -/** - * EndpointInfo is used internally by CorbaLoc object to store the - * host information used in creating the Service Object reference - * from the -ORBInitDef and -ORBDefaultInitDef definitions. +/** + * EndpointInfo is used internally by CorbaLoc object to store the host information used in creating the Service Object + * reference from the -ORBInitDef and -ORBDefaultInitDef definitions. * - * @author Hemanth + * @author Hemanth */ -public class IIOPEndpointInfo -{ +public class IIOPEndpointInfo { // Version information private int major, minor; @@ -38,12 +36,11 @@ public class IIOPEndpointInfo private int port; public String toString() { - return "IIOPEndpointInfo[" + major + "." + minor - + " " + host + ":" + port + "]" ; + return "IIOPEndpointInfo[" + major + "." + minor + " " + host + ":" + port + "]"; } - IIOPEndpointInfo( ) { - // Default IIOP Version + IIOPEndpointInfo() { + // Default IIOP Version major = ORBConstants.DEFAULT_INS_GIOP_MAJOR_VERSION; minor = ORBConstants.DEFAULT_INS_GIOP_MINOR_VERSION; // Default host is localhost @@ -52,41 +49,41 @@ public String toString() { port = ORBConstants.DEFAULT_INS_PORT; } - public void setHost( String theHost ) { + public void setHost(String theHost) { host = theHost; } - public String getHost( ) { + public String getHost() { return host; } - public void setPort( int thePort ) { + public void setPort(int thePort) { port = thePort; } - public int getPort( ) { + public int getPort() { return port; } - public void setVersion( int theMajor, int theMinor ) { + public void setVersion(int theMajor, int theMinor) { major = theMajor; minor = theMinor; } - public int getMajor( ) { + public int getMajor() { return major; } - public int getMinor( ) { + public int getMinor() { return minor; } - /** Internal Debug Method. + /** + * Internal Debug Method. */ - public void dump( ) { - System.out.println( " Major -> " + major + " Minor -> " + minor ); - System.out.println( "host -> " + host ); - System.out.println( "port -> " + port ); + public void dump() { + System.out.println(" Major -> " + major + " Minor -> " + minor); + System.out.println("host -> " + host); + System.out.println("port -> " + port); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURL.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURL.java index 7da2edecb..9e5cf0a62 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURL.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURL.java @@ -20,28 +20,25 @@ package com.sun.corba.ee.impl.naming.namingutil; /** - * INS URL is a generic interface for two different types of URL's specified - * in INS spec. + * INS URL is a generic interface for two different types of URL's specified in INS spec. * * @author Hemanth */ public interface INSURL { - public boolean getRIRFlag( ); + public boolean getRIRFlag(); // There can be one or more Endpoint's in the URL, so the return value is // a List - public java.util.List getEndpointInfo( ); + public java.util.List getEndpointInfo(); - public String getKeyString( ); + public String getKeyString(); - public String getStringifiedName( ); + public String getStringifiedName(); // This method will return true only in CorbanameURL, It is provided because - // corbaname: URL needs special handling. - public boolean isCorbanameURL( ); + // corbaname: URL needs special handling. + public boolean isCorbanameURL(); // A debug method, which is not required for normal operation - public void dPrint( ); + public void dPrint(); } - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURLBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURLBase.java index 2ab297d51..54866364f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURLBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURLBase.java @@ -19,72 +19,68 @@ package com.sun.corba.ee.impl.naming.namingutil; -import com.sun.corba.ee.spi.logging.OMGSystemException ; +import com.sun.corba.ee.spi.logging.OMGSystemException; -/** The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's - * will be stored in this object. This object is capable of storing multiple - * Host profiles as defined in the CorbaLoc grammer. +/** + * The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's will be stored in this object. This + * object is capable of storing multiple Host profiles as defined in the CorbaLoc grammer. * - * @author Hemanth + * @author Hemanth */ public abstract class INSURLBase implements INSURL { - private static OMGSystemException wrapper = - OMGSystemException.self ; + private static OMGSystemException wrapper = OMGSystemException.self; // If rirFlag is set to true that means internal // boot strapping technique will be used. If set to // false then the EndpointInfo will be used to create the // Service Object reference. - protected boolean rirFlag = false ; - protected java.util.ArrayList theEndpointInfo = null ; - protected String theKeyString = "NameService" ; - protected String theStringifiedName = null ; + protected boolean rirFlag = false; + protected java.util.ArrayList theEndpointInfo = null; + protected String theKeyString = "NameService"; + protected String theStringifiedName = null; /** - * A Utility method to throw BAD_PARAM exception to signal malformed - * INS URL. + * A Utility method to throw BAD_PARAM exception to signal malformed INS URL. + * * @param name Invalid name of the URL */ - protected void badAddress( String name ) - { - throw wrapper.soBadAddress( name ) ; + protected void badAddress(String name) { + throw wrapper.soBadAddress(name); } - protected void badAddress( java.lang.Throwable e, String name ) - { - throw wrapper.soBadAddress( e, name ) ; + protected void badAddress(java.lang.Throwable e, String name) { + throw wrapper.soBadAddress(e, name); } - public boolean getRIRFlag( ) { + public boolean getRIRFlag() { return rirFlag; - } + } - public java.util.List getEndpointInfo( ) { + public java.util.List getEndpointInfo() { return theEndpointInfo; } - public String getKeyString( ) { + public String getKeyString() { return theKeyString; } - public String getStringifiedName( ) { + public String getStringifiedName() { return theStringifiedName; } - public abstract boolean isCorbanameURL( ); + public abstract boolean isCorbanameURL(); - public void dPrint( ) { - System.out.println( "URL Dump..." ); - System.out.println( "Key String = " + getKeyString( ) ); - System.out.println( "RIR Flag = " + getRIRFlag( ) ); - System.out.println( "isCorbanameURL = " + isCorbanameURL() ); - for( int i = 0; i < theEndpointInfo.size( ); i++ ) { - ((IIOPEndpointInfo) theEndpointInfo.get( i )).dump( ); + public void dPrint() { + System.out.println("URL Dump..."); + System.out.println("Key String = " + getKeyString()); + System.out.println("RIR Flag = " + getRIRFlag()); + System.out.println("isCorbanameURL = " + isCorbanameURL()); + for (int i = 0; i < theEndpointInfo.size(); i++) { + ((IIOPEndpointInfo) theEndpointInfo.get(i)).dump(); } - if( isCorbanameURL( ) ) { - System.out.println( "Stringified Name = " + getStringifiedName() ); + if (isCorbanameURL()) { + System.out.println("Stringified Name = " + getStringifiedName()); } } - -} +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURLHandler.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURLHandler.java index ef0e215c2..85eb4273e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURLHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/INSURLHandler.java @@ -20,9 +20,9 @@ package com.sun.corba.ee.impl.naming.namingutil; /** - * This class is the entry point to parse different types of INS URL's. + * This class is the entry point to parse different types of INS URL's. * - * @author Hemanth + * @author Hemanth */ public class INSURLHandler { @@ -34,23 +34,23 @@ public class INSURLHandler { // Length of corbaname: private static final int CORBANAME_PREFIX_LENGTH = 10; - private INSURLHandler( ) { + private INSURLHandler() { } - public synchronized static INSURLHandler getINSURLHandler( ) { - if( insURLHandler == null ) { - insURLHandler = new INSURLHandler( ); + public synchronized static INSURLHandler getINSURLHandler() { + if (insURLHandler == null) { + insURLHandler = new INSURLHandler(); } return insURLHandler; } - public INSURL parseURL( String aUrl ) { + public INSURL parseURL(String aUrl) { String url = aUrl; - if ( url.startsWith( "corbaloc:" ) == true ) { - return new CorbalocURL( url.substring( CORBALOC_PREFIX_LENGTH ) ); - } else if ( url.startsWith ( "corbaname:" ) == true ) { - return new CorbanameURL( url.substring( CORBANAME_PREFIX_LENGTH ) ); - } + if (url.startsWith("corbaloc:") == true) { + return new CorbalocURL(url.substring(CORBALOC_PREFIX_LENGTH)); + } else if (url.startsWith("corbaname:") == true) { + return new CorbanameURL(url.substring(CORBANAME_PREFIX_LENGTH)); + } return null; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/NamingConstants.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/NamingConstants.java index 04fe34ad7..87281793b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/NamingConstants.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/NamingConstants.java @@ -20,7 +20,7 @@ package com.sun.corba.ee.impl.naming.namingutil; /** - * Constants specific to INS parsing and validation. + * Constants specific to INS parsing and validation. */ public class NamingConstants { @@ -30,7 +30,7 @@ public class NamingConstants { // rir: length public static final int RIRCOLON_LENGTH = 4; - public static final int MAJORNUMBER_SUPPORTED = 1; + public static final int MAJORNUMBER_SUPPORTED = 1; - public static final int MINORNUMBERMAX = 2; + public static final int MINORNUMBERMAX = 2; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/Utility.java b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/Utility.java index cf6038fb1..4e03e35e4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/Utility.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/naming/namingutil/Utility.java @@ -26,48 +26,45 @@ import com.sun.corba.ee.spi.logging.NamingSystemException; /** - * Utility methods for Naming. + * Utility methods for Naming. * - * @author Hemanth + * @author Hemanth */ class Utility { - private static NamingSystemException wrapper = - NamingSystemException.self ; + private static NamingSystemException wrapper = NamingSystemException.self; - /** + /** * cleanEscapes removes URL escapes as per IETF 2386 RFP. */ - static String cleanEscapes( String stringToDecode ) { + static String cleanEscapes(String stringToDecode) { StringWriter theStringWithoutEscape = new StringWriter(); - for( int i = 0; i < stringToDecode.length(); i++ ) { - char c = stringToDecode.charAt( i ) ; - if( c != '%' ) { - theStringWithoutEscape.write( c ); + for (int i = 0; i < stringToDecode.length(); i++) { + char c = stringToDecode.charAt(i); + if (c != '%') { + theStringWithoutEscape.write(c); } else { // Get the two hexadecimal digits and convert that into int i++; - int Hex1 = hexOf( stringToDecode.charAt(i) ); + int Hex1 = hexOf(stringToDecode.charAt(i)); i++; - int Hex2 = hexOf( stringToDecode.charAt(i) ); + int Hex2 = hexOf(stringToDecode.charAt(i)); int value = (Hex1 * 16) + Hex2; // Convert the integer to ASCII - theStringWithoutEscape.write( (char) value ); + theStringWithoutEscape.write((char) value); } } return theStringWithoutEscape.toString(); } - /** - * Converts an Ascii Character into Hexadecimal digit - * NOTE: THIS METHOD IS DUPLICATED TO DELIVER NAMING AS A SEPARATE - * COMPONENT TO RI. + /** + * Converts an Ascii Character into Hexadecimal digit NOTE: THIS METHOD IS DUPLICATED TO DELIVER NAMING AS A SEPARATE + * COMPONENT TO RI. **/ - static int hexOf( char x ) - { + static int hexOf(char x) { int val; val = x - '0'; - if (val >=0 && val <= 9) { + if (val >= 0 && val <= 9) { return val; } @@ -81,18 +78,16 @@ static int hexOf( char x ) return val; } - throw new DATA_CONVERSION( ); + throw new DATA_CONVERSION(); } /** - * If GIOP Version is not correct, This method throws a BAD_PARAM - * Exception. + * If GIOP Version is not correct, This method throws a BAD_PARAM Exception. **/ - static void validateGIOPVersion( IIOPEndpointInfo endpointInfo ) { - if ((endpointInfo.getMajor() > NamingConstants.MAJORNUMBER_SUPPORTED) || - (endpointInfo.getMinor() > NamingConstants.MINORNUMBERMAX ) ) - { - throw wrapper.insBadAddress() ; + static void validateGIOPVersion(IIOPEndpointInfo endpointInfo) { + if ((endpointInfo.getMajor() > NamingConstants.MAJORNUMBER_SUPPORTED) + || (endpointInfo.getMinor() > NamingConstants.MINORNUMBERMAX)) { + throw wrapper.insBadAddress(); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/NullServantImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/NullServantImpl.java index fb308a6d7..735411392 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/NullServantImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/NullServantImpl.java @@ -17,23 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa ; +package com.sun.corba.ee.impl.oa; -import org.omg.CORBA.SystemException ; +import org.omg.CORBA.SystemException; -import com.sun.corba.ee.spi.oa.NullServant ; +import com.sun.corba.ee.spi.oa.NullServant; -public class NullServantImpl implements NullServant -{ - private SystemException sysex ; +public class NullServantImpl implements NullServant { + private SystemException sysex; - public NullServantImpl( SystemException ex ) - { - this.sysex = ex ; + public NullServantImpl(SystemException ex) { + this.sysex = ex; } - public SystemException getException() - { - return sysex ; + public SystemException getException() { + return sysex; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/AOMEntry.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/AOMEntry.java index 61cf3e744..384848bd1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/AOMEntry.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/AOMEntry.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; +package com.sun.corba.ee.impl.oa.poa; import org.glassfish.pfl.basic.fsm.StateEngine; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @@ -28,230 +28,230 @@ import org.glassfish.pfl.basic.fsm.State; import org.glassfish.pfl.basic.fsm.Runner; import org.glassfish.pfl.basic.fsm.FSMImpl; -import java.util.concurrent.locks.Condition ; +import java.util.concurrent.locks.Condition; import com.sun.corba.ee.spi.trace.PoaFSM; -import com.sun.corba.ee.spi.logging.POASystemException ; +import com.sun.corba.ee.spi.logging.POASystemException; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; +import org.omg.PortableServer.POAPackage.ObjectAlreadyActive; -import static org.glassfish.pfl.basic.fsm.Guard.Base.* ; +import static org.glassfish.pfl.basic.fsm.Guard.Base.*; -/** AOMEntry represents a Servant or potential Servant in the ActiveObjectMap. -* It may be in several states to allow for long incarnate or etherealize -* operations. The methods on this class mostly represent input symbols to -* the state machine that controls the lifecycle of the entry. A library is -* used to build the state machine rather than the more usual state pattern -* so that the state machine transitions are explicitly visible. -*/ +/** + * AOMEntry represents a Servant or potential Servant in the ActiveObjectMap. It may be in several states to allow for + * long incarnate or etherealize operations. The methods on this class mostly represent input symbols to the state + * machine that controls the lifecycle of the entry. A library is used to build the state machine rather than the more + * usual state pattern so that the state machine transitions are explicitly visible. + */ @PoaFSM public class AOMEntry extends FSMImpl { - private static final POASystemException wrapper = - POASystemException.self ; + private static final POASystemException wrapper = POASystemException.self; - private Runner runner ; - private final Thread[] etherealizer ; // The actual etherealize operation - // for this entry. It is - // represented as a Thread because - // the POA.deactivate_object never - // waits for the completion. - private final int[] counter ; // single element holder for counter - // accessed in actions - private final Condition wait ; // accessed in actions + private Runner runner; + private final Thread[] etherealizer; // The actual etherealize operation + // for this entry. It is + // represented as a Thread because + // the POA.deactivate_object never + // waits for the completion. + private final int[] counter; // single element holder for counter + // accessed in actions + private final Condition wait; // accessed in actions - final POAImpl poa ; + final POAImpl poa; - public static final State INVALID = new State( "Invalid", - State.Kind.INITIAL ) ; + public static final State INVALID = new State("Invalid", State.Kind.INITIAL); - public static final State INCARN = new State( "Incarnating" ) { + public static final State INCARN = new State("Incarnating") { @Override - public void postAction( FSM fsm ) { - AOMEntry entry = (AOMEntry)fsm ; - entry.wait.signalAll() ; + public void postAction(FSM fsm) { + AOMEntry entry = (AOMEntry) fsm; + entry.wait.signalAll(); } }; - public static final State VALID = new State( "Valid" ) ; + public static final State VALID = new State("Valid"); - public static final State ETHP = new State( "EtherealizePending" ) ; + public static final State ETHP = new State("EtherealizePending"); - public static final State ETH = new State( "Etherealizing" ) { + public static final State ETH = new State("Etherealizing") { @Override - public FSM preAction( FSM fsm ) { - AOMEntry entry = (AOMEntry)fsm ; - Thread etherealizer = entry.etherealizer[0] ; + public FSM preAction(FSM fsm) { + AOMEntry entry = (AOMEntry) fsm; + Thread etherealizer = entry.etherealizer[0]; if (etherealizer != null) { etherealizer.start(); } - return null ; + return null; } @Override - public void postAction( FSM fsm ) { - AOMEntry entry = (AOMEntry)fsm ; - entry.wait.signalAll() ; + public void postAction(FSM fsm) { + AOMEntry entry = (AOMEntry) fsm; + entry.wait.signalAll(); } }; - public static final State DESTROYED = new State( "Destroyed" ) ; - - static final Input START_ETH = new Input.Base( "startEtherealize" ) ; - static final Input ETH_DONE = new Input.Base( "etherealizeDone" ) ; - static final Input INC_DONE = new Input.Base( "incarnateDone" ) ; - static final Input INC_FAIL = new Input.Base( "incarnateFailure" ) ; - static final Input ACTIVATE = new Input.Base( "activateObject" ) ; - static final Input ENTER = new Input.Base( "enter" ) ; - static final Input EXIT = new Input.Base( "exit" ) ; - - private static final Action incrementAction = - new Action.Base( "increment" ) { - public void doIt( FSM fsm, Input in ) { - AOMEntry entry = (AOMEntry)fsm ; - entry.counter[0]++ ; - } - } ; - - private static final Action decrementAction = - new Action.Base( "decrement" ) { - public void doIt( FSM fsm, Input in ) { - AOMEntry entry = (AOMEntry)fsm ; - if (entry.counter[0] > 0) { - entry.counter[0]--; - } else { - throw wrapper.aomEntryDecZero(); - } - } - } ; + public static final State DESTROYED = new State("Destroyed"); - private static final Action throwIllegalStateExceptionAction = - new Action.Base( "throwIllegalStateException" ) { - public void doIt( FSM fsm, Input in ) { - throw new IllegalStateException( - "No transitions allowed from the DESTROYED state" ) ; - } - } ; + static final Input START_ETH = new Input.Base("startEtherealize"); + static final Input ETH_DONE = new Input.Base("etherealizeDone"); + static final Input INC_DONE = new Input.Base("incarnateDone"); + static final Input INC_FAIL = new Input.Base("incarnateFailure"); + static final Input ACTIVATE = new Input.Base("activateObject"); + static final Input ENTER = new Input.Base("enter"); + static final Input EXIT = new Input.Base("exit"); - private static final Action oaaAction = - new Action.Base( "throwObjectAlreadyActive" ) { - public void doIt( FSM fsm, Input in ) { - throw new RuntimeException( new ObjectAlreadyActive() ) ; + private static final Action incrementAction = new Action.Base("increment") { + public void doIt(FSM fsm, Input in) { + AOMEntry entry = (AOMEntry) fsm; + entry.counter[0]++; + } + }; + + private static final Action decrementAction = new Action.Base("decrement") { + public void doIt(FSM fsm, Input in) { + AOMEntry entry = (AOMEntry) fsm; + if (entry.counter[0] > 0) { + entry.counter[0]--; + } else { + throw wrapper.aomEntryDecZero(); } - } ; + } + }; + + private static final Action throwIllegalStateExceptionAction = new Action.Base("throwIllegalStateException") { + public void doIt(FSM fsm, Input in) { + throw new IllegalStateException("No transitions allowed from the DESTROYED state"); + } + }; + + private static final Action oaaAction = new Action.Base("throwObjectAlreadyActive") { + public void doIt(FSM fsm, Input in) { + throw new RuntimeException(new ObjectAlreadyActive()); + } + }; - private static final Guard waitGuard = new Guard.Base( "wait" ) { - public Guard.Result evaluate( FSM fsm, Input in ) { - AOMEntry entry = (AOMEntry)fsm ; + private static final Guard waitGuard = new Guard.Base("wait") { + public Guard.Result evaluate(FSM fsm, Input in) { + AOMEntry entry = (AOMEntry) fsm; try { - entry.wait.await() ; + entry.wait.await(); } catch (InterruptedException exc) { - wrapper.waitGuardInterrupted() ; + wrapper.waitGuardInterrupted(); } - return Guard.Result.DEFERRED ; + return Guard.Result.DEFERRED; } - } ; + }; - private static final IntFunc counterFunc = - new Guard.Base.IntFunc( "counterFunc" ) { - public Integer evaluate( FSM fsm, Input in ) { - AOMEntry entry = (AOMEntry)fsm ; - return entry.counter[0] ; - } - } ; + private static final IntFunc counterFunc = new Guard.Base.IntFunc("counterFunc") { + public Integer evaluate(FSM fsm, Input in) { + AOMEntry entry = (AOMEntry) fsm; + return entry.counter[0]; + } + }; - private static final IntFunc one = constant( 1 ) ; - private static final IntFunc zero = constant( 0 ) ; + private static final IntFunc one = constant(1); + private static final IntFunc zero = constant(0); - private static final Guard greaterZeroGuard = - makeGuard( gt( counterFunc, zero ) ) ; - private static final Guard zeroGuard = - makeGuard( eq( counterFunc, zero ) ) ; - private static final Guard greaterOneGuard = - makeGuard( gt( counterFunc, one ) ) ; - private static final Guard oneGuard = - makeGuard( eq( counterFunc, one ) ) ; + private static final Guard greaterZeroGuard = makeGuard(gt(counterFunc, zero)); + private static final Guard zeroGuard = makeGuard(eq(counterFunc, zero)); + private static final Guard greaterOneGuard = makeGuard(gt(counterFunc, one)); + private static final Guard oneGuard = makeGuard(eq(counterFunc, one)); - private static final StateEngine engine = StateEngine.create() ; + private static final StateEngine engine = StateEngine.create(); static { - // State, Input, Guard, Action, new State - - engine.add( INVALID, ENTER, incrementAction, INCARN ) ; - engine.add( INVALID, ACTIVATE, null, VALID ) ; - engine.setDefault( INVALID ) ; - - engine.add( INCARN, ENTER, waitGuard, null, INCARN ) ; - engine.add( INCARN, EXIT, null, INCARN ) ; - engine.add( INCARN, START_ETH, waitGuard, null, INCARN ) ; - engine.add( INCARN, INC_DONE, null, VALID ) ; - engine.add( INCARN, INC_FAIL, decrementAction, INVALID ) ; - engine.add( INCARN, ACTIVATE, oaaAction, INCARN ) ; - - engine.add( VALID, ENTER, incrementAction, VALID ) ; - engine.add( VALID, EXIT, decrementAction, VALID ) ; - engine.add( VALID, START_ETH, greaterZeroGuard, null, ETHP ) ; - engine.add( VALID, START_ETH, zeroGuard, null, ETH ) ; - engine.add( VALID, ACTIVATE, oaaAction, VALID ) ; - - engine.add( ETHP, ENTER, waitGuard, null, ETHP ) ; - engine.add( ETHP, START_ETH, null, ETHP ) ; - engine.add( ETHP, EXIT, greaterOneGuard, decrementAction, ETHP ) ; - engine.add( ETHP, EXIT, oneGuard, decrementAction, ETH ) ; - engine.add( ETHP, ACTIVATE, oaaAction, ETHP ) ; - - engine.add( ETH, START_ETH, null, ETH ) ; - engine.add( ETH, ETH_DONE, null, DESTROYED ) ; - engine.add( ETH, ENTER, waitGuard, null, ETH ) ; - engine.add( ETH, ACTIVATE, oaaAction, ETH ) ; - - engine.setDefault( DESTROYED, throwIllegalStateExceptionAction, DESTROYED ) ; - - engine.done() ; + // State, Input, Guard, Action, new State + + engine.add(INVALID, ENTER, incrementAction, INCARN); + engine.add(INVALID, ACTIVATE, null, VALID); + engine.setDefault(INVALID); + + engine.add(INCARN, ENTER, waitGuard, null, INCARN); + engine.add(INCARN, EXIT, null, INCARN); + engine.add(INCARN, START_ETH, waitGuard, null, INCARN); + engine.add(INCARN, INC_DONE, null, VALID); + engine.add(INCARN, INC_FAIL, decrementAction, INVALID); + engine.add(INCARN, ACTIVATE, oaaAction, INCARN); + + engine.add(VALID, ENTER, incrementAction, VALID); + engine.add(VALID, EXIT, decrementAction, VALID); + engine.add(VALID, START_ETH, greaterZeroGuard, null, ETHP); + engine.add(VALID, START_ETH, zeroGuard, null, ETH); + engine.add(VALID, ACTIVATE, oaaAction, VALID); + + engine.add(ETHP, ENTER, waitGuard, null, ETHP); + engine.add(ETHP, START_ETH, null, ETHP); + engine.add(ETHP, EXIT, greaterOneGuard, decrementAction, ETHP); + engine.add(ETHP, EXIT, oneGuard, decrementAction, ETH); + engine.add(ETHP, ACTIVATE, oaaAction, ETHP); + + engine.add(ETH, START_ETH, null, ETH); + engine.add(ETH, ETH_DONE, null, DESTROYED); + engine.add(ETH, ENTER, waitGuard, null, ETH); + engine.add(ETH, ACTIVATE, oaaAction, ETH); + + engine.setDefault(DESTROYED, throwIllegalStateExceptionAction, DESTROYED); + + engine.done(); } - public AOMEntry( POAImpl poa ) - { - super( engine, INVALID ) ; - runner = new Runner( this ) ; - this.poa = poa ; - etherealizer = new Thread[1] ; - etherealizer[0] = null ; - counter = new int[1] ; - counter[0] = 0 ; - wait = poa.makeCondition() ; + public AOMEntry(POAImpl poa) { + super(engine, INVALID); + runner = new Runner(this); + this.poa = poa; + etherealizer = new Thread[1]; + etherealizer[0] = null; + counter = new int[1]; + counter[0] = 0; + wait = poa.makeCondition(); } @InfoMethod - private void state( State state ) { } + private void state(State state) { + } @PoaFSM @Override - public void setState( State state ) { - super.setState( state ) ; - state( getState() ) ; + public void setState(State state) { + super.setState(state); + state(getState()); } // Methods that drive the FSM: the real interface to this class // Most just call the doIt method, but startEtherealize needs // the etherealizer. - public void startEtherealize( Thread etherealizer ) - { - this.etherealizer[0] = etherealizer ; - runner.doIt( START_ETH ) ; + public void startEtherealize(Thread etherealizer) { + this.etherealizer[0] = etherealizer; + runner.doIt(START_ETH); + } + + public void etherealizeComplete() { + runner.doIt(ETH_DONE); } - public void etherealizeComplete() { runner.doIt( ETH_DONE ) ; } - public void incarnateComplete() { runner.doIt( INC_DONE ) ; } - public void incarnateFailure() { runner.doIt( INC_FAIL ) ; } - public void enter() { runner.doIt( ENTER ) ; } - public void exit() { runner.doIt( EXIT ) ; } + public void incarnateComplete() { + runner.doIt(INC_DONE); + } + + public void incarnateFailure() { + runner.doIt(INC_FAIL); + } + + public void enter() { + runner.doIt(ENTER); + } + + public void exit() { + runner.doIt(EXIT); + } - public void activateObject() throws ObjectAlreadyActive { + public void activateObject() throws ObjectAlreadyActive { try { - runner.doIt( ACTIVATE ) ; + runner.doIt(ACTIVATE); } catch (RuntimeException exc) { - Throwable thr = exc.getCause() ; + Throwable thr = exc.getCause(); if (thr instanceof ObjectAlreadyActive) { throw (ObjectAlreadyActive) thr; } else { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ActiveObjectMap.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ActiveObjectMap.java index 0294610e6..1019e456f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ActiveObjectMap.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ActiveObjectMap.java @@ -19,27 +19,25 @@ package com.sun.corba.ee.impl.oa.poa; -import java.util.Set ; -import java.util.HashSet ; -import java.util.Map ; -import java.util.HashMap ; - -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; - -/** The ActiveObjectMap maintains associations between servants and - * their keys. There are two variants, to support whether or not - * multiple IDs per servant are allowed. This class supports bidirectional - * traversal of the key-servant association. Access to an instance of this - * class is serialized by the POA mutex. +import java.util.Set; +import java.util.HashSet; +import java.util.Map; +import java.util.HashMap; + +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.POAPackage.WrongPolicy; + +/** + * The ActiveObjectMap maintains associations between servants and their keys. There are two variants, to support + * whether or not multiple IDs per servant are allowed. This class supports bidirectional traversal of the key-servant + * association. Access to an instance of this class is serialized by the POA mutex. */ -public abstract class ActiveObjectMap -{ +public abstract class ActiveObjectMap { static class Key { private byte[] id; byte[] id() { - return id ; + return id; } Key(byte[] id) { @@ -49,9 +47,9 @@ byte[] id() { @Override public String toString() { StringBuilder buffer = new StringBuilder(); - for(int i = 0; i < id.length; i++) { + for (int i = 0; i < id.length; i++) { buffer.append(Integer.toString((int) id[i], 16)); - if (i != id.length-1) { + if (i != id.length - 1) { buffer.append(":"); } } @@ -67,7 +65,7 @@ public boolean equals(java.lang.Object key) { if (k.id.length != this.id.length) { return false; } - for(int i = 0; i < this.id.length; i++) { + for (int i = 0; i < this.id.length; i++) { if (this.id[i] != k.id[i]) { return false; } @@ -85,16 +83,14 @@ public int hashCode() { return h; } } - - protected POAImpl poa ; - protected ActiveObjectMap( POAImpl poa ) - { - this.poa = poa ; + protected POAImpl poa; + + protected ActiveObjectMap(POAImpl poa) { + this.poa = poa; } - public static ActiveObjectMap create( POAImpl poa, boolean multipleIDsAllowed ) - { + public static ActiveObjectMap create(POAImpl poa, boolean multipleIDsAllowed) { if (multipleIDsAllowed) { return new MultipleObjectMap(poa); } else { @@ -102,170 +98,143 @@ public static ActiveObjectMap create( POAImpl poa, boolean multipleIDsAllowed ) } } - private Map keyToEntry = - new HashMap() ; - private Map entryToServant = - new HashMap() ; - private Map servantToEntry = - new HashMap() ; + private Map keyToEntry = new HashMap(); + private Map entryToServant = new HashMap(); + private Map servantToEntry = new HashMap(); - public final boolean contains(Servant value) - { - return servantToEntry.containsKey( value ) ; + public final boolean contains(Servant value) { + return servantToEntry.containsKey(value); } - public final boolean containsKey(Key key) - { + public final boolean containsKey(Key key) { return keyToEntry.containsKey(key); } - /* get Returns the entry assigned to the key, or creates a new - * entry in state INVALID if none is present. - */ - public final AOMEntry get(Key key) - { + /* + * get Returns the entry assigned to the key, or creates a new entry in state INVALID if none is present. + */ + public final AOMEntry get(Key key) { AOMEntry result = keyToEntry.get(key); if (result == null) { - result = new AOMEntry( poa ) ; - putEntry( key, result ) ; + result = new AOMEntry(poa); + putEntry(key, result); } - return result ; + return result; } - public final Servant getServant( AOMEntry entry ) - { - return entryToServant.get(entry) ; + public final Servant getServant(AOMEntry entry) { + return entryToServant.get(entry); } - public abstract Key getKey(AOMEntry value) throws WrongPolicy ; + public abstract Key getKey(AOMEntry value) throws WrongPolicy; - public Key getKey(Servant value) throws WrongPolicy - { - AOMEntry entry = servantToEntry.get(value) ; - return getKey( entry ) ; + public Key getKey(Servant value) throws WrongPolicy { + AOMEntry entry = servantToEntry.get(value); + return getKey(entry); } - protected void putEntry( Key key, AOMEntry value ) - { - keyToEntry.put( key, value ) ; + protected void putEntry(Key key, AOMEntry value) { + keyToEntry.put(key, value); } - public final void putServant( Servant servant, AOMEntry value ) - { - entryToServant.put( value, servant ) ; - servantToEntry.put( servant, value ) ; + public final void putServant(Servant servant, AOMEntry value) { + entryToServant.put(value, servant); + servantToEntry.put(servant, value); } - protected abstract void removeEntry( AOMEntry entry, Key key ) ; + protected abstract void removeEntry(AOMEntry entry, Key key); - public final void remove( Key key ) - { - AOMEntry entry = keyToEntry.remove(key) ; - Servant servant = entryToServant.remove(entry) ; + public final void remove(Key key) { + AOMEntry entry = keyToEntry.remove(key); + Servant servant = entryToServant.remove(entry); if (servant != null) { servantToEntry.remove(servant); } - removeEntry( entry, key ) ; + removeEntry(entry, key); } - public abstract boolean hasMultipleIDs(AOMEntry value) ; + public abstract boolean hasMultipleIDs(AOMEntry value); - protected void clear() - { + protected void clear() { keyToEntry.clear(); } - public final Set keySet() - { - return keyToEntry.keySet() ; + public final Set keySet() { + return keyToEntry.keySet(); } } -class SingleObjectMap extends ActiveObjectMap -{ - private Map entryToKey = new HashMap() ; +class SingleObjectMap extends ActiveObjectMap { + private Map entryToKey = new HashMap(); - SingleObjectMap( POAImpl poa ) - { - super( poa ) ; + SingleObjectMap(POAImpl poa) { + super(poa); } - public Key getKey(AOMEntry value) throws WrongPolicy - { - return entryToKey.get(value) ; + public Key getKey(AOMEntry value) throws WrongPolicy { + return entryToKey.get(value); } @Override - protected void putEntry(Key key, AOMEntry value) - { - super.putEntry( key, value); + protected void putEntry(Key key, AOMEntry value) { + super.putEntry(key, value); - entryToKey.put( value, key ) ; + entryToKey.put(value, key); } - public boolean hasMultipleIDs(AOMEntry value) - { + public boolean hasMultipleIDs(AOMEntry value) { return false; } // This case does not need the key. - protected void removeEntry(AOMEntry entry, Key key) - { - entryToKey.remove( entry ) ; + protected void removeEntry(AOMEntry entry, Key key) { + entryToKey.remove(entry); } @Override - public void clear() - { - super.clear() ; - entryToKey.clear() ; + public void clear() { + super.clear(); + entryToKey.clear(); } } -class MultipleObjectMap extends ActiveObjectMap -{ - private Map> entryToKeys = - new HashMap>() ; +class MultipleObjectMap extends ActiveObjectMap { + private Map> entryToKeys = new HashMap>(); - MultipleObjectMap( POAImpl poa ) - { - super( poa ) ; + MultipleObjectMap(POAImpl poa) { + super(poa); } - public Key getKey(AOMEntry value) throws WrongPolicy - { - throw new WrongPolicy() ; + public Key getKey(AOMEntry value) throws WrongPolicy { + throw new WrongPolicy(); } @Override - protected void putEntry(Key key, AOMEntry value) - { - super.putEntry( key, value); + protected void putEntry(Key key, AOMEntry value) { + super.putEntry(key, value); - Set set = entryToKeys.get( value ) ; + Set set = entryToKeys.get(value); if (set == null) { - set = new HashSet() ; - entryToKeys.put( value, set ) ; + set = new HashSet(); + entryToKeys.put(value, set); } - set.add( key ) ; + set.add(key); } - public boolean hasMultipleIDs(AOMEntry value) - { - Set set = entryToKeys.get( value ) ; + public boolean hasMultipleIDs(AOMEntry value) { + Set set = entryToKeys.get(value); if (set == null) { return false; } - return set.size() > 1 ; + return set.size() > 1; } - protected void removeEntry(AOMEntry entry, Key key) - { - Set keys = entryToKeys.get( entry ) ; + protected void removeEntry(AOMEntry entry, Key key) { + Set keys = entryToKeys.get(entry); if (keys != null) { - keys.remove( key ) ; + keys.remove(key); if (keys.isEmpty()) { entryToKeys.remove(entry); } @@ -273,10 +242,8 @@ protected void removeEntry(AOMEntry entry, Key key) } @Override - public void clear() - { - super.clear() ; - entryToKeys.clear() ; + public void clear() { + super.clear(); + entryToKeys.clear(); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/BadServerIdHandler.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/BadServerIdHandler.java index bffaaea8a..ee7411f77 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/BadServerIdHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/BadServerIdHandler.java @@ -22,13 +22,10 @@ import com.sun.corba.ee.spi.ior.ObjectKey; /** - * The bad server id handler is used to locate persistent objects. - * The Locator object registers the BadServerIdHandler with the ORB - * and when requests for persistent objects for servers (other than - * itself) comes, it throws a ForwardException with the IOR pointing - * to the active server. + * The bad server id handler is used to locate persistent objects. The Locator object registers the BadServerIdHandler + * with the ORB and when requests for persistent objects for servers (other than itself) comes, it throws a + * ForwardException with the IOR pointing to the active server. */ -public interface BadServerIdHandler -{ - void handle(ObjectKey objectKey) ; +public interface BadServerIdHandler { + void handle(ObjectKey objectKey); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/DelegateImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/DelegateImpl.java index 12585755f..767804dab 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/DelegateImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/DelegateImpl.java @@ -23,96 +23,87 @@ import org.omg.PortableServer.*; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.logging.POASystemException ; +import com.sun.corba.ee.spi.logging.POASystemException; -public class DelegateImpl implements org.omg.PortableServer.portable.Delegate -{ - private static final POASystemException wrapper = - POASystemException.self ; +public class DelegateImpl implements org.omg.PortableServer.portable.Delegate { + private static final POASystemException wrapper = POASystemException.self; - private ORB orb ; + private ORB orb; private POAFactory factory; - public DelegateImpl(ORB orb, POAFactory factory){ - this.orb = orb ; + public DelegateImpl(ORB orb, POAFactory factory) { + this.orb = orb; this.factory = factory; } - public org.omg.CORBA.ORB orb(Servant self) - { + public org.omg.CORBA.ORB orb(Servant self) { return orb; } - public org.omg.CORBA.Object this_object(Servant self) - { + public org.omg.CORBA.Object this_object(Servant self) { byte[] oid; POA poa; try { oid = orb.peekInvocationInfo().id(); - poa = (POA)orb.peekInvocationInfo().oa(); - String repId = self._all_interfaces(poa,oid)[0] ; - return poa.create_reference_with_id(oid, repId); - } catch (EmptyStackException notInInvocationE) { - //Not within an invocation context + poa = (POA) orb.peekInvocationInfo().oa(); + String repId = self._all_interfaces(poa, oid)[0]; + return poa.create_reference_with_id(oid, repId); + } catch (EmptyStackException notInInvocationE) { + // Not within an invocation context POAImpl defaultPOA = null; try { - defaultPOA = (POAImpl)self._default_POA(); - } catch (ClassCastException exception){ - throw wrapper.defaultPoaNotPoaimpl( exception ) ; + defaultPOA = (POAImpl) self._default_POA(); + } catch (ClassCastException exception) { + throw wrapper.defaultPoaNotPoaimpl(exception); } try { - if (defaultPOA.getPolicies().isImplicitlyActivated() || - (defaultPOA.getPolicies().isUniqueIds() && - defaultPOA.getPolicies().retainServants())) { + if (defaultPOA.getPolicies().isImplicitlyActivated() + || (defaultPOA.getPolicies().isUniqueIds() && defaultPOA.getPolicies().retainServants())) { return defaultPOA.servant_to_reference(self); } else { - throw wrapper.wrongPoliciesForThisObject() ; - } - } catch ( org.omg.PortableServer.POAPackage.ServantNotActive e) { - throw wrapper.thisObjectServantNotActive( e ) ; - } catch ( org.omg.PortableServer.POAPackage.WrongPolicy e) { - throw wrapper.thisObjectWrongPolicy( e ) ; + throw wrapper.wrongPoliciesForThisObject(); + } + } catch (org.omg.PortableServer.POAPackage.ServantNotActive e) { + throw wrapper.thisObjectServantNotActive(e); + } catch (org.omg.PortableServer.POAPackage.WrongPolicy e) { + throw wrapper.thisObjectWrongPolicy(e); } } catch (ClassCastException e) { - throw wrapper.defaultPoaNotPoaimpl( e ) ; + throw wrapper.defaultPoaNotPoaimpl(e); } } - public POA poa(Servant self) - { + public POA poa(Servant self) { try { - return (POA)orb.peekInvocationInfo().oa(); - } catch (EmptyStackException exception){ + return (POA) orb.peekInvocationInfo().oa(); + } catch (EmptyStackException exception) { POA returnValue = factory.lookupPOA(self); if (returnValue != null) { return returnValue; } - - throw wrapper.noContext( exception ) ; + + throw wrapper.noContext(exception); } } - public byte[] object_id(Servant self) - { - try{ + public byte[] object_id(Servant self) { + try { return orb.peekInvocationInfo().id(); - } catch (EmptyStackException exception){ - throw wrapper.noContext(exception) ; + } catch (EmptyStackException exception) { + throw wrapper.noContext(exception); } } - public POA default_POA(Servant self) - { + public POA default_POA(Servant self) { return factory.getRootPOA(); } - public boolean is_a(Servant self, String repId) - { - String[] repositoryIds = self._all_interfaces(poa(self),object_id(self)); - for ( int i=0; i exportedServantsToPOA = new WeakHashMap(); + private Map exportedServantsToPOA = new WeakHashMap(); - private java.util.concurrent.ConcurrentHashMap poaManagers ; + private java.util.concurrent.ConcurrentHashMap poaManagers; - private int poaManagerId ; - private int poaId ; - private POAImpl rootPOA ; + private int poaManagerId; + private int poaId; + private POAImpl rootPOA; private DelegateImpl delegateImpl; - private ORB orb ; - private boolean isShuttingDown = false ; - private ManagedObjectManager mom ; + private ORB orb; + private boolean isShuttingDown = false; + private ManagedObjectManager mom; - public POASystemException getWrapper() - { - return wrapper ; + public POASystemException getWrapper() { + return wrapper; } - /** All object adapter factories must have a no-arg constructor. - */ - public POAFactory( ) - { - poaManagers = new java.util.concurrent.ConcurrentHashMap(4); - poaManagerId = 0 ; - poaId = 0 ; - rootPOA = null ; - delegateImpl = null ; - orb = null ; + /** + * All object adapter factories must have a no-arg constructor. + */ + public POAFactory() { + poaManagers = new java.util.concurrent.ConcurrentHashMap(4); + poaManagerId = 0; + poaId = 0; + rootPOA = null; + delegateImpl = null; + orb = null; } @ManagedData - @Description( "A servant registered with a particular POA" ) + @Description("A servant registered with a particular POA") public static class ServantPOAPair { - private Servant servant ; - private POAImpl poa ; + private Servant servant; + private POAImpl poa; - public ServantPOAPair( Servant servant, POAImpl poa ) { - this.servant = servant ; - this.poa = poa ; + public ServantPOAPair(Servant servant, POAImpl poa) { + this.servant = servant; + this.poa = poa; } - @ManagedAttribute - @Description( "Servant" ) - Servant getServant() { return servant ; } + @ManagedAttribute + @Description("Servant") + Servant getServant() { + return servant; + } @ManagedAttribute - @Description( "POA for Servant" ) - POAImpl getPOA() { return poa ; } + @Description("POA for Servant") + POAImpl getPOA() { + return poa; + } } @ManagedAttribute - @Description( "The servants managed by a particular POA" ) + @Description("The servants managed by a particular POA") private synchronized List getExportedServants() { - List result = new ArrayList() ; - for (Map.Entry entry : exportedServantsToPOA.entrySet()) { - POAImpl pimpl = (POAImpl)entry.getValue() ; - result.add( new ServantPOAPair( entry.getKey(), pimpl ) ) ; + List result = new ArrayList(); + for (Map.Entry entry : exportedServantsToPOA.entrySet()) { + POAImpl pimpl = (POAImpl) entry.getValue(); + result.add(new ServantPOAPair(entry.getKey(), pimpl)); } - return result ; + return result; } @ManagedAttribute - @Description( "The POAManagers") + @Description("The POAManagers") private synchronized Set getPOAManagers() { - return new HashSet( poaManagers.keySet() ) ; + return new HashSet(poaManagers.keySet()); } @ManagedAttribute - @Description( "The last allocated POAManager id") + @Description("The last allocated POAManager id") private synchronized int getPOAManagerId() { - return poaManagerId ; + return poaManagerId; } @ManagedAttribute - @Description( "The last allocated POAManager id") + @Description("The last allocated POAManager id") private synchronized int getPOAId() { - return poaId ; + return poaId; } - @ManagedAttribute( id = "RootPOA" ) - @Description( "The root POA") + @ManagedAttribute(id = "RootPOA") + @Description("The root POA") private synchronized POAImpl getDisplayRootPOA() { - return rootPOA ; + return rootPOA; } - public synchronized POA lookupPOA (Servant servant) - { + public synchronized POA lookupPOA(Servant servant) { return exportedServantsToPOA.get(servant); } - public synchronized void registerPOAForServant(POA poa, Servant servant) - { + public synchronized void registerPOAForServant(POA poa, Servant servant) { exportedServantsToPOA.put(servant, poa); } - public synchronized void unregisterPOAForServant(POA poa, Servant servant) - { + public synchronized void unregisterPOAForServant(POA poa, Servant servant) { exportedServantsToPOA.remove(servant); } // Implementation of ObjectAdapterFactory interface - public void init( ORB orb ) - { - this.orb = orb ; - delegateImpl = new DelegateImpl( orb, this ) ; - registerRootPOA() ; + public void init(ORB orb) { + this.orb = orb; + delegateImpl = new DelegateImpl(orb, this); + registerRootPOA(); POACurrent poaCurrent = new POACurrent(orb); - orb.getLocalResolver().register( ORBConstants.POA_CURRENT_NAME, - NullaryFunction.Factory.makeConstant( - (org.omg.CORBA.Object)poaCurrent ) ) ; - this.mom = orb.mom() ; - mom.registerAtRoot( this ) ; + orb.getLocalResolver().register(ORBConstants.POA_CURRENT_NAME, + NullaryFunction.Factory.makeConstant((org.omg.CORBA.Object) poaCurrent)); + this.mom = orb.mom(); + mom.registerAtRoot(this); } - public ObjectAdapter find( ObjectAdapterId oaid ) - { - POA poa=null; + public ObjectAdapter find(ObjectAdapterId oaid) { + POA poa = null; try { - boolean first = true ; - Iterator iter = oaid.iterator() ; + boolean first = true; + Iterator iter = oaid.iterator(); poa = getRootPOA(); while (iter.hasNext()) { - String name = (String)(iter.next()) ; + String name = (String) (iter.next()); if (first) { - if (!name.equals( ORBConstants.ROOT_POA_NAME )) { + if (!name.equals(ORBConstants.ROOT_POA_NAME)) { throw wrapper.makeFactoryNotPoa(name); } - first = false ; + first = false; } else { - poa = poa.find_POA( name, true ) ; + poa = poa.find_POA(name, true); } } - } catch ( org.omg.PortableServer.POAPackage.AdapterNonExistent ex ){ - throw omgWrapper.noObjectAdaptor( ex ) ; - } catch ( OBJECT_NOT_EXIST ex ) { + } catch (org.omg.PortableServer.POAPackage.AdapterNonExistent ex) { + throw omgWrapper.noObjectAdaptor(ex); + } catch (OBJECT_NOT_EXIST ex) { throw ex; - } catch ( TRANSIENT ex ) { + } catch (TRANSIENT ex) { throw ex; - } catch ( Exception ex ) { - throw wrapper.poaLookupError( ex ) ; + } catch (Exception ex) { + throw wrapper.poaLookupError(ex); } - if ( poa == null ) { + if (poa == null) { throw wrapper.poaLookupError(); } - return (ObjectAdapter)poa; + return (ObjectAdapter) poa; } - public void shutdown( boolean waitForCompletion ) - { - // It is important to copy the list of POAManagers first because + public void shutdown(boolean waitForCompletion) { + // It is important to copy the list of POAManagers first because // pm.deactivate removes itself from poaManagers! - Iterator managers = null ; + Iterator managers = null; synchronized (this) { - isShuttingDown = true ; + isShuttingDown = true; managers = poaManagers.keySet().iterator(); } - while ( managers.hasNext() ) { + while (managers.hasNext()) { try { managers.next().deactivate(true, waitForCompletion); - } catch ( org.omg.PortableServer.POAManagerPackage.AdapterInactive e ) {} + } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive e) { + } } } // Special methods used to manipulate global POA related state - public synchronized void removePoaManager( POAManager manager ) - { + public synchronized void removePoaManager(POAManager manager) { poaManagers.remove(manager); - mom.unregister( manager ) ; + mom.unregister(manager); } - public void addPoaManager( POAManager manager ) - { + public void addPoaManager(POAManager manager) { poaManagers.putIfAbsent(manager, Boolean.TRUE); // Store the key. Value is dummy } - synchronized public int newPOAManagerId() - { - return poaManagerId++ ; + synchronized public int newPOAManagerId() { + return poaManagerId++; } - public void registerRootPOA() - { + public void registerRootPOA() { // We delay the evaluation of makeRootPOA until // a call to resolve_initial_references( "RootPOA" ). // The Future guarantees that makeRootPOA is only called once. - NullaryFunction rpClosure = - new NullaryFunction() { - public org.omg.CORBA.Object evaluate() { - return POAImpl.makeRootPOA( orb ) ; - } - } ; + NullaryFunction rpClosure = new NullaryFunction() { + public org.omg.CORBA.Object evaluate() { + return POAImpl.makeRootPOA(orb); + } + }; - orb.getLocalResolver().register( ORBConstants.ROOT_POA_NAME, - NullaryFunction.Factory.makeFuture( rpClosure ) ) ; + orb.getLocalResolver().register(ORBConstants.ROOT_POA_NAME, NullaryFunction.Factory.makeFuture(rpClosure)); } - public synchronized POA getRootPOA() - { + public synchronized POA getRootPOA() { if (rootPOA == null) { if (isShuttingDown) { - throw omgWrapper.noObjectAdaptor() ; + throw omgWrapper.noObjectAdaptor(); } try { - Object obj = orb.resolve_initial_references( - ORBConstants.ROOT_POA_NAME ) ; - rootPOA = (POAImpl)obj ; + Object obj = orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME); + rootPOA = (POAImpl) obj; } catch (InvalidName inv) { - throw wrapper.cantResolveRootPoa( inv ) ; - } + throw wrapper.cantResolveRootPoa(inv); + } } return rootPOA; } - public org.omg.PortableServer.portable.Delegate getDelegateImpl() - { - return delegateImpl ; + public org.omg.PortableServer.portable.Delegate getDelegateImpl() { + return delegateImpl; } - synchronized public int newPOAId() - { - return poaId++ ; + synchronized public int newPOAId() { + return poaId++; } - public ORB getORB() - { - return orb ; + public ORB getORB() { + return orb; } -} +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAImpl.java index dab29e901..ecf9f6ed5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAImpl.java @@ -19,27 +19,27 @@ package com.sun.corba.ee.impl.oa.poa; -import java.util.Collection ; -import java.util.Set ; -import java.util.HashSet ; -import java.util.Map ; -import java.util.HashMap ; -import java.util.Iterator ; - -import java.util.concurrent.locks.Condition ; -import java.util.concurrent.locks.ReentrantLock ; - -import javax.management.ObjectName ; - -import org.omg.CORBA.Policy ; -import org.omg.CORBA.SystemException ; - -import org.omg.PortableServer.POA ; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.POAManager ; -import org.omg.PortableServer.AdapterActivator ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; +import java.util.Collection; +import java.util.Set; +import java.util.HashSet; +import java.util.Map; +import java.util.HashMap; +import java.util.Iterator; + +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.ReentrantLock; + +import javax.management.ObjectName; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.SystemException; + +import org.omg.PortableServer.POA; +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.POAManager; +import org.omg.PortableServer.AdapterActivator; +import org.omg.PortableServer.ServantManager; +import org.omg.PortableServer.ForwardRequest; import org.omg.PortableServer.ThreadPolicy; import org.omg.PortableServer.LifespanPolicy; import org.omg.PortableServer.IdUniquenessPolicy; @@ -47,44 +47,44 @@ import org.omg.PortableServer.ImplicitActivationPolicy; import org.omg.PortableServer.ServantRetentionPolicy; import org.omg.PortableServer.RequestProcessingPolicy; -import org.omg.PortableServer.ThreadPolicyValue ; -import org.omg.PortableServer.LifespanPolicyValue ; -import org.omg.PortableServer.IdUniquenessPolicyValue ; -import org.omg.PortableServer.IdAssignmentPolicyValue ; -import org.omg.PortableServer.ImplicitActivationPolicyValue ; -import org.omg.PortableServer.ServantRetentionPolicyValue ; -import org.omg.PortableServer.RequestProcessingPolicyValue ; -import org.omg.PortableServer.POAPackage.AdapterAlreadyExists ; -import org.omg.PortableServer.POAPackage.AdapterNonExistent ; -import org.omg.PortableServer.POAPackage.InvalidPolicy ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.WrongAdapter ; -import org.omg.PortableServer.POAPackage.NoServant ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; - -import org.omg.PortableInterceptor.ObjectReferenceFactory ; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.NON_EXISTENT ; - -import com.sun.corba.ee.spi.copyobject.CopierManager ; -import com.sun.corba.ee.spi.oa.OADestroyed ; -import com.sun.corba.ee.spi.oa.OAInvocationInfo ; -import com.sun.corba.ee.spi.oa.ObjectAdapterBase ; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.IORFactories ; -import com.sun.corba.ee.spi.ior.IORTemplateList ; -import com.sun.corba.ee.spi.ior.TaggedProfile ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.protocol.ForwardException ; - -import com.sun.corba.ee.impl.ior.POAObjectKeyTemplate ; -import com.sun.corba.ee.impl.ior.ObjectAdapterIdArray ; +import org.omg.PortableServer.ThreadPolicyValue; +import org.omg.PortableServer.LifespanPolicyValue; +import org.omg.PortableServer.IdUniquenessPolicyValue; +import org.omg.PortableServer.IdAssignmentPolicyValue; +import org.omg.PortableServer.ImplicitActivationPolicyValue; +import org.omg.PortableServer.ServantRetentionPolicyValue; +import org.omg.PortableServer.RequestProcessingPolicyValue; +import org.omg.PortableServer.POAPackage.AdapterAlreadyExists; +import org.omg.PortableServer.POAPackage.AdapterNonExistent; +import org.omg.PortableServer.POAPackage.InvalidPolicy; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.WrongAdapter; +import org.omg.PortableServer.POAPackage.NoServant; +import org.omg.PortableServer.POAPackage.ServantAlreadyActive; +import org.omg.PortableServer.POAPackage.ObjectAlreadyActive; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.ObjectNotActive; + +import org.omg.PortableInterceptor.ObjectReferenceFactory; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; +import org.omg.PortableInterceptor.NON_EXISTENT; + +import com.sun.corba.ee.spi.copyobject.CopierManager; +import com.sun.corba.ee.spi.oa.OADestroyed; +import com.sun.corba.ee.spi.oa.OAInvocationInfo; +import com.sun.corba.ee.spi.oa.ObjectAdapterBase; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.IORFactories; +import com.sun.corba.ee.spi.ior.IORTemplateList; +import com.sun.corba.ee.spi.ior.TaggedProfile; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.protocol.ForwardException; + +import com.sun.corba.ee.impl.ior.POAObjectKeyTemplate; +import com.sun.corba.ee.impl.ior.ObjectAdapterIdArray; import com.sun.corba.ee.spi.logging.OMGSystemException; import com.sun.corba.ee.spi.logging.POASystemException; import com.sun.corba.ee.spi.misc.ORBConstants; @@ -104,42 +104,36 @@ import org.glassfish.pfl.tf.spi.annotation.InfoMethod; /** - * POAImpl is the implementation of the Portable Object Adapter. It - * contains an implementation of the POA interfaces specified in - * COBRA 2.3.1 chapter 11 (formal/99-10-07). This implementation - * is moving to comply with CORBA 3.0 due to the many clarifications - * that have been made to the POA semantics since CORBA 2.3.1. - * Specific comments have been added where 3.0 applies, but note that - * we do not have the new 3.0 APIs yet. + * POAImpl is the implementation of the Portable Object Adapter. It contains an implementation of the POA interfaces + * specified in COBRA 2.3.1 chapter 11 (formal/99-10-07). This implementation is moving to comply with CORBA 3.0 due to + * the many clarifications that have been made to the POA semantics since CORBA 2.3.1. Specific comments have been added + * where 3.0 applies, but note that we do not have the new 3.0 APIs yet. */ @Poa @ManagedObject -public class POAImpl extends ObjectAdapterBase implements POA -{ - private static final POASystemException wrapper = - POASystemException.self ; - private static final OMGSystemException omgWrapper = - OMGSystemException.self ; +public class POAImpl extends ObjectAdapterBase implements POA { + private static final POASystemException wrapper = POASystemException.self; + private static final OMGSystemException omgWrapper = OMGSystemException.self; private static final long serialVersionUID = -1746388801294205323L; // POA Creation // - // POA creation takes place in 2 stages: - // first, the POAImpl constructor is called - // then, the initialize method is called. - // This separation is needed because an AdapterActivator does not know - // the POAManager or the policies when - // the unknown_adapter method is invoked. However, the POA must be created + // POA creation takes place in 2 stages: + // first, the POAImpl constructor is called + // then, the initialize method is called. + // This separation is needed because an AdapterActivator does not know + // the POAManager or the policies when + // the unknown_adapter method is invoked. However, the POA must be created // before the unknown_adapter method is invoked, so that the parent knows // when concurrent attempts are made to create the same POA. // - // Calling the POAImpl constructor results in a new POA without initializing - // the new POA. new POAImpl is called in two places: + // Calling the POAImpl constructor results in a new POA without initializing + // the new POA. new POAImpl is called in two places: // 1. inside create_POA: state = STATE_START - // 2. inside find_POA: state = STATE_INIT + // 2. inside find_POA: state = STATE_INIT // - // Calling initialize( POAManager, Policies ) results in state STATE_RUN + // Calling initialize( POAManager, Policies ) results in state STATE_RUN // (if the POA create created directly in create_POA) or // state STATE_INIT_DONE (if the POA was create in an AdapterActivator). // @@ -147,87 +141,86 @@ public class POAImpl extends ObjectAdapterBase implements POA // POA destruction. // // destroyIfNotInitDone completes moves the POA state from STATE_INIT_DONE - // to STATE_RUN. It is called from find_POA after the unknown_adapter - // call returns. Note that unknown_adapter MUST call create_POA at some + // to STATE_RUN. It is called from find_POA after the unknown_adapter + // call returns. Note that unknown_adapter MUST call create_POA at some // point. // Notes on concurrency // // The POA requires careful design for concurrency management to correctly - // implement the specification and avoid deadlocks. The order of acquiring + // implement the specification and avoid deadlocks. The order of acquiring // locks must respect the following locking hierarchy: // // 1. Lock POAs before POAManagers // 2. Lock a POA before locking its child POA // // Also note that there are 3 separate conditions on which threads may wait - // in the POA, as defined by invokeCV, beingDestroyedCV, and - // adapterActivatorCV. This means that (for this reason as well as others) - // we cannot simply use the standard Java synchronized primitive. - // This implementation uses a modified version of Doug Lea's + // in the POA, as defined by invokeCV, beingDestroyedCV, and + // adapterActivatorCV. This means that (for this reason as well as others) + // we cannot simply use the standard Java synchronized primitive. + // This implementation uses a modified version of Doug Lea's // util.concurrent (version 1.3.0) that supports reentrant - // mutexes to handle the locking. This will all be replaced by the new JSR - // 166 concurrency primitives in J2SE 1.5 and later once the ORB moves to + // mutexes to handle the locking. This will all be replaced by the new JSR + // 166 concurrency primitives in J2SE 1.5 and later once the ORB moves to // J2SE 1.5. // - // Recently I've modified the POA to support read/write locking. This works - // well for reducing lock contention, but it can be a bit tricky. ALl 3 - // condition variables are creates from poaMutex.writeLock, so + // Recently I've modified the POA to support read/write locking. This works + // well for reducing lock contention, but it can be a bit tricky. ALl 3 + // condition variables are creates from poaMutex.writeLock, so // poaMutex.writeLock() must be held whenever an acquire or signal method - // is called on one of the condition variables. Since it is not possible + // is called on one of the condition variables. Since it is not possible // to upgrade a read lock to a write lock, using a condition variable // requires dropping the read lock, acquiring the write lock, and possibly // then checking again to make sure that an invariant is still satisified. - + // POA state constants // - // Note that ordering is important here: we must have the state defined in + // Note that ordering is important here: we must have the state defined in // this order so that ordered comparison is possible. - // DO NOT CHANGE THE VALUES OF THE STATE CONSTANTS!!! In particular, the - // initialization related states must be lower than STATE_RUN, and the + // DO NOT CHANGE THE VALUES OF THE STATE CONSTANTS!!! In particular, the + // initialization related states must be lower than STATE_RUN, and the // destruction related state must be higher. // // A POA is created in STATE_START // // Valid state transitions: // - // START to INIT after find_POA constructor call - // START to RUN after initialize completes - // INIT to INIT_DONE after initialize completes - // INIT to DESTROYED after failed unknown_adapter - // INIT_DONE to RUN after successful unknown_adapter - // STATE_RUN to STATE_DESTROYING after start of destruction - // STATE_DESTROYING to STATE_DESTROYED after destruction completes. - - private static final int STATE_START = 0 ; // constructor complete - private static final int STATE_INIT = 1 ; // waiting for adapter activator - private static final int STATE_INIT_DONE = 2 ; // adapter activator called create_POA - private static final int STATE_RUN = 3 ; // initialized and running - private static final int STATE_DESTROYING = 4 ; // being destroyed - private static final int STATE_DESTROYED = 5 ; // destruction complete - - private String stateToString() - { + // START to INIT after find_POA constructor call + // START to RUN after initialize completes + // INIT to INIT_DONE after initialize completes + // INIT to DESTROYED after failed unknown_adapter + // INIT_DONE to RUN after successful unknown_adapter + // STATE_RUN to STATE_DESTROYING after start of destruction + // STATE_DESTROYING to STATE_DESTROYED after destruction completes. + + private static final int STATE_START = 0; // constructor complete + private static final int STATE_INIT = 1; // waiting for adapter activator + private static final int STATE_INIT_DONE = 2; // adapter activator called create_POA + private static final int STATE_RUN = 3; // initialized and running + private static final int STATE_DESTROYING = 4; // being destroyed + private static final int STATE_DESTROYED = 5; // destruction complete + + private String stateToString() { switch (state) { - case STATE_START : - return "START" ; - case STATE_INIT : - return "INIT" ; - case STATE_INIT_DONE : - return "INIT_DONE" ; - case STATE_RUN : - return "RUN" ; - case STATE_DESTROYING : - return "DESTROYING" ; - case STATE_DESTROYED : - return "DESTROYED" ; - default : - return "UNKNOWN(" + state + ")" ; - } + case STATE_START: + return "START"; + case STATE_INIT: + return "INIT"; + case STATE_INIT_DONE: + return "INIT_DONE"; + case STATE_RUN: + return "RUN"; + case STATE_DESTROYING: + return "DESTROYING"; + case STATE_DESTROYED: + return "DESTROYED"; + default: + return "UNKNOWN(" + state + ")"; + } } // Current state of the POA - private int state ; + private int state; // The POA request handler that performs all policy specific operations // Note that POAImpl handles all synchronization, so mediator is (mostly) @@ -235,223 +228,212 @@ private String stateToString() private POAPolicyMediator mediator; // Representation of object adapter ID - private final int numLevels; // counts depth of tree. Root = 1. - private final ObjectAdapterId poaId ; // the actual object adapter ID for this POA + private final int numLevels; // counts depth of tree. Root = 1. + private final ObjectAdapterId poaId; // the actual object adapter ID for this POA - private final String poaName; // the name of this POA + private final String poaName; // the name of this POA private POAManagerImpl manager; // This POA's POAManager - private final int uniquePOAId ; // ID for this POA that is unique relative - // to the POAFactory, which has the same - // lifetime as the ORB. - private POAImpl parent; // The POA that created this POA. - private final Map children; // Map from name to POA of POAs - // created by this POA. + private final int uniquePOAId; // ID for this POA that is unique relative + // to the POAFactory, which has the same + // lifetime as the ORB. + private POAImpl parent; // The POA that created this POA. + private final Map children; // Map from name to POA of POAs + // created by this POA. private AdapterActivator activator; - private final AtomicInteger invocationCount ; // pending invocations on this POA. + private final AtomicInteger invocationCount; // pending invocations on this POA. // Data used to control POA concurrency - // Master lock for all POA synchronization. See lock and unlock. + // Master lock for all POA synchronization. See lock and unlock. // package private for access by AOMEntry. - final ReadWriteLock poaMutex ; + final ReadWriteLock poaMutex; - // Wait on this CV for AdapterActivator upcalls to complete - private final Condition adapterActivatorCV ; + // Wait on this CV for AdapterActivator upcalls to complete + private final Condition adapterActivatorCV; - // Wait on this CV for all active invocations to complete - private final Condition invokeCV ; + // Wait on this CV for all active invocations to complete + private final Condition invokeCV; // Wait on this CV for the destroy method to complete doing its work - private final Condition beingDestroyedCV ; + private final Condition beingDestroyedCV; - // thread local variable to store a boolean to detect deadlock in + // thread local variable to store a boolean to detect deadlock in // POA.destroy(). - private final ThreadLocal isDestroying ; + private final ThreadLocal isDestroying; // Used for synchronized access to the ManagedObjectManager. - private static final Object momLock = new Object() ; + private static final Object momLock = new Object(); // This includes the most important information for debugging // POA problems. @Override - public String toString() - { - return "POA[" + poaId.toString() + - ", uniquePOAId=" + uniquePOAId + - ", state=" + stateToString() + - ", invocationCount=" + invocationCount.get() + "]" ; + public String toString() { + return "POA[" + poaId.toString() + ", uniquePOAId=" + uniquePOAId + ", state=" + stateToString() + ", invocationCount=" + + invocationCount.get() + "]"; } - @ManagedAttribute( id="POAState") - @Description( "The current state of the POA") + @ManagedAttribute(id = "POAState") + @Description("The current state of the POA") private String getDisplayState() { - lock() ; + lock(); try { - return stateToString() ; + return stateToString(); } finally { - unlock() ; + unlock(); } } @ManagedAttribute - @Description( "The POA's mediator") + @Description("The POA's mediator") POAPolicyMediator getMediator() { - return mediator ; + return mediator; } @ManagedAttribute - @Description( "The ObjectAdapterId for this POA") + @Description("The ObjectAdapterId for this POA") private ObjectAdapterId getObjectAdapterId() { - return poaId ; + return poaId; } // package private for access to servant to POA map - static POAFactory getPOAFactory( ORB orb ) - { - return (POAFactory)orb.getRequestDispatcherRegistry(). - getObjectAdapterFactory( ORBConstants.TRANSIENT_SCID ) ; + static POAFactory getPOAFactory(ORB orb) { + return (POAFactory) orb.getRequestDispatcherRegistry().getObjectAdapterFactory(ORBConstants.TRANSIENT_SCID); } @Poa - private static void registerMBean( ORB orb, Object obj ) { - orb.mom().register( getPOAFactory( orb ), obj ) ; + private static void registerMBean(ORB orb, Object obj) { + orb.mom().register(getPOAFactory(orb), obj); } // package private so that POAFactory can access it. - static POAImpl makeRootPOA( ORB orb ) - { - POAManagerImpl poaManager = new POAManagerImpl( getPOAFactory( orb ), - orb.getPIHandler() ) ; - registerMBean( orb, poaManager ) ; + static POAImpl makeRootPOA(ORB orb) { + POAManagerImpl poaManager = new POAManagerImpl(getPOAFactory(orb), orb.getPIHandler()); + registerMBean(orb, poaManager); - POAImpl result = new POAImpl( ORBConstants.ROOT_POA_NAME, - null, orb, STATE_START ) ; - result.initialize( poaManager, Policies.rootPOAPolicies ) ; + POAImpl result = new POAImpl(ORBConstants.ROOT_POA_NAME, null, orb, STATE_START); + result.initialize(poaManager, Policies.rootPOAPolicies); // must come after initialize! - registerMBean( orb, result ) ; + registerMBean(orb, result); - return result ; + return result; } // package private so that POAPolicyMediatorBase can access it. @ManagedAttribute() - @Description( "The unique ID for this POA") - int getPOAId() - { - return uniquePOAId ; + @Description("The unique ID for this POA") + int getPOAId() { + return uniquePOAId; } @InfoMethod - private void thisPoa( POAImpl p ) { } + private void thisPoa(POAImpl p) { + } @InfoMethod - private void acquireLockWaiting( int count ) {} + private void acquireLockWaiting(int count) { + } @Poa // Be paranoid about lost wakeup problems like 6822370 // GLASSFISH_CORBA-11, GLASSFISH-16217, Bug #14247062, Bug #14390811 : // - 6822370 is resolved in JDK 6u21, hence simply call lock() - private void acquireLock( Lock lock ) { + private void acquireLock(Lock lock) { lock.lock(); } // package private so that POAPolicyMediator can access it. @Poa - void lock() - { - acquireLock( poaMutex.writeLock() ) ; - thisPoa( this ) ; + void lock() { + acquireLock(poaMutex.writeLock()); + thisPoa(this); } // package private so that POAPolicyMediator can access it. @Poa - void unlock() - { - thisPoa( this ) ; - poaMutex.writeLock().unlock() ; + void unlock() { + thisPoa(this); + poaMutex.writeLock().unlock(); } @Poa - void readLock() - { - acquireLock( poaMutex.readLock() ) ; - thisPoa( this ) ; + void readLock() { + acquireLock(poaMutex.readLock()); + thisPoa(this); } // package private so that POAPolicyMediator can access it. @Poa - void readUnlock() - { - thisPoa( this ) ; - poaMutex.readLock().unlock() ; + void readUnlock() { + thisPoa(this); + poaMutex.readLock().unlock(); } @Poa final Condition makeCondition() { - return poaMutex.writeLock().newCondition() ; + return poaMutex.writeLock().newCondition(); } // package private so that DelegateImpl can access it. - Policies getPolicies() - { - return mediator.getPolicies() ; + Policies getPolicies() { + return mediator.getPolicies(); } @Poa - private void newPOACreated( String name, String parentName ) { } + private void newPOACreated(String name, String parentName) { + } // Note that the parent POA must be write locked when this constructor // is called. - private POAImpl( String name, POAImpl parent, ORB orb, int initialState ) { - super( orb ) ; + private POAImpl(String name, POAImpl parent, ORB orb, int initialState) { + super(orb); if (parent == null) { - newPOACreated( name, "null parent for root POA" ) ; + newPOACreated(name, "null parent for root POA"); } else { - newPOACreated( name, parent.poaName ) ; + newPOACreated(name, parent.poaName); } - this.state = initialState ; - this.poaName = name ; - this.parent = parent; - children = new HashMap(); - activator = null ; + this.state = initialState; + this.poaName = name; + this.parent = parent; + children = new HashMap(); + activator = null; // This was done in initialize, but I moved it here // to get better searchability when tracing. - uniquePOAId = getPOAFactory( orb ).newPOAId() ; + uniquePOAId = getPOAFactory(orb).newPOAId(); if (parent == null) { // This is the root POA, which counts as 1 level - numLevels = 1 ; + numLevels = 1; } else { // My level is one more than that of my parent - numLevels = parent.numLevels + 1 ; + numLevels = parent.numLevels + 1; parent.children.put(name, this); } // Get an array of all of the POA names in order to // create the poaid. - String[] names = new String[ numLevels ] ; - POAImpl poaImpl = this ; - int ctr = numLevels - 1 ; + String[] names = new String[numLevels]; + POAImpl poaImpl = this; + int ctr = numLevels - 1; while (poaImpl != null) { - names[ctr] = poaImpl.poaName ; - ctr-- ; - poaImpl = poaImpl.parent ; + names[ctr] = poaImpl.poaName; + ctr--; + poaImpl = poaImpl.parent; } - poaId = new ObjectAdapterIdArray( names ) ; + poaId = new ObjectAdapterIdArray(names); - invocationCount = new AtomicInteger(0) ; + invocationCount = new AtomicInteger(0); - poaMutex = new ReentrantReadWriteLock() ; - adapterActivatorCV = makeCondition() ; - invokeCV = makeCondition() ; - beingDestroyedCV = makeCondition() ; + poaMutex = new ReentrantReadWriteLock(); + adapterActivatorCV = makeCondition(); + invokeCV = makeCondition(); + beingDestroyedCV = makeCondition(); isDestroying = new ThreadLocal() { @Override @@ -463,56 +445,50 @@ protected Boolean initialValue() { @NameValue private String getName() { - StringBuilder sb = new StringBuilder() ; - boolean first = true ; - for (String str : poaId.getAdapterName() ) { + StringBuilder sb = new StringBuilder(); + boolean first = true; + for (String str : poaId.getAdapterName()) { if (first) { - first = false ; + first = false; } else { - sb.append( '.' ) ; + sb.append('.'); } - sb.append( str ) ; + sb.append(str); } - return sb.toString() ; + return sb.toString(); } @InfoMethod - private void initializingPoa( int scid, int serverid, String orbid, - ObjectAdapterId poaId ) { } + private void initializingPoa(int scid, int serverid, String orbid, ObjectAdapterId poaId) { + } // The POA write lock must be held when this method is called. @Poa - private void initialize( POAManagerImpl manager, Policies policies ) - { + private void initialize(POAManagerImpl manager, Policies policies) { this.manager = manager; manager.addPOA(this); - mediator = POAPolicyMediatorFactory.create( policies, this ) ; + mediator = POAPolicyMediatorFactory.create(policies, this); // Construct the object key template - int serverid = mediator.getServerId() ; - int scid = mediator.getScid() ; + int serverid = mediator.getServerId(); + int scid = mediator.getScid(); String orbId = getORB().getORBData().getORBId(); - ObjectKeyTemplate oktemp = new POAObjectKeyTemplate( getORB(), - scid, serverid, orbId, poaId ) ; - + ObjectKeyTemplate oktemp = new POAObjectKeyTemplate(getORB(), scid, serverid, orbId, poaId); - initializingPoa( scid, serverid, orbId, poaId ) ; + initializingPoa(scid, serverid, orbId, poaId); // Note that parent == null iff this is the root POA. // This was used to avoid executing interceptors on the RootPOA. // That is no longer necessary. boolean objectAdapterCreated = true; // parent != null ; - + // XXX extract codebase from policies and pass into initializeTemplate // after the codebase policy change is finalized. - initializeTemplate( oktemp, objectAdapterCreated, - policies, - null, // codebase - null, // manager id - oktemp.getObjectAdapterId() - ) ; + initializeTemplate(oktemp, objectAdapterCreated, policies, null, // codebase + null, // manager id + oktemp.getObjectAdapterId()); if (state == STATE_START) { state = STATE_RUN; @@ -524,96 +500,92 @@ private void initialize( POAManagerImpl manager, Policies policies ) } @InfoMethod - private void interruptedAwait( InterruptedException exc ) {} + private void interruptedAwait(InterruptedException exc) { + } // The POA write lock must be held when this method is called // The lock may be upgraded to write. @Poa - private boolean waitUntilRunning() - { + private boolean waitUntilRunning() { while (state < STATE_RUN) { try { - adapterActivatorCV.await( 1, TimeUnit.SECONDS ) ; + adapterActivatorCV.await(1, TimeUnit.SECONDS); } catch (InterruptedException exc) { - interruptedAwait( exc ) ; + interruptedAwait(exc); } - } + } - // Note that a POA could be destroyed while in STATE_INIT due to a + // Note that a POA could be destroyed while in STATE_INIT due to a // failure in the AdapterActivator upcall. - return (state == STATE_RUN) ; + return (state == STATE_RUN); } - // This method checks that the AdapterActivator finished the - // initialization of a POA activated in find_POA. This is - // determined by checking the state of the POA. If the state is - // STATE_INIT, the AdapterActivator did not complete the - // inialization. In this case, we destroy the POA that was - // partially created and return false. Otherwise, we return true. + // This method checks that the AdapterActivator finished the + // initialization of a POA activated in find_POA. This is + // determined by checking the state of the POA. If the state is + // STATE_INIT, the AdapterActivator did not complete the + // inialization. In this case, we destroy the POA that was + // partially created and return false. Otherwise, we return true. // In any case, we must wake up all threads waiting for the adapter // activator, either to continue their invocations, or to return // errors to their client. // // No POA lock may be held when this method is called. - private boolean destroyIfNotInitDone() - { - lock() ; + private boolean destroyIfNotInitDone() { + lock(); try { - boolean success = (state == STATE_INIT_DONE) ; + boolean success = (state == STATE_INIT_DONE); if (success) { - state = STATE_RUN ; - unlock() ; + state = STATE_RUN; + unlock(); } else { // Issue 7061: do not hold POA lock while calling destroyer.doIt, // because this would violate the lock ordering constraints, // since doIt locks the parent first, then the child. - unlock() ; + unlock(); - // Don't just use destroy, because the check for + // Don't just use destroy, because the check for // deadlock is too general, and can prevent this from // functioning properly. - DestroyThread destroyer = new DestroyThread( false ); - destroyer.doIt( this, true ) ; + DestroyThread destroyer = new DestroyThread(false); + destroyer.doIt(this, true); } - return success ; + return success; } finally { - lock() ; + lock(); try { - adapterActivatorCV.signalAll() ; + adapterActivatorCV.signalAll(); } finally { - unlock() ; + unlock(); } } } - private byte[] internalReferenceToId( - org.omg.CORBA.Object reference ) throws WrongAdapter - { - IOR ior = getORB().getIOR( reference, false ) ; - IORTemplateList thisTemplate = ior.getIORTemplates() ; + private byte[] internalReferenceToId(org.omg.CORBA.Object reference) throws WrongAdapter { + IOR ior = getORB().getIOR(reference, false); + IORTemplateList thisTemplate = ior.getIORTemplates(); - ObjectReferenceFactory orf = getCurrentFactory() ; - IORTemplateList poaTemplate = - IORFactories.getIORTemplateList( orf ) ; + ObjectReferenceFactory orf = getCurrentFactory(); + IORTemplateList poaTemplate = IORFactories.getIORTemplateList(orf); - if (!poaTemplate.isEquivalent( thisTemplate )) { + if (!poaTemplate.isEquivalent(thisTemplate)) { throw new WrongAdapter(); } - + // Extract the ObjectId from the first TaggedProfile in the IOR. - // If ior was created in this POA, the same ID was used for + // If ior was created in this POA, the same ID was used for // every profile through the profile templates in the currentFactory, // so we will get the same result from any profile. - Iterator iter = ior.iterator() ; + Iterator iter = ior.iterator(); if (!iter.hasNext()) { throw wrapper.noProfilesInIor(); } - TaggedProfile prof = (iter.next()) ; - ObjectId oid = prof.getObjectId() ; + TaggedProfile prof = (iter.next()); + ObjectId oid = prof.getObjectId(); return oid.getId(); } @@ -622,135 +594,127 @@ private byte[] internalReferenceToId( // so that we can call performDestroy() directly. @Poa private static class DestroyThread extends Thread { - private boolean wait ; - private boolean etherealize ; - private POAImpl thePoa ; + private boolean wait; + private boolean etherealize; + private POAImpl thePoa; - DestroyThread( boolean etherealize ) { - this.etherealize = etherealize ; + DestroyThread(boolean etherealize) { + this.etherealize = etherealize; } @Poa - public void doIt( POAImpl thePoa, boolean wait ) { - this.thePoa = thePoa ; - this.wait = wait ; - + public void doIt(POAImpl thePoa, boolean wait) { + this.thePoa = thePoa; + this.wait = wait; + if (wait) { - run() ; + run(); } else { // Catch exceptions since setDaemon can cause a // security exception to be thrown under netscape // in the Applet mode - try { - setDaemon(true); + try { + setDaemon(true); } catch (Exception e) { - thePoa.wrapper.couldNotSetDaemon( e ) ; + thePoa.wrapper.couldNotSetDaemon(e); } - start() ; + start(); } } @Poa @Override - public void run() - { - final Set destroyedPOATemplates = - new HashSet() ; + public void run() { + final Set destroyedPOATemplates = new HashSet(); - performDestroy( thePoa, destroyedPOATemplates ); + performDestroy(thePoa, destroyedPOATemplates); - Iterator iter = destroyedPOATemplates.iterator() ; - ObjectReferenceTemplate[] orts = new ObjectReferenceTemplate[ - destroyedPOATemplates.size() ] ; - int index = 0 ; + Iterator iter = destroyedPOATemplates.iterator(); + ObjectReferenceTemplate[] orts = new ObjectReferenceTemplate[destroyedPOATemplates.size()]; + int index = 0; while (iter.hasNext()) { orts[index] = iter.next(); - index++ ; + index++; } - ORB myORB = thePoa.getORB() ; + ORB myORB = thePoa.getORB(); if (destroyedPOATemplates.size() > 0) { - myORB.getPIHandler().adapterStateChanged( orts, - NON_EXISTENT.value ) ; + myORB.getPIHandler().adapterStateChanged(orts, NON_EXISTENT.value); } } - - // Returns true if destruction must be completed, false + + // Returns true if destruction must be completed, false // if not, which means that another thread is already // destroying poa. @Poa - private boolean prepareForDestruction( POAImpl poa, - Set destroyedPOATemplates ) - { - POAImpl[] childPoas = null ; + private boolean prepareForDestruction(POAImpl poa, Set destroyedPOATemplates) { + POAImpl[] childPoas = null; // Note that we do not synchronize on this, since this is // the PerformDestroy instance, not the POA. - poa.lock() ; + poa.lock(); try { if (poa.state <= STATE_RUN) { - poa.state = STATE_DESTROYING ; + poa.state = STATE_DESTROYING; } else { // destroy may be called multiple times, and each call - // is allowed to proceed with its own setting of the wait - // flag, but the etherealize value is used from the first - // call to destroy. Also all children should be destroyed - // before the parent POA. If the poa is already destroyed, - // we can just return. If the poa has started destruction, - // but not completed, and wait is true, we need to wait + // is allowed to proceed with its own setting of the wait + // flag, but the etherealize value is used from the first + // call to destroy. Also all children should be destroyed + // before the parent POA. If the poa is already destroyed, + // we can just return. If the poa has started destruction, + // but not completed, and wait is true, we need to wait // until destruction is complete, then just return. if (wait) { while (poa.state != STATE_DESTROYED) { try { - poa.beingDestroyedCV.await( 1, TimeUnit.SECONDS ); + poa.beingDestroyedCV.await(1, TimeUnit.SECONDS); } catch (InterruptedException exc) { - interruptedAwait( exc ) ; + interruptedAwait(exc); } } } - return false ; + return false; } poa.isDestroying.set(Boolean.TRUE); // Make a copy since we can't hold the lock while destroying // the children, and an iterator is not deletion-safe. - childPoas = poa.children.values().toArray( new POAImpl[0] ); + childPoas = poa.children.values().toArray(new POAImpl[0]); } finally { - poa.unlock() ; + poa.unlock(); } - // We are not holding the POA mutex here to avoid holding it - // while destroying the POA's children, since this may involve + // We are not holding the POA mutex here to avoid holding it + // while destroying the POA's children, since this may involve // upcalls to etherealize methods. - for (int ctr=0; ctr destroyedPOATemplates ) - { - if (!prepareForDestruction( poa, destroyedPOATemplates )) { + public void performDestroy(POAImpl poa, Set destroyedPOATemplates) { + if (!prepareForDestruction(poa, destroyedPOATemplates)) { return; } - // NOTE: If we are here, poa is in STATE_DESTROYING state. All + // NOTE: If we are here, poa is in STATE_DESTROYING state. All // other state checks are taken care of in prepareForDestruction. - // No other threads may either be starting new invocations - // by calling enter or starting to destroy poa. There may + // No other threads may either be starting new invocations + // by calling enter or starting to destroy poa. There may // still be pending invocations. - POAImpl parent = poa.parent ; - boolean isRoot = parent == null ; + POAImpl parent = poa.parent; + boolean isRoot = parent == null; // Note that we must lock the parent before the child. // The parent lock is required (if poa is not the root) @@ -760,12 +724,11 @@ public void performDestroy( POAImpl poa, } try { - poa.lock() ; + poa.lock(); try { - completeDestruction( poa, parent, - destroyedPOATemplates ) ; + completeDestruction(poa, parent, destroyedPOATemplates); } finally { - poa.unlock() ; + poa.unlock(); if (isRoot) { poa.manager.getFactory().registerRootPOA(); @@ -773,40 +736,41 @@ public void performDestroy( POAImpl poa, } } finally { if (!isRoot) { - parent.unlock() ; - poa.parent = null ; + parent.unlock(); + poa.parent = null; } } } @InfoMethod - private void unregisteringMBean( ObjectName oname, POAImpl poa ) { } + private void unregisteringMBean(ObjectName oname, POAImpl poa) { + } @InfoMethod - private void noMBean( POAImpl poa ) { } + private void noMBean(POAImpl poa) { + } @InfoMethod - private void interruptedAwait( InterruptedException exc ) {} + private void interruptedAwait(InterruptedException exc) { + } @Poa - private void completeDestruction( POAImpl poa, POAImpl parent, - Set destroyedPOATemplates ) - { + private void completeDestruction(POAImpl poa, POAImpl parent, Set destroyedPOATemplates) { try { while (poa.invocationCount.get() != 0) { try { - poa.invokeCV.await( 1, TimeUnit.SECONDS ) ; + poa.invokeCV.await(1, TimeUnit.SECONDS); } catch (InterruptedException ex) { - interruptedAwait( ex ) ; - } + interruptedAwait(ex); + } } if (poa.mediator != null) { if (etherealize) { poa.mediator.etherealizeAll(); } - - poa.mediator.clearAOM() ; + + poa.mediator.clearAOM(); } if (poa.manager != null) { @@ -817,18 +781,18 @@ private void completeDestruction( POAImpl poa, POAImpl parent, parent.children.remove(poa.poaName); } - destroyedPOATemplates.add( poa.getAdapterTemplate() ) ; + destroyedPOATemplates.add(poa.getAdapterTemplate()); synchronized (momLock) { // Only unregister if the poa is still registered: we may get // here because another thread concurrently destroyed this POA. // XXX This may not be necessary now. - ObjectName oname = poa.getORB().mom().getObjectName( poa ) ; + ObjectName oname = poa.getORB().mom().getObjectName(poa); if (oname != null) { - unregisteringMBean( oname, poa ) ; - poa.getORB().mom().unregister( poa ); + unregisteringMBean(oname, poa); + poa.getORB().mom().unregister(poa); } else { - noMBean( poa ) ; + noMBean(poa); } } } catch (Throwable thr) { @@ -836,9 +800,9 @@ private void completeDestruction( POAImpl poa, POAImpl parent, throw (ThreadDeath) thr; } - wrapper.unexpectedException( thr, poa.toString() ) ; + wrapper.unexpectedException(thr, poa.toString()); } finally { - poa.state = STATE_DESTROYED ; + poa.state = STATE_DESTROYED; poa.beingDestroyedCV.signalAll(); poa.isDestroying.set(Boolean.FALSE); } @@ -846,33 +810,29 @@ private void completeDestruction( POAImpl poa, POAImpl parent, } @Poa - void etherealizeAll() - { - lock() ; + void etherealizeAll() { + lock(); try { - mediator.etherealizeAll() ; + mediator.etherealizeAll(); } finally { - unlock() ; + unlock(); } } - //******************************************************************* - // Public POA API - //******************************************************************* + // ******************************************************************* + // Public POA API + // ******************************************************************* @InfoMethod - private void newPOA( POAImpl poa ) { } + private void newPOA(POAImpl poa) { + } /** - * create_POA - * Section 3.3.8.2 + * create_POA Section 3.3.8.2 */ @Poa - public POA create_POA(String name, POAManager - theManager, Policy[] policies) throws AdapterAlreadyExists, - InvalidPolicy - { - lock() ; + public POA create_POA(String name, POAManager theManager, Policy[] policies) throws AdapterAlreadyExists, InvalidPolicy { + lock(); try { // We cannot create children of a POA that is (being) destroyed. @@ -880,141 +840,158 @@ public POA create_POA(String name, POAManager if (state > STATE_RUN) { throw omgWrapper.createPoaDestroy(); } - - POAImpl poa = children.get(name) ; + + POAImpl poa = children.get(name); if (poa == null) { - poa = new POAImpl( name, this, getORB(), STATE_START ) ; + poa = new POAImpl(name, this, getORB(), STATE_START); } try { - poa.lock() ; - newPOA( poa ) ; + poa.lock(); + newPOA(poa); if ((poa.state != STATE_START) && (poa.state != STATE_INIT)) { throw new AdapterAlreadyExists(); } - POAManagerImpl newManager = (POAManagerImpl)theManager ; + POAManagerImpl newManager = (POAManagerImpl) theManager; if (newManager == null) { - newManager = new POAManagerImpl( manager.getFactory(), - getORB().getPIHandler() ); - registerMBean( getORB(), newManager ) ; + newManager = new POAManagerImpl(manager.getFactory(), getORB().getPIHandler()); + registerMBean(getORB(), newManager); } - int defaultCopierId = - getORB().getCopierManager().getDefaultId() ; - Policies POAPolicies = - new Policies( policies, defaultCopierId ) ; + int defaultCopierId = getORB().getCopierManager().getDefaultId(); + Policies POAPolicies = new Policies(policies, defaultCopierId); - poa.initialize( newManager, POAPolicies ) ; + poa.initialize(newManager, POAPolicies); // Issue 11334: Must come after poa.initialize! - registerMBean( getORB(), poa ) ; + registerMBean(getORB(), poa); return poa; } finally { - poa.unlock() ; + poa.unlock(); } } finally { - unlock() ; + unlock(); } } @InfoMethod - private void foundPOA( POAImpl poa ) { } + private void foundPOA(POAImpl poa) { + } @InfoMethod - private void createdPOA( POAImpl poa ) { } + private void createdPOA(POAImpl poa) { + } @InfoMethod - private void noPOA() { } + private void noPOA() { + } @InfoMethod - private void callingAdapterActivator() { } + private void callingAdapterActivator() { + } @InfoMethod - private void adapterActivatorResult( boolean result ) { } + private void adapterActivatorResult(boolean result) { + } - /** find_POA - * Section 3.3.8.3 + /** + * find_POA Section 3.3.8.3 */ @Poa public POA find_POA(String name, boolean activate) throws AdapterNonExistent { - AdapterActivator act = null ; - boolean readLocked = false ; - boolean writeLocked = false ; - boolean childReadLocked = false ; - POAImpl child = null ; + AdapterActivator act = null; + boolean readLocked = false; + boolean writeLocked = false; + boolean childReadLocked = false; + POAImpl child = null; try { // Issue 14318: Use readLock where possible to reduce contention. - readLock() ; readLocked = true ; + readLock(); + readLocked = true; child = children.get(name); if (child != null) { - child.readLock() ; childReadLocked = true ; - foundPOA( child ) ; + child.readLock(); + childReadLocked = true; + foundPOA(child); try { // No parent lock while waiting for child init to complete! - readUnlock() ; readLocked = false ; + readUnlock(); + readLocked = false; if (child.state != STATE_RUN) { - child.readUnlock() ; childReadLocked = false ; - child.lockAndWaitUntilRunning() ; + child.readUnlock(); + childReadLocked = false; + child.lockAndWaitUntilRunning(); } - // child may be in DESTROYING or DESTROYED at this point. + // child may be in DESTROYING or DESTROYED at this point. // That's OK, since destruction could start at any time. } finally { - if (childReadLocked) { child.readUnlock() ; childReadLocked = false ; } + if (childReadLocked) { + child.readUnlock(); + childReadLocked = false; + } } } else { try { - noPOA() ; + noPOA(); if (activate && (activator != null)) { - readUnlock() ; readLocked = false ; // need writeLock: drop readLock + readUnlock(); + readLocked = false; // need writeLock: drop readLock // Note that another thread could create the child here // in between the unlock and the lock. - lock() ; writeLocked = true ; + lock(); + writeLocked = true; try { child = children.get(name); if (child == null) { - child = new POAImpl( name, this, getORB(), STATE_INIT ) ; - createdPOA( child ) ; - act = activator ; // Issue 14917: Only set if child NOT found + child = new POAImpl(name, this, getORB(), STATE_INIT); + createdPOA(child); + act = activator; // Issue 14917: Only set if child NOT found } else { // Child created before writeLock - unlock() ; writeLocked = false ; // don't hold parent lock! - child.lockAndWaitUntilRunning() ; + unlock(); + writeLocked = false; // don't hold parent lock! + child.lockAndWaitUntilRunning(); } } finally { - if (writeLocked) { unlock() ; writeLocked = false ; } + if (writeLocked) { + unlock(); + writeLocked = false; + } } } else { throw new AdapterNonExistent(); } } finally { - if (readLocked) { readUnlock() ; } // Issue 14917: was unlock() + if (readLocked) { + readUnlock(); + } // Issue 14917: was unlock() } } // assert (child != null) and not holding locks on this or child (must avoid deadlock) if (act != null) { - doActivate( act, name, child ) ; + doActivate(act, name, child); } return child; } finally { - cleanUpLocks( child, readLocked, writeLocked, childReadLocked ) ; + cleanUpLocks(child, readLocked, writeLocked, childReadLocked); } } @Poa private void lockAndWaitUntilRunning() { // Issue 14695: waitUntilRunning requires writeLock. - lock() ; + lock(); try { // wait for child init to complete if (!waitUntilRunning()) { @@ -1022,17 +999,16 @@ private void lockAndWaitUntilRunning() { throw omgWrapper.poaDestroyed(); } } finally { - unlock() ; + unlock(); } } @Poa - private void doActivate( AdapterActivator act, - String name, POAImpl child ) throws AdapterNonExistent { + private void doActivate(AdapterActivator act, String name, POAImpl child) throws AdapterNonExistent { - boolean status = false ; - boolean adapterResult = false ; - callingAdapterActivator() ; + boolean status = false; + boolean adapterResult = false; + callingAdapterActivator(); try { // Prevent more than one thread at a time from executing in act @@ -1041,12 +1017,11 @@ private void doActivate( AdapterActivator act, status = act.unknown_adapter(this, name); } } catch (SystemException exc) { - throw omgWrapper.adapterActivatorException( exc, - poaName, poaId ) ; + throw omgWrapper.adapterActivatorException(exc, poaName, poaId); } catch (Throwable thr) { // ignore most non-system exceptions, but log them for // diagnostic purposes. - wrapper.unexpectedException( thr, this.toString() ) ; + wrapper.unexpectedException(thr, this.toString()); if (thr instanceof ThreadDeath) { throw (ThreadDeath) thr; @@ -1055,9 +1030,9 @@ private void doActivate( AdapterActivator act, // At this point, we have completed adapter activation. // Whether this was successful or not, we must call // destroyIfNotInitDone so that calls to enter() and create_POA() - // that are waiting can execute again. Failing to do this + // that are waiting can execute again. Failing to do this // will cause the system to hang in complex tests. - adapterResult = child.destroyIfNotInitDone() ; + adapterResult = child.destroyIfNotInitDone(); } adapterActivatorResult(status); @@ -1074,344 +1049,296 @@ private void doActivate( AdapterActivator act, } @InfoMethod - private void locksWereHeld() {} + private void locksWereHeld() { + } @Poa - private void cleanUpLocks( POAImpl child, boolean readLocked, boolean writeLocked, - boolean childReadLocked ) { + private void cleanUpLocks(POAImpl child, boolean readLocked, boolean writeLocked, boolean childReadLocked) { // Log an error if we ever get here with a lock held! if (readLocked || writeLocked || childReadLocked) { locksWereHeld(); - wrapper.findPOALocksNotReleased( readLocked, writeLocked, - childReadLocked ) ; + wrapper.findPOALocksNotReleased(readLocked, writeLocked, childReadLocked); if (readLocked) { - readUnlock() ; + readUnlock(); } if (writeLocked) { - unlock() ; + unlock(); } if (childReadLocked && child != null) { - child.readUnlock() ; + child.readUnlock(); } } } /** - * destroy - * Section 3.3.8.4 + * destroy Section 3.3.8.4 */ - public void destroy(boolean etherealize, boolean wait_for_completion) - { + public void destroy(boolean etherealize, boolean wait_for_completion) { // This is to avoid deadlock if (wait_for_completion && getORB().isDuringDispatch()) { - throw wrapper.destroyDeadlock() ; + throw wrapper.destroyDeadlock(); } - DestroyThread destroyer = new DestroyThread( etherealize ); - destroyer.doIt( this, wait_for_completion ) ; + DestroyThread destroyer = new DestroyThread(etherealize); + destroyer.doIt(this, wait_for_completion); } /** - * create_thread_policy - * Section 3.3.8.5 + * create_thread_policy Section 3.3.8.5 */ - public ThreadPolicy create_thread_policy( - ThreadPolicyValue value) - { + public ThreadPolicy create_thread_policy(ThreadPolicyValue value) { return new ThreadPolicyImpl(value); } /** - * create_lifespan_policy - * Section 3.3.8.5 + * create_lifespan_policy Section 3.3.8.5 */ - public LifespanPolicy create_lifespan_policy( - LifespanPolicyValue value) - { + public LifespanPolicy create_lifespan_policy(LifespanPolicyValue value) { return new LifespanPolicyImpl(value); } /** - * create_id_uniqueness_policy - * Section 3.3.8.5 + * create_id_uniqueness_policy Section 3.3.8.5 */ - public IdUniquenessPolicy create_id_uniqueness_policy( - IdUniquenessPolicyValue value) - { + public IdUniquenessPolicy create_id_uniqueness_policy(IdUniquenessPolicyValue value) { return new IdUniquenessPolicyImpl(value); } /** - * create_id_assignment_policy - * Section 3.3.8.5 + * create_id_assignment_policy Section 3.3.8.5 */ - public IdAssignmentPolicy create_id_assignment_policy( - IdAssignmentPolicyValue value) - { + public IdAssignmentPolicy create_id_assignment_policy(IdAssignmentPolicyValue value) { return new IdAssignmentPolicyImpl(value); } /** - * create_implicit_activation_policy - * Section 3.3.8.5 + * create_implicit_activation_policy Section 3.3.8.5 */ - public ImplicitActivationPolicy create_implicit_activation_policy( - ImplicitActivationPolicyValue value) - { + public ImplicitActivationPolicy create_implicit_activation_policy(ImplicitActivationPolicyValue value) { return new ImplicitActivationPolicyImpl(value); } /** - * create_servant_retention_policy - * Section 3.3.8.5 + * create_servant_retention_policy Section 3.3.8.5 */ - public ServantRetentionPolicy create_servant_retention_policy( - ServantRetentionPolicyValue value) - { + public ServantRetentionPolicy create_servant_retention_policy(ServantRetentionPolicyValue value) { return new ServantRetentionPolicyImpl(value); } - + /** - * create_request_processing_policy - * Section 3.3.8.5 + * create_request_processing_policy Section 3.3.8.5 */ - public RequestProcessingPolicy create_request_processing_policy( - RequestProcessingPolicyValue value) - { + public RequestProcessingPolicy create_request_processing_policy(RequestProcessingPolicyValue value) { return new RequestProcessingPolicyImpl(value); } - + /** - * the_name - * Section 3.3.8.6 + * the_name Section 3.3.8.6 */ - @ManagedAttribute( id="POAName") - @Description( "The name of this POA") - public String the_name() - { + @ManagedAttribute(id = "POAName") + @Description("The name of this POA") + public String the_name() { try { - lock() ; + lock(); return poaName; } finally { - unlock() ; + unlock(); } } /** - * the_parent - * Section 3.3.8.7 + * the_parent Section 3.3.8.7 */ - @ManagedAttribute( id="POAParent") - @Description( "The parent of this POA") - public POA the_parent() - { + @ManagedAttribute(id = "POAParent") + @Description("The parent of this POA") + public POA the_parent() { try { - lock() ; + lock(); return parent; } finally { - unlock() ; + unlock(); } } /** * the_children */ - @ManagedAttribute( id="POAChildren") - @Description( "The children of this POA") + @ManagedAttribute(id = "POAChildren") + @Description("The children of this POA") private List children() { try { - lock() ; - return new ArrayList( children.values() ) ; + lock(); + return new ArrayList(children.values()); } finally { - unlock() ; + unlock(); } } - public org.omg.PortableServer.POA[] the_children() - { + public org.omg.PortableServer.POA[] the_children() { try { - lock() ; + lock(); - Collection coll = children.values() ; - int size = coll.size() ; - POA[] result = new POA[ size ] ; - int index = 0 ; - Iterator iter = coll.iterator() ; + Collection coll = children.values(); + int size = coll.size(); + POA[] result = new POA[size]; + int index = 0; + Iterator iter = coll.iterator(); while (iter.hasNext()) { - POA poa = iter.next() ; - result[ index ] = poa ; - index++ ; + POA poa = iter.next(); + result[index] = poa; + index++; } - return result ; + return result; } finally { - unlock() ; + unlock(); } } // We need this in order to return the correct type. // I'm not sure a covariant return could be used here. - @ManagedAttribute( id="POAManager") - @Description( "The POAManager of this POA") + @ManagedAttribute(id = "POAManager") + @Description("The POAManager of this POA") private POAManagerImpl getPOAManager() { try { - lock() ; + lock(); return manager; } finally { - unlock() ; + unlock(); } } /** - * the_POAManager - * Section 3.3.8.8 + * the_POAManager Section 3.3.8.8 */ - public POAManager the_POAManager() - { + public POAManager the_POAManager() { try { - lock() ; + lock(); return manager; } finally { - unlock() ; + unlock(); } } /** - * the_activator - * Section 3.3.8.9 + * the_activator Section 3.3.8.9 */ - @ManagedAttribute( id="Activator") - @Description( "The AdapterActivator of this POA") - public AdapterActivator the_activator() - { + @ManagedAttribute(id = "Activator") + @Description("The AdapterActivator of this POA") + public AdapterActivator the_activator() { try { - lock() ; + lock(); return activator; } finally { - unlock() ; + unlock(); } } - + /** - * the_activator - * Section 3.3.8.9 + * the_activator Section 3.3.8.9 */ @Poa - public void the_activator(AdapterActivator activator) - { + public void the_activator(AdapterActivator activator) { try { - lock() ; + lock(); this.activator = activator; } finally { - unlock() ; + unlock(); } } /** - * get_servant_manager - * Section 3.3.8.10 + * get_servant_manager Section 3.3.8.10 */ - public ServantManager get_servant_manager() throws WrongPolicy - { + public ServantManager get_servant_manager() throws WrongPolicy { try { - lock() ; + lock(); - return mediator.getServantManager() ; + return mediator.getServantManager(); } finally { - unlock() ; + unlock(); } } @ManagedAttribute - @Description( "The servant manager of this POA (may be null)") + @Description("The servant manager of this POA (may be null)") private ServantManager servantManager() { try { return get_servant_manager(); } catch (WrongPolicy ex) { - return null ; + return null; } } /** - * set_servant_manager - * Section 3.3.8.10 + * set_servant_manager Section 3.3.8.10 */ @Poa - public void set_servant_manager(ServantManager servantManager) - throws WrongPolicy - { + public void set_servant_manager(ServantManager servantManager) throws WrongPolicy { try { - lock() ; + lock(); - mediator.setServantManager( servantManager ) ; + mediator.setServantManager(servantManager); } finally { - unlock() ; + unlock(); } } - + /** - * get_servant - * Section 3.3.8.12 + * get_servant Section 3.3.8.12 */ - public Servant get_servant() throws NoServant, WrongPolicy - { + public Servant get_servant() throws NoServant, WrongPolicy { try { - lock() ; + lock(); - return mediator.getDefaultServant() ; + return mediator.getDefaultServant(); } finally { - unlock() ; + unlock(); } } @ManagedAttribute - @Description( "The default servant of this POA (may be null)") + @Description("The default servant of this POA (may be null)") private Servant servant() { try { return get_servant(); } catch (NoServant ex) { - return null ; + return null; } catch (WrongPolicy ex) { - return null ; + return null; } } /** - * set_servant - * Section 3.3.8.13 + * set_servant Section 3.3.8.13 */ @Poa - public void set_servant(Servant defaultServant) - throws WrongPolicy - { + public void set_servant(Servant defaultServant) throws WrongPolicy { try { - lock() ; + lock(); - mediator.setDefaultServant( defaultServant ) ; + mediator.setDefaultServant(defaultServant); } finally { - unlock() ; + unlock(); } } /** - * activate_object - * Section 3.3.8.14 + * activate_object Section 3.3.8.14 */ @Poa - public byte[] activate_object(Servant servant) - throws ServantAlreadyActive, WrongPolicy - { + public byte[] activate_object(Servant servant) throws ServantAlreadyActive, WrongPolicy { try { - lock() ; + lock(); // Allocate a new system-generated object-id. // This will throw WrongPolicy if not SYSTEM_ID @@ -1419,339 +1346,298 @@ public byte[] activate_object(Servant servant) byte[] id = mediator.newSystemId(); try { - mediator.activateObject( id, servant ) ; + mediator.activateObject(id, servant); } catch (ObjectAlreadyActive oaa) { // This exception can not occur in this case, // since id is always brand new. - // + // } - return id ; + return id; } finally { - unlock() ; + unlock(); } } /** - * activate_object_with_id - * Section 3.3.8.15 + * activate_object_with_id Section 3.3.8.15 */ @Poa - public void activate_object_with_id(byte[] id, - Servant servant) - throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy - { + public void activate_object_with_id(byte[] id, Servant servant) throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy { try { - lock() ; + lock(); // Clone the id to avoid possible errors due to aliasing // (e.g. the client passes the id in and then changes it later). - byte[] idClone = id.clone() ; + byte[] idClone = id.clone(); - mediator.activateObject( idClone, servant ) ; + mediator.activateObject(idClone, servant); } finally { - unlock() ; + unlock(); } } /** - * deactivate_object - * 3.3.8.16 + * deactivate_object 3.3.8.16 */ @Poa - public void deactivate_object(byte[] id) - throws ObjectNotActive, WrongPolicy - { + public void deactivate_object(byte[] id) throws ObjectNotActive, WrongPolicy { try { - lock() ; + lock(); - mediator.deactivateObject( id ) ; + mediator.deactivateObject(id); } finally { - unlock() ; + unlock(); } } /** - * create_reference - * 3.3.8.17 + * create_reference 3.3.8.17 */ @Poa - public org.omg.CORBA.Object create_reference(String repId) - throws WrongPolicy - { + public org.omg.CORBA.Object create_reference(String repId) throws WrongPolicy { try { - lock() ; + lock(); - return makeObject( repId, mediator.newSystemId()) ; + return makeObject(repId, mediator.newSystemId()); } finally { - unlock() ; + unlock(); } } /** - * create_reference_with_id - * 3.3.8.18 + * create_reference_with_id 3.3.8.18 */ @Poa - public org.omg.CORBA.Object - create_reference_with_id(byte[] oid, String repId) - { + public org.omg.CORBA.Object create_reference_with_id(byte[] oid, String repId) { try { - lock() ; + lock(); // Clone the id to avoid possible errors due to aliasing // (e.g. the client passes the id in and then changes it later). - byte[] idClone = (oid.clone()) ; + byte[] idClone = (oid.clone()); - return makeObject( repId, idClone ) ; + return makeObject(repId, idClone); } finally { - unlock() ; + unlock(); } } /** - * servant_to_id - * 3.3.8.19 + * servant_to_id 3.3.8.19 */ @Poa - public byte[] servant_to_id(Servant servant) - throws ServantNotActive, WrongPolicy - { + public byte[] servant_to_id(Servant servant) throws ServantNotActive, WrongPolicy { try { - lock() ; + lock(); - return mediator.servantToId( servant ) ; + return mediator.servantToId(servant); } finally { - unlock() ; + unlock(); } } - + /** - * servant_to_reference - * 3.3.8.20 + * servant_to_reference 3.3.8.20 */ @Poa - public org.omg.CORBA.Object servant_to_reference(Servant servant) - throws ServantNotActive, WrongPolicy - { + public org.omg.CORBA.Object servant_to_reference(Servant servant) throws ServantNotActive, WrongPolicy { try { - lock() ; + lock(); byte[] oid = mediator.servantToId(servant); - String repId = servant._all_interfaces( this, oid )[0] ; + String repId = servant._all_interfaces(this, oid)[0]; return create_reference_with_id(oid, repId); } finally { - unlock() ; + unlock(); } } /** - * reference_to_servant - * 3.3.8.21 + * reference_to_servant 3.3.8.21 */ @Poa - public Servant reference_to_servant(org.omg.CORBA.Object reference) - throws ObjectNotActive, WrongPolicy, WrongAdapter - { + public Servant reference_to_servant(org.omg.CORBA.Object reference) throws ObjectNotActive, WrongPolicy, WrongAdapter { try { - lock() ; + lock(); - if ( state >= STATE_DESTROYING ) { - throw wrapper.adapterDestroyed() ; + if (state >= STATE_DESTROYING) { + throw wrapper.adapterDestroyed(); } // reference_to_id should throw WrongAdapter // if the objref was not created by this POA - byte [] id = internalReferenceToId(reference); - - return mediator.idToServant( id ) ; + byte[] id = internalReferenceToId(reference); + + return mediator.idToServant(id); } finally { - unlock() ; + unlock(); } } /** - * reference_to_id - * 3.3.8.22 + * reference_to_id 3.3.8.22 */ @Poa - public byte[] reference_to_id(org.omg.CORBA.Object reference) - throws WrongAdapter, WrongPolicy - { + public byte[] reference_to_id(org.omg.CORBA.Object reference) throws WrongAdapter, WrongPolicy { try { - lock() ; - - if( state >= STATE_DESTROYING ) { - throw wrapper.adapterDestroyed() ; + lock(); + + if (state >= STATE_DESTROYING) { + throw wrapper.adapterDestroyed(); } - - return internalReferenceToId( reference ) ; + + return internalReferenceToId(reference); } finally { - unlock() ; + unlock(); } } /** - * id_to_servant - * 3.3.8.23 + * id_to_servant 3.3.8.23 */ @Poa - public Servant id_to_servant(byte[] id) - throws ObjectNotActive, WrongPolicy - { + public Servant id_to_servant(byte[] id) throws ObjectNotActive, WrongPolicy { try { - lock() ; - - if( state >= STATE_DESTROYING ) { - throw wrapper.adapterDestroyed() ; + lock(); + + if (state >= STATE_DESTROYING) { + throw wrapper.adapterDestroyed(); } - return mediator.idToServant( id ) ; + return mediator.idToServant(id); } finally { - unlock() ; + unlock(); } } /** - * id_to_reference - * 3.3.8.24 + * id_to_reference 3.3.8.24 */ @Poa - public org.omg.CORBA.Object id_to_reference(byte[] id) - throws ObjectNotActive, WrongPolicy + public org.omg.CORBA.Object id_to_reference(byte[] id) throws ObjectNotActive, WrongPolicy { try { - lock() ; - - if( state >= STATE_DESTROYING ) { - throw wrapper.adapterDestroyed() ; + lock(); + + if (state >= STATE_DESTROYING) { + throw wrapper.adapterDestroyed(); } - - Servant s = mediator.idToServant( id ) ; - String repId = s._all_interfaces( this, id )[0] ; - return makeObject(repId, id ); + + Servant s = mediator.idToServant(id); + String repId = s._all_interfaces(this, id)[0]; + return makeObject(repId, id); } finally { - unlock() ; + unlock(); } } /** - * id - * 11.3.8.26 in ptc/00-08-06 + * id 11.3.8.26 in ptc/00-08-06 */ - public byte[] id() - { + public byte[] id() { try { - lock() ; + lock(); - return getAdapterId() ; + return getAdapterId(); } finally { - unlock() ; + unlock(); } } - //*************************************************************** - //Implementation of ObjectAdapter interface - //*************************************************************** + // *************************************************************** + // Implementation of ObjectAdapter interface + // *************************************************************** - public Policy getEffectivePolicy( int type ) - { - return mediator.getPolicies().get_effective_policy( type ) ; + public Policy getEffectivePolicy(int type) { + return mediator.getPolicies().get_effective_policy(type); } - public int getManagerId() - { - return manager.getManagerId() ; + public int getManagerId() { + return manager.getManagerId(); } - public short getState() - { - return manager.getORTState() ; + public short getState() { + return manager.getORTState(); } - public String[] getInterfaces( java.lang.Object servant, byte[] objectId ) - { - Servant serv = (Servant)servant ; - return serv._all_interfaces( this, objectId ) ; + public String[] getInterfaces(java.lang.Object servant, byte[] objectId) { + Servant serv = (Servant) servant; + return serv._all_interfaces(this, objectId); } - protected ObjectCopierFactory getObjectCopierFactory() - { - int copierId = mediator.getPolicies().getCopierId() ; - CopierManager cm = getORB().getCopierManager() ; - return cm.getObjectCopierFactory( copierId ) ; + protected ObjectCopierFactory getObjectCopierFactory() { + int copierId = mediator.getPolicies().getCopierId(); + CopierManager cm = getORB().getCopierManager(); + return cm.getObjectCopierFactory(copierId); } @Poa - public void enter() throws OADestroyed - { + public void enter() throws OADestroyed { manager.enter(); - readLock() ; + readLock(); try { // Hold only the read lock to check the state if (state == STATE_RUN) { // fast path invocationCount.incrementAndGet(); - return ; + return; } } finally { readUnlock(); } // acquire lock: may need slow path - lock() ; + lock(); try { // Avoid deadlock if this is the thread that is processing the // POA.destroy because this is the only thread that can notify - // waiters on beingDestroyedCV. This can happen if an + // waiters on beingDestroyedCV. This can happen if an // etherealize upcall invokes a method on a colocated object // served by this POA. - while ((state == STATE_DESTROYING) && - (isDestroying.get() == Boolean.FALSE)) { + while ((state == STATE_DESTROYING) && (isDestroying.get() == Boolean.FALSE)) { try { - beingDestroyedCV.await( 1, TimeUnit.SECONDS ); + beingDestroyedCV.await(1, TimeUnit.SECONDS); } catch (InterruptedException ex) { - interruptedAwait( ex ) ; + interruptedAwait(ex); } } if (!waitUntilRunning()) { - manager.exit() ; - throw new OADestroyed() ; + manager.exit(); + throw new OADestroyed(); } invocationCount.incrementAndGet(); } finally { - unlock() ; + unlock(); } } @Poa - public void exit() - { + public void exit() { try { - readLock() ; + readLock(); try { // Hold only a read lock to check the state if (state == STATE_RUN) { // fast path invocationCount.decrementAndGet(); - return ; + return; } } finally { readUnlock(); } - lock() ; + lock(); try { - if ((invocationCount.decrementAndGet() == 0) - && (state == STATE_DESTROYING)) { + if ((invocationCount.decrementAndGet() == 0) && (state == STATE_DESTROYING)) { invokeCV.signalAll(); } } finally { - unlock() ; + unlock(); } } finally { manager.exit(); @@ -1760,45 +1646,42 @@ public void exit() } @ManagedAttribute - @Description( "The current invocation count of this POA") + @Description("The current invocation count of this POA") @Poa private int getInvocationCount() { try { - lock() ; - return invocationCount.get() ; + lock(); + return invocationCount.get(); } finally { - unlock() ; + unlock(); } } @Poa - public void getInvocationServant( OAInvocationInfo info ) { + public void getInvocationServant(OAInvocationInfo info) { // 6878245 if (info == null) { - return ; + return; } - java.lang.Object servant = null ; + java.lang.Object servant = null; try { - servant = mediator.getInvocationServant( info.id(), - info.getOperation() ); + servant = mediator.getInvocationServant(info.id(), info.getOperation()); } catch (ForwardRequest freq) { - throw new ForwardException( getORB(), freq.forward_reference ) ; + throw new ForwardException(getORB(), freq.forward_reference); } - info.setServant( servant ) ; + info.setServant(servant); } - public org.omg.CORBA.Object getLocalServant( byte[] objectId ) - { - return null ; + public org.omg.CORBA.Object getLocalServant(byte[] objectId) { + return null; } - /** Called from the subcontract to let this POA cleanup after an - * invocation. Note: If getServant was called, then returnServant - * MUST be called, even in the case of exceptions. This may be - * called multiple times for a single request. + /** + * Called from the subcontract to let this POA cleanup after an invocation. Note: If getServant was called, then + * returnServant MUST be called, even in the case of exceptions. This may be called multiple times for a single request. */ @Poa public void returnServant() { @@ -1808,8 +1691,8 @@ public void returnServant() { if (thr instanceof Error) { throw (Error) thr; } else if (thr instanceof RuntimeException) { - throw (RuntimeException)thr ; + throw (RuntimeException) thr; } - } + } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAManagerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAManagerImpl.java index f56c38d9a..93e54c8ec 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAManagerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAManagerImpl.java @@ -22,19 +22,18 @@ import java.util.Set; import java.util.HashSet; - import org.omg.PortableServer.POAManager; import org.omg.PortableServer.POAManagerPackage.State; -import org.omg.PortableInterceptor.DISCARDING ; -import org.omg.PortableInterceptor.ACTIVE ; -import org.omg.PortableInterceptor.HOLDING ; -import org.omg.PortableInterceptor.INACTIVE ; -import org.omg.PortableInterceptor.NON_EXISTENT ; +import org.omg.PortableInterceptor.DISCARDING; +import org.omg.PortableInterceptor.ACTIVE; +import org.omg.PortableInterceptor.HOLDING; +import org.omg.PortableInterceptor.INACTIVE; +import org.omg.PortableInterceptor.NON_EXISTENT; -import com.sun.corba.ee.spi.protocol.PIHandler ; +import com.sun.corba.ee.spi.protocol.PIHandler; -import com.sun.corba.ee.spi.logging.POASystemException ; +import com.sun.corba.ee.spi.logging.POASystemException; import com.sun.corba.ee.spi.trace.Poa; import java.util.concurrent.TimeUnit; @@ -42,274 +41,251 @@ import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.glassfish.gmbal.ManagedObject ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.ManagedOperation ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.ParameterNames ; -import org.glassfish.gmbal.NameValue ; +import org.glassfish.gmbal.ManagedObject; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.ManagedOperation; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.ParameterNames; +import org.glassfish.gmbal.NameValue; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; -import org.glassfish.pfl.basic.contain.MultiSet ; +import org.glassfish.pfl.basic.contain.MultiSet; -/** POAManagerImpl is the implementation of the POAManager interface. - * Its public methods are activate(), hold_requests(), discard_requests() - * and deactivate(). +/** + * POAManagerImpl is the implementation of the POAManager interface. Its public methods are activate(), hold_requests(), + * discard_requests() and deactivate(). */ @Poa @ManagedObject -@Description( "A POAManager which controls invocations of its POAs") -public class POAManagerImpl extends org.omg.CORBA.LocalObject implements - POAManager -{ - private static final POASystemException wrapper = - POASystemException.self ; +@Description("A POAManager which controls invocations of its POAs") +public class POAManagerImpl extends org.omg.CORBA.LocalObject implements POAManager { + private static final POASystemException wrapper = POASystemException.self; private static final long serialVersionUID = -3308938242684343402L; // final fields: no synchronization needed - private final POAFactory factory ; // factory which contains global state - // for all POAManagers - private final PIHandler pihandler ; // for AdapterManagerStateChanged - private final int myId ; // This POAManager's ID + private final POAFactory factory; // factory which contains global state + // for all POAManagers + private final PIHandler pihandler; // for AdapterManagerStateChanged + private final int myId; // This POAManager's ID // Making this a fair lock due to expected very high numbers of readers // with an occasional writer that must NOT be starved. // // The state and poas fields may be READ while holding the read lock. // Updates require holding the write lock. - private final ReentrantReadWriteLock stateLock = - new ReentrantReadWriteLock( true ) ; + private final ReentrantReadWriteLock stateLock = new ReentrantReadWriteLock(true); - // Condition var used for waiting. Can only wait on this when the + // Condition var used for waiting. Can only wait on this when the // write lock is held! - private final Condition stateCV = stateLock.writeLock().newCondition() ; + private final Condition stateCV = stateLock.writeLock().newCondition(); // fields protected by stateLock - private State state; // current state of this POAManager + private State state; // current state of this POAManager - private Set poas = - new HashSet(4) ; // all poas controlled by this POAManager + private Set poas = new HashSet(4); // all poas controlled by this POAManager // fields using other synchronization methods - private AtomicInteger nInvocations= - new AtomicInteger(0); // Number of invocations in progress - private AtomicInteger nWaiters = - new AtomicInteger(0) ; // Number of threads waiting for - // invocations to complete - private volatile boolean explicitStateChange ; // initially false, set true as soon as - // one of activate, hold_request, - // discard_request, or deactivate is called. - - /** activeManagers is the set of POAManagerImpls for which a thread has called - * enter without exit 1 or more times. Once a thread has entered a POAManager, - * it must be able to re-enter the POAManager, even if the manager is HOLDING, - * because state transitions can be deferred until all threads have completed execution - * and called exit(). Without this change, one thread can be blocked on the - * state change method, and another thread that has entered the POAManager once - * can be blocked from re-entry on a nested co-located call. This leads to a - * permanent deadlock between the two threads. See Bug 6586417. + private AtomicInteger nInvocations = new AtomicInteger(0); // Number of invocations in progress + private AtomicInteger nWaiters = new AtomicInteger(0); // Number of threads waiting for + // invocations to complete + private volatile boolean explicitStateChange; // initially false, set true as soon as + // one of activate, hold_request, + // discard_request, or deactivate is called. + + /** + * activeManagers is the set of POAManagerImpls for which a thread has called enter without exit 1 or more times. Once a + * thread has entered a POAManager, it must be able to re-enter the POAManager, even if the manager is HOLDING, because + * state transitions can be deferred until all threads have completed execution and called exit(). Without this change, + * one thread can be blocked on the state change method, and another thread that has entered the POAManager once can be + * blocked from re-entry on a nested co-located call. This leads to a permanent deadlock between the two threads. See + * Bug 6586417. * - * To avoid this, we create a set of active managers, and record which managers - * a particular thread is using. A thread may re-enter any manager in HOLDING state - * once it has entered it for the first time. Note that POAManagerImpl uses the - * default equals and hashCode methods inherited from Object. This is fine, - * because two distinct POAManagerImpl instances always represent distinct - * POAManagerImpls. + * To avoid this, we create a set of active managers, and record which managers a particular thread is using. A thread + * may re-enter any manager in HOLDING state once it has entered it for the first time. Note that POAManagerImpl uses + * the default equals and hashCode methods inherited from Object. This is fine, because two distinct POAManagerImpl + * instances always represent distinct POAManagerImpls. * - * This is only a partial solution to the problem, but it should be sufficient for - * the app server, because all EJBs in the app server share the same POAManager. - * The problem in general is that state changes between multiple POAManager and - * invocation threads that make co-located calls to different POAManagers can still - * deadlock. This problem requires a different solution, because the hold_requests - * method may have already returned when the active thread needs to enter the - * holding POAManager, so we can't just let the thread in. I think in this case - * we need to reject the request because it may cause a deadlock. So, checkState - * needs to throw a TRANSIENT exception if it finds that the thread is already active - * in one or more POAManagers, AND it tries to enter a new POAManager. Such exceptions - * should be re-tried by the client, and will succeed after - * the holding POAManagers have been resumed. + * This is only a partial solution to the problem, but it should be sufficient for the app server, because all EJBs in + * the app server share the same POAManager. The problem in general is that state changes between multiple POAManager + * and invocation threads that make co-located calls to different POAManagers can still deadlock. This problem requires + * a different solution, because the hold_requests method may have already returned when the active thread needs to + * enter the holding POAManager, so we can't just let the thread in. I think in this case we need to reject the request + * because it may cause a deadlock. So, checkState needs to throw a TRANSIENT exception if it finds that the thread is + * already active in one or more POAManagers, AND it tries to enter a new POAManager. Such exceptions should be re-tried + * by the client, and will succeed after the holding POAManagers have been resumed. * - * Another possible route to fix the app server bug (more globally) is to have the RFM - * suspend method use discard instead of hold. This may be better in some ways, - * but early tests with that approach led to some problems (which I can't recall right now). - * I suspect the issues may have been related to problems with the client-side retry logic, - * but those problems have now been fixed. In any case, we need to fix the POAManager - * issues. + * Another possible route to fix the app server bug (more globally) is to have the RFM suspend method use discard + * instead of hold. This may be better in some ways, but early tests with that approach led to some problems (which I + * can't recall right now). I suspect the issues may have been related to problems with the client-side retry logic, but + * those problems have now been fixed. In any case, we need to fix the POAManager issues. */ - private static ThreadLocal> activeManagers = - new ThreadLocal>() { + private static ThreadLocal> activeManagers = new ThreadLocal>() { @Override - public MultiSet initialValue() { - return new MultiSet() ; - } - } ; + public MultiSet initialValue() { + return new MultiSet(); + } + }; - private String stateToString( State state ) { + private String stateToString(State state) { switch (state.value()) { - case State._HOLDING : return "HOLDING" ; - case State._ACTIVE : return "ACTIVE" ; - case State._DISCARDING : return "DISCARDING" ; - case State._INACTIVE : return "INACTIVE" ; + case State._HOLDING: + return "HOLDING"; + case State._ACTIVE: + return "ACTIVE"; + case State._DISCARDING: + return "DISCARDING"; + case State._INACTIVE: + return "INACTIVE"; } - return "State[UNKNOWN]" ; + return "State[UNKNOWN]"; } @Override - public int hashCode() - { - return myId ; + public int hashCode() { + return myId; } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (obj == this) { - return true ; + return true; } if (!(obj instanceof POAManagerImpl)) { - return false ; + return false; } - POAManagerImpl other = (POAManagerImpl)obj ; + POAManagerImpl other = (POAManagerImpl) obj; - return other.myId == myId ; + return other.myId == myId; } @Override public String toString() { stateLock.readLock().lock(); try { - return "POAManagerImpl[" + myId + - "," + stateToString(state) + - ",nInvocations=" + nInvocations + - ",nWaiters=" + nWaiters + "]" ; + return "POAManagerImpl[" + myId + "," + stateToString(state) + ",nInvocations=" + nInvocations + ",nWaiters=" + nWaiters + "]"; } finally { stateLock.readLock().unlock(); } } @ManagedAttribute - @Description( "The set of POAs managed by this POAManager" ) + @Description("The set of POAs managed by this POAManager") Set getManagedPOAs() { - return new HashSet( poas ) ; + return new HashSet(poas); } @ManagedAttribute - @Description( "Number of active invocations executing in this POAManager" ) + @Description("Number of active invocations executing in this POAManager") public int numberOfInvocations() { - return nInvocations.get() ; + return nInvocations.get(); } @ManagedAttribute - @Description( "Number of threads waiting for invocations to complete in this POAManager" ) + @Description("Number of threads waiting for invocations to complete in this POAManager") public int numberOfWaiters() { - return nWaiters.get() ; + return nWaiters.get(); } @ManagedAttribute - @Description( "The current state of this POAManager" ) + @Description("The current state of this POAManager") public String displayState() { stateLock.readLock().lock(); try { - return stateToString( state ) ; + return stateToString(state); } finally { stateLock.readLock().unlock(); } } @ManagedAttribute - @Description( "The POAFactory that manages this POAManager" ) - POAFactory getFactory() - { - return factory ; + @Description("The POAFactory that manages this POAManager") + POAFactory getFactory() { + return factory; } - PIHandler getPIHandler() - { - return pihandler ; + PIHandler getPIHandler() { + return pihandler; } @InfoMethod - private void numWaitersStart( int value ) {} + private void numWaitersStart(int value) { + } @InfoMethod - private void numWaitersEnd( int value ) {} + private void numWaitersEnd(int value) { + } @Poa // Note: caller MUST hold write lock - private void countedWait() - { + private void countedWait() { try { - int num = nWaiters.incrementAndGet() ; - numWaitersStart( num ) ; + int num = nWaiters.incrementAndGet(); + numWaitersStart(num); // 6878245: I can see some sense in the timeout, but why this value? - stateCV.await(num*1000L, TimeUnit.MILLISECONDS); - } catch ( java.lang.InterruptedException ex ) { + stateCV.await(num * 1000L, TimeUnit.MILLISECONDS); + } catch (java.lang.InterruptedException ex) { // NOP } finally { - int num = nWaiters.decrementAndGet() ; - numWaitersEnd( num ) ; + int num = nWaiters.decrementAndGet(); + numWaitersEnd(num); } } @InfoMethod - private void nWaiters( int value ) { } + private void nWaiters(int value) { + } @Poa // Note: caller MUST hold write lock - private void notifyWaiters() - { - int num = nWaiters.get() ; - nWaiters( num ) ; + private void notifyWaiters() { + int num = nWaiters.get(); + nWaiters(num); - if (num >0) { - stateCV.signalAll() ; + if (num > 0) { + stateCV.signalAll(); } } @ManagedAttribute @NameValue - @Description( "The ID of this POAManager" ) - public int getManagerId() - { - return myId ; + @Description("The ID of this POAManager") + public int getManagerId() { + return myId; } - POAManagerImpl( POAFactory factory, PIHandler pih ) - { - this.factory = factory ; + POAManagerImpl(POAFactory factory, PIHandler pih) { + this.factory = factory; factory.addPoaManager(this); - pihandler = pih ; - myId = factory.newPOAManagerId() ; + pihandler = pih; + myId = factory.newPOAManagerId(); state = State.HOLDING; - explicitStateChange = false ; + explicitStateChange = false; } - void addPOA(POAImpl poa) - { + void addPOA(POAImpl poa) { stateLock.writeLock().lock(); try { if (state.value() == State._INACTIVE) { - throw wrapper.addPoaInactive() ; + throw wrapper.addPoaInactive(); } - poas.add( poa); + poas.add(poa); } finally { stateLock.writeLock().unlock(); } } - void removePOA(POAImpl poa) - { + void removePOA(POAImpl poa) { stateLock.writeLock().lock(); try { - poas.remove( poa); - if ( poas.isEmpty() ) { + poas.remove(poa); + if (poas.isEmpty()) { factory.removePoaManager(this); } } finally { @@ -318,88 +294,85 @@ void removePOA(POAImpl poa) } @ManagedAttribute - @Description( "The ObjectReferenceTemplate state of this POAManager" ) - public short getORTState() - { + @Description("The ObjectReferenceTemplate state of this POAManager") + public short getORTState() { switch (state.value()) { - case State._HOLDING : return HOLDING.value ; - case State._ACTIVE : return ACTIVE.value ; - case State._INACTIVE : return INACTIVE.value ; - case State._DISCARDING : return DISCARDING.value ; - default : return NON_EXISTENT.value ; + case State._HOLDING: + return HOLDING.value; + case State._ACTIVE: + return ACTIVE.value; + case State._INACTIVE: + return INACTIVE.value; + case State._DISCARDING: + return DISCARDING.value; + default: + return NON_EXISTENT.value; } } -/**************************************************************************** - * The following four public methods are used to change the POAManager's state. - ****************************************************************************/ + /**************************************************************************** + * The following four public methods are used to change the POAManager's state. + ****************************************************************************/ /** - * activate - * Spec: pages 3-14 thru 3-18 + * activate Spec: pages 3-14 thru 3-18 */ @Poa @ManagedOperation - @Description( "Make this POAManager active, so it can handle new requests" ) - public void activate() - throws org.omg.PortableServer.POAManagerPackage.AdapterInactive - { - explicitStateChange = true ; + @Description("Make this POAManager active, so it can handle new requests") + public void activate() throws org.omg.PortableServer.POAManagerPackage.AdapterInactive { + explicitStateChange = true; - stateLock.writeLock().lock() ; + stateLock.writeLock().lock(); try { - if ( state.value() == State._INACTIVE ) { + if (state.value() == State._INACTIVE) { throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive(); } // set the state to ACTIVE state = State.ACTIVE; - pihandler.adapterManagerStateChanged( myId, getORTState() ) ; + pihandler.adapterManagerStateChanged(myId, getORTState()); // Notify any invocations that were waiting because the previous // state was HOLDING, as well as notify any threads that were waiting // inside hold_requests() or discard_requests(). notifyWaiters(); } finally { - stateLock.writeLock().unlock() ; + stateLock.writeLock().unlock(); } } /** - * hold_requests - * Spec: pages 3-14 thru 3-18 + * hold_requests Spec: pages 3-14 thru 3-18 */ @Poa @ManagedOperation - @Description( "Hold all requests to this POAManager" ) - public void hold_requests(boolean wait_for_completion) - throws org.omg.PortableServer.POAManagerPackage.AdapterInactive - { - explicitStateChange = true ; + @Description("Hold all requests to this POAManager") + public void hold_requests(boolean wait_for_completion) throws org.omg.PortableServer.POAManagerPackage.AdapterInactive { + explicitStateChange = true; - stateLock.writeLock().lock() ; + stateLock.writeLock().lock(); try { - if ( state.value() == State._INACTIVE ) { + if (state.value() == State._INACTIVE) { throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive(); } // set the state to HOLDING - state = State.HOLDING; + state = State.HOLDING; - pihandler.adapterManagerStateChanged( myId, getORTState() ) ; + pihandler.adapterManagerStateChanged(myId, getORTState()); // Notify any threads that were waiting in the wait() inside // discard_requests. This will cause discard_requests to return // (which is in conformance with the spec). notifyWaiters(); - if ( wait_for_completion ) { - while ( state.value() == State._HOLDING - && nInvocations.get() > 0 ) { + if (wait_for_completion) { + while (state.value() == State._HOLDING && nInvocations.get() > 0) { - countedWait() ; + countedWait(); } } } finally { @@ -408,29 +381,26 @@ public void hold_requests(boolean wait_for_completion) } /** - * discard_requests - * Spec: pages 3-14 thru 3-18 + * discard_requests Spec: pages 3-14 thru 3-18 */ @Poa @ManagedOperation - @ParameterNames( { "waitForCompletion" } ) - @Description( "Make this POAManager discard all incoming requests" ) - public void discard_requests(boolean wait_for_completion) - throws org.omg.PortableServer.POAManagerPackage.AdapterInactive - { - explicitStateChange = true ; + @ParameterNames({ "waitForCompletion" }) + @Description("Make this POAManager discard all incoming requests") + public void discard_requests(boolean wait_for_completion) throws org.omg.PortableServer.POAManagerPackage.AdapterInactive { + explicitStateChange = true; stateLock.writeLock().lock(); try { - if ( state.value() == State._INACTIVE ) { + if (state.value() == State._INACTIVE) { throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive(); } // set the state to DISCARDING state = State.DISCARDING; - pihandler.adapterManagerStateChanged( myId, getORTState() ) ; + pihandler.adapterManagerStateChanged(myId, getORTState()); // Notify any invocations that were waiting because the previous // state was HOLDING. Those invocations will henceforth be rejected with @@ -440,12 +410,11 @@ public void discard_requests(boolean wait_for_completion) // Must hold writeLock for this call. notifyWaiters(); - if ( wait_for_completion ) { - while ( state.value() == State._DISCARDING - && nInvocations.get() > 0 ) { + if (wait_for_completion) { + while (state.value() == State._DISCARDING && nInvocations.get() > 0) { // Must hold writeLock for this call. - countedWait() ; + countedWait(); } } } finally { @@ -454,27 +423,24 @@ public void discard_requests(boolean wait_for_completion) } /** - * deactivate - * Spec: pages 3-14 thru 3-18 - * Note: INACTIVE is a permanent state. + * deactivate Spec: pages 3-14 thru 3-18 Note: INACTIVE is a permanent state. */ @Poa public void deactivate(boolean etherealize_objects, boolean wait_for_completion) - throws org.omg.PortableServer.POAManagerPackage.AdapterInactive - { + throws org.omg.PortableServer.POAManagerPackage.AdapterInactive { stateLock.writeLock().lock(); try { - explicitStateChange = true ; + explicitStateChange = true; - if ( state.value() == State._INACTIVE ) { + if (state.value() == State._INACTIVE) { throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive(); } state = State.INACTIVE; - pihandler.adapterManagerStateChanged( myId, getORTState() ) ; + pihandler.adapterManagerStateChanged(myId, getORTState()); // Notify any invocations that were waiting because the previous // state was HOLDING. Those invocations will then be rejected with @@ -485,60 +451,58 @@ public void deactivate(boolean etherealize_objects, boolean wait_for_completion) stateLock.writeLock().unlock(); } - POAManagerDeactivator deactivator = new POAManagerDeactivator( this, - etherealize_objects ) ; + POAManagerDeactivator deactivator = new POAManagerDeactivator(this, etherealize_objects); if (wait_for_completion) { deactivator.run(); } else { - Thread thr = new Thread(deactivator) ; - thr.start() ; + Thread thr = new Thread(deactivator); + thr.start(); } } @Poa - private static class POAManagerDeactivator implements Runnable - { - private boolean etherealize_objects ; - private final POAManagerImpl pmi ; + private static class POAManagerDeactivator implements Runnable { + private boolean etherealize_objects; + private final POAManagerImpl pmi; @InfoMethod - private void poaManagerDeactivatorCall( - boolean etherealizeObjects, POAManagerImpl pmi ) { } + private void poaManagerDeactivatorCall(boolean etherealizeObjects, POAManagerImpl pmi) { + } @InfoMethod - private void preparingToEtherealize( POAManagerImpl pmi ) { } + private void preparingToEtherealize(POAManagerImpl pmi) { + } @InfoMethod - private void removeAndClear( POAManagerImpl pmi ) { } + private void removeAndClear(POAManagerImpl pmi) { + } - POAManagerDeactivator( POAManagerImpl pmi, boolean etherealize_objects ) - { - this.etherealize_objects = etherealize_objects ; - this.pmi = pmi ; + POAManagerDeactivator(POAManagerImpl pmi, boolean etherealize_objects) { + this.etherealize_objects = etherealize_objects; + this.pmi = pmi; } @Poa - public void run() - { + public void run() { pmi.stateLock.writeLock().lock(); try { - poaManagerDeactivatorCall( etherealize_objects, pmi ) ; - while ( pmi.nInvocations.get() > 0 ) { - pmi.countedWait() ; + poaManagerDeactivatorCall(etherealize_objects, pmi); + while (pmi.nInvocations.get() > 0) { + pmi.countedWait(); } } finally { pmi.stateLock.writeLock().unlock(); } if (etherealize_objects) { - Set copyOfPOAs ; + Set copyOfPOAs; // Make sure that poas cannot change while we copy it! pmi.stateLock.readLock().lock(); try { - preparingToEtherealize( pmi ) ; - copyOfPOAs = new HashSet( pmi.poas ) ; + preparingToEtherealize(pmi); + copyOfPOAs = new HashSet(pmi.poas); } finally { pmi.stateLock.readLock().unlock(); } @@ -551,7 +515,7 @@ public void run() pmi.stateLock.writeLock().lock(); try { - removeAndClear( pmi ) ; + removeAndClear(pmi); pmi.factory.removePoaManager(pmi); pmi.poas.clear(); @@ -563,77 +527,78 @@ public void run() } /** - * Added according to the spec CORBA V2.3; this returns the - * state of the POAManager + * Added according to the spec CORBA V2.3; this returns the state of the POAManager */ - public org.omg.PortableServer.POAManagerPackage.State get_state () { + public org.omg.PortableServer.POAManagerPackage.State get_state() { return state; } -/**************************************************************************** - * The following methods are used on the invocation path. - ****************************************************************************/ + /**************************************************************************** + * The following methods are used on the invocation path. + ****************************************************************************/ @InfoMethod - private void activeManagers( MultiSet am ) { } + private void activeManagers(MultiSet am) { + } @InfoMethod - private void alreadyActive( POAManagerImpl pm ) { } + private void alreadyActive(POAManagerImpl pm) { + } @InfoMethod - private void activeInDifferentPoaManager() { } + private void activeInDifferentPoaManager() { + } @Poa - private void checkState() - { - MultiSet am = activeManagers.get() ; - activeManagers( am ) ; + private void checkState() { + MultiSet am = activeManagers.get(); + activeManagers(am); stateLock.readLock().lock(); try { - while ( state.value() != State._ACTIVE ) { - switch ( state.value() ) { - case State._HOLDING: - // Never block a thread that is already active in this POAManager. - if (am.contains( this )) { - alreadyActive( this ) ; - - return ; - } else { - if (am.size() == 0) { - if (state.value() == State._HOLDING) { - // Can't upgrade, so drop the read lock, - // then separately acquite the write lock. - stateLock.readLock().unlock(); - stateLock.writeLock().lock(); - } + while (state.value() != State._ACTIVE) { + switch (state.value()) { + case State._HOLDING: + // Never block a thread that is already active in this POAManager. + if (am.contains(this)) { + alreadyActive(this); + + return; + } else { + if (am.size() == 0) { + if (state.value() == State._HOLDING) { + // Can't upgrade, so drop the read lock, + // then separately acquite the write lock. + stateLock.readLock().unlock(); + stateLock.writeLock().lock(); + } - try { - while ( state.value() == State._HOLDING ) { - countedWait() ; - } - } finally { - // downgrade to read lock - stateLock.writeLock().unlock(); - stateLock.readLock().lock(); + try { + while (state.value() == State._HOLDING) { + countedWait(); } - } else { - activeInDifferentPoaManager() ; - - // This thread is already active in one or more other POAManagers. - // This could cause a deadlock, so throw a TRANSIENT exception - // to prevent it. - throw factory.getWrapper().poaManagerMightDeadlock() ; + } finally { + // downgrade to read lock + stateLock.writeLock().unlock(); + stateLock.readLock().lock(); } + } else { + activeInDifferentPoaManager(); + + // This thread is already active in one or more other POAManagers. + // This could cause a deadlock, so throw a TRANSIENT exception + // to prevent it. + throw factory.getWrapper().poaManagerMightDeadlock(); } - break; + } + break; - case State._DISCARDING: - throw factory.getWrapper().poaDiscarding() ; + case State._DISCARDING: + throw factory.getWrapper().poaDiscarding(); - case State._INACTIVE: - throw factory.getWrapper().poaInactive() ; + case State._INACTIVE: + throw factory.getWrapper().poaInactive(); } } } finally { @@ -642,44 +607,44 @@ private void checkState() } @InfoMethod - private void addingThreadToActiveManagers( POAManagerImpl pmi ) { } + private void addingThreadToActiveManagers(POAManagerImpl pmi) { + } @InfoMethod - private void removingThreadFromActiveManagers( POAManagerImpl pmi ) { } + private void removingThreadFromActiveManagers(POAManagerImpl pmi) { + } @Poa - void enter() - { + void enter() { checkState(); - nInvocations.getAndIncrement() ; + nInvocations.getAndIncrement(); - activeManagers.get().add( this ) ; - addingThreadToActiveManagers( this ) ; + activeManagers.get().add(this); + addingThreadToActiveManagers(this); } @Poa - void exit() - { + void exit() { try { - activeManagers.get().remove( this ) ; - removingThreadFromActiveManagers( this ) ; + activeManagers.get().remove(this); + removingThreadFromActiveManagers(this); } finally { - if ( nInvocations.decrementAndGet() == 0 ) { + if (nInvocations.decrementAndGet() == 0) { // Note: this is essentially notifyWaiters, but // we cannot afford to acquire the writeLock unless // there actually are waiters on the lock (GF issue 14348). // Note that a spurious wakeup is possible here, if - // an invocation comes in between nInvocation and nWaiters + // an invocation comes in between nInvocation and nWaiters // reads, but that's OK, because the looped condition checks // around countedWait will simply wait again. - final int num = nWaiters.get() ; - nWaiters( num ) ; + final int num = nWaiters.get(); + nWaiters(num); - if (num >0) { + if (num > 0) { stateLock.writeLock().lock(); try { - stateCV.signalAll() ; + stateCV.signalAll(); } finally { stateLock.writeLock().unlock(); } @@ -688,11 +653,10 @@ void exit() } } - /** Activate the POAManager if no explicit state change has ever been - * previously invoked. + /** + * Activate the POAManager if no explicit state change has ever been previously invoked. */ - public void implicitActivation() - { + public void implicitActivation() { if (!explicitStateChange) { try { activate(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediator.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediator.java index 96106304b..b21804082 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediator.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediator.java @@ -17,133 +17,140 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; +package com.sun.corba.ee.impl.oa.poa; import org.glassfish.gmbal.Description; import org.glassfish.gmbal.ManagedAttribute; import org.glassfish.gmbal.ManagedData; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; - -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.NoServant ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; - -/** POAPolicyMediator defines an interface to which the POA delegates all - * policy specific operations. This permits code paths for different - * policies to be optimized by creating the correct code at POA creation - * time. Also note that as much as possible, this interface does not - * do any concurrency control, except as noted. The POA is responsible - * for concurrency control. +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.ServantManager; +import org.omg.PortableServer.ForwardRequest; + +import org.omg.PortableServer.POAPackage.ObjectAlreadyActive; +import org.omg.PortableServer.POAPackage.ServantAlreadyActive; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.NoServant; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.ObjectNotActive; + +/** + * POAPolicyMediator defines an interface to which the POA delegates all policy specific operations. This permits code + * paths for different policies to be optimized by creating the correct code at POA creation time. Also note that as + * much as possible, this interface does not do any concurrency control, except as noted. The POA is responsible for + * concurrency control. */ @ManagedData -@Description( "Handles the Policy-specific parts of the POA") +@Description("Handles the Policy-specific parts of the POA") public interface POAPolicyMediator { - /** Return the policies object that was used to create this - * POAPolicyMediator. - * @return The policies of this POA - */ + /** + * Return the policies object that was used to create this POAPolicyMediator. + * + * @return The policies of this POA + */ @ManagedAttribute - @Description( "The policies of this POA") + @Description("The policies of this POA") Policies getPolicies(); - /** Return the subcontract ID to use in the IIOP profile in IORs - * created by this POAPolicyMediator's POA. This is initialized - * according to the policies and the POA used to construct this - * POAPolicyMediator in the POAPolicyMediatorFactory. - * @return This POA's subcontract ID. - */ + /** + * Return the subcontract ID to use in the IIOP profile in IORs created by this POAPolicyMediator's POA. This is + * initialized according to the policies and the POA used to construct this POAPolicyMediator in the + * POAPolicyMediatorFactory. + * + * @return This POA's subcontract ID. + */ @ManagedAttribute - @Description( "This POA's subcontract ID") + @Description("This POA's subcontract ID") int getScid(); - /** Return the server ID to use in the IIOP profile in IORs - * created by this POAPolicyMediator's POA. This is initialized - * according to the policies and the POA used to construct this - * POAPolicyMediator in the POAPolicyMediatorFactory. - * @return This POA's server ID. - */ + /** + * Return the server ID to use in the IIOP profile in IORs created by this POAPolicyMediator's POA. This is initialized + * according to the policies and the POA used to construct this POAPolicyMediator in the POAPolicyMediatorFactory. + * + * @return This POA's server ID. + */ @ManagedAttribute - @Description( "This POA's server ID") + @Description("This POA's server ID") int getServerId(); - /** Get the servant to use for an invocation with the - * given id and operation. - * @param id the object ID for which we are requesting a servant - * @param operation the name of the operation to be performed on - * the servant - * @return the resulting Servant. - * @throws ForwardRequest if the current ORB must forward the result. - */ - java.lang.Object getInvocationServant( byte[] id, - String operation ) throws ForwardRequest ; - - /** Release a servant that was obtained from getInvocationServant. - */ - void returnServant() ; - - /** Etherealize all servants associated with this POAPolicyMediator. - * Does nothing if the retention policy is non-retain. - */ - void etherealizeAll() ; - - /** Delete everything in the active object map. - */ - void clearAOM() ; - - /** Return the servant manager. Will throw WrongPolicy - * if the request processing policy is not USE_SERVANT_MANAGER. - * @return The current ServantManager - * @throws WrongPolicy If the request processing policy is not USE_SERVANT_MANAGER - */ - ServantManager getServantManager() throws WrongPolicy ; - - /** Set the servant manager. Will throw WrongPolicy - * if the request processing policy is not USE_SERVANT_MANAGER. - * @param servantManager The ServantManager - * @throws WrongPolicy if the request processing policy is not USE_SERVANT_MANAGER. - */ - void setServantManager( ServantManager servantManager ) throws WrongPolicy ; - - /** Return the default servant. Will throw WrongPolicy - * if the request processing policy is not USE_DEFAULT_SERVANT. - * @return the default Servant - * @throws NoServant if no Servant has been set - * @throws WrongPolicy if the policy is not USE_DEFAULT_SERVANT - */ - Servant getDefaultServant() throws NoServant, WrongPolicy ; - - /** Set the default servant. Will throw WrongPolicy - * if the request processing policy is not USE_DEFAULT_SERVANT. - * @param servant The default Servant - * @throws WrongPolicy if the request processing policy is not USE_DEFAULT_SERVANT. - */ - void setDefaultServant( Servant servant ) throws WrongPolicy ; - - void activateObject( byte[] id, Servant servant ) - throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy ; - - /** Deactivate the object that is associated with the given id. - * Returns the servant for id. - * @param id ID of the object to deactivate - * @return Servant for the ID - * @throws ObjectNotActive if the object was not active - * @throws WrongPolicy if not supported by the current policy - */ - Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy ; - - /** Allocate a new, unique system ID. Requires the ID assignment policy - * to be SYSTEM. - * @return the new system ID - * @throws WrongPolicy if the ID assignment policy is not SYSTEM - */ - byte[] newSystemId() throws WrongPolicy ; - - byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy ; - - Servant idToServant( byte[] id ) throws ObjectNotActive, WrongPolicy ; + /** + * Get the servant to use for an invocation with the given id and operation. + * + * @param id the object ID for which we are requesting a servant + * @param operation the name of the operation to be performed on the servant + * @return the resulting Servant. + * @throws ForwardRequest if the current ORB must forward the result. + */ + java.lang.Object getInvocationServant(byte[] id, String operation) throws ForwardRequest; + + /** + * Release a servant that was obtained from getInvocationServant. + */ + void returnServant(); + + /** + * Etherealize all servants associated with this POAPolicyMediator. Does nothing if the retention policy is non-retain. + */ + void etherealizeAll(); + + /** + * Delete everything in the active object map. + */ + void clearAOM(); + + /** + * Return the servant manager. Will throw WrongPolicy if the request processing policy is not USE_SERVANT_MANAGER. + * + * @return The current ServantManager + * @throws WrongPolicy If the request processing policy is not USE_SERVANT_MANAGER + */ + ServantManager getServantManager() throws WrongPolicy; + + /** + * Set the servant manager. Will throw WrongPolicy if the request processing policy is not USE_SERVANT_MANAGER. + * + * @param servantManager The ServantManager + * @throws WrongPolicy if the request processing policy is not USE_SERVANT_MANAGER. + */ + void setServantManager(ServantManager servantManager) throws WrongPolicy; + + /** + * Return the default servant. Will throw WrongPolicy if the request processing policy is not USE_DEFAULT_SERVANT. + * + * @return the default Servant + * @throws NoServant if no Servant has been set + * @throws WrongPolicy if the policy is not USE_DEFAULT_SERVANT + */ + Servant getDefaultServant() throws NoServant, WrongPolicy; + + /** + * Set the default servant. Will throw WrongPolicy if the request processing policy is not USE_DEFAULT_SERVANT. + * + * @param servant The default Servant + * @throws WrongPolicy if the request processing policy is not USE_DEFAULT_SERVANT. + */ + void setDefaultServant(Servant servant) throws WrongPolicy; + + void activateObject(byte[] id, Servant servant) throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy; + + /** + * Deactivate the object that is associated with the given id. Returns the servant for id. + * + * @param id ID of the object to deactivate + * @return Servant for the ID + * @throws ObjectNotActive if the object was not active + * @throws WrongPolicy if not supported by the current policy + */ + Servant deactivateObject(byte[] id) throws ObjectNotActive, WrongPolicy; + + /** + * Allocate a new, unique system ID. Requires the ID assignment policy to be SYSTEM. + * + * @return the new system ID + * @throws WrongPolicy if the ID assignment policy is not SYSTEM + */ + byte[] newSystemId() throws WrongPolicy; + + byte[] servantToId(Servant servant) throws ServantNotActive, WrongPolicy; + + Servant idToServant(byte[] id) throws ObjectNotActive, WrongPolicy; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorBase.java index 90c526a4f..0282bd30f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorBase.java @@ -17,131 +17,119 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; +package com.sun.corba.ee.impl.oa.poa; +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.ForwardRequest; +import org.omg.PortableServer.POAPackage.WrongPolicy; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; +import com.sun.corba.ee.spi.extension.ServantCachingPolicy; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.extension.ServantCachingPolicy ; -import com.sun.corba.ee.spi.orb.ORB ; - -import com.sun.corba.ee.spi.misc.ORBConstants ; -import com.sun.corba.ee.impl.misc.ORBUtility ; +import com.sun.corba.ee.spi.misc.ORBConstants; +import com.sun.corba.ee.impl.misc.ORBUtility; import com.sun.corba.ee.spi.logging.OMGSystemException; import com.sun.corba.ee.spi.logging.POASystemException; -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA. +/** + * Implementation of POARequesHandler that provides policy specific operations on the POA. */ public abstract class POAPolicyMediatorBase implements POAPolicyMediator { - protected static final POASystemException wrapper = - POASystemException.self ; - protected static final OMGSystemException omgWrapper = - OMGSystemException.self ; + protected static final POASystemException wrapper = POASystemException.self; + protected static final OMGSystemException omgWrapper = OMGSystemException.self; - protected POAImpl poa ; - protected ORB orb ; + protected POAImpl poa; + protected ORB orb; - private int sysIdCounter ; - private Policies policies ; - private DelegateImpl delegateImpl ; + private int sysIdCounter; + private Policies policies; + private DelegateImpl delegateImpl; - private int serverid ; - private int scid ; + private int serverid; + private int scid; - protected boolean isImplicit ; - protected boolean isUnique ; - protected boolean isSystemId ; + protected boolean isImplicit; + protected boolean isUnique; + protected boolean isSystemId; - public final Policies getPolicies() - { - return policies ; + public final Policies getPolicies() { + return policies; } - public final int getScid() - { - return scid ; + public final int getScid() { + return scid; } - public final int getServerId() - { - return serverid ; + public final int getServerId() { + return serverid; } - POAPolicyMediatorBase( Policies policies, POAImpl poa ) - { + POAPolicyMediatorBase(Policies policies, POAImpl poa) { if (policies.isSingleThreaded()) { throw wrapper.singleThreadNotSupported(); } - POAManagerImpl poam = (POAManagerImpl)(poa.the_POAManager()) ; - POAFactory poaf = poam.getFactory() ; - delegateImpl = (DelegateImpl)(poaf.getDelegateImpl()) ; - this.policies = policies ; - this.poa = poa ; - orb = poa.getORB() ; + POAManagerImpl poam = (POAManagerImpl) (poa.the_POAManager()); + POAFactory poaf = poam.getFactory(); + delegateImpl = (DelegateImpl) (poaf.getDelegateImpl()); + this.policies = policies; + this.poa = poa; + orb = poa.getORB(); switch (policies.servantCachingLevel()) { - case ServantCachingPolicy.NO_SERVANT_CACHING : - scid = ORBConstants.TRANSIENT_SCID ; - break ; - case ServantCachingPolicy.FULL_SEMANTICS : - scid = ORBConstants.SC_TRANSIENT_SCID ; - break ; - case ServantCachingPolicy.INFO_ONLY_SEMANTICS : - scid = ORBConstants.IISC_TRANSIENT_SCID ; - break ; - case ServantCachingPolicy.MINIMAL_SEMANTICS : - scid = ORBConstants.MINSC_TRANSIENT_SCID ; - break ; + case ServantCachingPolicy.NO_SERVANT_CACHING: + scid = ORBConstants.TRANSIENT_SCID; + break; + case ServantCachingPolicy.FULL_SEMANTICS: + scid = ORBConstants.SC_TRANSIENT_SCID; + break; + case ServantCachingPolicy.INFO_ONLY_SEMANTICS: + scid = ORBConstants.IISC_TRANSIENT_SCID; + break; + case ServantCachingPolicy.MINIMAL_SEMANTICS: + scid = ORBConstants.MINSC_TRANSIENT_SCID; + break; } - if ( policies.isTransient() ) { + if (policies.isTransient()) { serverid = orb.getTransientServerId(); } else { serverid = orb.getORBData().getPersistentServerId(); - scid = ORBConstants.makePersistent( scid ) ; + scid = ORBConstants.makePersistent(scid); } - isImplicit = policies.isImplicitlyActivated() ; - isUnique = policies.isUniqueIds() ; - isSystemId = policies.isSystemAssignedIds() ; + isImplicit = policies.isImplicitlyActivated(); + isUnique = policies.isUniqueIds(); + isSystemId = policies.isSystemAssignedIds(); - sysIdCounter = 0 ; + sysIdCounter = 0; } - - public final java.lang.Object getInvocationServant( byte[] id, - String operation ) throws ForwardRequest - { - java.lang.Object result = internalGetServant( id, operation ) ; - return result ; + public final java.lang.Object getInvocationServant(byte[] id, String operation) throws ForwardRequest { + java.lang.Object result = internalGetServant(id, operation); + + return result; } // Create a delegate and stick it in the servant. // This delegate is needed during dispatch for the ObjectImpl._orb() // method to work. - protected final void setDelegate(Servant servant, byte[] id) - { - //This new servant delegate no longer needs the id for + protected final void setDelegate(Servant servant, byte[] id) { + // This new servant delegate no longer needs the id for // its initialization. servant._set_delegate(delegateImpl); } - public synchronized byte[] newSystemId() throws WrongPolicy - { + public synchronized byte[] newSystemId() throws WrongPolicy { if (!isSystemId) { throw new WrongPolicy(); } byte[] array = new byte[8]; ORBUtility.intToBytes(++sysIdCounter, array, 0); - ORBUtility.intToBytes( poa.getPOAId(), array, 4); + ORBUtility.intToBytes(poa.getPOAId(), array, 4); return array; } - protected abstract java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest ; + protected abstract java.lang.Object internalGetServant(byte[] id, String operation) throws ForwardRequest; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorBase_R.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorBase_R.java index 1f186c645..099f9fa61 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorBase_R.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorBase_R.java @@ -17,26 +17,25 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; +package com.sun.corba.ee.impl.oa.poa; -import org.omg.PortableServer.Servant ; +import org.omg.PortableServer.Servant; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.ServantAlreadyActive; +import org.omg.PortableServer.POAPackage.ObjectNotActive; +import org.omg.PortableServer.POAPackage.ObjectAlreadyActive; import com.sun.corba.ee.spi.trace.Poa; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Poa public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase { - protected ActiveObjectMap activeObjectMap ; - - POAPolicyMediatorBase_R( Policies policies, POAImpl poa ) - { - super( policies, poa ) ; + protected ActiveObjectMap activeObjectMap; + + POAPolicyMediatorBase_R(Policies policies, POAImpl poa) { + super(policies, poa); // assert policies.retainServants() && policies.useActiveObjectMapOnly() if (!policies.retainServants()) { @@ -45,112 +44,100 @@ public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase { activeObjectMap = ActiveObjectMap.create(poa, !isUnique); } - - public void returnServant() - { + + public void returnServant() { // NO-OP } - public void clearAOM() - { - activeObjectMap.clear() ; - activeObjectMap = null ; + public void clearAOM() { + activeObjectMap.clear(); + activeObjectMap = null; } - protected Servant internalKeyToServant( ActiveObjectMap.Key key ) - { + protected Servant internalKeyToServant(ActiveObjectMap.Key key) { AOMEntry entry = activeObjectMap.get(key); if (entry == null) { return null; } - return activeObjectMap.getServant( entry ) ; + return activeObjectMap.getServant(entry); } - protected Servant internalIdToServant( byte[] id ) - { - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - return internalKeyToServant( key ) ; + protected Servant internalIdToServant(byte[] id) { + ActiveObjectMap.Key key = new ActiveObjectMap.Key(id); + return internalKeyToServant(key); } @Poa - protected void activateServant( ActiveObjectMap.Key key, AOMEntry entry, Servant servant ) - { - setDelegate(servant, key.id() ); + protected void activateServant(ActiveObjectMap.Key key, AOMEntry entry, Servant servant) { + setDelegate(servant, key.id()); - activeObjectMap.putServant( servant, entry ) ; + activeObjectMap.putServant(servant, entry); - POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; - POAFactory factory = pm.getFactory() ; + POAManagerImpl pm = (POAManagerImpl) poa.the_POAManager(); + POAFactory factory = pm.getFactory(); factory.registerPOAForServant(poa, servant); } @Poa - public final void activateObject(byte[] id, Servant servant) - throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive - { + public final void activateObject(byte[] id, Servant servant) throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive { if (isUnique && activeObjectMap.contains(servant)) { throw new ServantAlreadyActive(); } - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; + ActiveObjectMap.Key key = new ActiveObjectMap.Key(id); - AOMEntry entry = activeObjectMap.get( key ) ; + AOMEntry entry = activeObjectMap.get(key); // Check for an ObjectAlreadyActive error - entry.activateObject() ; + entry.activateObject(); - activateServant( key, entry, servant ) ; + activateServant(key, entry, servant); } - + @Poa - public Servant deactivateObject( byte[] id ) - throws ObjectNotActive, WrongPolicy - { - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - return deactivateObject( key ) ; + public Servant deactivateObject(byte[] id) throws ObjectNotActive, WrongPolicy { + ActiveObjectMap.Key key = new ActiveObjectMap.Key(id); + return deactivateObject(key); } - + @Poa - protected void deactivateHelper( ActiveObjectMap.Key key, AOMEntry entry, - Servant s ) throws ObjectNotActive, WrongPolicy - { + protected void deactivateHelper(ActiveObjectMap.Key key, AOMEntry entry, Servant s) throws ObjectNotActive, WrongPolicy { // Default does nothing, but the USE_SERVANT_MANAGER case // must handle etherealization activeObjectMap.remove(key); - POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; - POAFactory factory = pm.getFactory() ; + POAManagerImpl pm = (POAManagerImpl) poa.the_POAManager(); + POAFactory factory = pm.getFactory(); factory.unregisterPOAForServant(poa, s); } @InfoMethod - private void deactivatingObject( Servant s, POAImpl poa ) { } + private void deactivatingObject(Servant s, POAImpl poa) { + } @Poa - public Servant deactivateObject( ActiveObjectMap.Key key ) - throws ObjectNotActive, WrongPolicy { + public Servant deactivateObject(ActiveObjectMap.Key key) throws ObjectNotActive, WrongPolicy { AOMEntry entry = activeObjectMap.get(key); if (entry == null) { throw new ObjectNotActive(); } - Servant s = activeObjectMap.getServant( entry ) ; + Servant s = activeObjectMap.getServant(entry); if (s == null) { throw new ObjectNotActive(); } - deactivatingObject( s, poa ) ; + deactivatingObject(s, poa); - deactivateHelper( key, entry, s ) ; + deactivateHelper(key, entry, s); - return s ; + return s; } @Poa - public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy - { + public byte[] servantToId(Servant servant) throws ServantNotActive, WrongPolicy { if (!isUnique && !isImplicit) { throw new WrongPolicy(); } @@ -160,10 +147,10 @@ public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolic if (key != null) { return key.id(); } - } + } // assert !isUnique || (servant not in activateObjectMap) - + if (isImplicit) { try { byte[] id = newSystemId(); @@ -181,4 +168,3 @@ public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolic throw new ServantNotActive(); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorFactory.java index 4f188722d..eeb973126 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorFactory.java @@ -17,19 +17,17 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; +package com.sun.corba.ee.impl.oa.poa; import com.sun.corba.ee.spi.logging.POASystemException; abstract class POAPolicyMediatorFactory { - private static final POASystemException wrapper = - POASystemException.self ; + private static final POASystemException wrapper = POASystemException.self; // create an appropriate policy mediator based on the policies. // Note that the policies object has already been validated before // this call, so it can only contain valid combinations of POA policies. - static POAPolicyMediator create( Policies policies, POAImpl poa ) - { + static POAPolicyMediator create(Policies policies, POAImpl poa) { if (policies.retainServants()) { if (policies.useActiveMapOnly()) { return new POAPolicyMediatorImpl_R_AOM(policies, poa); @@ -43,8 +41,7 @@ static POAPolicyMediator create( Policies policies, POAImpl poa ) } else { if (policies.useDefaultServant()) { return new POAPolicyMediatorImpl_NR_UDS(policies, poa); - } - else if (policies.useServantManager()) { + } else if (policies.useServantManager()) { return new POAPolicyMediatorImpl_NR_USM(policies, poa); } else { throw wrapper.pmfCreateNonRetain(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java index 1b1dd6cbe..ccfba89da 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java @@ -17,27 +17,26 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; - -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.NoServant ; - -/** Implementation of POAPolicyMediator that provides policy specific - * operations on the POA. +package com.sun.corba.ee.impl.oa.poa; + +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.ServantManager; +import org.omg.PortableServer.ForwardRequest; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.ObjectNotActive; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.ObjectAlreadyActive; +import org.omg.PortableServer.POAPackage.ServantAlreadyActive; +import org.omg.PortableServer.POAPackage.NoServant; + +/** + * Implementation of POAPolicyMediator that provides policy specific operations on the POA. */ public class POAPolicyMediatorImpl_NR_UDS extends POAPolicyMediatorBase { - private Servant defaultServant ; + private Servant defaultServant; - POAPolicyMediatorImpl_NR_UDS( Policies policies, POAImpl poa ) - { - super( policies, poa ) ; + POAPolicyMediatorImpl_NR_UDS(Policies policies, POAImpl poa) { + super(policies, poa); // assert !policies.retainServants() && policies.useDefaultServant() if (policies.retainServants()) { @@ -48,13 +47,12 @@ public class POAPolicyMediatorImpl_NR_UDS extends POAPolicyMediatorBase { throw wrapper.policyMediatorBadPolicyInFactory(); } - defaultServant = null ; + defaultServant = null; } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest { - poa.readLock() ; + protected java.lang.Object internalGetServant(byte[] id, String operation) throws ForwardRequest { + + poa.readLock(); try { if (defaultServant == null) { throw wrapper.poaNoDefaultServant(); @@ -62,72 +60,59 @@ protected java.lang.Object internalGetServant( byte[] id, return defaultServant; } finally { - poa.readUnlock() ; + poa.readUnlock(); } } - public void returnServant() - { + public void returnServant() { // NO-OP } - public void etherealizeAll() - { + public void etherealizeAll() { // NO-OP } - public void clearAOM() - { + public void clearAOM() { // NO-OP } - public ServantManager getServantManager() throws WrongPolicy - { + public ServantManager getServantManager() throws WrongPolicy { throw new WrongPolicy(); } - public void setServantManager( ServantManager servantManager ) throws WrongPolicy - { + public void setServantManager(ServantManager servantManager) throws WrongPolicy { throw new WrongPolicy(); } - public Servant getDefaultServant() throws NoServant, WrongPolicy - { + public Servant getDefaultServant() throws NoServant, WrongPolicy { if (defaultServant == null) { throw new NoServant(); } return defaultServant; } - public void setDefaultServant( Servant servant ) throws WrongPolicy - { + public void setDefaultServant(Servant servant) throws WrongPolicy { this.defaultServant = servant; setDelegate(defaultServant, "DefaultServant".getBytes()); } - public final void activateObject(byte[] id, Servant servant) - throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive - { + public final void activateObject(byte[] id, Servant servant) throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive { throw new WrongPolicy(); } - public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy - { + public Servant deactivateObject(byte[] id) throws ObjectNotActive, WrongPolicy { throw new WrongPolicy(); } - public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy - { + public byte[] servantToId(Servant servant) throws ServantNotActive, WrongPolicy { throw new WrongPolicy(); } - public Servant idToServant( byte[] id ) - throws WrongPolicy, ObjectNotActive - { + public Servant idToServant(byte[] id) throws WrongPolicy, ObjectNotActive { if (defaultServant != null) { return defaultServant; } - throw new ObjectNotActive() ; + throw new ObjectNotActive(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java index 1a2c8f136..00b479502 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java @@ -17,36 +17,33 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; - - -import org.omg.PortableServer.POA ; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ServantLocator ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.NoServant ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ; - - -import com.sun.corba.ee.spi.oa.OAInvocationInfo ; -import com.sun.corba.ee.impl.oa.NullServantImpl ; - -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA. +package com.sun.corba.ee.impl.oa.poa; + +import org.omg.PortableServer.POA; +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.ServantManager; +import org.omg.PortableServer.ServantLocator; +import org.omg.PortableServer.ForwardRequest; +import org.omg.PortableServer.POAPackage.NoServant; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.ObjectNotActive; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.ObjectAlreadyActive; +import org.omg.PortableServer.POAPackage.ServantAlreadyActive; +import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; + +import com.sun.corba.ee.spi.oa.OAInvocationInfo; +import com.sun.corba.ee.impl.oa.NullServantImpl; + +/** + * Implementation of POARequesHandler that provides policy specific operations on the POA. */ public class POAPolicyMediatorImpl_NR_USM extends POAPolicyMediatorBase { // XXX How do we protect locator from multi-threaded access? - private ServantLocator locator ; + private ServantLocator locator; - POAPolicyMediatorImpl_NR_USM( Policies policies, POAImpl poa ) - { - super( policies, poa ) ; + POAPolicyMediatorImpl_NR_USM(Policies policies, POAImpl poa) { + super(policies, poa); // assert !policies.retainServants() && policies.useServantManager() if (policies.retainServants()) { @@ -57,20 +54,17 @@ public class POAPolicyMediatorImpl_NR_USM extends POAPolicyMediatorBase { throw wrapper.policyMediatorBadPolicyInFactory(); } - locator = null ; + locator = null; } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest - { + + protected java.lang.Object internalGetServant(byte[] id, String operation) throws ForwardRequest { if (locator == null) { throw wrapper.poaNoServantManager(); } - - CookieHolder cookieHolder = orb.peekInvocationInfo().getCookieHolder() ; - java.lang.Object servant = locator.preinvoke(id, poa, operation, - cookieHolder); + CookieHolder cookieHolder = orb.peekInvocationInfo().getCookieHolder(); + + java.lang.Object servant = locator.preinvoke(id, poa, operation, cookieHolder); if (servant == null) { servant = new NullServantImpl(omgWrapper.nullServantReturned()); @@ -78,12 +72,10 @@ protected java.lang.Object internalGetServant( byte[] id, setDelegate((Servant) servant, id); } - return servant; } - public void returnServant() - { + public void returnServant() { OAInvocationInfo info = orb.peekInvocationInfo(); // 6878245: added info == null check. @@ -91,28 +83,23 @@ public void returnServant() return; } - locator.postinvoke(info.id(), (POA)(info.oa()), - info.getOperation(), info.getCookieHolder().value, - (Servant)(info.getServantContainer()) ); + locator.postinvoke(info.id(), (POA) (info.oa()), info.getOperation(), info.getCookieHolder().value, + (Servant) (info.getServantContainer())); } - public void etherealizeAll() - { + public void etherealizeAll() { // NO-OP } - public void clearAOM() - { + public void clearAOM() { // NO-OP } - public ServantManager getServantManager() throws WrongPolicy - { - return locator ; + public ServantManager getServantManager() throws WrongPolicy { + return locator; } - public void setServantManager( ServantManager servantManager ) throws WrongPolicy - { + public void setServantManager(ServantManager servantManager) throws WrongPolicy { if (locator != null) { throw wrapper.servantManagerAlreadySet(); } @@ -124,35 +111,27 @@ public void setServantManager( ServantManager servantManager ) throws WrongPolic } } - public Servant getDefaultServant() throws NoServant, WrongPolicy - { + public Servant getDefaultServant() throws NoServant, WrongPolicy { throw new WrongPolicy(); } - public void setDefaultServant( Servant servant ) throws WrongPolicy - { + public void setDefaultServant(Servant servant) throws WrongPolicy { throw new WrongPolicy(); } - public final void activateObject(byte[] id, Servant servant) - throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive - { + public final void activateObject(byte[] id, Servant servant) throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive { throw new WrongPolicy(); } - public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy - { + public Servant deactivateObject(byte[] id) throws ObjectNotActive, WrongPolicy { throw new WrongPolicy(); } - public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy - { + public byte[] servantToId(Servant servant) throws ServantNotActive, WrongPolicy { throw new WrongPolicy(); } - public Servant idToServant( byte[] id ) - throws WrongPolicy, ObjectNotActive - { + public Servant idToServant(byte[] id) throws WrongPolicy, ObjectNotActive { throw new WrongPolicy(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java index 4015f57d0..0d4377636 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java @@ -17,52 +17,49 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; +package com.sun.corba.ee.impl.oa.poa; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.NoServant ; +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.ServantManager; +import org.omg.PortableServer.ForwardRequest; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.ObjectNotActive; +import org.omg.PortableServer.POAPackage.NoServant; -import com.sun.corba.ee.impl.oa.NullServantImpl ; +import com.sun.corba.ee.impl.oa.NullServantImpl; -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA in the case: +/** + * Implementation of POARequesHandler that provides policy specific operations on the POA in the case: *

    *
  • retain
  • *
  • useActiveObjectMapOnly
  • *
*/ public class POAPolicyMediatorImpl_R_AOM extends POAPolicyMediatorBase_R { - POAPolicyMediatorImpl_R_AOM( Policies policies, POAImpl poa ) - { - // assert policies.retainServants() - super( policies, poa ) ; + POAPolicyMediatorImpl_R_AOM(Policies policies, POAImpl poa) { + // assert policies.retainServants() + super(policies, poa); // policies.useActiveObjectMapOnly() if (!policies.useActiveMapOnly()) { throw wrapper.policyMediatorBadPolicyInFactory(); } } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest - { - poa.lock() ; + + protected java.lang.Object internalGetServant(byte[] id, String operation) throws ForwardRequest { + poa.lock(); try { - java.lang.Object servant = internalIdToServant( id ) ; + java.lang.Object servant = internalIdToServant(id); if (servant == null) { servant = new NullServantImpl(wrapper.nullServant()); } - return servant ; + return servant; } finally { - poa.unlock() ; + poa.unlock(); } } - public void etherealizeAll() { + public void etherealizeAll() { // NO-OP } @@ -70,8 +67,7 @@ public ServantManager getServantManager() throws WrongPolicy { throw new WrongPolicy(); } - public void setServantManager( ServantManager servantManager ) - throws WrongPolicy { + public void setServantManager(ServantManager servantManager) throws WrongPolicy { throw new WrongPolicy(); } @@ -79,13 +75,12 @@ public Servant getDefaultServant() throws NoServant, WrongPolicy { throw new WrongPolicy(); } - public void setDefaultServant( Servant servant ) throws WrongPolicy { + public void setDefaultServant(Servant servant) throws WrongPolicy { throw new WrongPolicy(); } - public Servant idToServant( byte[] id ) - throws WrongPolicy, ObjectNotActive { - Servant s = internalIdToServant( id ) ; + public Servant idToServant(byte[] id) throws WrongPolicy, ObjectNotActive { + Servant s = internalIdToServant(id); if (s == null) { throw new ObjectNotActive(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java index ae800051e..741b8addd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java @@ -17,37 +17,37 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; +package com.sun.corba.ee.impl.oa.poa; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.NoServant ; +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.ServantManager; +import org.omg.PortableServer.ForwardRequest; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.ObjectNotActive; +import org.omg.PortableServer.POAPackage.NoServant; -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA. +/** + * Implementation of POARequesHandler that provides policy specific operations on the POA. */ public class POAPolicyMediatorImpl_R_UDS extends POAPolicyMediatorBase_R { - private Servant defaultServant ; + private Servant defaultServant; - POAPolicyMediatorImpl_R_UDS( Policies policies, POAImpl poa ) { - // assert policies.retainServants() - super( policies, poa ) ; - defaultServant = null ; + POAPolicyMediatorImpl_R_UDS(Policies policies, POAImpl poa) { + // assert policies.retainServants() + super(policies, poa); + defaultServant = null; // policies.useDefaultServant() if (!policies.useDefaultServant()) { throw wrapper.policyMediatorBadPolicyInFactory(); - } } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest { + } + } - poa.readLock() ; + protected java.lang.Object internalGetServant(byte[] id, String operation) throws ForwardRequest { + + poa.readLock(); try { - Servant servant = internalIdToServant( id ) ; + Servant servant = internalIdToServant(id); if (servant == null) { servant = defaultServant; } @@ -56,13 +56,13 @@ protected java.lang.Object internalGetServant( byte[] id, throw wrapper.poaNoDefaultServant(); } - return servant ; + return servant; } finally { poa.readUnlock(); } } - public void etherealizeAll() { + public void etherealizeAll() { // NO-OP } @@ -70,8 +70,7 @@ public ServantManager getServantManager() throws WrongPolicy { throw new WrongPolicy(); } - public void setServantManager( - ServantManager servantManager ) throws WrongPolicy { + public void setServantManager(ServantManager servantManager) throws WrongPolicy { throw new WrongPolicy(); } @@ -83,17 +82,16 @@ public Servant getDefaultServant() throws NoServant, WrongPolicy { } } - public void setDefaultServant( Servant servant ) throws WrongPolicy { + public void setDefaultServant(Servant servant) throws WrongPolicy { defaultServant = servant; setDelegate(defaultServant, "DefaultServant".getBytes()); } - public Servant idToServant( byte[] id ) - throws WrongPolicy, ObjectNotActive { + public Servant idToServant(byte[] id) throws WrongPolicy, ObjectNotActive { - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; + ActiveObjectMap.Key key = new ActiveObjectMap.Key(id); Servant s = internalKeyToServant(key); - + if (s == null) { if (defaultServant != null) { s = defaultServant; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java index f48ea8170..de681fadc 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java @@ -17,146 +17,145 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.poa ; +package com.sun.corba.ee.impl.oa.poa; -import java.util.Set ; +import java.util.Set; -import org.omg.CORBA.SystemException ; +import org.omg.CORBA.SystemException; -import org.omg.PortableServer.ServantActivator ; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.NoServant ; +import org.omg.PortableServer.ServantActivator; +import org.omg.PortableServer.Servant; +import org.omg.PortableServer.ServantManager; +import org.omg.PortableServer.ForwardRequest; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.ObjectNotActive; +import org.omg.PortableServer.POAPackage.NoServant; -import com.sun.corba.ee.impl.oa.NullServantImpl ; +import com.sun.corba.ee.impl.oa.NullServantImpl; -import com.sun.corba.ee.spi.oa.OAInvocationInfo ; -import com.sun.corba.ee.spi.oa.NullServant ; +import com.sun.corba.ee.spi.oa.OAInvocationInfo; +import com.sun.corba.ee.spi.oa.NullServant; import com.sun.corba.ee.spi.trace.Poa; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA. +/** + * Implementation of POARequesHandler that provides policy specific operations on the POA. */ @Poa public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R { - protected ServantActivator activator ; + protected ServantActivator activator; - POAPolicyMediatorImpl_R_USM( Policies policies, POAImpl poa ) - { - // assert policies.retainServants() - super( policies, poa ) ; - activator = null ; + POAPolicyMediatorImpl_R_USM(Policies policies, POAImpl poa) { + // assert policies.retainServants() + super(policies, poa); + activator = null; if (!policies.useServantManager()) { throw wrapper.policyMediatorBadPolicyInFactory(); } } - - /* This handles a rather subtle bug (4939892). The problem is that - * enter will wait on the entry if it is being etherealized. When the - * deferred state transition completes, the entry is no longer in the - * AOM, and so we need to get a new entry, otherwise activator.incarnate - * will be called twice, once for the old entry, and again when a new - * entry is created. This fix also required extending the FSM StateEngine - * to allow actions to throw exceptions, and adding a new state in the - * AOMEntry FSM to detect this condition. + + /* + * This handles a rather subtle bug (4939892). The problem is that enter will wait on the entry if it is being + * etherealized. When the deferred state transition completes, the entry is no longer in the AOM, and so we need to get + * a new entry, otherwise activator.incarnate will be called twice, once for the old entry, and again when a new entry + * is created. This fix also required extending the FSM StateEngine to allow actions to throw exceptions, and adding a + * new state in the AOMEntry FSM to detect this condition. */ - private AOMEntry enterEntry( ActiveObjectMap.Key key ) - { - AOMEntry result = null ; - boolean failed ; + private AOMEntry enterEntry(ActiveObjectMap.Key key) { + AOMEntry result = null; + boolean failed; do { - failed = false ; - result = activeObjectMap.get(key) ; + failed = false; + result = activeObjectMap.get(key); try { - result.enter() ; + result.enter(); } catch (Exception exc) { - failed = true ; + failed = true; } - } while (failed) ; + } while (failed); - return result ; + return result; } @InfoMethod - private void servantAlreadyActivated() { } + private void servantAlreadyActivated() { + } @InfoMethod - private void upcallToIncarnate() { } + private void upcallToIncarnate() { + } @InfoMethod - private void incarnateFailed() { } + private void incarnateFailed() { + } @InfoMethod - private void incarnateComplete() { } + private void incarnateComplete() { + } @InfoMethod - private void servantAlreadyAssignedToID() { } + private void servantAlreadyAssignedToID() { + } @Poa - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest { + protected java.lang.Object internalGetServant(byte[] id, String operation) throws ForwardRequest { - poa.lock() ; + poa.lock(); try { - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - AOMEntry entry = enterEntry(key) ; - java.lang.Object servant = activeObjectMap.getServant( entry ) ; + ActiveObjectMap.Key key = new ActiveObjectMap.Key(id); + AOMEntry entry = enterEntry(key); + java.lang.Object servant = activeObjectMap.getServant(entry); if (servant != null) { - servantAlreadyActivated() ; - return servant ; + servantAlreadyActivated(); + return servant; } if (activator == null) { - entry.incarnateFailure() ; - throw wrapper.poaNoServantManager() ; + entry.incarnateFailure(); + throw wrapper.poaNoServantManager(); } // Drop the POA lock during the incarnate call and - // re-acquire it afterwards. The entry state machine + // re-acquire it afterwards. The entry state machine // prevents more than one thread from executing the // incarnate method at a time within the same POA. try { - upcallToIncarnate() ; + upcallToIncarnate(); - poa.unlock() ; + poa.unlock(); servant = activator.incarnate(id, poa); if (servant == null) { - servant = new NullServantImpl( - omgWrapper.nullServantReturned()); + servant = new NullServantImpl(omgWrapper.nullServantReturned()); } } catch (ForwardRequest freq) { - throw freq ; + throw freq; } catch (SystemException exc) { - throw exc ; + throw exc; } catch (Throwable exc) { - throw wrapper.poaServantActivatorLookupFailed( exc ) ; + throw wrapper.poaServantActivatorLookupFailed(exc); } finally { - poa.lock() ; + poa.lock(); // servant == null means incarnate threw an exception, // while servant instanceof NullServant means incarnate returned a - // null servant. Either case is an incarnate failure to the + // null servant. Either case is an incarnate failure to the // entry state machine. if ((servant == null) || (servant instanceof NullServant)) { - incarnateFailed() ; + incarnateFailed(); // XXX Does the AOM leak in this case? Yes, - // but the problem is hard to fix. There may be + // but the problem is hard to fix. There may be // a number of threads waiting for the state to change // from INCARN to something else, which is VALID or // INVALID, depending on the incarnate result. // The activeObjectMap.get() call above creates an // ActiveObjectMap.Entry if one does not already exist, // and stores it in the keyToEntry map in the AOM. - entry.incarnateFailure() ; + entry.incarnateFailure(); } else { // here check for unique_id policy, and if the servant // is already registered for a different ID, then throw @@ -164,81 +163,78 @@ protected java.lang.Object internalGetServant( byte[] id, // 99-10-07.pdf if (isUnique) { // check if the servant already is associated with some id - if (activeObjectMap.contains((Servant)servant)) { - servantAlreadyAssignedToID() ; - entry.incarnateFailure() ; - throw wrapper.poaServantNotUnique() ; + if (activeObjectMap.contains((Servant) servant)) { + servantAlreadyAssignedToID(); + entry.incarnateFailure(); + throw wrapper.poaServantNotUnique(); } } - incarnateComplete() ; + incarnateComplete(); - entry.incarnateComplete() ; - activateServant(key, entry, (Servant)servant); + entry.incarnateComplete(); + activateServant(key, entry, (Servant) servant); } } - return servant ; + return servant; } finally { - poa.unlock() ; + poa.unlock(); } } @Poa @Override public void returnServant() { - poa.lock() ; + poa.lock(); try { OAInvocationInfo info = orb.peekInvocationInfo(); // 6878245: added null check. if (info == null) { - return ; + return; } - byte[] id = info.id() ; - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - AOMEntry entry = activeObjectMap.get( key ) ; - entry.exit() ; + byte[] id = info.id(); + ActiveObjectMap.Key key = new ActiveObjectMap.Key(id); + AOMEntry entry = activeObjectMap.get(key); + entry.exit(); } finally { poa.unlock(); } } @Poa - public void etherealizeAll() { - if (activator != null) { - Set keySet = activeObjectMap.keySet() ; + public void etherealizeAll() { + if (activator != null) { + Set keySet = activeObjectMap.keySet(); // Copy the elements in the set to an array to avoid // changes in the set due to concurrent modification @SuppressWarnings("unchecked") - ActiveObjectMap.Key[] keys = - keySet.toArray(new ActiveObjectMap.Key[keySet.size()]) ; + ActiveObjectMap.Key[] keys = keySet.toArray(new ActiveObjectMap.Key[keySet.size()]); - for (int ctr=0; ctr policyMap = new HashMap() ; + /* + * Order of *POLICY_ID : THREAD_ LIFESPAN_ ID_UNIQUENESS_ ID_ASSIGNMENT_ IMPLICIT_ACTIVATION_ SERvANT_RETENTION_ + * REQUEST_PROCESSING_ The code in this class depends on this order! + */ + private static final int MIN_POA_POLICY_ID = THREAD_POLICY_ID.value; + private static final int MAX_POA_POLICY_ID = REQUEST_PROCESSING_POLICY_ID.value; + private static final int POLICY_TABLE_SIZE = MAX_POA_POLICY_ID - MIN_POA_POLICY_ID + 1; + + int defaultObjectCopierFactoryId; + + private Map policyMap = new HashMap(); @ManagedAttribute - @Description( "The policies") - Map getPolicies() { - return new HashMap( policyMap ) ; + @Description("The policies") + Map getPolicies() { + return new HashMap(policyMap); } - public static final Policies defaultPolicies - = new Policies() ; - - public static final Policies rootPOAPolicies - = new Policies( - ThreadPolicyValue._ORB_CTRL_MODEL, - LifespanPolicyValue._TRANSIENT, - IdUniquenessPolicyValue._UNIQUE_ID, - IdAssignmentPolicyValue._SYSTEM_ID, - ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION, - ServantRetentionPolicyValue._RETAIN, - RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY ) ; - - private int[] poaPolicyValues ; - - private int getPolicyValue( int id ) - { - return poaPolicyValues[ id - MIN_POA_POLICY_ID ] ; + public static final Policies defaultPolicies = new Policies(); + + public static final Policies rootPOAPolicies = new Policies(ThreadPolicyValue._ORB_CTRL_MODEL, LifespanPolicyValue._TRANSIENT, + IdUniquenessPolicyValue._UNIQUE_ID, IdAssignmentPolicyValue._SYSTEM_ID, ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION, + ServantRetentionPolicyValue._RETAIN, RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY); + + private int[] poaPolicyValues; + + private int getPolicyValue(int id) { + return poaPolicyValues[id - MIN_POA_POLICY_ID]; } - private void setPolicyValue( int id, int value ) - { - poaPolicyValues[ id - MIN_POA_POLICY_ID ] = value ; + private void setPolicyValue(int id, int value) { + poaPolicyValues[id - MIN_POA_POLICY_ID] = value; } - - private Policies( - int threadModel, - int lifespan, - int idUniqueness, - int idAssignment, - int implicitActivation, - int retention, - int requestProcessing ) - { - poaPolicyValues = new int[] { - threadModel, - lifespan, - idUniqueness, - idAssignment, - implicitActivation, - retention, - requestProcessing }; + + private Policies(int threadModel, int lifespan, int idUniqueness, int idAssignment, int implicitActivation, int retention, + int requestProcessing) { + poaPolicyValues = new int[] { threadModel, lifespan, idUniqueness, idAssignment, implicitActivation, retention, requestProcessing }; } private Policies() { - this( ThreadPolicyValue._ORB_CTRL_MODEL, - LifespanPolicyValue._TRANSIENT, - IdUniquenessPolicyValue._UNIQUE_ID, - IdAssignmentPolicyValue._SYSTEM_ID, - ImplicitActivationPolicyValue._NO_IMPLICIT_ACTIVATION, - ServantRetentionPolicyValue._RETAIN, - RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY ) ; + this(ThreadPolicyValue._ORB_CTRL_MODEL, LifespanPolicyValue._TRANSIENT, IdUniquenessPolicyValue._UNIQUE_ID, + IdAssignmentPolicyValue._SYSTEM_ID, ImplicitActivationPolicyValue._NO_IMPLICIT_ACTIVATION, + ServantRetentionPolicyValue._RETAIN, RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY); } @Override public String toString() { StringBuilder buffer = new StringBuilder(); - buffer.append( "Policies[" ) ; - boolean first = true ; - for ( Policy p : policyMap.values() ) { + buffer.append("Policies["); + boolean first = true; + for (Policy p : policyMap.values()) { if (first) - first = false ; + first = false; else - buffer.append( "," ) ; + buffer.append(","); - buffer.append( p.toString() ) ; - } - buffer.append( "]" ) ; - return buffer.toString() ; + buffer.append(p.toString()); + } + buffer.append("]"); + return buffer.toString(); } - /* Returns the integer value of the POA policy, if this is a - * POA policy, otherwise returns -1. + /* + * Returns the integer value of the POA policy, if this is a POA policy, otherwise returns -1. */ - private int getPOAPolicyValue( Policy policy) - { + private int getPOAPolicyValue(Policy policy) { if (policy instanceof ThreadPolicy) { return ((ThreadPolicy) policy).value().value(); } else if (policy instanceof LifespanPolicy) { @@ -173,212 +138,185 @@ private int getPOAPolicyValue( Policy policy) } else if (policy instanceof ServantRetentionPolicy) { return ((ServantRetentionPolicy) policy).value().value(); } else if (policy instanceof RequestProcessingPolicy) { - return ((RequestProcessingPolicy) policy).value().value(); + return ((RequestProcessingPolicy) policy).value().value(); } else if (policy instanceof ImplicitActivationPolicy) { return ((ImplicitActivationPolicy) policy).value().value(); - } else - return -1 ; + } else + return -1; } - /** If any errors were found, throw INVALID_POLICY with the smallest - * index of any offending policy. + /** + * If any errors were found, throw INVALID_POLICY with the smallest index of any offending policy. */ - private void checkForPolicyError( BitSet errorSet ) throws InvalidPolicy - { - for (short ctr=0; ctr= 0) { - setPolicyValue( key, POAPolicyValue ) ; + setPolicyValue(key, POAPolicyValue); - // if the value of this POA policy was previously set to a - // different value than the current value given in + // if the value of this POA policy was previously set to a + // different value than the current value given in // POAPolicyValue, record an error. - if ((prev != null) && - (getPOAPolicyValue( prev ) != POAPolicyValue)) - errorSet.set( i ) ; + if ((prev != null) && (getPOAPolicyValue(prev) != POAPolicyValue)) + errorSet.set(i); } } // Check for bad policy combinations // NON_RETAIN requires USE_DEFAULT_SERVANT or USE_SERVANT_MANAGER - if (!retainServants() && useActiveMapOnly() ) { - addToErrorSet( policies, SERVANT_RETENTION_POLICY_ID.value, - errorSet ) ; - addToErrorSet( policies, REQUEST_PROCESSING_POLICY_ID.value, - errorSet ) ; + if (!retainServants() && useActiveMapOnly()) { + addToErrorSet(policies, SERVANT_RETENTION_POLICY_ID.value, errorSet); + addToErrorSet(policies, REQUEST_PROCESSING_POLICY_ID.value, errorSet); } // IMPLICIT_ACTIVATION requires SYSTEM_ID and RETAIN if (isImplicitlyActivated()) { if (!retainServants()) { - addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value, - errorSet ) ; - addToErrorSet( policies, SERVANT_RETENTION_POLICY_ID.value, - errorSet ) ; + addToErrorSet(policies, IMPLICIT_ACTIVATION_POLICY_ID.value, errorSet); + addToErrorSet(policies, SERVANT_RETENTION_POLICY_ID.value, errorSet); } if (!isSystemAssignedIds()) { - addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value, - errorSet ) ; - addToErrorSet( policies, ID_ASSIGNMENT_POLICY_ID.value, - errorSet ) ; - } + addToErrorSet(policies, IMPLICIT_ACTIVATION_POLICY_ID.value, errorSet); + addToErrorSet(policies, ID_ASSIGNMENT_POLICY_ID.value, errorSet); + } } - checkForPolicyError( errorSet ) ; + checkForPolicyError(errorSet); } - - public Policy get_effective_policy( int type ) - { - return policyMap.get(type) ; + + public Policy get_effective_policy(int type) { + return policyMap.get(type); } /* Thread Policies */ public final boolean isOrbControlledThreads() { - return getPolicyValue( THREAD_POLICY_ID.value ) == - ThreadPolicyValue._ORB_CTRL_MODEL; + return getPolicyValue(THREAD_POLICY_ID.value) == ThreadPolicyValue._ORB_CTRL_MODEL; } + public final boolean isSingleThreaded() { - return getPolicyValue( THREAD_POLICY_ID.value ) == - ThreadPolicyValue._SINGLE_THREAD_MODEL; + return getPolicyValue(THREAD_POLICY_ID.value) == ThreadPolicyValue._SINGLE_THREAD_MODEL; } /* Lifespan */ public final boolean isTransient() { - return getPolicyValue( LIFESPAN_POLICY_ID.value ) == - LifespanPolicyValue._TRANSIENT; + return getPolicyValue(LIFESPAN_POLICY_ID.value) == LifespanPolicyValue._TRANSIENT; } + public final boolean isPersistent() { - return getPolicyValue( LIFESPAN_POLICY_ID.value ) == - LifespanPolicyValue._PERSISTENT; + return getPolicyValue(LIFESPAN_POLICY_ID.value) == LifespanPolicyValue._PERSISTENT; } /* ID Uniqueness */ public final boolean isUniqueIds() { - return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) == - IdUniquenessPolicyValue._UNIQUE_ID; + return getPolicyValue(ID_UNIQUENESS_POLICY_ID.value) == IdUniquenessPolicyValue._UNIQUE_ID; } + public final boolean isMultipleIds() { - return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) == - IdUniquenessPolicyValue._MULTIPLE_ID; + return getPolicyValue(ID_UNIQUENESS_POLICY_ID.value) == IdUniquenessPolicyValue._MULTIPLE_ID; } /* ID Assignment */ public final boolean isUserAssignedIds() { - return getPolicyValue( ID_ASSIGNMENT_POLICY_ID.value ) == - IdAssignmentPolicyValue._USER_ID; + return getPolicyValue(ID_ASSIGNMENT_POLICY_ID.value) == IdAssignmentPolicyValue._USER_ID; } + public final boolean isSystemAssignedIds() { - return getPolicyValue( ID_ASSIGNMENT_POLICY_ID.value ) == - IdAssignmentPolicyValue._SYSTEM_ID; + return getPolicyValue(ID_ASSIGNMENT_POLICY_ID.value) == IdAssignmentPolicyValue._SYSTEM_ID; } /* Servant Rentention */ public final boolean retainServants() { - return getPolicyValue( SERVANT_RETENTION_POLICY_ID.value ) == - ServantRetentionPolicyValue._RETAIN; + return getPolicyValue(SERVANT_RETENTION_POLICY_ID.value) == ServantRetentionPolicyValue._RETAIN; } /* Request Processing */ public final boolean useActiveMapOnly() { - return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) == - RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY; + return getPolicyValue(REQUEST_PROCESSING_POLICY_ID.value) == RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY; } + public final boolean useDefaultServant() { - return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) == - RequestProcessingPolicyValue._USE_DEFAULT_SERVANT; + return getPolicyValue(REQUEST_PROCESSING_POLICY_ID.value) == RequestProcessingPolicyValue._USE_DEFAULT_SERVANT; } + public final boolean useServantManager() { - return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) == - RequestProcessingPolicyValue._USE_SERVANT_MANAGER; + return getPolicyValue(REQUEST_PROCESSING_POLICY_ID.value) == RequestProcessingPolicyValue._USE_SERVANT_MANAGER; } /* Implicit Activation */ public final boolean isImplicitlyActivated() { - return getPolicyValue( IMPLICIT_ACTIVATION_POLICY_ID.value ) == - ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION; + return getPolicyValue(IMPLICIT_ACTIVATION_POLICY_ID.value) == ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION; } /* proprietary servant caching policy */ - public final int servantCachingLevel() - { - ServantCachingPolicy policy = - ServantCachingPolicy.class.cast( policyMap.get( - ORBConstants.SERVANT_CACHING_POLICY ) ) ; + public final int servantCachingLevel() { + ServantCachingPolicy policy = ServantCachingPolicy.class.cast(policyMap.get(ORBConstants.SERVANT_CACHING_POLICY)); if (policy == null) - return ServantCachingPolicy.NO_SERVANT_CACHING ; + return ServantCachingPolicy.NO_SERVANT_CACHING; else - return policy.getType() ; + return policy.getType(); } - public final boolean forceZeroPort() - { - ZeroPortPolicy policy = - ZeroPortPolicy.class.cast( policyMap.get( - ORBConstants.ZERO_PORT_POLICY ) ) ; + public final boolean forceZeroPort() { + ZeroPortPolicy policy = ZeroPortPolicy.class.cast(policyMap.get(ORBConstants.ZERO_PORT_POLICY)); if (policy == null) - return false ; + return false; else - return policy.forceZeroPort() ; + return policy.forceZeroPort(); } - public final int getCopierId() - { - CopyObjectPolicy policy = - CopyObjectPolicy.class.cast( policyMap.get( - ORBConstants.COPY_OBJECT_POLICY ) ) ; + public final int getCopierId() { + CopyObjectPolicy policy = CopyObjectPolicy.class.cast(policyMap.get(ORBConstants.COPY_OBJECT_POLICY)); if (policy != null) - return policy.getValue() ; + return policy.getValue(); else - return defaultObjectCopierFactoryId ; + return defaultObjectCopierFactoryId; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/RequestProcessingPolicyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/RequestProcessingPolicyImpl.java index 11c685f97..68d626674 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/RequestProcessingPolicyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/RequestProcessingPolicyImpl.java @@ -22,11 +22,9 @@ import org.omg.CORBA.*; import org.omg.PortableServer.*; -public class RequestProcessingPolicyImpl - extends org.omg.CORBA.LocalObject implements RequestProcessingPolicy { +public class RequestProcessingPolicyImpl extends org.omg.CORBA.LocalObject implements RequestProcessingPolicy { - public RequestProcessingPolicyImpl(RequestProcessingPolicyValue - value) { + public RequestProcessingPolicyImpl(RequestProcessingPolicyValue value) { this.value = value; } @@ -34,9 +32,8 @@ public RequestProcessingPolicyValue value() { return value; } - public int policy_type() - { - return REQUEST_PROCESSING_POLICY_ID.value ; + public int policy_type() { + return REQUEST_PROCESSING_POLICY_ID.value; } public Policy copy() { @@ -49,21 +46,20 @@ public void destroy() { private RequestProcessingPolicyValue value; - public String toString() - { - String type = null ; + public String toString() { + String type = null; switch (value.value()) { - case RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY : - type = "USE_ACTIVE_OBJECT_MAP_ONLY" ; - break ; - case RequestProcessingPolicyValue._USE_DEFAULT_SERVANT : - type = "USE_DEFAULT_SERVANT" ; - break ; - case RequestProcessingPolicyValue._USE_SERVANT_MANAGER : - type = "USE_SERVANT_MANAGER" ; - break ; + case RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY: + type = "USE_ACTIVE_OBJECT_MAP_ONLY"; + break; + case RequestProcessingPolicyValue._USE_DEFAULT_SERVANT: + type = "USE_DEFAULT_SERVANT"; + break; + case RequestProcessingPolicyValue._USE_SERVANT_MANAGER: + type = "USE_SERVANT_MANAGER"; + break; } - return "RequestProcessingPolicy[" + type + "]" ; + return "RequestProcessingPolicy[" + type + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ServantRetentionPolicyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ServantRetentionPolicyImpl.java index e1696d217..49c038b2c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ServantRetentionPolicyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ServantRetentionPolicyImpl.java @@ -24,8 +24,7 @@ import org.omg.PortableServer.ServantRetentionPolicy; import org.omg.PortableServer.ServantRetentionPolicyValue; -final class ServantRetentionPolicyImpl - extends org.omg.CORBA.LocalObject implements ServantRetentionPolicy { +final class ServantRetentionPolicyImpl extends org.omg.CORBA.LocalObject implements ServantRetentionPolicy { private static final long serialVersionUID = 469062222833983100L; @@ -37,9 +36,8 @@ public ServantRetentionPolicyValue value() { return value; } - public int policy_type() - { - return SERVANT_RETENTION_POLICY_ID.value ; + public int policy_type() { + return SERVANT_RETENTION_POLICY_ID.value; } public Policy copy() { @@ -53,10 +51,7 @@ public void destroy() { private ServantRetentionPolicyValue value; @Override - public String toString() - { - return "ServantRetentionPolicy[" + - ((value.value() == ServantRetentionPolicyValue._RETAIN) ? - "RETAIN" : "NON_RETAIN" + "]") ; + public String toString() { + return "ServantRetentionPolicy[" + ((value.value() == ServantRetentionPolicyValue._RETAIN) ? "RETAIN" : "NON_RETAIN" + "]"); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ThreadPolicyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ThreadPolicyImpl.java index 4c162383a..248ce557e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ThreadPolicyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/poa/ThreadPolicyImpl.java @@ -22,9 +22,8 @@ import org.omg.CORBA.*; import org.omg.PortableServer.*; -final class ThreadPolicyImpl - extends org.omg.CORBA.LocalObject implements ThreadPolicy { - +final class ThreadPolicyImpl extends org.omg.CORBA.LocalObject implements ThreadPolicy { + public ThreadPolicyImpl(ThreadPolicyValue value) { this.value = value; } @@ -33,9 +32,8 @@ public ThreadPolicyValue value() { return value; } - public int policy_type() - { - return THREAD_POLICY_ID.value ; + public int policy_type() { + return THREAD_POLICY_ID.value; } public Policy copy() { @@ -48,10 +46,8 @@ public void destroy() { private ThreadPolicyValue value; - public String toString() - { - return "ThreadPolicy[" + - ((value.value() == ThreadPolicyValue._SINGLE_THREAD_MODEL) ? - "SINGLE_THREAD_MODEL" : "ORB_CTRL_MODEL" + "]") ; + public String toString() { + return "ThreadPolicy[" + + ((value.value() == ThreadPolicyValue._SINGLE_THREAD_MODEL) ? "SINGLE_THREAD_MODEL" : "ORB_CTRL_MODEL" + "]"); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/rfm/ReferenceFactoryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/rfm/ReferenceFactoryImpl.java index ceb57b0f3..48d85a701 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/rfm/ReferenceFactoryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/rfm/ReferenceFactoryImpl.java @@ -19,38 +19,31 @@ package com.sun.corba.ee.impl.oa.rfm; -import org.omg.CORBA.LocalObject ; - -import com.sun.corba.ee.spi.oa.rfm.ReferenceFactory ; -import com.sun.corba.ee.spi.oa.rfm.ReferenceFactoryManager ; - -public class ReferenceFactoryImpl extends LocalObject implements ReferenceFactory -{ - private ReferenceFactoryManagerImpl manager ; - private String name ; - private String repositoryId ; - - public ReferenceFactoryImpl( ReferenceFactoryManagerImpl manager, - String name, String repositoryId ) { - this.manager = manager ; - this.name = name ; - this.repositoryId = repositoryId ; +import org.omg.CORBA.LocalObject; + +import com.sun.corba.ee.spi.oa.rfm.ReferenceFactory; +import com.sun.corba.ee.spi.oa.rfm.ReferenceFactoryManager; + +public class ReferenceFactoryImpl extends LocalObject implements ReferenceFactory { + private ReferenceFactoryManagerImpl manager; + private String name; + private String repositoryId; + + public ReferenceFactoryImpl(ReferenceFactoryManagerImpl manager, String name, String repositoryId) { + this.manager = manager; + this.name = name; + this.repositoryId = repositoryId; } - public org.omg.CORBA.Object createReference( byte[] key ) { - return manager.createReference( name, key, repositoryId ) ; + public org.omg.CORBA.Object createReference(byte[] key) { + return manager.createReference(name, key, repositoryId); } public void destroy() { - manager.destroy( name ) ; + manager.destroy(name); } - public String toString() - { - return "ReferenceFactoryImpl[" - + name - + ", " - + repositoryId - + "]"; + public String toString() { + return "ReferenceFactoryImpl[" + name + ", " + repositoryId + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/rfm/ReferenceFactoryManagerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/rfm/ReferenceFactoryManagerImpl.java index 88d3df06a..f37a3c4af 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/rfm/ReferenceFactoryManagerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/rfm/ReferenceFactoryManagerImpl.java @@ -19,36 +19,36 @@ package com.sun.corba.ee.impl.oa.rfm; -import java.util.List ; -import java.util.ArrayList ; -import java.util.Map ; -import java.util.HashMap ; -import java.util.Arrays ; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.Arrays; -import java.util.concurrent.locks.ReentrantLock ; -import java.util.concurrent.locks.Condition ; +import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.locks.Condition; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; +import org.omg.CORBA.Policy; +import org.omg.CORBA.LocalObject; -import org.omg.PortableServer.POA ; -import org.omg.PortableServer.POAManager ; -import org.omg.PortableServer.AdapterActivator ; -import org.omg.PortableServer.ServantLocator ; -import org.omg.PortableServer.RequestProcessingPolicyValue ; -import org.omg.PortableServer.LifespanPolicyValue ; -import org.omg.PortableServer.ServantRetentionPolicyValue ; +import org.omg.PortableServer.POA; +import org.omg.PortableServer.POAManager; +import org.omg.PortableServer.AdapterActivator; +import org.omg.PortableServer.ServantLocator; +import org.omg.PortableServer.RequestProcessingPolicyValue; +import org.omg.PortableServer.LifespanPolicyValue; +import org.omg.PortableServer.ServantRetentionPolicyValue; -import org.omg.PortableServer.POAManagerPackage.AdapterInactive ; +import org.omg.PortableServer.POAManagerPackage.AdapterInactive; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.oa.ObjectAdapter ; -import com.sun.corba.ee.spi.oa.rfm.ReferenceFactory ; -import com.sun.corba.ee.spi.oa.rfm.ReferenceFactoryManager ; +import com.sun.corba.ee.spi.oa.ObjectAdapter; +import com.sun.corba.ee.spi.oa.rfm.ReferenceFactory; +import com.sun.corba.ee.spi.oa.rfm.ReferenceFactoryManager; -import com.sun.corba.ee.spi.logging.POASystemException ; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.logging.POASystemException; +import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.spi.trace.Poa; import java.util.HashSet; import java.util.Set; @@ -58,180 +58,159 @@ @Poa @ManagedObject -@Description( "The ReferenceFactoryManager, used to handle dynamic cluster membership updates") -public class ReferenceFactoryManagerImpl - extends org.omg.CORBA.LocalObject - implements ReferenceFactoryManager -{ - private static final POASystemException wrapper = - POASystemException.self ; +@Description("The ReferenceFactoryManager, used to handle dynamic cluster membership updates") +public class ReferenceFactoryManagerImpl extends org.omg.CORBA.LocalObject implements ReferenceFactoryManager { + private static final POASystemException wrapper = POASystemException.self; private static final long serialVersionUID = -6689846523143143228L; - private static final String PARENT_POA_NAME = "#RFMBase#" ; + private static final String PARENT_POA_NAME = "#RFMBase#"; // Initialized in the constructor - private RFMState state ; - private final ReentrantLock lock ; - private final Condition suspendCondition ; - private final ORB orb ; + private RFMState state; + private final ReentrantLock lock; + private final Condition suspendCondition; + private final ORB orb; // poatable contains the mapping from the ReferenceFactory name to - // the ServantLocator and list of policies. Note that the policy + // the ServantLocator and list of policies. Note that the policy // list is stored in the form passed to the create() call: that is, // it does not contain the standard policies. - private final Map>> poatable ; - private final Map factories ; - private final Set managers ; - private final AdapterActivator activator ; - private volatile boolean isActive ; + private final Map>> poatable; + private final Map factories; + private final Set managers; + private final AdapterActivator activator; + private volatile boolean isActive; // Initialized on activation because the root POA is required. - private POA rootPOA ; - private List standardPolicies ; - private POA parentPOA ; - private String[] parentPOAAdapterName ; - - public ReferenceFactoryManagerImpl( ORB orb ) - { - lock = new ReentrantLock() ; - suspendCondition = lock.newCondition() ; - state = RFMState.READY ; - this.orb = orb ; - poatable = new HashMap>>() ; - factories = new HashMap() ; - managers = new HashSet() ; - activator = new AdapterActivatorImpl() ; - isActive = false ; + private POA rootPOA; + private List standardPolicies; + private POA parentPOA; + private String[] parentPOAAdapterName; + + public ReferenceFactoryManagerImpl(ORB orb) { + lock = new ReentrantLock(); + suspendCondition = lock.newCondition(); + state = RFMState.READY; + this.orb = orb; + poatable = new HashMap>>(); + factories = new HashMap(); + managers = new HashSet(); + activator = new AdapterActivatorImpl(); + isActive = false; } @Poa - private class AdapterActivatorImpl - extends LocalObject - implements AdapterActivator - { + private class AdapterActivatorImpl extends LocalObject implements AdapterActivator { private static final long serialVersionUID = 7922226881290146012L; @Poa - public boolean unknown_adapter( POA parent, String name ) { - Pair> data = null ; + public boolean unknown_adapter(POA parent, String name) { + Pair> data = null; synchronized (poatable) { // REVISIT: make sure that data can't change concurrently! // Should be OK because Pair is immutable. - data = poatable.get( name ) ; + data = poatable.get(name); } if (data == null) { - return false ; + return false; } else { try { - List policies = new ArrayList() ; + List policies = new ArrayList(); // XXX What should we do if data.second() contains // policies with the same ID as standard policies? if (data.second() != null) { policies.addAll(data.second()); } - policies.addAll( standardPolicies ) ; - Policy[] arr = policies.toArray( new Policy[policies.size()] ) ; + policies.addAll(standardPolicies); + Policy[] arr = policies.toArray(new Policy[policies.size()]); - POA child = parentPOA.create_POA( name, null, arr ) ; - POAManager pm = child.the_POAManager() ; + POA child = parentPOA.create_POA(name, null, arr); + POAManager pm = child.the_POAManager(); - lock.lock() ; + lock.lock(); try { - managers.add(pm) ; + managers.add(pm); } finally { - lock.unlock() ; + lock.unlock(); } - child.set_servant_manager( data.first() ) ; - pm.activate() ; - return true ; + child.set_servant_manager(data.first()); + pm.activate(); + return true; } catch (Exception exc) { - wrapper.rfmAdapterActivatorFailed( exc ) ; - return false ; + wrapper.rfmAdapterActivatorFailed(exc); + return false; } } } - } ; + }; // Policy used to indicate that a POA may particpate in the reference manager. // If this policy is not present, and a create_POA call is made under base POA, // an IORInterceptor will be used reject the POA creation. - private static class ReferenceManagerPolicy - extends LocalObject - implements Policy - { - private static Policy thisPolicy = new ReferenceManagerPolicy() ; + private static class ReferenceManagerPolicy extends LocalObject implements Policy { + private static Policy thisPolicy = new ReferenceManagerPolicy(); private static final long serialVersionUID = -4780983694679451387L; public static Policy getPolicy() { - return thisPolicy ; + return thisPolicy; } private ReferenceManagerPolicy() { } public int policy_type() { - return ORBConstants.REFERENCE_MANAGER_POLICY ; + return ORBConstants.REFERENCE_MANAGER_POLICY; } public Policy copy() { - return this ; + return this; } public void destroy() { } } - public RFMState getState() - { - lock.lock() ; + public RFMState getState() { + lock.lock(); try { - return state ; + return state; } finally { lock.unlock(); } } @Poa - public void activate() - { - lock.lock() ; + public void activate() { + lock.lock(); try { if (isActive) { throw wrapper.rfmAlreadyActive(); } - rootPOA = (POA)orb.resolve_initial_references( - ORBConstants.ROOT_POA_NAME ) ; - - standardPolicies = Arrays.asList( - ReferenceManagerPolicy.getPolicy(), - rootPOA.create_servant_retention_policy( - ServantRetentionPolicyValue.NON_RETAIN ), - rootPOA.create_request_processing_policy( - RequestProcessingPolicyValue.USE_SERVANT_MANAGER ), - rootPOA.create_lifespan_policy( - LifespanPolicyValue.PERSISTENT ) - ) ; - - Policy[] policies = { ReferenceManagerPolicy.getPolicy() } ; - parentPOA = rootPOA.create_POA( PARENT_POA_NAME, - null, policies ) ; - parentPOAAdapterName = ObjectAdapter.class.cast( parentPOA ) - .getIORTemplate().getObjectKeyTemplate().getObjectAdapterId() - .getAdapterName() ; - - POAManager pm = parentPOA.the_POAManager() ; - parentPOA.the_activator( activator ) ; - pm.activate() ; + rootPOA = (POA) orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME); + + standardPolicies = Arrays.asList(ReferenceManagerPolicy.getPolicy(), + rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.NON_RETAIN), + rootPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_SERVANT_MANAGER), + rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT)); + + Policy[] policies = { ReferenceManagerPolicy.getPolicy() }; + parentPOA = rootPOA.create_POA(PARENT_POA_NAME, null, policies); + parentPOAAdapterName = ObjectAdapter.class.cast(parentPOA).getIORTemplate().getObjectKeyTemplate().getObjectAdapterId() + .getAdapterName(); + + POAManager pm = parentPOA.the_POAManager(); + parentPOA.the_activator(activator); + pm.activate(); // Don't activate if there is a failure - isActive = true ; + isActive = true; } catch (Exception exc) { - throw wrapper.rfmActivateFailed( exc ) ; + throw wrapper.rfmActivateFailed(exc); } finally { - lock.unlock() ; + lock.unlock(); } } @@ -239,15 +218,12 @@ public void activate() // to attempt to deploy an EJB while the cluster shape is changing. // We really need to enqueue (at least) create calls while suspended. // It may also be better to get rid of separate suspend/resume calls, instead - // passing an object to a method that does suspend/resume (as in - // doPrivileged). See GF issue 4560. + // passing an object to a method that does suspend/resume (as in + // doPrivileged). See GF issue 4560. @Poa - public ReferenceFactory create( final String name, - final String repositoryId, - final List policies, - final ServantLocator locator ) - { - lock.lock() ; + public ReferenceFactory create(final String name, final String repositoryId, final List policies, + final ServantLocator locator) { + lock.lock(); try { if (state == RFMState.SUSPENDED) { throw wrapper.rfmMightDeadlock(); @@ -257,7 +233,7 @@ public ReferenceFactory create( final String name, throw wrapper.rfmNotActive(); } - List newPolicies = null ; + List newPolicies = null; if (policies != null) { newPolicies = new ArrayList(policies); } @@ -265,23 +241,20 @@ public ReferenceFactory create( final String name, // Store an entry for the appropriate POA in the POA table, // which is used by the AdapterActivator on the root. synchronized (poatable) { - poatable.put( name, new Pair>( - locator, newPolicies ) ) ; + poatable.put(name, new Pair>(locator, newPolicies)); } - ReferenceFactory factory = new ReferenceFactoryImpl( this, name, - repositoryId ) ; - factories.put( name, factory ) ; - return factory ; + ReferenceFactory factory = new ReferenceFactoryImpl(this, name, repositoryId); + factories.put(name, factory); + return factory; } finally { - lock.unlock() ; + lock.unlock(); } } @Poa - public ReferenceFactory find( String[] adapterName ) - { - lock.lock() ; + public ReferenceFactory find(String[] adapterName) { + lock.lock(); try { if (state == RFMState.SUSPENDED) { throw wrapper.rfmMightDeadlock(); @@ -290,27 +263,27 @@ public ReferenceFactory find( String[] adapterName ) if (!isActive) { return null; } - - int expectedLength = parentPOAAdapterName.length + 1 ; + + int expectedLength = parentPOAAdapterName.length + 1; if (expectedLength != adapterName.length) { return null; } - for (int ctr=0; ctr pms = new HashSet( managers ) ; + final Set pms = new HashSet(managers); // wait until all requests in the manager have completed. try { if (!isActive) { - throw wrapper.rfmNotActive() ; + throw wrapper.rfmNotActive(); } while (state == RFMState.SUSPENDED) { @@ -367,89 +339,86 @@ public void suspend() } // At this point, the state must be READY, and any other - // suspending thread has released the lock. So now + // suspending thread has released the lock. So now // we set the state back to SUSPENDED, drop the lock, // and continue. - state = RFMState.SUSPENDED ; + state = RFMState.SUSPENDED; } finally { - lock.unlock() ; + lock.unlock(); } // do NOT hold the RFM lock here, because then we would hold - // first the RFM, and then the POAManager lock. Another thread - // could reverse the order, leading to a deadlock. See bug + // first the RFM, and then the POAManager lock. Another thread + // could reverse the order, leading to a deadlock. See bug // 6586417. try { for (POAManager pm : pms) { - pm.hold_requests( true ) ; + pm.hold_requests(true); } } catch (AdapterInactive ai) { // This should never happen - throw wrapper.rfmManagerInactive( ai ) ; + throw wrapper.rfmManagerInactive(ai); } } @Poa - public void resume() - { - lock.lock() ; + public void resume() { + lock.lock(); // Clone managers so we can safely iterator over it. - final Set pms = new HashSet( managers ) ; + final Set pms = new HashSet(managers); try { if (!isActive) { throw wrapper.rfmNotActive(); } - state = RFMState.READY ; - suspendCondition.signalAll() ; + state = RFMState.READY; + suspendCondition.signalAll(); } finally { - lock.unlock() ; + lock.unlock(); } - // Allow new requests to start. This will lazily + // Allow new requests to start. This will lazily // re-create POAs as needed through the parentPOA's // AdapterActivator. - // 6933574. But note that these POAManagers belong to + // 6933574. But note that these POAManagers belong to // destroyed POAs (from the restartFactories call), // so the activation here results in // an PADestrpyed exception, which causes a retry in - // the server request dispatcher. Re-creating the + // the server request dispatcher. Re-creating the // POA also re-creates the POAManager, so after // activating the POAmanagers, we remove the (old) - // POAManagers from the list. Note that the list + // POAManagers from the list. Note that the list // may (probably will) have changed by then, since other // threads may (probably will) be re-creating the POAs and hence // re-creates the POAmanagers and adding the new POAmanagers // to managers. try { for (POAManager pm : pms) { - pm.activate() ; + pm.activate(); } } catch (AdapterInactive ai) { // This should never happen - throw wrapper.rfmManagerInactive( ai ) ; + throw wrapper.rfmManagerInactive(ai); } - lock.lock() ; + lock.lock(); try { // 6933574: As noted above, we need to remove all // of the old POAManagers (to avoid a memory leak). // Note that managers may contain new POAManagers by // this time, so we can't just call managers.clear(). - managers.removeAll( pms ) ; + managers.removeAll(pms); } finally { lock.unlock(); } } @Poa - public void restartFactories( - Map>> updates ) - { - lock.lock() ; + public void restartFactories(Map>> updates) { + lock.lock(); try { if (!isActive) { throw wrapper.rfmNotActive(); @@ -459,7 +428,7 @@ public void restartFactories( throw wrapper.rfmMethodRequiresSuspendedState("restartFactories"); } } finally { - lock.unlock() ; + lock.unlock(); } if (updates == null) { @@ -468,127 +437,120 @@ public void restartFactories( synchronized (poatable) { // Update the poatable with the updates information. - poatable.putAll( updates ) ; + poatable.putAll(updates); } try { // Now destroy all POAs that are used to // implement ReferenceFactory instances. for (POA poa : parentPOA.the_children()) { - poa.destroy( false, true ) ; + poa.destroy(false, true); } } catch (Exception exc) { - throw wrapper.rfmRestartFailed( exc ) ; + throw wrapper.rfmRestartFailed(exc); } } public void restartFactories() { - restartFactories( new HashMap>>() ) ; + restartFactories(new HashMap>>()); } - /** Restart all ReferenceFactories. This is done safely, so that - * any request against object references created from these factories - * complete correctly. Restart does not return until all restart - * activity completes. - * @param updates is a map giving the updated policies for - * some or all of the ReferenceFactory instances in this ReferenceFactoryManager. - * This parameter must not be null. + /** + * Restart all ReferenceFactories. This is done safely, so that any request against object references created from these + * factories complete correctly. Restart does not return until all restart activity completes. + * + * @param updates is a map giving the updated policies for some or all of the ReferenceFactory instances in this + * ReferenceFactoryManager. This parameter must not be null. */ @Poa - public void restart( Map>> updates ) - { - suspend() ; + public void restart(Map>> updates) { + suspend(); try { - restartFactories( updates ) ; + restartFactories(updates); } finally { - resume() ; + resume(); } } - /** Restart all ReferenceFactories. This is done safely, so that - * any request against object references created from these factories - * complete correctly. Restart does not return until all restart - * activity completes. Equivalent to calling restart( new Map() ). + /** + * Restart all ReferenceFactories. This is done safely, so that any request against object references created from these + * factories complete correctly. Restart does not return until all restart activity completes. Equivalent to calling + * restart( new Map() ). */ public void restart() { - restart( new HashMap>>() ) ; + restart(new HashMap>>()); } // Methods used to implement the ReferenceFactory interface. // ReferenceFactoryImpl just delegates to these methods. @Poa - org.omg.CORBA.Object createReference( String name, byte[] key, - String repositoryId ) - { + org.omg.CORBA.Object createReference(String name, byte[] key, String repositoryId) { try { - POA child = parentPOA.find_POA( name, true ) ; - return child.create_reference_with_id( key, repositoryId ) ; + POA child = parentPOA.find_POA(name, true); + return child.create_reference_with_id(key, repositoryId); } catch (Exception exc) { - throw wrapper.rfmCreateReferenceFailed( exc ) ; + throw wrapper.rfmCreateReferenceFailed(exc); } } // Called from ReferenceFactoryImpl. @Poa - void destroy( String name ) { + void destroy(String name) { try { - POA child = parentPOA.find_POA( name, true ) ; + POA child = parentPOA.find_POA(name, true); synchronized (poatable) { - poatable.remove( name ) ; + poatable.remove(name); } - lock.lock() ; + lock.lock(); try { - factories.remove( name ) ; - POAManager pm = child.the_POAManager() ; - managers.remove( pm ) ; + factories.remove(name); + POAManager pm = child.the_POAManager(); + managers.remove(pm); } finally { - lock.unlock() ; + lock.unlock(); } // Wait for all requests to complete before completing // destruction of the POA. - child.destroy( false, true ) ; + child.destroy(false, true); } catch (Exception exc) { - throw wrapper.rfmDestroyFailed( exc ) ; + throw wrapper.rfmDestroyFailed(exc); } } // Called from ReferenceManagerConfigurator. - void validatePOACreation( POA poa ) { + void validatePOACreation(POA poa) { // Some POAs are created before the ReferenceFactoryManager is created. // In particular, the root POA and parentPOA are created before isActive - // is set to true. Don't check in these case. + // is set to true. Don't check in these case. if (!isActive) { return; } // Only check the case where poa does not have the reference manager - // policy. We assume that we handle the policy correctly inside + // policy. We assume that we handle the policy correctly inside // the RFM itself. - Policy policy = ObjectAdapter.class.cast(poa).getEffectivePolicy( - ORBConstants.REFERENCE_MANAGER_POLICY ) ; + Policy policy = ObjectAdapter.class.cast(poa).getEffectivePolicy(ORBConstants.REFERENCE_MANAGER_POLICY); if (policy != null) { return; } // At this point, we know that poa comes from outside the - // active RFM. If poa's parent POA has the policy, we have an + // active RFM. If poa's parent POA has the policy, we have an // error. - POA parent = poa.the_parent() ; - Policy parentPolicy = - ObjectAdapter.class.cast(parent).getEffectivePolicy( - ORBConstants.REFERENCE_MANAGER_POLICY ) ; + POA parent = poa.the_parent(); + Policy parentPolicy = ObjectAdapter.class.cast(parent).getEffectivePolicy(ORBConstants.REFERENCE_MANAGER_POLICY); if (parentPolicy != null) { throw wrapper.rfmIllegalParentPoaUsage(); } // If poa's POAManager is the manager for the RFM, we have // an error. - lock.lock() ; + lock.lock(); try { - if (managers.contains( poa.the_POAManager())) { - throw wrapper.rfmIllegalPoaManagerUsage() ; + if (managers.contains(poa.the_POAManager())) { + throw wrapper.rfmIllegalPoaManagerUsage(); } } finally { lock.unlock(); @@ -597,25 +559,24 @@ void validatePOACreation( POA poa ) { // locking not required @Poa - public boolean isRfmName( String[] adapterName ) - { + public boolean isRfmName(String[] adapterName) { if (!isActive) { - return false ; + return false; } - int expectedLength = parentPOAAdapterName.length + 1 ; + int expectedLength = parentPOAAdapterName.length + 1; if (expectedLength != adapterName.length) { return false; } - for (int ctr=0; ctr - *
  • Create an instance of ReferenceFactoryManagerImpl and register it with - * register_local_reference. - *
  • Create and register an IORInterceptor that prevent outside POAs from - * interfering with the ReferenceManager. + *
  • Create an instance of ReferenceFactoryManagerImpl and register it with register_local_reference. + *
  • Create and register an IORInterceptor that prevent outside POAs from interfering with the ReferenceManager. * */ public class ReferenceManagerConfigurator implements ORBConfigurator { - private static final POASystemException wrapper = - POASystemException.self ; + private static final POASystemException wrapper = POASystemException.self; - private static class RMIORInterceptor - extends LocalObject - implements IORInterceptor_3_0 - { - private ReferenceFactoryManagerImpl rm ; + private static class RMIORInterceptor extends LocalObject implements IORInterceptor_3_0 { + private ReferenceFactoryManagerImpl rm; - public RMIORInterceptor( ReferenceFactoryManagerImpl rm ) { - this.rm = rm ; + public RMIORInterceptor(ReferenceFactoryManagerImpl rm) { + this.rm = rm; } public String name() { - return "##" + this.getClass().getName() + "##" ; + return "##" + this.getClass().getName() + "##"; } public void destroy() { // NO-OP } - public void establish_components( IORInfo info ) { + public void establish_components(IORInfo info) { // NO-OP } - - public void adapter_manager_state_changed( int id, short state ) { + + public void adapter_manager_state_changed(int id, short state) { // NO-OP } - public void adapter_state_changed( ObjectReferenceTemplate[] templates, short state ) { + public void adapter_state_changed(ObjectReferenceTemplate[] templates, short state) { // NO-OP } - // We must do the checking here, because exceptions are not - // ignored. All exceptions thrown in establish_components - // are ignored. The whole purpose of this interceptor is + // We must do the checking here, because exceptions are not + // ignored. All exceptions thrown in establish_components + // are ignored. The whole purpose of this interceptor is // to throw an exception if an error is detected. - public void components_established( IORInfo info ) { - IORInfoExt ext = IORInfoExt.class.cast( info ) ; - ObjectAdapter oa = ext.getObjectAdapter() ; + public void components_established(IORInfo info) { + IORInfoExt ext = IORInfoExt.class.cast(info); + ObjectAdapter oa = ext.getObjectAdapter(); if (!(oa instanceof POA)) { return; } // if not POA, then there is no chance of a conflict. - POA poa = POA.class.cast( oa ) ; - rm.validatePOACreation( poa ) ; + POA poa = POA.class.cast(oa); + rm.validatePOACreation(poa); } } - private static class RMORBInitializer - extends LocalObject - implements ORBInitializer - { - private IORInterceptor_3_0 interceptor ; + private static class RMORBInitializer extends LocalObject implements ORBInitializer { + private IORInterceptor_3_0 interceptor; - public RMORBInitializer( IORInterceptor_3_0 interceptor ) { - this.interceptor = interceptor ; + public RMORBInitializer(IORInterceptor_3_0 interceptor) { + this.interceptor = interceptor; } - public void pre_init( ORBInitInfo info ) { + public void pre_init(ORBInitInfo info) { // NO-OP } - public void post_init( ORBInitInfo info ) { + public void post_init(ORBInitInfo info) { try { - info.add_ior_interceptor( interceptor ) ; + info.add_ior_interceptor(interceptor); } catch (Exception exc) { - throw wrapper.rfmPostInitException( exc ) ; + throw wrapper.rfmPostInitException(exc); } } } - public void configure( DataCollector collector, ORB orb ) - { + public void configure(DataCollector collector, ORB orb) { try { - ReferenceFactoryManagerImpl rm = new ReferenceFactoryManagerImpl( orb ) ; - orb.register_initial_reference( ORBConstants.REFERENCE_FACTORY_MANAGER, rm ) ; - IORInterceptor_3_0 interceptor = new RMIORInterceptor( rm ) ; - ORBInitializer initializer = new RMORBInitializer( interceptor ) ; - orb.getORBData().addORBInitializer( initializer ) ; + ReferenceFactoryManagerImpl rm = new ReferenceFactoryManagerImpl(orb); + orb.register_initial_reference(ORBConstants.REFERENCE_FACTORY_MANAGER, rm); + IORInterceptor_3_0 interceptor = new RMIORInterceptor(rm); + ORBInitializer initializer = new RMORBInitializer(interceptor); + orb.getORBData().addORBInitializer(initializer); } catch (Exception exc) { - throw wrapper.rfmConfigureException( exc ) ; + throw wrapper.rfmConfigureException(exc); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOA.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOA.java index 7a3f3c74c..16cef50ce 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOA.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOA.java @@ -17,26 +17,29 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.toa ; +package com.sun.corba.ee.impl.oa.toa; -import com.sun.corba.ee.spi.oa.ObjectAdapter ; +import com.sun.corba.ee.spi.oa.ObjectAdapter; -/** The Transient Object Adapter is used for standard RMI-IIOP and Java-IDL - * (legacy JDK 1.2) object implementations. Its protocol for managing objects is very - * simple: just connect and disconnect. There is only a single TOA instance per ORB, - * and its lifetime is the same as the ORB. The TOA instance is always ready to receive - * messages except when the ORB is shutting down. +/** + * The Transient Object Adapter is used for standard RMI-IIOP and Java-IDL (legacy JDK 1.2) object implementations. Its + * protocol for managing objects is very simple: just connect and disconnect. There is only a single TOA instance per + * ORB, and its lifetime is the same as the ORB. The TOA instance is always ready to receive messages except when the + * ORB is shutting down. */ public interface TOA extends ObjectAdapter { - /** Connect the given servant to the ORB by allocating a transient object key - * and creating an IOR and object reference using the current factory. + /** + * Connect the given servant to the ORB by allocating a transient object key and creating an IOR and object reference + * using the current factory. + * * @param servant servant to connect to the ORB */ - void connect( org.omg.CORBA.Object servant ) ; + void connect(org.omg.CORBA.Object servant); - /** Disconnect the object from this ORB. + /** + * Disconnect the object from this ORB. + * * @param obj ORB to disconnect from - */ - void disconnect( org.omg.CORBA.Object obj ) ; + */ + void disconnect(org.omg.CORBA.Object obj); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOAFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOAFactory.java index 006306010..5092357f3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOAFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOAFactory.java @@ -17,107 +17,96 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.toa ; +package com.sun.corba.ee.impl.oa.toa; -import java.util.Map ; -import java.util.HashMap ; +import java.util.Map; +import java.util.HashMap; +import com.sun.corba.ee.spi.oa.ObjectAdapterFactory; +import com.sun.corba.ee.spi.oa.ObjectAdapter; -import com.sun.corba.ee.spi.oa.ObjectAdapterFactory ; -import com.sun.corba.ee.spi.oa.ObjectAdapter ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; +import com.sun.corba.ee.impl.ior.ObjectKeyTemplateBase; -import com.sun.corba.ee.impl.javax.rmi.CORBA.Util ; - -import com.sun.corba.ee.impl.ior.ObjectKeyTemplateBase ; - -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import org.glassfish.gmbal.AMXMetadata; import org.glassfish.gmbal.Description; import org.glassfish.gmbal.ManagedAttribute; import org.glassfish.gmbal.ManagedObject; @ManagedObject -@Description( "The Factory for the TOA (transient object adapter)") -@AMXMetadata( isSingleton=true ) -public class TOAFactory implements ObjectAdapterFactory -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +@Description("The Factory for the TOA (transient object adapter)") +@AMXMetadata(isSingleton = true) +public class TOAFactory implements ObjectAdapterFactory { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private ORB orb ; + private ORB orb; - private TOAImpl toa ; - private Map codebaseToTOA ; - private TransientObjectManager tom ; + private TOAImpl toa; + private Map codebaseToTOA; + private TransientObjectManager tom; @ManagedAttribute - @Description( "The default TOA used only for dispatch, not objref creation") + @Description("The default TOA used only for dispatch, not objref creation") private TOAImpl getDefaultTOA() { - return toa ; + return toa; } @ManagedAttribute - @Description( "The map from Codebase to TOA") - private synchronized Map getCodebaseMap() { - return new HashMap( codebaseToTOA ) ; + @Description("The map from Codebase to TOA") + private synchronized Map getCodebaseMap() { + return new HashMap(codebaseToTOA); } - public ObjectAdapter find ( ObjectAdapterId oaid ) - { - if (oaid.equals( ObjectKeyTemplateBase.JIDL_OAID ) ) { + public ObjectAdapter find(ObjectAdapterId oaid) { + if (oaid.equals(ObjectKeyTemplateBase.JIDL_OAID)) { return getTOA(); } else { throw wrapper.badToaOaid(); } } - public void init( ORB orb ) - { - this.orb = orb ; - tom = new TransientObjectManager( orb ) ; - codebaseToTOA = new HashMap() ; - orb.mom().registerAtRoot( this ) ; + public void init(ORB orb) { + this.orb = orb; + tom = new TransientObjectManager(orb); + codebaseToTOA = new HashMap(); + orb.mom().registerAtRoot(this); } - public void shutdown( boolean waitForCompletion ) - { + public void shutdown(boolean waitForCompletion) { if (Util.getInstance() != null) { Util.getInstance().unregisterTargetsForORB(orb); } } - public synchronized TOA getTOA( String codebase ) - { - TOAImpl myToa = codebaseToTOA.get( codebase ) ; + public synchronized TOA getTOA(String codebase) { + TOAImpl myToa = codebaseToTOA.get(codebase); if (myToa == null) { - myToa = new TOAImpl( orb, tom, codebase ) ; + myToa = new TOAImpl(orb, tom, codebase); - codebaseToTOA.put( codebase, myToa ) ; + codebaseToTOA.put(codebase, myToa); } - return myToa ; + return myToa; } - public synchronized TOA getTOA() - { + public synchronized TOA getTOA() { if (toa == null) { // The dispatch-only TOA is not used for creating // objrefs, so its codebase can be null (and must // be, since we do not have a servant at this point) - toa = new TOAImpl( orb, tom, null ) ; + toa = new TOAImpl(orb, tom, null); } - return toa ; + return toa; } - public ORB getORB() - { - return orb ; + public ORB getORB() { + return orb; } -} ; - +}; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOAImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOAImpl.java index ef27a6244..11acc82e5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOAImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TOAImpl.java @@ -17,27 +17,27 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.oa.toa ; +package com.sun.corba.ee.impl.oa.toa; -import org.omg.CORBA.Policy ; -import org.omg.PortableInterceptor.ObjectReferenceFactory ; +import org.omg.CORBA.Policy; +import org.omg.PortableInterceptor.ObjectReferenceFactory; import org.omg.PortableInterceptor.ACTIVE; -import com.sun.corba.ee.spi.copyobject.CopierManager ; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.ee.spi.oa.OAInvocationInfo ; -import com.sun.corba.ee.spi.oa.OADestroyed ; -import com.sun.corba.ee.spi.oa.ObjectAdapterBase ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.presentation.rmi.StubAdapter ; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher ; -import com.sun.corba.ee.spi.transport.ContactInfoList ; - -import com.sun.corba.ee.impl.ior.JIDLObjectKeyTemplate ; +import com.sun.corba.ee.spi.copyobject.CopierManager; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; +import com.sun.corba.ee.spi.oa.OAInvocationInfo; +import com.sun.corba.ee.spi.oa.OADestroyed; +import com.sun.corba.ee.spi.oa.ObjectAdapterBase; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher; +import com.sun.corba.ee.spi.transport.ContactInfoList; + +import com.sun.corba.ee.impl.ior.JIDLObjectKeyTemplate; import com.sun.corba.ee.impl.oa.NullServantImpl; import com.sun.corba.ee.impl.oa.poa.Policies; -import com.sun.corba.ee.spi.misc.ORBConstants ; -import com.sun.corba.ee.impl.protocol.JIDLLocalCRDImpl ; +import com.sun.corba.ee.spi.misc.ORBConstants; +import com.sun.corba.ee.impl.protocol.JIDLLocalCRDImpl; import com.sun.corba.ee.spi.protocol.ClientDelegate; import java.util.concurrent.atomic.AtomicLong; import org.glassfish.gmbal.Description; @@ -46,192 +46,167 @@ import org.glassfish.gmbal.NameValue; import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory; -/** The Transient Object Adapter (TOA) represents the OA for purely transient -* objects. It is used for standard RMI-IIOP as well as backwards compatible -* server support (i.e. the ORB.connect() method) -* Its characteristics include: -*
      -*
    • There is only one OA instance of the TOA. Its OAId is { "TOA" }
    • -*
    • There is not adapter manager. The TOA manager ID is fixed.
    • -*
    • State is the same as ORB state (TBD)
    • -*
    -* Other requirements: -*
      -*
    • All object adapters must invoke ORB.adapterCreated when they are created. -*
    • -*
    • All adapter managers must invoke ORB.adapterManagerStateChanged when -* their state changes, mapping the internal state to an ORT state.
    • -*
    • AdapterStateChanged must be invoked (from somewhere) whenever -* an adapter state changes that is not due to an adapter manager state change.
    • -*
    -*/ +/** + * The Transient Object Adapter (TOA) represents the OA for purely transient objects. It is used for standard RMI-IIOP + * as well as backwards compatible server support (i.e. the ORB.connect() method) Its characteristics include: + *
      + *
    • There is only one OA instance of the TOA. Its OAId is { "TOA" }
    • + *
    • There is not adapter manager. The TOA manager ID is fixed. + *
    • + *
    • State is the same as ORB state (TBD)
    • + *
    + * Other requirements: + *
      + *
    • All object adapters must invoke ORB.adapterCreated when they are created.
    • + *
    • All adapter managers must invoke ORB.adapterManagerStateChanged when their state changes, mapping the internal + * state to an ORT state.
    • + *
    • AdapterStateChanged must be invoked (from somewhere) whenever an adapter state changes that is not due to an + * adapter manager state change.
    • + *
    + */ @ManagedObject -@Description( "The Transient Object Adapter") -public class TOAImpl extends ObjectAdapterBase implements TOA -{ - private static AtomicLong currentId = new AtomicLong( 0 ); +@Description("The Transient Object Adapter") +public class TOAImpl extends ObjectAdapterBase implements TOA { + private static AtomicLong currentId = new AtomicLong(0); - private TransientObjectManager servants ; - private long id ; - private String codebase ; + private TransientObjectManager servants; + private long id; + private String codebase; @NameValue private long getId() { - return id ; + return id; } @ManagedAttribute - @Description( "The codebase used to create this TOA") + @Description("The codebase used to create this TOA") private String getCodebase() { - return codebase ; + return codebase; } @ManagedAttribute - @Description( "The TransientObjectManager") + @Description("The TransientObjectManager") private TransientObjectManager getTransientObjectManager() { - return servants ; + return servants; } - public TOAImpl( ORB orb, TransientObjectManager tom, String codebase ) - { - super( orb ) ; - servants = tom ; - this.codebase = codebase ; - id = currentId.getAndIncrement() ; + public TOAImpl(ORB orb, TransientObjectManager tom, String codebase) { + super(orb); + servants = tom; + this.codebase = codebase; + id = currentId.getAndIncrement(); // Make the object key template int serverid = (getORB()).getTransientServerId(); - int scid = ORBConstants.TOA_SCID ; + int scid = ORBConstants.TOA_SCID; - ObjectKeyTemplate oktemp = new JIDLObjectKeyTemplate( orb, scid, serverid ) ; + ObjectKeyTemplate oktemp = new JIDLObjectKeyTemplate(orb, scid, serverid); // REVISIT - POA specific Policies policies = Policies.defaultPolicies; // REVISIT - absorb codebase into a policy - initializeTemplate( oktemp, true, - policies, - codebase, - null, // manager id - oktemp.getObjectAdapterId() - ) ; + initializeTemplate(oktemp, true, policies, codebase, null, // manager id + oktemp.getObjectAdapterId()); } // Methods required for dispatching requests - public ObjectCopierFactory getObjectCopierFactory() - { - CopierManager cm = getORB().getCopierManager() ; - return cm.getDefaultObjectCopierFactory() ; + public ObjectCopierFactory getObjectCopierFactory() { + CopierManager cm = getORB().getCopierManager(); + return cm.getDefaultObjectCopierFactory(); } - public org.omg.CORBA.Object getLocalServant( byte[] objectId ) - { - return (org.omg.CORBA.Object)(servants.lookupServant( objectId ) ) ; + public org.omg.CORBA.Object getLocalServant(byte[] objectId) { + return (org.omg.CORBA.Object) (servants.lookupServant(objectId)); } - /** Get the servant for the request given by the parameters. - * This will update thread Current, so that subsequent calls to - * returnServant and removeCurrent from the same thread are for the - * same request. - * @param info is the request containing the rest of the request - */ + /** + * Get the servant for the request given by the parameters. This will update thread Current, so that subsequent calls to + * returnServant and removeCurrent from the same thread are for the same request. + * + * @param info is the request containing the rest of the request + */ @Override - public void getInvocationServant( OAInvocationInfo info ) - { - java.lang.Object servant = servants.lookupServant( info.id() ) ; + public void getInvocationServant(OAInvocationInfo info) { + java.lang.Object servant = servants.lookupServant(info.id()); if (servant == null) { - servant = - new NullServantImpl(wrapper.nullServant()); + servant = new NullServantImpl(wrapper.nullServant()); } - info.setServant( servant ) ; + info.setServant(servant); } - public void returnServant() - { + public void returnServant() { // NO-OP } - /** Return the most derived interface for the given servant and objectId. - */ - public String[] getInterfaces( Object servant, byte[] objectId ) - { - return StubAdapter.getTypeIds( servant ) ; + /** + * Return the most derived interface for the given servant and objectId. + */ + public String[] getInterfaces(Object servant, byte[] objectId) { + return StubAdapter.getTypeIds(servant); } - public Policy getEffectivePolicy( int type ) - { - return null ; + public Policy getEffectivePolicy(int type) { + return null; } - public int getManagerId() - { - return -1 ; + public int getManagerId() { + return -1; } - public short getState() - { - return ACTIVE.value ; + public short getState() { + return ACTIVE.value; } - public void enter() throws OADestroyed - { + public void enter() throws OADestroyed { } - public void exit() - { + public void exit() { } - + // Methods unique to the TOA - public void connect( org.omg.CORBA.Object objref) - { + public void connect(org.omg.CORBA.Object objref) { // Store the objref and get a userkey allocated by the transient // object manager. byte[] key = servants.storeServant(objref, null); // Find out the repository ID for this objref. - String id = StubAdapter.getTypeIds( objref )[0] ; + String id = StubAdapter.getTypeIds(objref)[0]; // Create the new objref - ObjectReferenceFactory orf = getCurrentFactory() ; - org.omg.CORBA.Object obj = orf.make_object( id, key ) ; + ObjectReferenceFactory orf = getCurrentFactory(); + org.omg.CORBA.Object obj = orf.make_object(id, key); // Copy the delegate from the new objref to the argument - org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate( - obj ) ; - ContactInfoList ccil = ((ClientDelegate) delegate).getContactInfoList() ; - LocalClientRequestDispatcher lcs = - ccil.getLocalClientRequestDispatcher() ; + org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate(obj); + ContactInfoList ccil = ((ClientDelegate) delegate).getContactInfoList(); + LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher(); if (lcs instanceof JIDLLocalCRDImpl) { - JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl)lcs ; - jlcs.setServant( objref ) ; - } else { - throw new RuntimeException( - "TOAImpl.connect can not be called on " + lcs ) ; + JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl) lcs; + jlcs.setServant(objref); + } else { + throw new RuntimeException("TOAImpl.connect can not be called on " + lcs); } - StubAdapter.setDelegate( objref, delegate ) ; + StubAdapter.setDelegate(objref, delegate); } - public void disconnect( org.omg.CORBA.Object objref ) - { + public void disconnect(org.omg.CORBA.Object objref) { // Get the delegate, then ior, then transientKey, then delete servant - org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate( - objref ) ; - ContactInfoList ccil = ((ClientDelegate) del).getContactInfoList() ; - LocalClientRequestDispatcher lcs = - ccil.getLocalClientRequestDispatcher() ; + org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(objref); + ContactInfoList ccil = ((ClientDelegate) del).getContactInfoList(); + LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher(); if (lcs instanceof JIDLLocalCRDImpl) { - JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl)lcs ; - byte[] oid = jlcs.getObjectId() ; + JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl) lcs; + byte[] oid = jlcs.getObjectId(); servants.deleteServant(oid); - jlcs.unexport() ; - } else { - throw new RuntimeException( - "TOAImpl.disconnect can not be called on " + lcs ) ; + jlcs.unexport(); + } else { + throw new RuntimeException("TOAImpl.disconnect can not be called on " + lcs); } } -} +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TransientObjectManager.java b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TransientObjectManager.java index bf6cc798e..0a05ba3d2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TransientObjectManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/oa/toa/TransientObjectManager.java @@ -20,8 +20,8 @@ package com.sun.corba.ee.impl.oa.toa; -import com.sun.corba.ee.impl.misc.ORBUtility ; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.impl.misc.ORBUtility; +import com.sun.corba.ee.spi.orb.ORB; import org.glassfish.gmbal.Description; import org.glassfish.gmbal.ManagedAttribute; import org.glassfish.gmbal.ManagedData; @@ -29,99 +29,90 @@ @com.sun.corba.ee.spi.trace.TransientObjectManager @ManagedData -@Description( "Maintains mapping from Object ID to servant") +@Description("Maintains mapping from Object ID to servant") public final class TransientObjectManager { - private ORB orb ; + private ORB orb; private int maxSize = 128; - private Element[] elementArray; + private Element[] elementArray; private Element freeList; - @ManagedAttribute() - @Description( "The element array mapping indices into servants" ) + @ManagedAttribute() + @Description("The element array mapping indices into servants") private synchronized Element[] getElements() { - return elementArray.clone() ; + return elementArray.clone(); } - public TransientObjectManager( ORB orb ) - { - this.orb = orb ; + public TransientObjectManager(ORB orb) { + this.orb = orb; elementArray = new Element[maxSize]; - elementArray[maxSize-1] = new Element(maxSize-1,null); - for ( int i=maxSize-2; i>=0; i-- ) - elementArray[i] = new Element(i,elementArray[i+1]); + elementArray[maxSize - 1] = new Element(maxSize - 1, null); + for (int i = maxSize - 2; i >= 0; i--) + elementArray[i] = new Element(i, elementArray[i + 1]); freeList = elementArray[0]; } @com.sun.corba.ee.spi.trace.TransientObjectManager - public synchronized byte[] storeServant(java.lang.Object servant, java.lang.Object servantData) - { - if ( freeList == null ) + public synchronized byte[] storeServant(java.lang.Object servant, java.lang.Object servantData) { + if (freeList == null) doubleSize(); Element elem = freeList; - freeList = (Element)freeList.servant; - + freeList = (Element) freeList.servant; + byte[] result = elem.getKey(servant, servantData); - return result ; + return result; } @com.sun.corba.ee.spi.trace.TransientObjectManager - public synchronized java.lang.Object lookupServant(byte transientKey[]) - { - int index = ORBUtility.bytesToInt(transientKey,0); - int counter = ORBUtility.bytesToInt(transientKey,4); + public synchronized java.lang.Object lookupServant(byte transientKey[]) { + int index = ORBUtility.bytesToInt(transientKey, 0); + int counter = ORBUtility.bytesToInt(transientKey, 4); - if (elementArray[index].counter == counter && - elementArray[index].valid ) { + if (elementArray[index].counter == counter && elementArray[index].valid) { return elementArray[index].servant; } - // servant not found + // servant not found return null; } @com.sun.corba.ee.spi.trace.TransientObjectManager - public synchronized java.lang.Object lookupServantData(byte transientKey[]) - { - int index = ORBUtility.bytesToInt(transientKey,0); - int counter = ORBUtility.bytesToInt(transientKey,4); + public synchronized java.lang.Object lookupServantData(byte transientKey[]) { + int index = ORBUtility.bytesToInt(transientKey, 0); + int counter = ORBUtility.bytesToInt(transientKey, 4); - if (elementArray[index].counter == counter && - elementArray[index].valid ) { + if (elementArray[index].counter == counter && elementArray[index].valid) { return elementArray[index].servantData; } - // servant not found + // servant not found return null; } @InfoMethod - private void deleteAtIndex( int index ) { } + private void deleteAtIndex(int index) { + } @com.sun.corba.ee.spi.trace.TransientObjectManager - public synchronized void deleteServant(byte transientKey[]) - { - int index = ORBUtility.bytesToInt(transientKey,0); + public synchronized void deleteServant(byte transientKey[]) { + int index = ORBUtility.bytesToInt(transientKey, 0); deleteAtIndex(index); elementArray[index].delete(freeList); freeList = elementArray[index]; } - public synchronized byte[] getKey(java.lang.Object servant) - { - for ( int i=0; i=oldSize; i-- ) - elementArray[i] = new Element(i,elementArray[i+1]); + elementArray[maxSize - 1] = new Element(maxSize - 1, null); + for (int i = maxSize - 2; i >= oldSize; i--) + elementArray[i] = new Element(i, elementArray[i + 1]); freeList = elementArray[oldSize]; } } - @ManagedData -@Description( "A single element mapping one ObjectId to a Servant") +@Description("A single element mapping one ObjectId to a Servant") final class Element { - java.lang.Object servant=null; // also stores "next pointer" in free list - java.lang.Object servantData=null; - int index=-1; - int counter=0; - boolean valid=false; // valid=true if this Element contains + java.lang.Object servant = null; // also stores "next pointer" in free list + java.lang.Object servantData = null; + int index = -1; + int counter = 0; + boolean valid = false; // valid=true if this Element contains // a valid servant @ManagedAttribute - @Description( "The servant" ) + @Description("The servant") private synchronized Object getServant() { - return servant ; + return servant; } @ManagedAttribute - @Description( "The servant data" ) + @Description("The servant data") private synchronized Object getServantData() { - return servantData ; + return servantData; } @ManagedAttribute - @Description( "The reuse counter") + @Description("The reuse counter") private synchronized int getReuseCounter() { - return counter ; + return counter; } @ManagedAttribute - @Description( "The index of this entry") + @Description("The index of this entry") private synchronized int getIndex() { - return index ; + return index; } - Element(int i, java.lang.Object next) - { + Element(int i, java.lang.Object next) { servant = next; index = i; } - byte[] getKey(java.lang.Object servant, java.lang.Object servantData) - { + byte[] getKey(java.lang.Object servant, java.lang.Object servantData) { this.servant = servant; this.servantData = servantData; this.valid = true; @@ -189,8 +177,7 @@ byte[] getKey(java.lang.Object servant, java.lang.Object servantData) return toBytes(); } - byte[] toBytes() - { + byte[] toBytes() { // Convert the index+counter into an 8-byte (big-endian) key. byte key[] = new byte[8]; @@ -200,9 +187,8 @@ byte[] toBytes() return key; } - void delete(Element freeList) - { - if ( !valid ) // prevent double deletion + void delete(Element freeList) { + if (!valid) // prevent double deletion return; counter++; servantData = null; @@ -213,9 +199,7 @@ void delete(Element freeList) } @Override - public String toString() - { - return "Element[" + index + ", " + counter + "]" ; + public String toString() { + return "Element[" + index + ", " + counter + "]"; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/AppletDataCollector.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/AppletDataCollector.java index dd341d649..abbce8196 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/AppletDataCollector.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/AppletDataCollector.java @@ -17,36 +17,32 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.applet.Applet ; -import java.util.Properties ; +import java.applet.Applet; +import java.util.Properties; public class AppletDataCollector extends DataCollectorBase { - private Applet applet ; + private Applet applet; - AppletDataCollector( Applet app, Properties props, String localHostName, - String configurationHostName ) - { - super( props, localHostName, configurationHostName ) ; - this.applet = app ; + AppletDataCollector(Applet app, Properties props, String localHostName, String configurationHostName) { + super(props, localHostName, configurationHostName); + this.applet = app; } - public boolean isApplet() - { - return true ; + public boolean isApplet() { + return true; } - protected void collect( ) - { - checkPropertyDefaults() ; + protected void collect() { + checkPropertyDefaults(); - findPropertiesFromFile() ; + findPropertiesFromFile(); - // We do not use system properties for applets in order to + // We do not use system properties for applets in order to // avoid security exceptions. - findPropertiesFromProperties() ; - findPropertiesFromApplet( applet ) ; + findPropertiesFromProperties(); + findPropertiesFromApplet(applet); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/DataCollectorBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/DataCollectorBase.java index 8914bddf6..b008881c4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/DataCollectorBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/DataCollectorBase.java @@ -17,81 +17,76 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import com.sun.corba.ee.org.omg.CORBA.GetPropertyAction ; +import com.sun.corba.ee.org.omg.CORBA.GetPropertyAction; -import java.security.PrivilegedAction ; +import java.security.PrivilegedAction; -import java.applet.Applet ; +import java.applet.Applet; -import java.util.Properties ; -import java.util.Set ; -import java.util.HashSet ; -import java.util.Enumeration ; -import java.util.Iterator ; -import java.util.StringTokenizer ; +import java.util.Properties; +import java.util.Set; +import java.util.HashSet; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.StringTokenizer; -import java.net.URL ; +import java.net.URL; -import java.security.AccessController ; +import java.security.AccessController; -import java.io.File ; -import java.io.FileInputStream ; +import java.io.File; +import java.io.FileInputStream; -import com.sun.corba.ee.spi.orb.DataCollector ; -import com.sun.corba.ee.spi.orb.PropertyParser ; +import com.sun.corba.ee.spi.orb.DataCollector; +import com.sun.corba.ee.spi.orb.PropertyParser; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.misc.ORBConstants; public abstract class DataCollectorBase implements DataCollector { - private Set propertyNames ; - private Set propertyPrefixes ; - private Set URLPropertyNames ; - protected String localHostName ; - protected String configurationHostName ; - private boolean setParserCalled ; - private Properties originalProps ; - private Properties resultProps ; - - public DataCollectorBase( Properties props, String localHostName, - String configurationHostName ) - { - URLPropertyNames = new HashSet() ; - URLPropertyNames.add( ORBConstants.INITIAL_SERVICES_PROPERTY ) ; - - propertyNames = new HashSet() ; - - // Make sure that we are ready to handle -ORBInitRef. This is special + private Set propertyNames; + private Set propertyPrefixes; + private Set URLPropertyNames; + protected String localHostName; + protected String configurationHostName; + private boolean setParserCalled; + private Properties originalProps; + private Properties resultProps; + + public DataCollectorBase(Properties props, String localHostName, String configurationHostName) { + URLPropertyNames = new HashSet(); + URLPropertyNames.add(ORBConstants.INITIAL_SERVICES_PROPERTY); + + propertyNames = new HashSet(); + + // Make sure that we are ready to handle -ORBInitRef. This is special // due to the need to handle multiple -ORBInitRef args as prefix // parsing. - propertyNames.add( ORBConstants.ORB_INIT_REF_PROPERTY ) ; + propertyNames.add(ORBConstants.ORB_INIT_REF_PROPERTY); - propertyPrefixes = new HashSet() ; + propertyPrefixes = new HashSet(); - this.originalProps = props ; - this.localHostName = localHostName ; - this.configurationHostName = configurationHostName ; - setParserCalled = false ; - resultProps = new Properties() ; + this.originalProps = props; + this.localHostName = localHostName; + this.configurationHostName = configurationHostName; + setParserCalled = false; + resultProps = new Properties(); } ////////////////////////////////////////////////////////// // Public interface defined in DataCollector ////////////////////////////////////////////////////////// - public boolean initialHostIsLocal() - { - checkSetParserCalled() ; - return localHostName.equals( resultProps.getProperty( - ORBConstants.INITIAL_HOST_PROPERTY ) ) ; + public boolean initialHostIsLocal() { + checkSetParserCalled(); + return localHostName.equals(resultProps.getProperty(ORBConstants.INITIAL_HOST_PROPERTY)); } - public void setParser( PropertyParser parser ) - { - Iterator iter = parser.iterator() ; + public void setParser(PropertyParser parser) { + Iterator iter = parser.iterator(); while (iter.hasNext()) { - ParserAction pa = iter.next() ; + ParserAction pa = iter.next(); if (pa.isPrefix()) { propertyPrefixes.add(pa.getPropertyName()); } else { @@ -99,14 +94,13 @@ public void setParser( PropertyParser parser ) } } - collect() ; - setParserCalled = true ; + collect(); + setParserCalled = true; } - public Properties getProperties() - { - checkSetParserCalled() ; - return resultProps ; + public Properties getProperties() { + checkSetParserCalled(); + return resultProps; } ////////////////////////////////////////////////////////// @@ -114,31 +108,27 @@ public Properties getProperties() // in subclasses ////////////////////////////////////////////////////////// - public abstract boolean isApplet() ; + public abstract boolean isApplet(); ////////////////////////////////////////////////////////// // Implementation methods needed in subclasses ////////////////////////////////////////////////////////// - protected abstract void collect() ; + protected abstract void collect(); ////////////////////////////////////////////////////////// // methods for use by subclasses ////////////////////////////////////////////////////////// - protected void checkPropertyDefaults() - { - String host = - resultProps.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ; + protected void checkPropertyDefaults() { + String host = resultProps.getProperty(ORBConstants.INITIAL_HOST_PROPERTY); if ((host == null) || (host.equals(""))) { - setProperty(ORBConstants.INITIAL_HOST_PROPERTY, - configurationHostName); + setProperty(ORBConstants.INITIAL_HOST_PROPERTY, configurationHostName); } } - protected void findPropertiesFromArgs( String[] params ) - { + protected void findPropertiesFromArgs(String[] params) { if (params == null) { return; } @@ -146,16 +136,16 @@ protected void findPropertiesFromArgs( String[] params ) // All command-line args are of the form "-ORBkey value". // The key is mapped to .ORBkey. - String name ; - String value ; + String name; + String value; - for ( int i=0; i normalNames = getCORBAPrefixes( propertyNames ) ; - Set prefixNames = getCORBAPrefixes( propertyPrefixes ) ; + protected void findPropertiesFromSystem() { + Set normalNames = getCORBAPrefixes(propertyNames); + Set prefixNames = getCORBAPrefixes(propertyPrefixes); PropertyCallback callback = new PropertyCallback() { public String get(String name) { return getSystemProperty(name); } - } ; + }; - findPropertiesByName( normalNames.iterator(), callback ) ; + findPropertiesByName(normalNames.iterator(), callback); - findPropertiesByPrefix( prefixNames, - getSystemPropertyNames(), callback ) ; + findPropertiesByPrefix(prefixNames, getSystemPropertyNames(), callback); } ////////////////////////////////////////////////////////// // internal implementation ////////////////////////////////////////////////////////// - // Store name, value in resultProps, with special - // treatment of ORBInitRef. All updates to resultProps + // Store name, value in resultProps, with special + // treatment of ORBInitRef. All updates to resultProps // must happen through this method. - private void setProperty( String name, String value ) - { - if( name.equals( ORBConstants.ORB_INIT_REF_PROPERTY ) ) { + private void setProperty(String name, String value) { + if (name.equals(ORBConstants.ORB_INIT_REF_PROPERTY)) { // Value is = - StringTokenizer st = new StringTokenizer( value, "=" ) ; + StringTokenizer st = new StringTokenizer(value, "="); if (st.countTokens() != 2) { throw new IllegalArgumentException(); } - String refName = st.nextToken() ; - String refValue = st.nextToken() ; + String refName = st.nextToken(); + String refValue = st.nextToken(); - resultProps.setProperty( name + "." + refName, refValue ) ; + resultProps.setProperty(name + "." + refName, refValue); } else { - resultProps.setProperty( name, value ) ; + resultProps.setProperty(name, value); } } - private void checkSetParserCalled() - { + private void checkSetParserCalled() { if (!setParserCalled) { throw new IllegalStateException("setParser not called."); } @@ -306,20 +286,18 @@ private void checkSetParserCalled() // For each prefix in prefixes, For each name in propertyNames, // if (prefix is a prefix of name) get value from getProperties and // setProperty (name, value). - private void findPropertiesByPrefix( Set prefixes, - Iterator propertyNames, PropertyCallback getProperty ) - { + private void findPropertiesByPrefix(Set prefixes, Iterator propertyNames, PropertyCallback getProperty) { while (propertyNames.hasNext()) { - String name = propertyNames.next() ; - Iterator iter = prefixes.iterator() ; + String name = propertyNames.next(); + Iterator iter = prefixes.iterator(); while (iter.hasNext()) { - String prefix = iter.next() ; - if (name.startsWith( prefix )) { - String value = getProperty.get( name ) ; + String prefix = iter.next(); + if (name.startsWith(prefix)) { + String value = getProperty.get(name); // Note: do a put even if value is null since just // the presence of the property may be significant. - setProperty( name, value ) ; + setProperty(name, value); } } } @@ -328,12 +306,10 @@ private void findPropertiesByPrefix( Set prefixes, // For each prefix in names, get the corresponding property // value from the callback, and store the name/value pair in // the result. - private void findPropertiesByName( Iterator names, - PropertyCallback getProperty ) - { + private void findPropertiesByName(Iterator names, PropertyCallback getProperty) { while (names.hasNext()) { - String name = names.next() ; - String value = getProperty.get( name ) ; + String name = names.next(); + String value = getProperty.get(name); if (value != null) { setProperty(name, value); } @@ -341,121 +317,112 @@ private void findPropertiesByName( Iterator names, } @SuppressWarnings("unchecked") - private static String getSystemProperty(final String name) - { - return (String)AccessController.doPrivileged( - new GetPropertyAction(name)); + private static String getSystemProperty(final String name) { + return (String) AccessController.doPrivileged(new GetPropertyAction(name)); } // Map command-line arguments to ORB properties. // - private String findMatchingPropertyName( Set names, - String suffix ) - { - Iterator iter = names.iterator() ; + private String findMatchingPropertyName(Set names, String suffix) { + Iterator iter = names.iterator(); while (iter.hasNext()) { - String name = iter.next() ; - if (name.endsWith( suffix )) { + String name = iter.next(); + if (name.endsWith(suffix)) { return name; } } - return null ; + return null; } - private static Iterator makeIterator( - final Enumeration enumeration ) - { + private static Iterator makeIterator(final Enumeration enumeration) { return new Iterator() { - public boolean hasNext() { return enumeration.hasMoreElements() ; } - public String next() { return (String)enumeration.nextElement() ; } - public void remove() { throw new UnsupportedOperationException() ; } - } ; + public boolean hasNext() { + return enumeration.hasMoreElements(); + } + + public String next() { + return (String) enumeration.nextElement(); + } + + public void remove() { + throw new UnsupportedOperationException(); + } + }; } - private static Iterator getSystemPropertyNames() - { + private static Iterator getSystemPropertyNames() { // This will not throw a SecurityException because this // class was loaded from rt.jar using the bootstrap classloader. @SuppressWarnings("unchecked") - Enumeration enumeration = - (Enumeration)AccessController.doPrivileged( - new PrivilegedAction>() { - public Enumeration run() { - return System.getProperties().propertyNames(); - } - } - ); + Enumeration enumeration = (Enumeration) AccessController.doPrivileged(new PrivilegedAction>() { + public Enumeration run() { + return System.getProperties().propertyNames(); + } + }); - return makeIterator( enumeration ) ; + return makeIterator(enumeration); } - private void getPropertiesFromFile( Properties props, String fileName ) - { + private void getPropertiesFromFile(Properties props, String fileName) { try { - File file = new File( fileName ) ; + File file = new File(fileName); if (!file.exists()) { return; } - FileInputStream in = new FileInputStream( file ) ; - + FileInputStream in = new FileInputStream(file); + try { - props.load( in ) ; + props.load(in); } finally { - in.close() ; + in.close(); } } catch (Exception exc) { // if (ORBInitDebug) - // dprint( "ORB properties file " + fileName + " not found: " + - // exc) ; + // dprint( "ORB properties file " + fileName + " not found: " + + // exc) ; } } - private Properties getFileProperties() - { - Properties defaults = new Properties() ; + private Properties getFileProperties() { + Properties defaults = new Properties(); - String javaHome = getSystemProperty( "java.home" ) ; - String fileName = javaHome + File.separator + "lib" + File.separator + - "orb.properties" ; + String javaHome = getSystemProperty("java.home"); + String fileName = javaHome + File.separator + "lib" + File.separator + "orb.properties"; - getPropertiesFromFile( defaults, fileName ) ; + getPropertiesFromFile(defaults, fileName); - Properties results = new Properties( defaults ) ; + Properties results = new Properties(defaults); - String userHome = getSystemProperty( "user.home" ) ; - fileName = userHome + File.separator + "orb.properties" ; + String userHome = getSystemProperty("user.home"); + fileName = userHome + File.separator + "orb.properties"; - getPropertiesFromFile( results, fileName ) ; - return results ; + getPropertiesFromFile(results, fileName); + return results; } - private boolean hasCORBAPrefix( String prefix ) - { - return prefix.startsWith( ORBConstants.CORBA_PREFIX ) || - prefix.startsWith( ORBConstants.SUN_PREFIX ) ; + private boolean hasCORBAPrefix(String prefix) { + return prefix.startsWith(ORBConstants.CORBA_PREFIX) || prefix.startsWith(ORBConstants.SUN_PREFIX); } - // Return only those element of prefixes for which hasCORBAPrefix - // is true. - private Set getCORBAPrefixes( final Set prefixes ) - { - Set result = new HashSet() ; - Iterator iter = prefixes.iterator() ; + // Return only those element of prefixes for which hasCORBAPrefix + // is true. + private Set getCORBAPrefixes(final Set prefixes) { + Set result = new HashSet(); + Iterator iter = prefixes.iterator(); while (iter.hasNext()) { - String element = iter.next() ; - if (hasCORBAPrefix( element )) { + String element = iter.next(); + if (hasCORBAPrefix(element)) { result.add(element); } } - return result ; + return result; } } // Used to collect properties from various sources. -abstract class PropertyCallback -{ +abstract class PropertyCallback { abstract public String get(String name); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/DataCollectorFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/DataCollectorFactory.java index fb629bd53..405ab1ced 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/DataCollectorFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/DataCollectorFactory.java @@ -17,44 +17,36 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.applet.Applet ; -import java.util.Properties ; -import java.net.URL ; +import java.applet.Applet; +import java.util.Properties; +import java.net.URL; -import com.sun.corba.ee.spi.orb.DataCollector ; +import com.sun.corba.ee.spi.orb.DataCollector; public abstract class DataCollectorFactory { - private DataCollectorFactory() {} + private DataCollectorFactory() { + } - public static DataCollector create( Applet app, Properties props, - String localHostName ) - { - String appletHost = localHostName ; + public static DataCollector create(Applet app, Properties props, String localHostName) { + String appletHost = localHostName; if (app != null) { - URL appletCodeBase = app.getCodeBase() ; - + URL appletCodeBase = app.getCodeBase(); + if (appletCodeBase != null) - appletHost = appletCodeBase.getHost() ; + appletHost = appletCodeBase.getHost(); } - return new AppletDataCollector( app, props, localHostName, - appletHost ) ; + return new AppletDataCollector(app, props, localHostName, appletHost); } - public static DataCollector create( String[] args, Properties props, - String localHostName ) - { - return new NormalDataCollector( args, props, localHostName, - localHostName ) ; + public static DataCollector create(String[] args, Properties props, String localHostName) { + return new NormalDataCollector(args, props, localHostName, localHostName); } - public static DataCollector create( Properties props, - String localHostName ) - { - return new PropertyOnlyDataCollector( props, localHostName, - localHostName ) ; + public static DataCollector create(Properties props, String localHostName) { + return new PropertyOnlyDataCollector(props, localHostName, localHostName); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalDataCollector.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalDataCollector.java index a63a7f43f..808c84a58 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalDataCollector.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalDataCollector.java @@ -17,37 +17,33 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.net.InetAddress ; +import java.net.InetAddress; -import java.util.Properties ; +import java.util.Properties; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.CompletionStatus ; +import org.omg.CORBA.INTERNAL; +import org.omg.CORBA.CompletionStatus; public class NormalDataCollector extends DataCollectorBase { - private String[] args ; + private String[] args; - public NormalDataCollector( String[] args, Properties props, - String localHostName, String configurationHostName ) - { - super( props, localHostName, configurationHostName ) ; - this.args = args ; + public NormalDataCollector(String[] args, Properties props, String localHostName, String configurationHostName) { + super(props, localHostName, configurationHostName); + this.args = args; } - public boolean isApplet() - { - return false ; + public boolean isApplet() { + return false; } - protected void collect() - { - checkPropertyDefaults() ; + protected void collect() { + checkPropertyDefaults(); - findPropertiesFromFile() ; - findPropertiesFromSystem() ; - findPropertiesFromProperties() ; - findPropertiesFromArgs( args ) ; + findPropertiesFromFile(); + findPropertiesFromSystem(); + findPropertiesFromProperties(); + findPropertiesFromArgs(args); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalParserAction.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalParserAction.java index d859e5087..c9de24473 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalParserAction.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalParserAction.java @@ -17,30 +17,26 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.util.Properties ; +import java.util.Properties; -import com.sun.corba.ee.spi.orb.Operation ; +import com.sun.corba.ee.spi.orb.Operation; public class NormalParserAction extends ParserActionBase { - public NormalParserAction( String propertyName, - Operation operation, String fieldName ) - { - super( propertyName, false, operation, fieldName ) ; + public NormalParserAction(String propertyName, Operation operation, String fieldName) { + super(propertyName, false, operation, fieldName); } - /** Create a String[] of all suffixes of property names that - * match the propertyName prefix, pass this to op, and return the - * result. + /** + * Create a String[] of all suffixes of property names that match the propertyName prefix, pass this to op, and return + * the result. */ - public Object apply( Properties props ) - { - Object value = props.getProperty( getPropertyName() ) ; + public Object apply(Properties props) { + Object value = props.getProperty(getPropertyName()); if (value != null) - return getOperation().operate( value ) ; - else - return null ; + return getOperation().operate(value); + else + return null; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalParserData.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalParserData.java index a027249cf..4ffa4c582 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalParserData.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/NormalParserData.java @@ -17,31 +17,27 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.util.Properties ; +import java.util.Properties; -import com.sun.corba.ee.spi.orb.Operation ; -import com.sun.corba.ee.spi.orb.PropertyParser ; +import com.sun.corba.ee.spi.orb.Operation; +import com.sun.corba.ee.spi.orb.PropertyParser; public class NormalParserData extends ParserDataBase { - private String testData ; + private String testData; - public NormalParserData( String propertyName, - Operation operation, String fieldName, Object defaultValue, - Object testValue, String testData ) - { - super( propertyName, operation, fieldName, defaultValue, testValue ) ; - this.testData = testData ; + public NormalParserData(String propertyName, Operation operation, String fieldName, Object defaultValue, Object testValue, + String testData) { + super(propertyName, operation, fieldName, defaultValue, testValue); + this.testData = testData; } - public void addToParser( PropertyParser parser ) - { - parser.add( getPropertyName(), getOperation(), getFieldName() ) ; + + public void addToParser(PropertyParser parser) { + parser.add(getPropertyName(), getOperation(), getFieldName()); } - public void addToProperties( Properties props ) - { - props.setProperty( getPropertyName(), testData ) ; + public void addToProperties(Properties props) { + props.setProperty(getPropertyName(), testData); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBConfiguratorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBConfiguratorImpl.java index cc0f8a2c6..2a0e4b2d6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBConfiguratorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBConfiguratorImpl.java @@ -17,58 +17,58 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.security.PrivilegedExceptionAction ; -import java.security.AccessController ; +import java.security.PrivilegedExceptionAction; +import java.security.AccessController; -import com.sun.corba.ee.spi.protocol.ClientRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.ClientRequestDispatcher; -import com.sun.corba.ee.spi.copyobject.CopyobjectDefaults ; -import com.sun.corba.ee.spi.copyobject.CopierManager ; +import com.sun.corba.ee.spi.copyobject.CopyobjectDefaults; +import com.sun.corba.ee.spi.copyobject.CopierManager; -import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder ; +import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder; import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.ior.IORFactories ; +import com.sun.corba.ee.spi.ior.IORFactories; -import com.sun.corba.ee.spi.ior.iiop.IIOPFactories ; +import com.sun.corba.ee.spi.ior.iiop.IIOPFactories; import com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory; -import com.sun.corba.ee.spi.oa.OADefault ; -import com.sun.corba.ee.spi.oa.ObjectAdapterFactory ; +import com.sun.corba.ee.spi.oa.OADefault; +import com.sun.corba.ee.spi.oa.ObjectAdapterFactory; -import com.sun.corba.ee.spi.orb.Operation ; -import com.sun.corba.ee.spi.orb.OperationFactory ; -import com.sun.corba.ee.spi.orb.ORBData ; -import com.sun.corba.ee.spi.orb.DataCollector ; -import com.sun.corba.ee.spi.orb.ORBConfigurator ; -import com.sun.corba.ee.spi.orb.ParserImplBase ; -import com.sun.corba.ee.spi.orb.PropertyParser ; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.Operation; +import com.sun.corba.ee.spi.orb.OperationFactory; +import com.sun.corba.ee.spi.orb.ORBData; +import com.sun.corba.ee.spi.orb.DataCollector; +import com.sun.corba.ee.spi.orb.ORBConfigurator; +import com.sun.corba.ee.spi.orb.ParserImplBase; +import com.sun.corba.ee.spi.orb.PropertyParser; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.protocol.RequestDispatcherRegistry ; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; -import com.sun.corba.ee.spi.protocol.RequestDispatcherDefault ; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory ; +import com.sun.corba.ee.spi.protocol.RequestDispatcherRegistry; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; +import com.sun.corba.ee.spi.protocol.RequestDispatcherDefault; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory; -import com.sun.corba.ee.spi.resolver.LocalResolver ; -import com.sun.corba.ee.spi.resolver.Resolver ; -import com.sun.corba.ee.spi.resolver.ResolverDefault ; +import com.sun.corba.ee.spi.resolver.LocalResolver; +import com.sun.corba.ee.spi.resolver.Resolver; +import com.sun.corba.ee.spi.resolver.ResolverDefault; import com.sun.corba.ee.spi.transport.ContactInfoList; import com.sun.corba.ee.spi.transport.ContactInfoListFactory; import com.sun.corba.ee.spi.transport.SocketInfo; -import com.sun.corba.ee.spi.transport.TransportDefault ; +import com.sun.corba.ee.spi.transport.TransportDefault; -import com.sun.corba.ee.spi.presentation.rmi.PresentationDefaults ; +import com.sun.corba.ee.spi.presentation.rmi.PresentationDefaults; -import com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults ; -import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry ; +import com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults; +import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.impl.transport.AcceptorImpl; import com.sun.corba.ee.spi.legacy.connection.LegacyServerSocketEndPointInfo; @@ -76,7 +76,7 @@ import com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoListImpl; import com.sun.corba.ee.impl.legacy.connection.USLPort; -import com.sun.corba.ee.impl.dynamicany.DynAnyFactoryImpl ; +import com.sun.corba.ee.impl.dynamicany.DynAnyFactoryImpl; import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.spi.transport.Acceptor; @@ -84,106 +84,94 @@ import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory; public class ORBConfiguratorImpl implements ORBConfigurator { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; protected void persistentServerInitialization(ORB theOrb) { // Does nothing, but can be overridden in subclass. } public static class ConfigParser extends ParserImplBase { - private ORB orb ; - - public ConfigParser( ORB orb ) { - this.orb = orb ; - } ; - - public Class[] userConfigurators = null ; - - public PropertyParser makeParser() - { - PropertyParser parser = new PropertyParser() ; - Operation action = OperationFactory.compose( - OperationFactory.suffixAction(), - OperationFactory.classAction( orb.classNameResolver() ) - ) ; - parser.addPrefix( ORBConstants.USER_CONFIGURATOR_PREFIX, action, - "userConfigurators", Class.class ) ; - return parser ; + private ORB orb; + + public ConfigParser(ORB orb) { + this.orb = orb; + }; + + public Class[] userConfigurators = null; + + public PropertyParser makeParser() { + PropertyParser parser = new PropertyParser(); + Operation action = OperationFactory.compose(OperationFactory.suffixAction(), + OperationFactory.classAction(orb.classNameResolver())); + parser.addPrefix(ORBConstants.USER_CONFIGURATOR_PREFIX, action, "userConfigurators", Class.class); + return parser; } } - public void configure( DataCollector collector, ORB orb ) - { - ORB theOrb = orb ; + public void configure(DataCollector collector, ORB orb) { + ORB theOrb = orb; - initObjectCopiers( theOrb ) ; - initIORFinders( theOrb ) ; + initObjectCopiers(theOrb); + initIORFinders(theOrb); - theOrb.setClientDelegateFactory( - // REVISIT: this should be ProtocolDefault. - TransportDefault.makeClientDelegateFactory( theOrb )) ; + theOrb.setClientDelegateFactory( + // REVISIT: this should be ProtocolDefault. + TransportDefault.makeClientDelegateFactory(theOrb)); - initializeTransport(theOrb) ; + initializeTransport(theOrb); - initializeNaming( theOrb ) ; - initServiceContextRegistry( theOrb ) ; - initRequestDispatcherRegistry( theOrb ) ; - registerInitialReferences( theOrb ) ; - - // Set up the PIHandler now. The user configurator call is the + initializeNaming(theOrb); + initServiceContextRegistry(theOrb); + initRequestDispatcherRegistry(theOrb); + registerInitialReferences(theOrb); + + // Set up the PIHandler now. The user configurator call is the // earliest point at which an invocation on this ORB can occur due to // external code extending the ORB through a configurator. // persistentServerInitialization also needs to make invocations to ORBD. // ORB invocations can also occur during the execution of - // the ORBInitializers. - theOrb.createPIHandler() ; + // the ORBInitializers. + theOrb.createPIHandler(); - theOrb.setInvocationInterceptor( - PresentationDefaults.getNullInvocationInterceptor() ) ; + theOrb.setInvocationInterceptor(PresentationDefaults.getNullInvocationInterceptor()); - persistentServerInitialization( theOrb ) ; + persistentServerInitialization(theOrb); - runUserConfigurators( collector, theOrb ) ; + runUserConfigurators(collector, theOrb); } - private void runUserConfigurators( DataCollector collector, ORB orb ) - { - // Run any pluggable configurators. This is a lot like + private void runUserConfigurators(DataCollector collector, ORB orb) { + // Run any pluggable configurators. This is a lot like // ORBInitializers, only it uses the internal ORB and has - // access to all data for parsing. - ConfigParser parser = new ConfigParser( orb ) ; - parser.init( collector ) ; + // access to all data for parsing. + ConfigParser parser = new ConfigParser(orb); + parser.init(collector); if (parser.userConfigurators != null) { - for (int ctr=0; ctr() { - public Object run() - throws InstantiationException, IllegalAccessException - { - try { - Method method = - legacySocketFactory.getClass().getMethod( - "setORB", ORB.class ); - method.invoke(legacySocketFactory, orb); - } catch (NoSuchMethodException e) { - // NOTE: If there is no method then it - // is not ours - so ignore it. - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - throw new RuntimeException(e); - } - return null; + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws InstantiationException, IllegalAccessException { + try { + Method method = legacySocketFactory.getClass().getMethod("setORB", ORB.class); + method.invoke(legacySocketFactory, orb); + } catch (NoSuchMethodException e) { + // NOTE: If there is no method then it + // is not ours - so ignore it. + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + throw new RuntimeException(e); } + return null; } - ); + }); } catch (Throwable t) { throw wrapper.unableToSetSocketFactoryOrb(t); } } - private void initializeNaming( ORB orb ) - { - LocalResolver localResolver = ResolverDefault.makeLocalResolver() ; - orb.setLocalResolver( localResolver ) ; + private void initializeNaming(ORB orb) { + LocalResolver localResolver = ResolverDefault.makeLocalResolver(); + orb.setLocalResolver(localResolver); - Resolver bootResolver = ResolverDefault.makeBootstrapResolver( orb, - orb.getORBData().getORBInitialHost(), - orb.getORBData().getORBInitialPort() ) ; + Resolver bootResolver = ResolverDefault.makeBootstrapResolver(orb, orb.getORBData().getORBInitialHost(), + orb.getORBData().getORBInitialPort()); - Operation urlOperation = ResolverDefault.makeINSURLOperation( orb ) ; - orb.setURLOperation( urlOperation ) ; + Operation urlOperation = ResolverDefault.makeINSURLOperation(orb); + orb.setURLOperation(urlOperation); - Resolver irResolver = ResolverDefault.makeORBInitRefResolver( urlOperation, - orb.getORBData().getORBInitialReferences() ) ; + Resolver irResolver = ResolverDefault.makeORBInitRefResolver(urlOperation, orb.getORBData().getORBInitialReferences()); - Resolver dirResolver = ResolverDefault.makeORBDefaultInitRefResolver( - urlOperation, orb.getORBData().getORBDefaultInitialReference() ) ; + Resolver dirResolver = ResolverDefault.makeORBDefaultInitRefResolver(urlOperation, + orb.getORBData().getORBDefaultInitialReference()); - Resolver resolver = - ResolverDefault.makeCompositeResolver( localResolver, - ResolverDefault.makeCompositeResolver( irResolver, - ResolverDefault.makeCompositeResolver( dirResolver, - bootResolver ) ) ) ; - orb.setResolver( resolver ) ; + Resolver resolver = ResolverDefault.makeCompositeResolver(localResolver, + ResolverDefault.makeCompositeResolver(irResolver, ResolverDefault.makeCompositeResolver(dirResolver, bootResolver))); + orb.setResolver(resolver); } - private void initServiceContextRegistry( ORB orb ) - { - ServiceContextFactoryRegistry scr = orb.getServiceContextFactoryRegistry() ; - - scr.register( - ServiceContextDefaults.makeUEInfoServiceContextFactory() ) ; - scr.register( - ServiceContextDefaults.makeCodeSetServiceContextFactory() ) ; - scr.register( - ServiceContextDefaults.makeSendingContextServiceContextFactory() ) ; - scr.register( - ServiceContextDefaults.makeORBVersionServiceContextFactory() ) ; - scr.register( - ServiceContextDefaults.makeMaxStreamFormatVersionServiceContextFactory() ) ; + private void initServiceContextRegistry(ORB orb) { + ServiceContextFactoryRegistry scr = orb.getServiceContextFactoryRegistry(); + + scr.register(ServiceContextDefaults.makeUEInfoServiceContextFactory()); + scr.register(ServiceContextDefaults.makeCodeSetServiceContextFactory()); + scr.register(ServiceContextDefaults.makeSendingContextServiceContextFactory()); + scr.register(ServiceContextDefaults.makeORBVersionServiceContextFactory()); + scr.register(ServiceContextDefaults.makeMaxStreamFormatVersionServiceContextFactory()); } - private void registerInitialReferences( final ORB orb ) - { + private void registerInitialReferences(final ORB orb) { // Register the Dynamic Any factory - NullaryFunction closure = - new NullaryFunction() { - public org.omg.CORBA.Object evaluate() { - return new DynAnyFactoryImpl( orb ) ; - } - } ; + NullaryFunction closure = new NullaryFunction() { + public org.omg.CORBA.Object evaluate() { + return new DynAnyFactoryImpl(orb); + } + }; - NullaryFunction future = - NullaryFunction.Factory.makeFuture( closure ) ; - orb.getLocalResolver().register( ORBConstants.DYN_ANY_FACTORY_NAME, - future ) ; + NullaryFunction future = NullaryFunction.Factory.makeFuture(closure); + orb.getLocalResolver().register(ORBConstants.DYN_ANY_FACTORY_NAME, future); } - private static final int ORB_STREAM = 0 ; + private static final int ORB_STREAM = 0; - private void initObjectCopiers( ORB orb ) - { + private void initObjectCopiers(ORB orb) { // No optimization or policy selection here. - ObjectCopierFactory orbStream = - CopyobjectDefaults.makeORBStreamObjectCopierFactory( orb ) ; + ObjectCopierFactory orbStream = CopyobjectDefaults.makeORBStreamObjectCopierFactory(orb); - CopierManager cm = orb.getCopierManager() ; - cm.setDefaultId( ORB_STREAM ) ; + CopierManager cm = orb.getCopierManager(); + cm.setDefaultId(ORB_STREAM); - cm.registerObjectCopierFactory( orbStream, ORB_STREAM ) ; + cm.registerObjectCopierFactory(orbStream, ORB_STREAM); } - private void initIORFinders( ORB orb ) - { - IdentifiableFactoryFinder profFinder = - orb.getTaggedProfileFactoryFinder() ; - profFinder.registerFactory( IIOPFactories.makeIIOPProfileFactory() ) ; - - IdentifiableFactoryFinder profTempFinder = - orb.getTaggedProfileTemplateFactoryFinder() ; - profTempFinder.registerFactory( - IIOPFactories.makeIIOPProfileTemplateFactory() ) ; - - IdentifiableFactoryFinder compFinder = - orb.getTaggedComponentFactoryFinder() ; - compFinder.registerFactory( - IIOPFactories.makeCodeSetsComponentFactory() ) ; - compFinder.registerFactory( - IIOPFactories.makeJavaCodebaseComponentFactory() ) ; - compFinder.registerFactory( - IIOPFactories.makeORBTypeComponentFactory() ) ; - compFinder.registerFactory( - IIOPFactories.makeMaxStreamFormatVersionComponentFactory() ) ; - compFinder.registerFactory( - IIOPFactories.makeAlternateIIOPAddressComponentFactory() ) ; - compFinder.registerFactory( - IIOPFactories.makeRequestPartitioningComponentFactory() ) ; - compFinder.registerFactory( - IIOPFactories.makeJavaSerializationComponentFactory()); - compFinder.registerFactory( - IIOPFactories.makeLoadBalancingComponentFactory()); - compFinder.registerFactory( - IIOPFactories.makeClusterInstanceInfoComponentFactory()); + private void initIORFinders(ORB orb) { + IdentifiableFactoryFinder profFinder = orb.getTaggedProfileFactoryFinder(); + profFinder.registerFactory(IIOPFactories.makeIIOPProfileFactory()); + + IdentifiableFactoryFinder profTempFinder = orb.getTaggedProfileTemplateFactoryFinder(); + profTempFinder.registerFactory(IIOPFactories.makeIIOPProfileTemplateFactory()); + + IdentifiableFactoryFinder compFinder = orb.getTaggedComponentFactoryFinder(); + compFinder.registerFactory(IIOPFactories.makeCodeSetsComponentFactory()); + compFinder.registerFactory(IIOPFactories.makeJavaCodebaseComponentFactory()); + compFinder.registerFactory(IIOPFactories.makeORBTypeComponentFactory()); + compFinder.registerFactory(IIOPFactories.makeMaxStreamFormatVersionComponentFactory()); + compFinder.registerFactory(IIOPFactories.makeAlternateIIOPAddressComponentFactory()); + compFinder.registerFactory(IIOPFactories.makeRequestPartitioningComponentFactory()); + compFinder.registerFactory(IIOPFactories.makeJavaSerializationComponentFactory()); + compFinder.registerFactory(IIOPFactories.makeLoadBalancingComponentFactory()); + compFinder.registerFactory(IIOPFactories.makeClusterInstanceInfoComponentFactory()); // Register the ValueFactory instances for ORT - IORFactories.registerValueFactories( orb ) ; + IORFactories.registerValueFactories(orb); // Register an ObjectKeyFactory - orb.setObjectKeyFactory( IORFactories.makeObjectKeyFactory(orb) ) ; + orb.setObjectKeyFactory(IORFactories.makeObjectKeyFactory(orb)); } - private void initRequestDispatcherRegistry( ORB orb ) - { - RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ; + private void initRequestDispatcherRegistry(ORB orb) { + RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry(); // register client subcontracts - ClientRequestDispatcher csub = - RequestDispatcherDefault.makeClientRequestDispatcher() ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.TOA_SCID ) ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.TRANSIENT_SCID ) ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.PERSISTENT_SCID ) ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.SC_TRANSIENT_SCID ) ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.SC_PERSISTENT_SCID ) ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.IISC_TRANSIENT_SCID ) ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.IISC_PERSISTENT_SCID ) ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.MINSC_TRANSIENT_SCID ) ; - scr.registerClientRequestDispatcher( csub, - ORBConstants.MINSC_PERSISTENT_SCID ) ; - + ClientRequestDispatcher csub = RequestDispatcherDefault.makeClientRequestDispatcher(); + scr.registerClientRequestDispatcher(csub, ORBConstants.TOA_SCID); + scr.registerClientRequestDispatcher(csub, ORBConstants.TRANSIENT_SCID); + scr.registerClientRequestDispatcher(csub, ORBConstants.PERSISTENT_SCID); + scr.registerClientRequestDispatcher(csub, ORBConstants.SC_TRANSIENT_SCID); + scr.registerClientRequestDispatcher(csub, ORBConstants.SC_PERSISTENT_SCID); + scr.registerClientRequestDispatcher(csub, ORBConstants.IISC_TRANSIENT_SCID); + scr.registerClientRequestDispatcher(csub, ORBConstants.IISC_PERSISTENT_SCID); + scr.registerClientRequestDispatcher(csub, ORBConstants.MINSC_TRANSIENT_SCID); + scr.registerClientRequestDispatcher(csub, ORBConstants.MINSC_PERSISTENT_SCID); + // register server delegates - ServerRequestDispatcher sd = - RequestDispatcherDefault.makeServerRequestDispatcher( orb ); - scr.registerServerRequestDispatcher( sd, - ORBConstants.TOA_SCID ) ; - scr.registerServerRequestDispatcher( sd, - ORBConstants.TRANSIENT_SCID ) ; - scr.registerServerRequestDispatcher( sd, - ORBConstants.PERSISTENT_SCID ) ; - scr.registerServerRequestDispatcher( sd, - ORBConstants.SC_TRANSIENT_SCID ) ; - scr.registerServerRequestDispatcher( sd, - ORBConstants.SC_PERSISTENT_SCID ) ; - scr.registerServerRequestDispatcher( sd, - ORBConstants.IISC_TRANSIENT_SCID ) ; - scr.registerServerRequestDispatcher( sd, - ORBConstants.IISC_PERSISTENT_SCID ) ; - scr.registerServerRequestDispatcher( sd, - ORBConstants.MINSC_TRANSIENT_SCID ) ; - scr.registerServerRequestDispatcher( sd, - ORBConstants.MINSC_PERSISTENT_SCID ) ; - - orb.setINSDelegate( - RequestDispatcherDefault.makeINSServerRequestDispatcher( orb ) ) ; - + ServerRequestDispatcher sd = RequestDispatcherDefault.makeServerRequestDispatcher(orb); + scr.registerServerRequestDispatcher(sd, ORBConstants.TOA_SCID); + scr.registerServerRequestDispatcher(sd, ORBConstants.TRANSIENT_SCID); + scr.registerServerRequestDispatcher(sd, ORBConstants.PERSISTENT_SCID); + scr.registerServerRequestDispatcher(sd, ORBConstants.SC_TRANSIENT_SCID); + scr.registerServerRequestDispatcher(sd, ORBConstants.SC_PERSISTENT_SCID); + scr.registerServerRequestDispatcher(sd, ORBConstants.IISC_TRANSIENT_SCID); + scr.registerServerRequestDispatcher(sd, ORBConstants.IISC_PERSISTENT_SCID); + scr.registerServerRequestDispatcher(sd, ORBConstants.MINSC_TRANSIENT_SCID); + scr.registerServerRequestDispatcher(sd, ORBConstants.MINSC_PERSISTENT_SCID); + + orb.setINSDelegate(RequestDispatcherDefault.makeINSServerRequestDispatcher(orb)); + // register local client subcontracts - LocalClientRequestDispatcherFactory lcsf = - RequestDispatcherDefault.makeJIDLLocalClientRequestDispatcherFactory( - orb ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.TOA_SCID ) ; - - lcsf = - RequestDispatcherDefault.makePOALocalClientRequestDispatcherFactory( - orb ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.TRANSIENT_SCID ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.PERSISTENT_SCID ) ; - - lcsf = RequestDispatcherDefault. - makeFullServantCacheLocalClientRequestDispatcherFactory( orb ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.SC_TRANSIENT_SCID ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.SC_PERSISTENT_SCID ) ; - - lcsf = RequestDispatcherDefault. - makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory( orb ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.IISC_TRANSIENT_SCID ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.IISC_PERSISTENT_SCID ) ; - - lcsf = RequestDispatcherDefault. - makeMinimalServantCacheLocalClientRequestDispatcherFactory( orb ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.MINSC_TRANSIENT_SCID ) ; - scr.registerLocalClientRequestDispatcherFactory( lcsf, - ORBConstants.MINSC_PERSISTENT_SCID ) ; - - /* Register the server delegate that implements the ancient bootstrap - * naming protocol. This takes an object key of either "INIT" or - * "TINI" to allow for big or little endian implementations. + LocalClientRequestDispatcherFactory lcsf = RequestDispatcherDefault.makeJIDLLocalClientRequestDispatcherFactory(orb); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.TOA_SCID); + + lcsf = RequestDispatcherDefault.makePOALocalClientRequestDispatcherFactory(orb); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.TRANSIENT_SCID); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.PERSISTENT_SCID); + + lcsf = RequestDispatcherDefault.makeFullServantCacheLocalClientRequestDispatcherFactory(orb); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.SC_TRANSIENT_SCID); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.SC_PERSISTENT_SCID); + + lcsf = RequestDispatcherDefault.makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory(orb); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.IISC_TRANSIENT_SCID); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.IISC_PERSISTENT_SCID); + + lcsf = RequestDispatcherDefault.makeMinimalServantCacheLocalClientRequestDispatcherFactory(orb); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.MINSC_TRANSIENT_SCID); + scr.registerLocalClientRequestDispatcherFactory(lcsf, ORBConstants.MINSC_PERSISTENT_SCID); + + /* + * Register the server delegate that implements the ancient bootstrap naming protocol. This takes an object key of + * either "INIT" or "TINI" to allow for big or little endian implementations. */ - ServerRequestDispatcher bootsd = - RequestDispatcherDefault.makeBootstrapServerRequestDispatcher( - orb ) ; - scr.registerServerRequestDispatcher( bootsd, "INIT" ) ; - scr.registerServerRequestDispatcher( bootsd, "TINI" ) ; + ServerRequestDispatcher bootsd = RequestDispatcherDefault.makeBootstrapServerRequestDispatcher(orb); + scr.registerServerRequestDispatcher(bootsd, "INIT"); + scr.registerServerRequestDispatcher(bootsd, "TINI"); // Register object adapter factories - ObjectAdapterFactory oaf = OADefault.makeTOAFactory( orb ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.TOA_SCID ) ; - - oaf = OADefault.makePOAFactory( orb ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.TRANSIENT_SCID ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.PERSISTENT_SCID ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.SC_TRANSIENT_SCID ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.SC_PERSISTENT_SCID ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.IISC_TRANSIENT_SCID ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.IISC_PERSISTENT_SCID ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.MINSC_TRANSIENT_SCID ) ; - scr.registerObjectAdapterFactory( oaf, ORBConstants.MINSC_PERSISTENT_SCID ) ; - } + ObjectAdapterFactory oaf = OADefault.makeTOAFactory(orb); + scr.registerObjectAdapterFactory(oaf, ORBConstants.TOA_SCID); + + oaf = OADefault.makePOAFactory(orb); + scr.registerObjectAdapterFactory(oaf, ORBConstants.TRANSIENT_SCID); + scr.registerObjectAdapterFactory(oaf, ORBConstants.PERSISTENT_SCID); + scr.registerObjectAdapterFactory(oaf, ORBConstants.SC_TRANSIENT_SCID); + scr.registerObjectAdapterFactory(oaf, ORBConstants.SC_PERSISTENT_SCID); + scr.registerObjectAdapterFactory(oaf, ORBConstants.IISC_TRANSIENT_SCID); + scr.registerObjectAdapterFactory(oaf, ORBConstants.IISC_PERSISTENT_SCID); + scr.registerObjectAdapterFactory(oaf, ORBConstants.MINSC_TRANSIENT_SCID); + scr.registerObjectAdapterFactory(oaf, ORBConstants.MINSC_PERSISTENT_SCID); + } } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBDataParserImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBDataParserImpl.java index b1a6e8669..454b523c4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBDataParserImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBDataParserImpl.java @@ -17,71 +17,68 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; import java.net.InetAddress; -import org.omg.PortableInterceptor.ORBInitializer ; +import org.omg.PortableInterceptor.ORBInitializer; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.ee.spi.orb.DataCollector ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBData ; -import com.sun.corba.ee.spi.orb.ParserImplTableBase ; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; +import com.sun.corba.ee.spi.orb.DataCollector; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBData; +import com.sun.corba.ee.spi.orb.ParserImplTableBase; import com.sun.corba.ee.spi.transport.ContactInfoListFactory; import com.sun.corba.ee.spi.transport.IORToSocketInfo; import com.sun.corba.ee.spi.transport.IIOPPrimaryToContactInfo; import com.sun.corba.ee.spi.transport.TcpTimeouts; -import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo ; +import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; import com.sun.corba.ee.impl.legacy.connection.USLPort; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.spi.transport.Acceptor; import org.glassfish.pfl.basic.contain.Pair; +public class ORBDataParserImpl extends ParserImplTableBase implements ORBData { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; -public class ORBDataParserImpl extends ParserImplTableBase implements ORBData -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - - private String ORBInitialHost ; - private int ORBInitialPort ; - private String ORBServerHost ; - private int ORBServerPort ; + private String ORBInitialHost; + private int ORBInitialPort; + private String ORBServerHost; + private int ORBServerPort; private boolean listenOnAllInterfaces; - private com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory legacySocketFactory ; + private com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory legacySocketFactory; private com.sun.corba.ee.spi.transport.ORBSocketFactory socketFactory; - private USLPort[] userSpecifiedListenPorts ; + private USLPort[] userSpecifiedListenPorts; private IORToSocketInfo iorToSocketInfo; private IIOPPrimaryToContactInfo iiopPrimaryToContactInfo; - private String orbId ; - private boolean allowLocalOptimization ; - private GIOPVersion giopVersion ; - private int highWaterMark ; - private int lowWaterMark ; - private int numberToReclaim ; - private int giopFragmentSize ; - private int giopBufferSize ; - private int giop11BuffMgr ; - private int giop12BuffMgr ; - private short giopTargetAddressPreference ; - private short giopAddressDisposition ; - private boolean useByteOrderMarkers ; - private boolean useByteOrderMarkersInEncaps ; - private boolean alwaysSendCodeSetCtx ; - private boolean persistentPortInitialized ; - private int persistentServerPort ; - private boolean persistentServerIdInitialized ; - private int persistentServerId ; - private boolean serverIsORBActivated ; - private Class badServerIdHandlerClass ; - private CodeSetComponentInfo.CodeSetComponent charData ; - private CodeSetComponentInfo.CodeSetComponent wcharData ; - private ORBInitializer[] orbInitializers ; - private Pair[] orbInitialReferences ; - private String defaultInitRef ; - private String[] debugFlags ; + private String orbId; + private boolean allowLocalOptimization; + private GIOPVersion giopVersion; + private int highWaterMark; + private int lowWaterMark; + private int numberToReclaim; + private int giopFragmentSize; + private int giopBufferSize; + private int giop11BuffMgr; + private int giop12BuffMgr; + private short giopTargetAddressPreference; + private short giopAddressDisposition; + private boolean useByteOrderMarkers; + private boolean useByteOrderMarkersInEncaps; + private boolean alwaysSendCodeSetCtx; + private boolean persistentPortInitialized; + private int persistentServerPort; + private boolean persistentServerIdInitialized; + private int persistentServerId; + private boolean serverIsORBActivated; + private Class badServerIdHandlerClass; + private CodeSetComponentInfo.CodeSetComponent charData; + private CodeSetComponentInfo.CodeSetComponent wcharData; + private ORBInitializer[] orbInitializers; + private Pair[] orbInitialReferences; + private String defaultInitRef; + private String[] debugFlags; private Acceptor[] acceptors; private ContactInfoListFactory corbaContactInfoListFactory; private String acceptorSocketType; @@ -107,126 +104,105 @@ public class ORBDataParserImpl extends ParserImplTableBase implements ORBData private boolean nonBlockingReadCheckMessageParser; private boolean blockingReadCheckMessageParser; private boolean timingPointsEnabled; - private boolean useEnumDesc ; - private boolean environmentIsGFServer ; - private boolean noDefaultAcceptors ; - private boolean registerMBeans ; - private int fragmentReadTimeout ; + private boolean useEnumDesc; + private boolean environmentIsGFServer; + private boolean noDefaultAcceptors; + private boolean registerMBeans; + private int fragmentReadTimeout; // This is not initialized from ParserTable. - private CodeSetComponentInfo codesets ; + private CodeSetComponentInfo codesets; - private String[] orbInitArgs ; + private String[] orbInitArgs; private boolean disableORBD; // Public accessor methods ======================================================================== - public String getORBInitialHost() - { - return ORBInitialHost; + public String getORBInitialHost() { + return ORBInitialHost; } - public int getORBInitialPort() - { - return ORBInitialPort; + public int getORBInitialPort() { + return ORBInitialPort; } - public String getORBServerHost() - { - return ORBServerHost; + public String getORBServerHost() { + return ORBServerHost; } - public boolean getListenOnAllInterfaces() - { + public boolean getListenOnAllInterfaces() { return listenOnAllInterfaces; } - public int getORBServerPort() - { - return ORBServerPort; + public int getORBServerPort() { + return ORBServerPort; } - public com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory() - { + public com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory() { return legacySocketFactory; } - public com.sun.corba.ee.spi.transport.ORBSocketFactory getSocketFactory() - { - return socketFactory; + public com.sun.corba.ee.spi.transport.ORBSocketFactory getSocketFactory() { + return socketFactory; } - public USLPort[] getUserSpecifiedListenPorts () - { - return userSpecifiedListenPorts; + public USLPort[] getUserSpecifiedListenPorts() { + return userSpecifiedListenPorts; } - public IORToSocketInfo getIORToSocketInfo() - { + public IORToSocketInfo getIORToSocketInfo() { return iorToSocketInfo; } - public void setIORToSocketInfo(IORToSocketInfo x) - { + public void setIORToSocketInfo(IORToSocketInfo x) { iorToSocketInfo = x; } - public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo() - { + public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo() { return iiopPrimaryToContactInfo; } - public void setIIOPPrimaryToContactInfo(IIOPPrimaryToContactInfo x) - { + public void setIIOPPrimaryToContactInfo(IIOPPrimaryToContactInfo x) { iiopPrimaryToContactInfo = x; } - public String getORBId() - { - return orbId; + public String getORBId() { + return orbId; } - public boolean isLocalOptimizationAllowed() - { - return allowLocalOptimization ; + public boolean isLocalOptimizationAllowed() { + return allowLocalOptimization; } - public GIOPVersion getGIOPVersion() - { - return giopVersion; + public GIOPVersion getGIOPVersion() { + return giopVersion; } - public int getHighWaterMark() - { - return highWaterMark; + public int getHighWaterMark() { + return highWaterMark; } - public int getLowWaterMark() - { - return lowWaterMark; + public int getLowWaterMark() { + return lowWaterMark; } - public int getNumberToReclaim() - { - return numberToReclaim; + public int getNumberToReclaim() { + return numberToReclaim; } - public int getGIOPFragmentSize() - { - return giopFragmentSize; + public int getGIOPFragmentSize() { + return giopFragmentSize; } - public int getGIOPBufferSize() - { - return giopBufferSize; + public int getGIOPBufferSize() { + return giopBufferSize; } - public int getGIOPBuffMgrStrategy(GIOPVersion gv) - { - if(gv!=null){ + public int getGIOPBuffMgrStrategy(GIOPVersion gv) { + if (gv != null) { if (gv.equals(GIOPVersion.V1_0)) { return 0; - } //Always grow for 1.0 + } // Always grow for 1.0 if (gv.equals(GIOPVersion.V1_1)) { return giop11BuffMgr; } @@ -234,202 +210,172 @@ public int getGIOPBuffMgrStrategy(GIOPVersion gv) return giop12BuffMgr; } } - //If a "faulty" GIOPVersion is passed, it's going to return 0; + // If a "faulty" GIOPVersion is passed, it's going to return 0; return 0; } /** - * @return the GIOP Target Addressing preference of the ORB. - * This ORB by default supports all addressing dispositions unless specified - * otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING + * @return the GIOP Target Addressing preference of the ORB. This ORB by default supports all addressing dispositions + * unless specified otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING */ - public short getGIOPTargetAddressPreference() - { - return giopTargetAddressPreference; + public short getGIOPTargetAddressPreference() { + return giopTargetAddressPreference; } - public short getGIOPAddressDisposition() - { - return giopAddressDisposition; + public short getGIOPAddressDisposition() { + return giopAddressDisposition; } - public boolean useByteOrderMarkers() - { - return useByteOrderMarkers; + public boolean useByteOrderMarkers() { + return useByteOrderMarkers; } - public boolean useByteOrderMarkersInEncapsulations() - { - return useByteOrderMarkersInEncaps; + public boolean useByteOrderMarkersInEncapsulations() { + return useByteOrderMarkersInEncaps; } - public boolean alwaysSendCodeSetServiceContext() - { - return alwaysSendCodeSetCtx; + public boolean alwaysSendCodeSetServiceContext() { + return alwaysSendCodeSetCtx; } - public boolean getPersistentPortInitialized() - { - return persistentPortInitialized ; + public boolean getPersistentPortInitialized() { + return persistentPortInitialized; } - public int getPersistentServerPort() - { - if ( persistentPortInitialized ) { + public int getPersistentServerPort() { + if (persistentPortInitialized) { return persistentServerPort; - } - else { - throw wrapper.persistentServerportNotSet( ) ; + } else { + throw wrapper.persistentServerportNotSet(); } } - public boolean getPersistentServerIdInitialized() - { - return persistentServerIdInitialized; + public boolean getPersistentServerIdInitialized() { + return persistentServerIdInitialized; } - /** Return the persistent-server-id of this server. This id is the same - * across multiple activations of this server. This is in contrast to - * com.sun.corba.ee.impl.iiop.ORB.getTransientServerId() which - * returns a transient id that is guaranteed to be different - * across multiple activations of - * this server. The user/environment is required to supply the - * persistent-server-id every time this server is started, in - * the ORBServerId parameter, System properties, or other means. - * The user is also required to ensure that no two persistent servers - * on the same host have the same server-id. + /** + * Return the persistent-server-id of this server. This id is the same across multiple activations of this server. This + * is in contrast to com.sun.corba.ee.impl.iiop.ORB.getTransientServerId() which returns a transient id that is + * guaranteed to be different across multiple activations of this server. The user/environment is required to supply the + * persistent-server-id every time this server is started, in the ORBServerId parameter, System properties, or other + * means. The user is also required to ensure that no two persistent servers on the same host have the same server-id. */ - public int getPersistentServerId() - { - if ( persistentServerIdInitialized ) { + public int getPersistentServerId() { + if (persistentServerIdInitialized) { return persistentServerId; } else { - throw wrapper.persistentServeridNotSet( ) ; + throw wrapper.persistentServeridNotSet(); } } - public boolean getServerIsORBActivated() - { - return serverIsORBActivated ; + public boolean getServerIsORBActivated() { + return serverIsORBActivated; } - public Class getBadServerIdHandler() - { - return badServerIdHandlerClass ; + public Class getBadServerIdHandler() { + return badServerIdHandlerClass; } - /** - * Get the prefered code sets for connections. Should the client send the code set service context on every - * request? + /** + * Get the prefered code sets for connections. Should the client send the code set service context on every request? */ - public CodeSetComponentInfo getCodeSetComponentInfo() - { - return codesets; + public CodeSetComponentInfo getCodeSetComponentInfo() { + return codesets; } - public ORBInitializer[] getORBInitializers() - { - return orbInitializers ; + public ORBInitializer[] getORBInitializers() { + return orbInitializers; } - public void addORBInitializer( ORBInitializer initializer ) - { - ORBInitializer[] arr = new ORBInitializer[orbInitializers.length+1] ; + public void addORBInitializer(ORBInitializer initializer) { + ORBInitializer[] arr = new ORBInitializer[orbInitializers.length + 1]; System.arraycopy(orbInitializers, 0, arr, 0, orbInitializers.length); - arr[orbInitializers.length] = initializer ; - orbInitializers = arr ; + arr[orbInitializers.length] = initializer; + orbInitializers = arr; } - public Pair[] getORBInitialReferences() - { - return orbInitialReferences ; + public Pair[] getORBInitialReferences() { + return orbInitialReferences; } - public String getORBDefaultInitialReference() - { - return defaultInitRef ; + public String getORBDefaultInitialReference() { + return defaultInitRef; } - public String[] getORBDebugFlags() - { - return debugFlags ; + public String[] getORBDebugFlags() { + return debugFlags; } - public Acceptor[] getAcceptors() - { + public Acceptor[] getAcceptors() { return acceptors; } - public ContactInfoListFactory getCorbaContactInfoListFactory() - { + public ContactInfoListFactory getCorbaContactInfoListFactory() { return corbaContactInfoListFactory; } - public String acceptorSocketType() - { + public String acceptorSocketType() { return acceptorSocketType; } - public boolean acceptorSocketUseSelectThreadToWait() - { + + public boolean acceptorSocketUseSelectThreadToWait() { return acceptorSocketUseSelectThreadToWait; } - public boolean acceptorSocketUseWorkerThreadForEvent() - { + + public boolean acceptorSocketUseWorkerThreadForEvent() { return acceptorSocketUseWorkerThreadForEvent; } - public String connectionSocketType() - { + + public String connectionSocketType() { return connectionSocketType; } - public boolean connectionSocketUseSelectThreadToWait() - { + + public boolean connectionSocketUseSelectThreadToWait() { return connectionSocketUseSelectThreadToWait; } - public boolean connectionSocketUseWorkerThreadForEvent() - { + + public boolean connectionSocketUseWorkerThreadForEvent() { return connectionSocketUseWorkerThreadForEvent; } - public boolean isJavaSerializationEnabled() - { + + public boolean isJavaSerializationEnabled() { return enableJavaSerialization; } - public long getCommunicationsRetryTimeout() - { + + public long getCommunicationsRetryTimeout() { return communicationsRetryTimeout; } - public long getWaitForResponseTimeout() - { + + public long getWaitForResponseTimeout() { return waitForResponseTimeout; } - public TcpTimeouts getTransportTcpTimeouts() - { + + public TcpTimeouts getTransportTcpTimeouts() { return tcpTimeouts; } - public TcpTimeouts getTransportTcpConnectTimeouts() - { + + public TcpTimeouts getTransportTcpConnectTimeouts() { return tcpConnectTimeouts; } - public boolean disableDirectByteBufferUse() - { - return disableDirectByteBufferUse ; + + public boolean disableDirectByteBufferUse() { + return disableDirectByteBufferUse; } - public boolean useRepId() - { + + public boolean useRepId() { return useRepId; } - public boolean showInfoMessages() - { + public boolean showInfoMessages() { return showInfoMessages; } - - public boolean getServiceContextReturnsNull() - { + + public boolean getServiceContextReturnsNull() { return getServiceContextReturnsNull; } - public boolean isAppServerMode() - { + public boolean isAppServerMode() { return isAppServerMode; } @@ -441,7 +387,7 @@ public int getReadByteBufferSize() { public int getMaxReadByteBufferSizeThreshold() { return maxReadByteBufferSizeThreshold; } - + public int getPooledDirectByteBufferSlabSize() { return pooledDirectByteBufferSlabSize; } @@ -464,79 +410,65 @@ public boolean blockingReadCheckMessageParser() { // ====== Methods for constructing and initializing this object ========= - public ORBDataParserImpl( ORB orb, DataCollector coll ) - { - super( ParserTable.get( - ORB.defaultClassNameResolver() ).getParserData() ) ; - init( coll ) ; + public ORBDataParserImpl(ORB orb, DataCollector coll) { + super(ParserTable.get(ORB.defaultClassNameResolver()).getParserData()); + init(coll); } @Override - public void complete() - { + public void complete() { codesets = new CodeSetComponentInfo(charData, wcharData); initializeServerHostInfo(); } - private void initializeServerHostInfo() - { - if (ORBServerHost == null || - ORBServerHost.equals("") || - ORBServerHost.equals("0.0.0.0") || - ORBServerHost.equals("::") || - ORBServerHost.toLowerCase().equals("::ffff:0.0.0.0")) - { - try - { + private void initializeServerHostInfo() { + if (ORBServerHost == null || ORBServerHost.equals("") || ORBServerHost.equals("0.0.0.0") || ORBServerHost.equals("::") + || ORBServerHost.toLowerCase().equals("::ffff:0.0.0.0")) { + try { ORBServerHost = InetAddress.getLocalHost().getHostAddress(); - } - catch (Exception ex) - { + } catch (Exception ex) { throw wrapper.getLocalHostFailed(ex); } listenOnAllInterfaces = true; - } - else - { + } else { listenOnAllInterfaces = false; } } - public boolean timingPointsEnabled() - { - return timingPointsEnabled ; + + public boolean timingPointsEnabled() { + return timingPointsEnabled; } - public boolean useEnumDesc() - { - return useEnumDesc ; + public boolean useEnumDesc() { + return useEnumDesc; } public boolean environmentIsGFServer() { - return environmentIsGFServer ; + return environmentIsGFServer; } public boolean noDefaultAcceptors() { - return noDefaultAcceptors ; + return noDefaultAcceptors; } public boolean registerMBeans() { - return registerMBeans ; + return registerMBeans; } public int fragmentReadTimeout() { - return fragmentReadTimeout ; + return fragmentReadTimeout; } - public void setOrbInitArgs( String[] args ) { - orbInitArgs = args ; + public void setOrbInitArgs(String[] args) { + orbInitArgs = args; } public String[] getOrbInitArgs() { - return orbInitArgs ; + return orbInitArgs; } public boolean disableORBD() { - return disableORBD ; + return disableORBD; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBImpl.java index 407d8f49f..cd3005f42 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBImpl.java @@ -17,29 +17,29 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; import java.applet.Applet; -import java.io.IOException ; +import java.io.IOException; import java.lang.reflect.Constructor; import java.util.Arrays; import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock ; - -import java.util.List ; -import java.util.Set ; -import java.util.HashSet ; -import java.util.ArrayList ; -import java.util.Iterator ; -import java.util.Properties ; -import java.util.Map ; -import java.util.HashMap ; -import java.util.WeakHashMap ; - -import java.net.InetAddress ; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import java.util.List; +import java.util.Set; +import java.util.HashSet; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Properties; +import java.util.Map; +import java.util.HashMap; +import java.util.WeakHashMap; + +import java.net.InetAddress; import java.util.logging.Level; import java.util.logging.Logger; @@ -63,16 +63,16 @@ import com.sun.org.omg.SendingContext.CodeBase; -import com.sun.corba.ee.spi.protocol.ClientInvocationInfo ; +import com.sun.corba.ee.spi.protocol.ClientInvocationInfo; import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.ior.TaggedProfile; import com.sun.corba.ee.spi.ior.TaggedProfileTemplate; -import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder ; +import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder; import com.sun.corba.ee.spi.ior.TaggedComponentFactoryFinder; -import com.sun.corba.ee.spi.ior.IORFactories ; -import com.sun.corba.ee.spi.ior.ObjectKey ; -import com.sun.corba.ee.spi.ior.ObjectKeyFactory ; +import com.sun.corba.ee.spi.ior.IORFactories; +import com.sun.corba.ee.spi.ior.ObjectKey; +import com.sun.corba.ee.spi.ior.ObjectKeyFactory; import com.sun.corba.ee.spi.oa.OAInvocationInfo; import com.sun.corba.ee.spi.oa.ObjectAdapterFactory; import com.sun.corba.ee.spi.orb.DataCollector; @@ -94,14 +94,14 @@ import com.sun.corba.ee.spi.transport.ContactInfoListFactory; import com.sun.corba.ee.spi.transport.TransportManager; import com.sun.corba.ee.spi.legacy.connection.LegacyServerSocketManager; -import com.sun.corba.ee.spi.copyobject.CopierManager ; -import com.sun.corba.ee.spi.presentation.rmi.InvocationInterceptor ; -import com.sun.corba.ee.spi.presentation.rmi.StubAdapter ; +import com.sun.corba.ee.spi.copyobject.CopierManager; +import com.sun.corba.ee.spi.presentation.rmi.InvocationInterceptor; +import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry; import com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults; import com.sun.corba.ee.spi.servicecontext.ServiceContextsCache; import com.sun.corba.ee.spi.threadpool.ThreadPoolManager; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.impl.corba.TypeCodeImpl; import com.sun.corba.ee.impl.corba.NVListImpl; @@ -141,183 +141,163 @@ import org.glassfish.pfl.basic.contain.ResourceFactory; import org.glassfish.pfl.basic.func.NullaryFunction; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; - + /** * The JavaIDL ORB implementation. */ @OrbLifeCycle @Subcontract -public class ORBImpl extends com.sun.corba.ee.spi.orb.ORB -{ - private boolean set_parameters_called = false ; +public class ORBImpl extends com.sun.corba.ee.spi.orb.ORB { + private boolean set_parameters_called = false; protected TransportManager transportManager; protected LegacyServerSocketManager legacyServerSocketManager; - private ThreadLocal> - OAInvocationInfoStack ; + private ThreadLocal> OAInvocationInfoStack; - private ThreadLocal> - clientInvocationInfoStack ; + private ThreadLocal> clientInvocationInfoStack; // pure java orb, caching the servant IOR per ORB - private CodeBase codeBase = null ; - private IOR codeBaseIOR = null ; + private CodeBase codeBase = null; + private IOR codeBaseIOR = null; // List holding deferred Requests - private final List dynamicRequests = - new ArrayList(); + private final List dynamicRequests = new ArrayList(); private final SynchVariable svResponseReceived = new SynchVariable(); - private final Object runObj = new Object(); private final Object shutdownObj = new Object(); - private final AtomicInteger numWaiters = new AtomicInteger() ; + private final AtomicInteger numWaiters = new AtomicInteger(); private final Object waitForCompletionObj = new Object(); private static final byte STATUS_OPERATING = 1; private static final byte STATUS_SHUTTING_DOWN = 2; private static final byte STATUS_SHUTDOWN = 3; private static final byte STATUS_DESTROYED = 4; - private final ReadWriteLock statueLock = new ReentrantReadWriteLock() ; + private final ReadWriteLock statueLock = new ReentrantReadWriteLock(); private byte status = STATUS_OPERATING; private final java.lang.Object invocationObj = new java.lang.Object(); private AtomicInteger numInvocations = new AtomicInteger(); - // thread local variable to store a boolean to detect deadlock in + // thread local variable to store a boolean to detect deadlock in // ORB.shutdown(true). - private ThreadLocal isProcessingInvocation = - new ThreadLocal () { + private ThreadLocal isProcessingInvocation = new ThreadLocal() { @Override - protected Boolean initialValue() { - return false ; - } - }; + protected Boolean initialValue() { + return false; + } + }; // This map is caching TypeCodes created for a certain class (key) // and is used in Util.writeAny() - private Map,TypeCodeImpl> typeCodeForClassMap ; + private Map, TypeCodeImpl> typeCodeForClassMap; // Cache to hold ValueFactories (Helper classes) keyed on repository ids - private Map valueFactoryCache = - new HashMap(); + private Map valueFactoryCache = new HashMap(); // thread local variable to store the current ORB version. // default ORB version is the version of ORB with correct Rep-id // changes - private ThreadLocal orbVersionThreadLocal ; + private ThreadLocal orbVersionThreadLocal; - private RequestDispatcherRegistry requestDispatcherRegistry ; + private RequestDispatcherRegistry requestDispatcherRegistry; - private CopierManager copierManager ; + private CopierManager copierManager; - private int transientServerId ; + private int transientServerId; - private ServiceContextFactoryRegistry serviceContextFactoryRegistry ; + private ServiceContextFactoryRegistry serviceContextFactoryRegistry; private ServiceContextsCache serviceContextsCache; // Needed here to implement connect/disconnect - private ResourceFactory toaFactory = - new ResourceFactory( - new NullaryFunction() { - public TOAFactory evaluate() { - return (TOAFactory)requestDispatcherRegistry.getObjectAdapterFactory( - ORBConstants.TOA_SCID) ; - } - } - ); + private ResourceFactory toaFactory = new ResourceFactory(new NullaryFunction() { + public TOAFactory evaluate() { + return (TOAFactory) requestDispatcherRegistry.getObjectAdapterFactory(ORBConstants.TOA_SCID); + } + }); // Needed here for set_delegate - private ResourceFactory poaFactory = - new ResourceFactory( - new NullaryFunction() { - public POAFactory evaluate() { - return (POAFactory)requestDispatcherRegistry.getObjectAdapterFactory( - ORBConstants.TRANSIENT_SCID) ; - } - } - ); + private ResourceFactory poaFactory = new ResourceFactory(new NullaryFunction() { + public POAFactory evaluate() { + return (POAFactory) requestDispatcherRegistry.getObjectAdapterFactory(ORBConstants.TRANSIENT_SCID); + } + }); // The interceptor handler, which provides portable interceptor services for // subcontracts and object adapters. - private PIHandler pihandler ; + private PIHandler pihandler; - private ORBData configData ; + private ORBData configData; - private BadServerIdHandler badServerIdHandler ; + private BadServerIdHandler badServerIdHandler; - private ClientDelegateFactory clientDelegateFactory ; + private ClientDelegateFactory clientDelegateFactory; - private ContactInfoListFactory corbaContactInfoListFactory ; + private ContactInfoListFactory corbaContactInfoListFactory; // All access to resolver, localResolver, and urlOperation must be protected using - // the appropriate locks. Do not hold the ORBImpl lock while accessing + // the appropriate locks. Do not hold the ORBImpl lock while accessing // resolver, or deadlocks may occur. - // Note that we now have separate locks for each resolver type. This is due + // Note that we now have separate locks for each resolver type. This is due // to bug 6238477, which was caused by a deadlock while resolving a // corbaname: URL that contained a reference to the same ORB as the - // ORB making the call to string_to_object. This caused a deadlock between the + // ORB making the call to string_to_object. This caused a deadlock between the // client thread holding the single lock for access to the urlOperation, // and the server thread handling the client is_a request waiting on the // same lock to access the localResolver. // Used for resolver_initial_references and list_initial_services - private Resolver resolver ; + private Resolver resolver; // Used for register_initial_references - private LocalResolver localResolver ; + private LocalResolver localResolver; // ServerRequestDispatcher used for all INS object references. - private ServerRequestDispatcher insNamingDelegate ; + private ServerRequestDispatcher insNamingDelegate; // resolverLock must be used for all access to either resolver or // localResolver, since it is possible for the resolver to indirectly - // refer to the localResolver. Also used to protect access to + // refer to the localResolver. Also used to protect access to // insNamingDelegate. - private final Object resolverLock = new Object() ; + private final Object resolverLock = new Object(); // Converts strings to object references for resolvers and string_to_object - private Operation urlOperation ; - private final Object urlOperationLock = new java.lang.Object() ; + private Operation urlOperation; + private final Object urlOperationLock = new java.lang.Object(); - private TaggedComponentFactoryFinder - taggedComponentFactoryFinder ; + private TaggedComponentFactoryFinder taggedComponentFactoryFinder; - private IdentifiableFactoryFinder - taggedProfileFactoryFinder ; + private IdentifiableFactoryFinder taggedProfileFactoryFinder; - private IdentifiableFactoryFinder - taggedProfileTemplateFactoryFinder ; + private IdentifiableFactoryFinder taggedProfileTemplateFactoryFinder; - private ObjectKeyFactory objectKeyFactory ; + private ObjectKeyFactory objectKeyFactory; - private boolean orbOwnsThreadPoolManager = false ; + private boolean orbOwnsThreadPoolManager = false; private ThreadPoolManager threadpoolMgr; - private InvocationInterceptor invocationInterceptor ; + private InvocationInterceptor invocationInterceptor; - private WeakCache objectKeyCache = - new WeakCache () { - @Override - protected ObjectKeyCacheEntry lookup(ByteArrayWrapper key) { - ObjectKey okey = ORBImpl.this.getObjectKeyFactory().create( - key.getObjKey()); - ObjectKeyCacheEntry entry = new ObjectKeyCacheEntryImpl( okey ) ; - return entry ; - } - } ; + private WeakCache objectKeyCache = new WeakCache() { + @Override + protected ObjectKeyCacheEntry lookup(ByteArrayWrapper key) { + ObjectKey okey = ORBImpl.this.getObjectKeyFactory().create(key.getObjKey()); + ObjectKeyCacheEntry entry = new ObjectKeyCacheEntryImpl(okey); + return entry; + } + }; public InvocationInterceptor getInvocationInterceptor() { - return invocationInterceptor ; + return invocationInterceptor; } - public void setInvocationInterceptor( InvocationInterceptor interceptor ) { - this.invocationInterceptor = interceptor ; + public void setInvocationInterceptor(InvocationInterceptor interceptor) { + this.invocationInterceptor = interceptor; } - + //////////////////////////////////////////////////// // // NOTE: @@ -331,153 +311,144 @@ public void setInvocationInterceptor( InvocationInterceptor interceptor ) { // // checkShutDownState - lock on different object - and normalize usage. // starting/FinishDispatch and Shutdown - // + // - public ORBData getORBData() - { - return configData ; + public ORBData getORBData() { + return configData; } - - public PIHandler getPIHandler() - { - return pihandler ; + + public PIHandler getPIHandler() { + return pihandler; } - public void createPIHandler() - { - this.pihandler = new PIHandlerImpl( this, configData.getOrbInitArgs() ) ; + public void createPIHandler() { + this.pihandler = new PIHandlerImpl(this, configData.getOrbInitArgs()); } /** - * Create a new ORB. Should be followed by the appropriate - * set_parameters() call. + * Create a new ORB. Should be followed by the appropriate set_parameters() call. */ - public ORBImpl() - { + public ORBImpl() { // All initialization is done through set_parameters(). } - public ORBVersion getORBVersion() - { - return orbVersionThreadLocal.get() ; + public ORBVersion getORBVersion() { + return orbVersionThreadLocal.get(); } - public void setORBVersion(ORBVersion verObj) - { + public void setORBVersion(ORBVersion verObj) { orbVersionThreadLocal.set(verObj); } - @OrbLifeCycle private void initManagedObjectManager() { - createORBManagedObjectManager() ; - mom.registerAtRoot( configData ) ; + createORBManagedObjectManager(); + mom.registerAtRoot(configData); } -/**************************************************************************** - * The following methods are ORB initialization - ****************************************************************************/ + /**************************************************************************** + * The following methods are ORB initialization + ****************************************************************************/ // preInit initializes all non-pluggable ORB data that is independent // of the property parsing. - private void preInit( String[] params, Properties props ) - { + private void preInit(String[] params, Properties props) { // This is the unique id of this server (JVM). Multiple incarnations // of this server will get different ids. // Compute transientServerId = milliseconds since Jan 1, 1970 // Note: transientServerId will wrap in about 2^32 / 86400000 = 49.7 days. // If two ORBS are started at the same time then there is a possibility - // of having the same transientServerId. This may result in collision - // and may be a problem in ior.isLocal() check to see if the object + // of having the same transientServerId. This may result in collision + // and may be a problem in ior.isLocal() check to see if the object // belongs to the current ORB. This problem is taken care of by checking // to see if the IOR port matches ORB server port in legacyIsLocalServerPort() // method. - transientServerId = (int)System.currentTimeMillis(); + transientServerId = (int) System.currentTimeMillis(); - orbVersionThreadLocal = new ThreadLocal() { + orbVersionThreadLocal = new ThreadLocal() { @Override protected ORBVersion initialValue() { // set default to version of the ORB with correct Rep-ids - return ORBVersionFactory.getORBVersion() ; + return ORBVersionFactory.getORBVersion(); } }; - requestDispatcherRegistry = new RequestDispatcherRegistryImpl( - ORBConstants.DEFAULT_SCID); - copierManager = new CopierManagerImpl() ; - - taggedComponentFactoryFinder = - new TaggedComponentFactoryFinderImpl(this) ; - taggedProfileFactoryFinder = - new TaggedProfileFactoryFinderImpl(this) ; - taggedProfileTemplateFactoryFinder = - new TaggedProfileTemplateFactoryFinderImpl(this) ; - - OAInvocationInfoStack = - new ThreadLocal> () { - @Override - protected StackImpl initialValue() { - return new StackImpl(); - } - }; - - clientInvocationInfoStack = - new ThreadLocal>() { - @Override - protected StackImpl initialValue() { - return new StackImpl(); - } - }; + requestDispatcherRegistry = new RequestDispatcherRegistryImpl(ORBConstants.DEFAULT_SCID); + copierManager = new CopierManagerImpl(); + + taggedComponentFactoryFinder = new TaggedComponentFactoryFinderImpl(this); + taggedProfileFactoryFinder = new TaggedProfileFactoryFinderImpl(this); + taggedProfileTemplateFactoryFinder = new TaggedProfileTemplateFactoryFinderImpl(this); + + OAInvocationInfoStack = new ThreadLocal>() { + @Override + protected StackImpl initialValue() { + return new StackImpl(); + } + }; - serviceContextFactoryRegistry = - ServiceContextDefaults.makeServiceContextFactoryRegistry( this ) ; + clientInvocationInfoStack = new ThreadLocal>() { + @Override + protected StackImpl initialValue() { + return new StackImpl(); + } + }; + + serviceContextFactoryRegistry = ServiceContextDefaults.makeServiceContextFactoryRegistry(this); } @InfoMethod - private void configDataParsingComplete(String oRBId) { } + private void configDataParsingComplete(String oRBId) { + } @InfoMethod - private void transportInitializationComplete(String oRBId) { } + private void transportInitializationComplete(String oRBId) { + } @InfoMethod - private void userConfiguratorExecutionComplete(String oRBId) { } + private void userConfiguratorExecutionComplete(String oRBId) { + } @InfoMethod - private void interceptorInitializationComplete(String oRBId) { } + private void interceptorInitializationComplete(String oRBId) { + } @InfoMethod - private void mbeansRegistereed(String oRBId) { } + private void mbeansRegistereed(String oRBId) { + } @InfoMethod - private void initializationComplete(String oRBId) { } + private void initializationComplete(String oRBId) { + } @InfoMethod - private void startingShutdown(String oRBId) { } + private void startingShutdown(String oRBId) { + } @InfoMethod - private void startingDestruction(String oRBId) { } + private void startingDestruction(String oRBId) { + } @InfoMethod - private void isLocalServerIdInfo(int subcontractId, int serverId, - int transientServerId, boolean aTransient, - boolean persistentServerIdInitialized, int psid) { } + private void isLocalServerIdInfo(int subcontractId, int serverId, int transientServerId, boolean aTransient, + boolean persistentServerIdInitialized, int psid) { + } // Class that defines a parser that gets the name of the // ORBConfigurator class. private class ConfigParser extends ParserImplBase { // The default here is the ORBConfiguratorImpl that we define, // but this can be replaced. - public Class configurator ; + public Class configurator; - public ConfigParser( boolean disableORBD ) { + public ConfigParser(boolean disableORBD) { // Default configurator - configurator = ORBConfiguratorImpl.class ; + configurator = ORBConfiguratorImpl.class; if (!disableORBD) { // Note: this class is NOT included in the GF bundles! // Try to load it if present. - String cname = - "com.sun.corba.ee.impl.activation.ORBConfiguratorPersistentImpl" ; + String cname = "com.sun.corba.ee.impl.activation.ORBConfiguratorPersistentImpl"; try { configurator = Class.forName(cname); @@ -487,242 +458,224 @@ public ConfigParser( boolean disableORBD ) { } } - public PropertyParser makeParser() - { - PropertyParser parser = new PropertyParser() ; - parser.add( ORBConstants.SUN_PREFIX + "ORBConfigurator", - OperationFactory.classAction( classNameResolver() ), - "configurator" ) ; - return parser ; + public PropertyParser makeParser() { + PropertyParser parser = new PropertyParser(); + parser.add(ORBConstants.SUN_PREFIX + "ORBConfigurator", OperationFactory.classAction(classNameResolver()), "configurator"); + return parser; } } - // Map String to Integer to count number of ORBs with the + // Map String to Integer to count number of ORBs with the // same ORBId. - private static final Map idcount = - new HashMap() ; - private String rootName = null ; + private static final Map idcount = new HashMap(); + private String rootName = null; @Override public synchronized String getUniqueOrbId() { if (rootName == null) { - String orbid = getORBData().getORBId() ; + String orbid = getORBData().getORBId(); if (orbid.length() == 0) { orbid = "orb"; } - int num = 1 ; - // Look up the current count of ORB instances with - // the same ORBId. If this is the first instance, + int num = 1; + // Look up the current count of ORB instances with + // the same ORBId. If this is the first instance, // the count is 1, otherwise increment the count. synchronized (idcount) { - if (idcount.containsKey( orbid )) { - num = idcount.get( orbid ) + 1 ; + if (idcount.containsKey(orbid)) { + num = idcount.get(orbid) + 1; } - idcount.put( orbid, num ) ; + idcount.put(orbid, num); } if (num != 1) { - rootName = orbid + "_" + num ; + rootName = orbid + "_" + num; } else { - rootName = orbid ; + rootName = orbid; } } - return rootName ; + return rootName; } @OrbLifeCycle - private void postInit( String[] params, DataCollector dataCollector ) { + private void postInit(String[] params, DataCollector dataCollector) { // First, create the standard ORB config data. // This must be initialized before the ORBConfigurator // is executed. Note that the orbId is initialized here. - configData = new ORBDataParserImpl( this, dataCollector) ; + configData = new ORBDataParserImpl(this, dataCollector); if (orbInitDebug) { - System.out.println( "Contents of ORB configData:" ) ; - System.out.println( ObjectUtility.defaultObjectToString( configData ) ) ; + System.out.println("Contents of ORB configData:"); + System.out.println(ObjectUtility.defaultObjectToString(configData)); } - configData.setOrbInitArgs( params ) ; + configData.setOrbInitArgs(params); // Set the debug flags early so they can be used by other // parts of the initialization. - setDebugFlags( configData.getORBDebugFlags() ) ; - configDataParsingComplete( getORBData().getORBId() ) ; + setDebugFlags(configData.getORBDebugFlags()); + configDataParsingComplete(getORBData().getORBId()); - initManagedObjectManager() ; + initManagedObjectManager(); // The TimerManager must be // initialized BEFORE the pihandler.initialize() call, in - // case we want to time interceptor setup. Obviously we + // case we want to time interceptor setup. Obviously we // want to initialize the timerManager as early as possible // so we can time parts of initialization if desired. // timerManager = makeTimerManager( mom ) ; // This requires a valid TimerManager. - initializePrimitiveTypeCodeConstants() ; + initializePrimitiveTypeCodeConstants(); // REVISIT: this should go away after more transport init cleanup - // and going to ORT based ORBD. + // and going to ORT based ORBD. transportManager = new TransportManagerImpl(this); getLegacyServerSocketManager(); - transportInitializationComplete( getORBData().getORBId() ) ; + transportInitializationComplete(getORBData().getORBId()); super.getByteBufferPool(); serviceContextsCache = new ServiceContextsCache(this); // Create a parser to get the configured ORBConfigurator. - ConfigParser parser = new ConfigParser( configData.disableORBD() ) ; - parser.init( dataCollector ) ; + ConfigParser parser = new ConfigParser(configData.disableORBD()); + parser.init(dataCollector); - ORBConfigurator configurator = null ; - String name = "NO NAME AVAILABLE" ; + ORBConfigurator configurator = null; + String name = "NO NAME AVAILABLE"; if (parser.configurator == null) { - throw wrapper.badOrbConfigurator( name ) ; + throw wrapper.badOrbConfigurator(name); } else { try { - configurator = - (ORBConfigurator)(parser.configurator.newInstance()) ; + configurator = (ORBConfigurator) (parser.configurator.newInstance()); } catch (Exception iexc) { - name = parser.configurator.getName() ; - throw wrapper.badOrbConfigurator( iexc, name ) ; + name = parser.configurator.getName(); + throw wrapper.badOrbConfigurator(iexc, name); } } - // Finally, run the configurator. Note that the default implementation allows + // Finally, run the configurator. Note that the default implementation allows // other configurators with their own parsers to run, // using the same DataCollector. try { - configurator.configure( dataCollector, this ) ; + configurator.configure(dataCollector, this); } catch (Exception exc) { - throw wrapper.orbConfiguratorError( exc ) ; + throw wrapper.orbConfiguratorError(exc); } - userConfiguratorExecutionComplete( getORBData().getORBId() ) ; + userConfiguratorExecutionComplete(getORBData().getORBId()); - // Initialize the thread manager pool + // Initialize the thread manager pool // so it may be initialized & accessed without synchronization. - // This must take place here so that a user conifigurator can + // This must take place here so that a user conifigurator can // set the threadpool manager first. getThreadPoolManager(); // Last of all, run the ORB initializers. - // Interceptors will not be executed until - // after pihandler.initialize(). A request that starts before + // Interceptors will not be executed until + // after pihandler.initialize(). A request that starts before // initialize completes and completes after initialize completes does // not see any interceptors. - pihandler.initialize() ; + pihandler.initialize(); - interceptorInitializationComplete( getORBData().getORBId() ) ; + interceptorInitializationComplete(getORBData().getORBId()); // Now the ORB is ready, so finish all of the MBean registration if (configData.registerMBeans()) { - mom.resumeJMXRegistration() ; - mbeansRegistereed( getORBData().getORBId() ) ; + mom.resumeJMXRegistration(); + mbeansRegistereed(getORBData().getORBId()); } } private POAFactory getPOAFactory() { - return poaFactory.get() ; + return poaFactory.get(); } private TOAFactory getTOAFactory() { - return toaFactory.get() ; + return toaFactory.get(); } public void check_set_parameters() { if (set_parameters_called) { - throw wrapper.setParameterCalledAgain() ; + throw wrapper.setParameterCalledAgain(); } else { - set_parameters_called = true ; + set_parameters_called = true; } } @OrbLifeCycle - public void set_parameters( Properties props ) - { - preInit( null, props ) ; - DataCollector dataCollector = - DataCollectorFactory.create( props, getLocalHostName() ) ; - postInit( null, dataCollector ) ; - initializationComplete( getORBData().getORBId() ) ; + public void set_parameters(Properties props) { + preInit(null, props); + DataCollector dataCollector = DataCollectorFactory.create(props, getLocalHostName()); + postInit(null, dataCollector); + initializationComplete(getORBData().getORBId()); } @OrbLifeCycle - protected void set_parameters(Applet app, Properties props) - { - preInit( null, props ) ; - DataCollector dataCollector = - DataCollectorFactory.create( app, props, getLocalHostName() ) ; - postInit( null, dataCollector ) ; - initializationComplete( getORBData().getORBId() ) ; - } - - public void setParameters( String[] params, Properties props ) { - set_parameters( params, props ) ; - } - - /* we can't create object adapters inside the ORB init path, or else we'll get this same problem - * in slightly different ways. (address in use exception) - * Having an IORInterceptor (TxSecIORInterceptor) get called during ORB init always results in a - * nested ORB.init call because of the call to getORB in the IORInterceptor. - */ - protected void set_parameters (String[] params, Properties props) - { - preInit( params, props ) ; - DataCollector dataCollector = - DataCollectorFactory.create( params, props, getLocalHostName() ) ; - postInit( params, dataCollector ) ; - } - -/**************************************************************************** - * The following methods are standard public CORBA ORB APIs - ****************************************************************************/ - - public synchronized org.omg.CORBA.portable.OutputStream create_output_stream() - { + protected void set_parameters(Applet app, Properties props) { + preInit(null, props); + DataCollector dataCollector = DataCollectorFactory.create(app, props, getLocalHostName()); + postInit(null, dataCollector); + initializationComplete(getORBData().getORBId()); + } + + public void setParameters(String[] params, Properties props) { + set_parameters(params, props); + } + + /* + * we can't create object adapters inside the ORB init path, or else we'll get this same problem in slightly different + * ways. (address in use exception) Having an IORInterceptor (TxSecIORInterceptor) get called during ORB init always + * results in a nested ORB.init call because of the call to getORB in the IORInterceptor. + */ + protected void set_parameters(String[] params, Properties props) { + preInit(params, props); + DataCollector dataCollector = DataCollectorFactory.create(params, props, getLocalHostName()); + postInit(params, dataCollector); + } + + /**************************************************************************** + * The following methods are standard public CORBA ORB APIs + ****************************************************************************/ + + public synchronized org.omg.CORBA.portable.OutputStream create_output_stream() { return OutputStreamFactory.newEncapsOutputStream(this); } /** - * Get a Current pseudo-object. - * The Current interface is used to manage thread-specific - * information for use by the transactions, security and other - * services. This method is deprecated, - * and replaced by ORB.resolve_initial_references("NameOfCurrentObject"); + * Get a Current pseudo-object. The Current interface is used to manage thread-specific information for use by the + * transactions, security and other services. This method is deprecated, and replaced by + * ORB.resolve_initial_references("NameOfCurrentObject"); * - * @return a Current pseudo-object. + * @return a Current pseudo-object. * @deprecated */ @Override - public synchronized org.omg.CORBA.Current get_current() - { + public synchronized org.omg.CORBA.Current get_current() { checkShutdownState(); - /* _REVISIT_ - The implementation of get_current is not clear. How would - ORB know whether the caller wants a Current for transactions - or security ?? Or is it assumed that there is just one - implementation for both ? If Current is thread-specific, - then it should not be instantiated; so where does the - ORB get a Current ? - - This should probably be deprecated. */ + /* + * _REVISIT_ The implementation of get_current is not clear. How would ORB know whether the caller wants a Current for + * transactions or security ?? Or is it assumed that there is just one implementation for both ? If Current is + * thread-specific, then it should not be instantiated; so where does the ORB get a Current ? + * + * This should probably be deprecated. + */ - throw wrapper.genericNoImpl() ; + throw wrapper.genericNoImpl(); } /** * Create an NVList * - * @param count size of list to create - * @return NVList created + * @param count size of list to create + * @return NVList created * * @see NVList */ - public synchronized NVList create_list(int count) - { + public synchronized NVList create_list(int count) { checkShutdownState(); return new NVListImpl(this, count); } @@ -730,25 +683,23 @@ public synchronized NVList create_list(int count) /** * Create an NVList corresponding to an OperationDef * - * @param oper operation def to use to create list - * @return NVList created + * @param oper operation def to use to create list + * @return NVList created * * @see NVList */ @Override - public synchronized NVList create_operation_list(org.omg.CORBA.Object oper) - { + public synchronized NVList create_operation_list(org.omg.CORBA.Object oper) { checkShutdownState(); - throw wrapper.genericNoImpl() ; + throw wrapper.genericNoImpl(); } /** * Create a NamedValue * - * @return NamedValue created + * @return NamedValue created */ - public synchronized NamedValue create_named_value(String s, Any any, int flags) - { + public synchronized NamedValue create_named_value(String s, Any any, int flags) { checkShutdownState(); return new NamedValueImpl(this, s, any, flags); } @@ -756,10 +707,9 @@ public synchronized NamedValue create_named_value(String s, Any any, int flags) /** * Create an ExceptionList * - * @return ExceptionList created + * @return ExceptionList created */ - public synchronized org.omg.CORBA.ExceptionList create_exception_list() - { + public synchronized org.omg.CORBA.ExceptionList create_exception_list() { checkShutdownState(); return new ExceptionListImpl(); } @@ -767,10 +717,9 @@ public synchronized org.omg.CORBA.ExceptionList create_exception_list() /** * Create a ContextList * - * @return ContextList created + * @return ContextList created */ - public synchronized org.omg.CORBA.ContextList create_context_list() - { + public synchronized org.omg.CORBA.ContextList create_context_list() { checkShutdownState(); return new ContextListImpl(this); } @@ -778,27 +727,24 @@ public synchronized org.omg.CORBA.ContextList create_context_list() /** * Get the default Context object * - * @return the default Context object + * @return the default Context object */ - public synchronized org.omg.CORBA.Context get_default_context() - { + public synchronized org.omg.CORBA.Context get_default_context() { checkShutdownState(); - throw wrapper.genericNoImpl() ; + throw wrapper.genericNoImpl(); } /** * Create an Environment * - * @return Environment created + * @return Environment created */ - public synchronized org.omg.CORBA.Environment create_environment() - { + public synchronized org.omg.CORBA.Environment create_environment() { checkShutdownState(); return new EnvironmentImpl(); } - public synchronized void send_multiple_requests_oneway(Request[] req) - { + public synchronized void send_multiple_requests_oneway(Request[] req) { checkShutdownState(); // Invoke the send_oneway on each new Request @@ -810,17 +756,15 @@ public synchronized void send_multiple_requests_oneway(Request[] req) /** * Send multiple dynamic requests asynchronously. * - * @param req an array of request objects. + * @param req an array of request objects. */ - public synchronized void send_multiple_requests_deferred(Request[] req) - { + public synchronized void send_multiple_requests_deferred(Request[] req) { checkShutdownState(); dynamicRequests.addAll(Arrays.asList(req)); // Invoke the send_deferred on each new Request for (Request r : req) { - AsynchInvoke invokeObject = new AsynchInvoke( this, - (com.sun.corba.ee.impl.corba.RequestImpl)r, true); + AsynchInvoke invokeObject = new AsynchInvoke(this, (com.sun.corba.ee.impl.corba.RequestImpl) r, true); new Thread(invokeObject).start(); } } @@ -828,12 +772,11 @@ public synchronized void send_multiple_requests_deferred(Request[] req) /** * Find out if any of the deferred invocations have a response yet. */ - public synchronized boolean poll_next_response() - { + public synchronized boolean poll_next_response() { checkShutdownState(); // poll on each pending request - synchronized(dynamicRequests) { + synchronized (dynamicRequests) { for (Request r : dynamicRequests) { if (r.poll_response()) { return true; @@ -846,35 +789,33 @@ public synchronized boolean poll_next_response() /** * Get the next request that has gotten a response. * - * @return the next request ready with a response. + * @return the next request ready with a response. */ - public org.omg.CORBA.Request get_next_response() - throws org.omg.CORBA.WrongTransaction - { - synchronized( this ) { + public org.omg.CORBA.Request get_next_response() throws org.omg.CORBA.WrongTransaction { + synchronized (this) { checkShutdownState(); } while (true) { // check if there already is a response - synchronized ( dynamicRequests ) { - Iterator iter = dynamicRequests.iterator() ; + synchronized (dynamicRequests) { + Iterator iter = dynamicRequests.iterator(); while (iter.hasNext()) { - Request curr = iter.next() ; + Request curr = iter.next(); if (curr.poll_response()) { - curr.get_response() ; - iter.remove() ; - return curr ; + curr.get_response(); + iter.remove(); + return curr; } } } // wait for a response - synchronized(this.svResponseReceived) { + synchronized (this.svResponseReceived) { while (!this.svResponseReceived.value()) { try { this.svResponseReceived.wait(); - } catch(java.lang.InterruptedException ex) { + } catch (java.lang.InterruptedException ex) { // NO-OP } } @@ -887,8 +828,7 @@ public org.omg.CORBA.Request get_next_response() /** * Notify response to ORB for get_next_response */ - public void notifyORB() - { + public void notifyORB() { synchronized (this.svResponseReceived) { this.svResponseReceived.set(); this.svResponseReceived.notify(); @@ -897,47 +837,47 @@ public void notifyORB() /** * Convert an object ref to a string. + * * @param obj The object to stringify. * @return A stringified object reference. */ - public synchronized String object_to_string(org.omg.CORBA.Object obj) - { + public synchronized String object_to_string(org.omg.CORBA.Object obj) { checkShutdownState(); // Handle the null objref case if (obj == null) { - IOR nullIOR = IORFactories.makeIOR( this ) ; + IOR nullIOR = IORFactories.makeIOR(this); return nullIOR.stringify(); } - IOR ior = null ; + IOR ior = null; try { - ior = getIOR( obj, true ) ; + ior = getIOR(obj, true); } catch (BAD_PARAM bp) { // Throw MARSHAL instead if this is a LOCAL_OBJECT_NOT_ALLOWED error. if (bp.minor == ORBUtilSystemException.LOCAL_OBJECT_NOT_ALLOWED) { - throw omgWrapper.notAnObjectImpl( bp ) ; + throw omgWrapper.notAnObjectImpl(bp); } else { throw bp; } } - return ior.stringify() ; + return ior.stringify(); } /** * Convert a stringified object reference to the object it represents. + * * @param str The stringified object reference. * @return The unstringified object reference. */ - public org.omg.CORBA.Object string_to_object(String str) - { - Operation op ; + public org.omg.CORBA.Object string_to_object(String str) { + Operation op; synchronized (this) { checkShutdownState(); - op = urlOperation ; + op = urlOperation; } if (str == null) { @@ -945,19 +885,18 @@ public org.omg.CORBA.Object string_to_object(String str) } synchronized (urlOperationLock) { - org.omg.CORBA.Object obj = (org.omg.CORBA.Object)op.operate( str ) ; - return obj ; + org.omg.CORBA.Object obj = (org.omg.CORBA.Object) op.operate(str); + return obj; } } // pure java orb support, moved this method from FVDCodeBaseImpl. // Note that we connect this if we have not already done so. - public synchronized IOR getFVDCodeBaseIOR() - { + public synchronized IOR getFVDCodeBaseIOR() { if (codeBaseIOR == null) { ValueHandler vh = ORBUtility.createValueHandler(); - codeBase = (CodeBase)vh.getRunTimeCodeBase(); - codeBaseIOR = getIOR( codeBase, true ) ; + codeBase = (CodeBase) vh.getRunTimeCodeBase(); + codeBaseIOR = getIOR(codeBase, true); } return codeBaseIOR; @@ -966,25 +905,22 @@ public synchronized IOR getFVDCodeBaseIOR() /** * Get the TypeCode for a primitive type. * - * @param tcKind the integer kind for the primitive type - * @return the requested TypeCode + * @param tcKind the integer kind for the primitive type + * @return the requested TypeCode */ public TypeCode get_primitive_tc(TCKind tcKind) { - return get_primitive_tc( tcKind.value() ) ; + return get_primitive_tc(tcKind.value()); } /** * Create a TypeCode for a structure. * - * @param id the logical id for the typecode. - * @param name the name for the typecode. - * @param members an array describing the members of the TypeCode. - * @return the requested TypeCode. + * @param id the logical id for the typecode. + * @param name the name for the typecode. + * @param members an array describing the members of the TypeCode. + * @return the requested TypeCode. */ - public synchronized TypeCode create_struct_tc(String id, - String name, - StructMember[] members) - { + public synchronized TypeCode create_struct_tc(String id, String name, StructMember[] members) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_struct, id, name, members); } @@ -992,39 +928,26 @@ public synchronized TypeCode create_struct_tc(String id, /** * Create a TypeCode for a union. * - * @param id the logical id for the typecode. - * @param name the name for the typecode. - * @param discriminator_type - * the type of the union discriminator. - * @param members an array describing the members of the TypeCode. - * @return the requested TypeCode. + * @param id the logical id for the typecode. + * @param name the name for the typecode. + * @param discriminator_type the type of the union discriminator. + * @param members an array describing the members of the TypeCode. + * @return the requested TypeCode. */ - public synchronized TypeCode create_union_tc(String id, - String name, - TypeCode discriminator_type, - UnionMember[] members) - { + public synchronized TypeCode create_union_tc(String id, String name, TypeCode discriminator_type, UnionMember[] members) { checkShutdownState(); - return new TypeCodeImpl(this, - TCKind._tk_union, - id, - name, - discriminator_type, - members); + return new TypeCodeImpl(this, TCKind._tk_union, id, name, discriminator_type, members); } /** * Create a TypeCode for an enum. * - * @param id the logical id for the typecode. - * @param name the name for the typecode. - * @param members an array describing the members of the TypeCode. - * @return the requested TypeCode. + * @param id the logical id for the typecode. + * @param name the name for the typecode. + * @param members an array describing the members of the TypeCode. + * @return the requested TypeCode. */ - public synchronized TypeCode create_enum_tc(String id, - String name, - String[] members) - { + public synchronized TypeCode create_enum_tc(String id, String name, String[] members) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members); } @@ -1032,16 +955,12 @@ public synchronized TypeCode create_enum_tc(String id, /** * Create a TypeCode for an alias. * - * @param id the logical id for the typecode. - * @param name the name for the typecode. - * @param original_type - * the type this is an alias for. - * @return the requested TypeCode. + * @param id the logical id for the typecode. + * @param name the name for the typecode. + * @param original_type the type this is an alias for. + * @return the requested TypeCode. */ - public synchronized TypeCode create_alias_tc(String id, - String name, - TypeCode original_type) - { + public synchronized TypeCode create_alias_tc(String id, String name, TypeCode original_type) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_alias, id, name, original_type); } @@ -1049,15 +968,12 @@ public synchronized TypeCode create_alias_tc(String id, /** * Create a TypeCode for an exception. * - * @param id the logical id for the typecode. - * @param name the name for the typecode. - * @param members an array describing the members of the TypeCode. - * @return the requested TypeCode. + * @param id the logical id for the typecode. + * @param name the name for the typecode. + * @param members an array describing the members of the TypeCode. + * @return the requested TypeCode. */ - public synchronized TypeCode create_exception_tc(String id, - String name, - StructMember[] members) - { + public synchronized TypeCode create_exception_tc(String id, String name, StructMember[] members) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_except, id, name, members); } @@ -1065,13 +981,11 @@ public synchronized TypeCode create_exception_tc(String id, /** * Create a TypeCode for an interface. * - * @param id the logical id for the typecode. - * @param name the name for the typecode. - * @return the requested TypeCode. + * @param id the logical id for the typecode. + * @param name the name for the typecode. + * @return the requested TypeCode. */ - public synchronized TypeCode create_interface_tc(String id, - String name) - { + public synchronized TypeCode create_interface_tc(String id, String name) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_objref, id, name); } @@ -1079,11 +993,10 @@ public synchronized TypeCode create_interface_tc(String id, /** * Create a TypeCode for a string. * - * @param bound the bound for the string. - * @return the requested TypeCode. + * @param bound the bound for the string. + * @return the requested TypeCode. */ - public synchronized TypeCode create_string_tc(int bound) - { + public synchronized TypeCode create_string_tc(int bound) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_string, bound); } @@ -1091,72 +1004,54 @@ public synchronized TypeCode create_string_tc(int bound) /** * Create a TypeCode for a wide string. * - * @param bound the bound for the string. - * @return the requested TypeCode. + * @param bound the bound for the string. + * @return the requested TypeCode. */ public synchronized TypeCode create_wstring_tc(int bound) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_wstring, bound); } - public synchronized TypeCode create_sequence_tc(int bound, - TypeCode element_type) { + public synchronized TypeCode create_sequence_tc(int bound, TypeCode element_type) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_sequence, bound, element_type); } - @SuppressWarnings("deprecation") - public synchronized TypeCode create_recursive_sequence_tc(int bound, - int offset) { + public synchronized TypeCode create_recursive_sequence_tc(int bound, int offset) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_sequence, bound, offset); } - - public synchronized TypeCode create_array_tc(int length, - TypeCode element_type) - { + public synchronized TypeCode create_array_tc(int length, TypeCode element_type) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_array, length, element_type); } - @Override - public synchronized org.omg.CORBA.TypeCode create_native_tc(String id, - String name) - { + public synchronized org.omg.CORBA.TypeCode create_native_tc(String id, String name) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_native, id, name); } @Override - public synchronized org.omg.CORBA.TypeCode create_abstract_interface_tc( - String id, - String name) - { + public synchronized org.omg.CORBA.TypeCode create_abstract_interface_tc(String id, String name) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_abstract_interface, id, name); } @Override - public synchronized org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale) - { + public synchronized org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale) { checkShutdownState(); return new TypeCodeImpl(this, TCKind._tk_fixed, digits, scale); } @Override - public synchronized org.omg.CORBA.TypeCode create_value_tc(String id, - String name, - short type_modifier, - TypeCode concrete_base, - ValueMember[] members) - { + public synchronized org.omg.CORBA.TypeCode create_value_tc(String id, String name, short type_modifier, TypeCode concrete_base, + ValueMember[] members) { checkShutdownState(); - return new TypeCodeImpl(this, TCKind._tk_value, id, name, - type_modifier, concrete_base, members); + return new TypeCodeImpl(this, TCKind._tk_value, id, name, type_modifier, concrete_base, members); } @Override @@ -1166,17 +1061,12 @@ public synchronized org.omg.CORBA.TypeCode create_recursive_tc(String id) { } @Override - public synchronized org.omg.CORBA.TypeCode create_value_box_tc(String id, - String name, - TypeCode boxed_type) - { + public synchronized org.omg.CORBA.TypeCode create_value_box_tc(String id, String name, TypeCode boxed_type) { checkShutdownState(); - return new TypeCodeImpl(this, TCKind._tk_value_box, id, name, - boxed_type); + return new TypeCodeImpl(this, TCKind._tk_value_box, id, name, boxed_type); } - public synchronized Any create_any() - { + public synchronized Any create_any() { checkShutdownState(); return new AnyImpl(this); } @@ -1187,56 +1077,53 @@ public synchronized Any create_any() // Keeping a cache of TypeCodes associated with the class // they got created from in Util.writeAny(). - public synchronized void setTypeCodeForClass(Class c, TypeCodeImpl tci) - { + public synchronized void setTypeCodeForClass(Class c, TypeCodeImpl tci) { if (typeCodeForClassMap == null) { typeCodeForClassMap = new WeakHashMap, TypeCodeImpl>(64); } // Store only one TypeCode per class. - if ( ! typeCodeForClassMap.containsKey(c)) { + if (!typeCodeForClassMap.containsKey(c)) { typeCodeForClassMap.put(c, tci); } } - public synchronized TypeCodeImpl getTypeCodeForClass(Class c) - { + public synchronized TypeCodeImpl getTypeCodeForClass(Class c) { if (typeCodeForClassMap == null) { return null; } return typeCodeForClassMap.get(c); } -/**************************************************************************** - * The following methods deal with listing and resolving the initial - * (bootstrap) object references such as "NameService". - ****************************************************************************/ + /**************************************************************************** + * The following methods deal with listing and resolving the initial (bootstrap) object references such as + * "NameService". + ****************************************************************************/ public String[] list_initial_services() { - Resolver res ; + Resolver res; - synchronized( this ) { + synchronized (this) { checkShutdownState(); - res = resolver ; + res = resolver; } synchronized (resolverLock) { - java.util.Set keys = res.list() ; - return keys.toArray( new String[keys.size()] ) ; + java.util.Set keys = res.list(); + return keys.toArray(new String[keys.size()]); } } - public org.omg.CORBA.Object resolve_initial_references( - String identifier) throws InvalidName { - Resolver res ; + public org.omg.CORBA.Object resolve_initial_references(String identifier) throws InvalidName { + Resolver res; - synchronized( this ) { + synchronized (this) { checkShutdownState(); - res = resolver ; + res = resolver; } - org.omg.CORBA.Object result = res.resolve( identifier ) ; - + org.omg.CORBA.Object result = res.resolve(identifier); + if (result == null) { throw new InvalidName(identifier + " not found"); } else { @@ -1245,9 +1132,8 @@ public org.omg.CORBA.Object resolve_initial_references( } @Override - public void register_initial_reference( - String id, org.omg.CORBA.Object obj ) throws InvalidName { - ServerRequestDispatcher insnd ; + public void register_initial_reference(String id, org.omg.CORBA.Object obj) throws InvalidName { + ServerRequestDispatcher insnd; if ((id == null) || (id.length() == 0)) { throw new InvalidName("Null or empty id string"); @@ -1258,17 +1144,16 @@ public void register_initial_reference( } synchronized (resolverLock) { - insnd = insNamingDelegate ; + insnd = insNamingDelegate; - java.lang.Object obj2 = localResolver.resolve( id ) ; + java.lang.Object obj2 = localResolver.resolve(id); if (obj2 != null) { throw new InvalidName(id + " already registered"); } - localResolver.register( id, - NullaryFunction.Factory.makeConstant( obj )) ; + localResolver.register(id, NullaryFunction.Factory.makeConstant(obj)); } - + synchronized (this) { if (StubAdapter.isStub(obj)) { requestDispatcherRegistry.registerServerRequestDispatcher(insnd, id); @@ -1276,14 +1161,12 @@ public void register_initial_reference( } } -/**************************************************************************** - * The following methods (introduced in POA / CORBA2.1) deal with - * shutdown / single threading. - ****************************************************************************/ + /**************************************************************************** + * The following methods (introduced in POA / CORBA2.1) deal with shutdown / single threading. + ****************************************************************************/ @Override - public void run() - { + public void run() { synchronized (this) { checkShutdownState(); } @@ -1291,37 +1174,37 @@ public void run() synchronized (runObj) { try { runObj.wait(); - } catch ( InterruptedException ex ) {} + } catch (InterruptedException ex) { + } } } @Override @OrbLifeCycle public void shutdown(boolean wait_for_completion) { - boolean wait = false ; + boolean wait = false; synchronized (this) { checkShutdownState(); - - // This is to avoid deadlock: don't allow a thread that is + + // This is to avoid deadlock: don't allow a thread that is // processing a request to call shutdown( true ), because // the shutdown would block waiting for the request to complete, // while the request would block waiting for shutdown to complete. - if (wait_for_completion && - isProcessingInvocation.get() == Boolean.TRUE) { - throw omgWrapper.shutdownWaitForCompletionDeadlock() ; + if (wait_for_completion && isProcessingInvocation.get() == Boolean.TRUE) { + throw omgWrapper.shutdownWaitForCompletionDeadlock(); } if (status == STATUS_SHUTTING_DOWN) { if (wait_for_completion) { - wait = true ; + wait = true; } else { - return ; + return; } } - status = STATUS_SHUTTING_DOWN ; - } + status = STATUS_SHUTTING_DOWN; + } // Avoid more than one thread performing shutdown at a time. synchronized (shutdownObj) { @@ -1337,52 +1220,51 @@ public void shutdown(boolean wait_for_completion) { } try { - shutdownObj.wait() ; + shutdownObj.wait(); } catch (InterruptedException exc) { // NOP: just loop and wait until state is changed } } } else { - startingShutdown( getORBData().getORBId() ) ; - + startingShutdown(getORBData().getORBId()); + // perform the actual shutdown shutdownServants(wait_for_completion); if (wait_for_completion) { - synchronized ( waitForCompletionObj ) { + synchronized (waitForCompletionObj) { while (numInvocations.get() > 0) { try { - numWaiters.incrementAndGet() ; + numWaiters.incrementAndGet(); waitForCompletionObj.wait(); } catch (InterruptedException ex) { // ignore } finally { - numWaiters.decrementAndGet() ; + numWaiters.decrementAndGet(); } } } } - synchronized ( runObj ) { + synchronized (runObj) { runObj.notifyAll(); } status = STATUS_SHUTDOWN; - shutdownObj.notifyAll() ; + shutdownObj.notifyAll(); } } } - // Cause all ObjectAdapaterFactories to clean up all of their internal state, which + // Cause all ObjectAdapaterFactories to clean up all of their internal state, which // may include activated objects that have associated state and callbacks that must - // complete in order to shutdown. This will cause new request to be rejected. + // complete in order to shutdown. This will cause new request to be rejected. @OrbLifeCycle protected void shutdownServants(boolean wait_for_completion) { - Set oaset ; - synchronized(this) { - oaset = new HashSet( - requestDispatcherRegistry.getObjectAdapterFactories() ) ; + Set oaset; + synchronized (this) { + oaset = new HashSet(requestDispatcherRegistry.getObjectAdapterFactories()); } for (ObjectAdapterFactory oaf : oaset) { @@ -1391,31 +1273,30 @@ protected void shutdownServants(boolean wait_for_completion) { } // Note that the caller must hold the ORBImpl lock. - private void checkShutdownState() - { + private void checkShutdownState() { if (status == STATUS_DESTROYED) { - throw wrapper.orbDestroyed() ; + throw wrapper.orbDestroyed(); } if (status == STATUS_SHUTDOWN) { - throw omgWrapper.badOperationAfterShutdown() ; + throw omgWrapper.badOperationAfterShutdown(); } } public boolean isDuringDispatch() { - return isProcessingInvocation.get() ; + return isProcessingInvocation.get(); } public void startingDispatch() { isProcessingInvocation.set(true); - numInvocations.incrementAndGet() ; + numInvocations.incrementAndGet(); } public void finishedDispatch() { isProcessingInvocation.set(false); - int ni = numInvocations.decrementAndGet() ; + int ni = numInvocations.decrementAndGet(); if (ni < 0) { - throw wrapper.numInvocationsAlreadyZero() ; + throw wrapper.numInvocationsAlreadyZero(); } if (numWaiters.get() > 0 && ni == 0) { @@ -1426,16 +1307,15 @@ public void finishedDispatch() { } /** - * formal/99-10-07 p 159: "If destroy is called on an ORB that has - * not been shut down, it will start the shutdown process and block until - * the ORB has shut down before it destroys the ORB." + * formal/99-10-07 p 159: "If destroy is called on an ORB that has not been shut down, it will start the shutdown + * process and block until the ORB has shut down before it destroys the ORB." */ @Override @OrbLifeCycle public void destroy() { - boolean shutdownFirst = false ; + boolean shutdownFirst = false; synchronized (this) { - shutdownFirst = (status == STATUS_OPERATING) ; + shutdownFirst = (status == STATUS_OPERATING); } if (shutdownFirst) { @@ -1445,84 +1325,84 @@ public void destroy() { synchronized (this) { if (status < STATUS_DESTROYED) { getCorbaTransportManager().close(); - getPIHandler().destroyInterceptors() ; + getPIHandler().destroyInterceptors(); // timerManager.destroy() ; // timerManager = null ; status = STATUS_DESTROYED; } else { // Already destroyed: don't want to throw null pointer exceptions. - return ; + return; } } - startingDestruction( getORBData().getORBId() ) ; + startingDestruction(getORBData().getORBId()); - ThreadPoolManager tpToClose = null ; + ThreadPoolManager tpToClose = null; synchronized (threadPoolManagerAccessLock) { if (orbOwnsThreadPoolManager) { - tpToClose = threadpoolMgr ; - threadpoolMgr = null ; + tpToClose = threadpoolMgr; + threadpoolMgr = null; } } if (tpToClose != null) { try { - tpToClose.close() ; + tpToClose.close(); } catch (IOException exc) { - wrapper.ioExceptionOnClose( exc ) ; + wrapper.ioExceptionOnClose(exc); } } - CachedCodeBase.cleanCache( this ) ; + CachedCodeBase.cleanCache(this); try { - pihandler.close() ; + pihandler.close(); } catch (IOException exc) { - wrapper.ioExceptionOnClose( exc ) ; + wrapper.ioExceptionOnClose(exc); } - super.destroy() ; + super.destroy(); synchronized (this) { - corbaContactInfoListFactoryAccessLock = null ; - corbaContactInfoListFactoryReadLock = null ; - corbaContactInfoListFactoryWriteLock = null ; - - transportManager = null ; - legacyServerSocketManager = null ; - OAInvocationInfoStack = null ; - clientInvocationInfoStack = null ; - codeBase = null ; - codeBaseIOR = null ; - dynamicRequests.clear() ; - isProcessingInvocation = null ; - typeCodeForClassMap = null ; - valueFactoryCache = null ; - orbVersionThreadLocal = null ; - requestDispatcherRegistry = null ; - copierManager = null ; - serviceContextFactoryRegistry = null ; - serviceContextsCache= null ; - toaFactory = null ; - poaFactory = null ; - pihandler = null ; - configData = null ; - badServerIdHandler = null ; - clientDelegateFactory = null ; - corbaContactInfoListFactory = null ; - resolver = null ; - localResolver = null ; - insNamingDelegate = null ; - urlOperation = null ; - taggedComponentFactoryFinder = null ; - taggedProfileFactoryFinder = null ; - taggedProfileTemplateFactoryFinder = null ; - objectKeyFactory = null ; - invocationInterceptor = null ; - objectKeyCache.clear() ; + corbaContactInfoListFactoryAccessLock = null; + corbaContactInfoListFactoryReadLock = null; + corbaContactInfoListFactoryWriteLock = null; + + transportManager = null; + legacyServerSocketManager = null; + OAInvocationInfoStack = null; + clientInvocationInfoStack = null; + codeBase = null; + codeBaseIOR = null; + dynamicRequests.clear(); + isProcessingInvocation = null; + typeCodeForClassMap = null; + valueFactoryCache = null; + orbVersionThreadLocal = null; + requestDispatcherRegistry = null; + copierManager = null; + serviceContextFactoryRegistry = null; + serviceContextsCache = null; + toaFactory = null; + poaFactory = null; + pihandler = null; + configData = null; + badServerIdHandler = null; + clientDelegateFactory = null; + corbaContactInfoListFactory = null; + resolver = null; + localResolver = null; + insNamingDelegate = null; + urlOperation = null; + taggedComponentFactoryFinder = null; + taggedProfileFactoryFinder = null; + taggedProfileTemplateFactoryFinder = null; + objectKeyFactory = null; + invocationInterceptor = null; + objectKeyCache.clear(); } try { - mom.close() ; + mom.close(); } catch (Exception exc) { // ignore: stupid close exception } @@ -1533,14 +1413,12 @@ public void destroy() { * * @param repositoryID the repository ID. * @param factory the factory. - * @return the previously registered factory for the given repository ID, - * or null if no such factory was previously registered. + * @return the previously registered factory for the given repository ID, or null if no such factory was previously + * registered. * @exception org.omg.CORBA.BAD_PARAM if the registration fails. **/ @Override - public synchronized ValueFactory register_value_factory(String repositoryID, - ValueFactory factory) - { + public synchronized ValueFactory register_value_factory(String repositoryID, ValueFactory factory) { checkShutdownState(); if ((repositoryID == null) || (factory == null)) { @@ -1556,8 +1434,7 @@ public synchronized ValueFactory register_value_factory(String repositoryID, * @param repositoryID the repository ID. **/ @Override - public synchronized void unregister_value_factory(String repositoryID) - { + public synchronized void unregister_value_factory(String repositoryID) { checkShutdownState(); if (valueFactoryCache.remove(repositoryID) == null) { @@ -1566,17 +1443,15 @@ public synchronized void unregister_value_factory(String repositoryID) } /** - * Finds and returns a value factory for the given repository ID. - * The value factory returned was previously registered by a call to - * {@link #register_value_factory} or is the default factory. + * Finds and returns a value factory for the given repository ID. The value factory returned was previously registered + * by a call to {@link #register_value_factory} or is the default factory. * * @param repositoryID the repository ID. * @return the value factory. * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory. **/ @Override - public synchronized ValueFactory lookup_value_factory(String repositoryID) - { + public synchronized ValueFactory lookup_value_factory(String repositoryID) { checkShutdownState(); ValueFactory factory = valueFactoryCache.get(repositoryID); @@ -1584,60 +1459,55 @@ public synchronized ValueFactory lookup_value_factory(String repositoryID) if (factory == null) { try { factory = Utility.getFactory(null, null, null, repositoryID); - } catch(org.omg.CORBA.MARSHAL ex) { - throw wrapper.unableFindValueFactory( ex ) ; + } catch (org.omg.CORBA.MARSHAL ex) { + throw wrapper.unableFindValueFactory(ex); } } - return factory ; + return factory; } public OAInvocationInfo peekInvocationInfo() { - return OAInvocationInfoStack.get().peek() ; + return OAInvocationInfoStack.get().peek(); } - public void pushInvocationInfo( OAInvocationInfo info ) { - OAInvocationInfoStack.get().push( info ) ; + public void pushInvocationInfo(OAInvocationInfo info) { + OAInvocationInfoStack.get().push(info); } public OAInvocationInfo popInvocationInfo() { - return OAInvocationInfoStack.get().pop() ; + return OAInvocationInfoStack.get().pop(); } /** - * The bad server id handler is used by the Locator to - * send back the location of a persistant server to the client. + * The bad server id handler is used by the Locator to send back the location of a persistant server to the client. */ private final Object badServerIdHandlerAccessLock = new Object(); - public void initBadServerIdHandler() - { + public void initBadServerIdHandler() { synchronized (badServerIdHandlerAccessLock) { - Class cls = configData.getBadServerIdHandler() ; + Class cls = configData.getBadServerIdHandler(); if (cls != null) { try { Class[] params = new Class[] { org.omg.CORBA.ORB.class }; - java.lang.Object[] args = new java.lang.Object[]{this}; + java.lang.Object[] args = new java.lang.Object[] { this }; Constructor cons = cls.getConstructor(params); - badServerIdHandler = - (BadServerIdHandler) cons.newInstance(args); + badServerIdHandler = (BadServerIdHandler) cons.newInstance(args); } catch (Exception e) { - throw wrapper.errorInitBadserveridhandler( e ) ; + throw wrapper.errorInitBadserveridhandler(e); } } } } - public void setBadServerIdHandler( BadServerIdHandler handler ) - { + public void setBadServerIdHandler(BadServerIdHandler handler) { synchronized (badServerIdHandlerAccessLock) { badServerIdHandler = handler; } } - public void handleBadServerId( ObjectKey okey ) - { + public void handleBadServerId(ObjectKey okey) { synchronized (badServerIdHandlerAccessLock) { if (badServerIdHandler == null) { throw wrapper.badServerId(); @@ -1648,107 +1518,93 @@ public void handleBadServerId( ObjectKey okey ) } @Override - public synchronized org.omg.CORBA.Policy create_policy( int type, - org.omg.CORBA.Any val ) throws org.omg.CORBA.PolicyError - { - checkShutdownState() ; + public synchronized org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError { + checkShutdownState(); - return pihandler.create_policy( type, val ) ; + return pihandler.create_policy(type, val); } @Override - public synchronized void connect(org.omg.CORBA.Object servant) - { + public synchronized void connect(org.omg.CORBA.Object servant) { checkShutdownState(); if (getTOAFactory() == null) { throw wrapper.noToa(); } try { - String codebase = Util.getInstance().getCodebase( servant.getClass() ) ; - getTOAFactory().getTOA( codebase ).connect( servant ) ; - } catch ( Exception ex ) { - throw wrapper.orbConnectError( ex ) ; + String codebase = Util.getInstance().getCodebase(servant.getClass()); + getTOAFactory().getTOA(codebase).connect(servant); + } catch (Exception ex) { + throw wrapper.orbConnectError(ex); } } @Override - public synchronized void disconnect(org.omg.CORBA.Object obj) - { + public synchronized void disconnect(org.omg.CORBA.Object obj) { checkShutdownState(); if (getTOAFactory() == null) { throw wrapper.noToa(); } try { - getTOAFactory().getTOA().disconnect( obj ) ; - } catch ( Exception ex ) { - throw wrapper.orbConnectError( ex ) ; + getTOAFactory().getTOA().disconnect(obj); + } catch (Exception ex) { + throw wrapper.orbConnectError(ex); } } - public int getTransientServerId() - { - if( configData.getPersistentServerIdInitialized( ) ) { + public int getTransientServerId() { + if (configData.getPersistentServerIdInitialized()) { // ORBServerId is specified then use that value - return configData.getPersistentServerId( ); + return configData.getPersistentServerId(); } return transientServerId; } - public RequestDispatcherRegistry getRequestDispatcherRegistry() - { + public RequestDispatcherRegistry getRequestDispatcherRegistry() { return requestDispatcherRegistry; } - public ServiceContextFactoryRegistry getServiceContextFactoryRegistry() - { - return serviceContextFactoryRegistry ; - } + public ServiceContextFactoryRegistry getServiceContextFactoryRegistry() { + return serviceContextFactoryRegistry; + } - public ServiceContextsCache getServiceContextsCache() - { + public ServiceContextsCache getServiceContextsCache() { return serviceContextsCache; } // XXX All of the isLocalYYY checking needs to be revisited. // First of all, all three of these methods are called from - // only one place in impl.ior.IORImpl. Second, we have problems + // only one place in impl.ior.IORImpl. Second, we have problems // both with multi-homed hosts and with multi-profile IORs. // A possible strategy: like the LocalClientRequestDispatcher, we need // to determine this more abstractly at the ContactInfo level. // This level should probably just get the CorbaContactInfoList from - // the IOR, then iterator over ContactInfo. If any ContactInfo is - // local, the IOR is local, and we can pick one to create the - // LocalClientRequestDispatcher as well. Bottom line: this code needs to move. - public boolean isLocalHost( String hostName ) - { - return hostName.equals( configData.getORBServerHost() ) || - hostName.equals( getLocalHostName() ) ; + // the IOR, then iterator over ContactInfo. If any ContactInfo is + // local, the IOR is local, and we can pick one to create the + // LocalClientRequestDispatcher as well. Bottom line: this code needs to move. + public boolean isLocalHost(String hostName) { + return hostName.equals(configData.getORBServerHost()) || hostName.equals(getLocalHostName()); } @Subcontract - public boolean isLocalServerId( int subcontractId, int serverId ) - { + public boolean isLocalServerId(int subcontractId, int serverId) { if (subcontractDebugFlag) { int psid = -1; if (configData.getPersistentServerIdInitialized()) { psid = configData.getPersistentServerId(); } - isLocalServerIdInfo( subcontractId, serverId, - getTransientServerId(), - ORBConstants.isTransient(subcontractId), - configData.getPersistentServerIdInitialized(), psid ) ; + isLocalServerIdInfo(subcontractId, serverId, getTransientServerId(), ORBConstants.isTransient(subcontractId), + configData.getPersistentServerIdInitialized(), psid); } - if ((subcontractId < ORBConstants.FIRST_POA_SCID) || - (subcontractId > ORBConstants.MAX_POA_SCID)) { + if ((subcontractId < ORBConstants.FIRST_POA_SCID) || (subcontractId > ORBConstants.MAX_POA_SCID)) { return serverId == getTransientServerId(); } - + // XXX isTransient info should be stored in subcontract registry - if (ORBConstants.isTransient( subcontractId )) { + if (ORBConstants.isTransient(subcontractId)) { return serverId == getTransientServerId(); } else if (configData.getPersistentServerIdInitialized()) { return serverId == configData.getPersistentServerId(); @@ -1758,71 +1614,63 @@ public boolean isLocalServerId( int subcontractId, int serverId ) } /************************************************************************* - * The following public methods are for ORB shutdown. + * The following public methods are for ORB shutdown. *************************************************************************/ - private String getHostName(String host) - throws java.net.UnknownHostException - { - return InetAddress.getByName( host ).getHostAddress(); - } - - /* keeping a copy of the getLocalHostName so that it can only be called - * internally and the unauthorized clients cannot have access to the - * localHost information, originally, the above code was calling - * getLocalHostName from Connection.java. If the hostname is cached in - * Connection.java, then - * it is a security hole, since any unauthorized client has access to - * the host information. With this change it is used internally so the - * security problem is resolved. Also in Connection.java, the - * getLocalHost() implementation has changed to always call the - * InetAddress.getLocalHost().getHostAddress() - * The above mentioned method has been removed from the connection class + private String getHostName(String host) throws java.net.UnknownHostException { + return InetAddress.getByName(host).getHostAddress(); + } + + /* + * keeping a copy of the getLocalHostName so that it can only be called internally and the unauthorized clients cannot + * have access to the localHost information, originally, the above code was calling getLocalHostName from + * Connection.java. If the hostname is cached in Connection.java, then it is a security hole, since any unauthorized + * client has access to the host information. With this change it is used internally so the security problem is + * resolved. Also in Connection.java, the getLocalHost() implementation has changed to always call the + * InetAddress.getLocalHost().getHostAddress() The above mentioned method has been removed from the connection class */ private static String localHostString = null; - private synchronized String getLocalHostName() - { + private synchronized String getLocalHostName() { if (localHostString == null) { try { localHostString = InetAddress.getLocalHost().getHostAddress(); } catch (Exception ex) { - throw wrapper.getLocalHostFailed( ex ) ; + throw wrapper.getLocalHostFailed(ex); } } - return localHostString ; + return localHostString; } - /****************************************************************************** - * The following public methods are for ORB shutdown. - * - ******************************************************************************/ + /****************************************************************************** + * The following public methods are for ORB shutdown. + * + ******************************************************************************/ - /** This method always returns false because the ORB never needs the - * main thread to do work. + /** + * This method always returns false because the ORB never needs the main thread to do work. */ @Override - public synchronized boolean work_pending() - { + public synchronized boolean work_pending() { checkShutdownState(); - throw wrapper.genericNoImpl() ; + throw wrapper.genericNoImpl(); } - - /** This method does nothing. It is not required by the spec to do anything! + + /** + * This method does nothing. It is not required by the spec to do anything! */ @Override - public synchronized void perform_work() - { + public synchronized void perform_work() { checkShutdownState(); - throw wrapper.genericNoImpl() ; + throw wrapper.genericNoImpl(); } @Override - public synchronized void set_delegate(java.lang.Object servant){ + public synchronized void set_delegate(java.lang.Object servant) { checkShutdownState(); - POAFactory pf = getPOAFactory() ; + POAFactory pf = getPOAFactory(); if (pf != null) { ((org.omg.PortableServer.Servant) servant)._set_delegate(pf.getDelegateImpl()); } else { @@ -1831,57 +1679,54 @@ public synchronized void set_delegate(java.lang.Object servant){ } @InfoMethod - private void invocationInfoChange( String msg ) { } + private void invocationInfoChange(String msg) { + } @Subcontract public ClientInvocationInfo createOrIncrementInvocationInfo() { ClientInvocationInfo clientInvocationInfo = null; - StackImpl invocationInfoStack = - clientInvocationInfoStack.get(); + StackImpl invocationInfoStack = clientInvocationInfoStack.get(); if (!invocationInfoStack.empty()) { clientInvocationInfo = invocationInfoStack.peek(); } - if ((clientInvocationInfo == null) || - (!clientInvocationInfo.isRetryInvocation())) - { + if ((clientInvocationInfo == null) || (!clientInvocationInfo.isRetryInvocation())) { // This is a new call - not a retry. clientInvocationInfo = new InvocationInfo(); invocationInfoStack.push(clientInvocationInfo); - invocationInfoChange( "new call" ) ; + invocationInfoChange("new call"); } else { - invocationInfoChange( "retry" ) ; + invocationInfoChange("retry"); } // Reset retry so recursive calls will get a new info object. clientInvocationInfo.setIsRetryInvocation(false); clientInvocationInfo.incrementEntryCount(); return clientInvocationInfo; } - + @Subcontract public void releaseOrDecrementInvocationInfo() { int entryCount = -1; ClientInvocationInfo clientInvocationInfo = null; - StackImpl invocationInfoStack = - clientInvocationInfoStack.get(); + StackImpl invocationInfoStack = clientInvocationInfoStack.get(); if (!invocationInfoStack.empty()) { clientInvocationInfo = invocationInfoStack.peek(); } else { - throw wrapper.invocationInfoStackEmpty() ; + throw wrapper.invocationInfoStackEmpty(); } clientInvocationInfo.decrementEntryCount(); entryCount = clientInvocationInfo.getEntryCount(); if (clientInvocationInfo.getEntryCount() == 0 - // 6763340: don't pop if this is a retry! - && !clientInvocationInfo.isRetryInvocation()) { + // 6763340: don't pop if this is a retry! + && !clientInvocationInfo.isRetryInvocation()) { invocationInfoStack.pop(); - invocationInfoChange( "pop" ) ; + invocationInfoChange("pop"); } } - + public ClientInvocationInfo getInvocationInfo() { - return clientInvocationInfoStack.get().peek() ; + return clientInvocationInfoStack.get().peek(); } //////////////////////////////////////////////////// @@ -1891,133 +1736,119 @@ public ClientInvocationInfo getInvocationInfo() { private final Object clientDelegateFactoryAccessorLock = new Object(); - public void setClientDelegateFactory( ClientDelegateFactory factory ) - { + public void setClientDelegateFactory(ClientDelegateFactory factory) { synchronized (clientDelegateFactoryAccessorLock) { - clientDelegateFactory = factory ; + clientDelegateFactory = factory; } } - public ClientDelegateFactory getClientDelegateFactory() - { + public ClientDelegateFactory getClientDelegateFactory() { synchronized (clientDelegateFactoryAccessorLock) { - return clientDelegateFactory ; + return clientDelegateFactory; } } - private ReentrantReadWriteLock - corbaContactInfoListFactoryAccessLock = new ReentrantReadWriteLock(); - private Lock corbaContactInfoListFactoryReadLock = - corbaContactInfoListFactoryAccessLock.readLock(); - private Lock corbaContactInfoListFactoryWriteLock = - corbaContactInfoListFactoryAccessLock.writeLock(); - - public void setCorbaContactInfoListFactory( ContactInfoListFactory factory ) - { - corbaContactInfoListFactoryWriteLock.lock() ; + private ReentrantReadWriteLock corbaContactInfoListFactoryAccessLock = new ReentrantReadWriteLock(); + private Lock corbaContactInfoListFactoryReadLock = corbaContactInfoListFactoryAccessLock.readLock(); + private Lock corbaContactInfoListFactoryWriteLock = corbaContactInfoListFactoryAccessLock.writeLock(); + + public void setCorbaContactInfoListFactory(ContactInfoListFactory factory) { + corbaContactInfoListFactoryWriteLock.lock(); try { - corbaContactInfoListFactory = factory ; + corbaContactInfoListFactory = factory; } finally { - corbaContactInfoListFactoryWriteLock.unlock() ; + corbaContactInfoListFactoryWriteLock.unlock(); } } - public ContactInfoListFactory getCorbaContactInfoListFactory() - { - corbaContactInfoListFactoryReadLock.lock() ; + public ContactInfoListFactory getCorbaContactInfoListFactory() { + corbaContactInfoListFactoryReadLock.lock(); try { - return corbaContactInfoListFactory ; + return corbaContactInfoListFactory; } finally { - corbaContactInfoListFactoryReadLock.unlock() ; + corbaContactInfoListFactoryReadLock.unlock(); } } - public void setResolver( Resolver resolver ) { + public void setResolver(Resolver resolver) { synchronized (resolverLock) { - this.resolver = resolver ; + this.resolver = resolver; } } public Resolver getResolver() { synchronized (resolverLock) { - return resolver ; + return resolver; } } - public void setLocalResolver( LocalResolver resolver ) { + public void setLocalResolver(LocalResolver resolver) { synchronized (resolverLock) { - this.localResolver = resolver ; + this.localResolver = resolver; } } public LocalResolver getLocalResolver() { synchronized (resolverLock) { - return localResolver ; + return localResolver; } } - public void setURLOperation( Operation stringToObject ) { + public void setURLOperation(Operation stringToObject) { synchronized (urlOperationLock) { - urlOperation = stringToObject ; + urlOperation = stringToObject; } } public Operation getURLOperation() { synchronized (urlOperationLock) { - return urlOperation ; + return urlOperation; } } - public void setINSDelegate( ServerRequestDispatcher sdel ) { + public void setINSDelegate(ServerRequestDispatcher sdel) { synchronized (resolverLock) { - insNamingDelegate = sdel ; + insNamingDelegate = sdel; } } public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() { - return taggedComponentFactoryFinder ; + return taggedComponentFactoryFinder; } - public IdentifiableFactoryFinder - getTaggedProfileFactoryFinder() { - return taggedProfileFactoryFinder ; + public IdentifiableFactoryFinder getTaggedProfileFactoryFinder() { + return taggedProfileFactoryFinder; } - public IdentifiableFactoryFinder - getTaggedProfileTemplateFactoryFinder() { - return taggedProfileTemplateFactoryFinder ; + public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() { + return taggedProfileTemplateFactoryFinder; } private final Object objectKeyFactoryAccessLock = new Object(); - public ObjectKeyFactory getObjectKeyFactory() - { + public ObjectKeyFactory getObjectKeyFactory() { synchronized (objectKeyFactoryAccessLock) { - return objectKeyFactory ; + return objectKeyFactory; } } - public void setObjectKeyFactory( ObjectKeyFactory factory ) - { + public void setObjectKeyFactory(ObjectKeyFactory factory) { synchronized (objectKeyFactoryAccessLock) { - objectKeyFactory = factory ; + objectKeyFactory = factory; } } - public TransportManager getTransportManager() - { + public TransportManager getTransportManager() { return transportManager; } - public TransportManager getCorbaTransportManager() - { + public TransportManager getCorbaTransportManager() { return getTransportManager(); } private final Object legacyServerSocketManagerAccessLock = new Object(); - public LegacyServerSocketManager getLegacyServerSocketManager() - { + public LegacyServerSocketManager getLegacyServerSocketManager() { synchronized (legacyServerSocketManagerAccessLock) { if (legacyServerSocketManager == null) { legacyServerSocketManager = new LegacyServerSocketManagerImpl(this); @@ -2038,44 +1869,44 @@ public ThreadPoolManager getThreadPoolManager() { synchronized (threadPoolManagerAccessLock) { if (threadpoolMgr == null) { threadpoolMgr = new ThreadPoolManagerImpl(); - orbOwnsThreadPoolManager = true ; + orbOwnsThreadPoolManager = true; } return threadpoolMgr; } } public CopierManager getCopierManager() { - return copierManager ; + return copierManager; } @Override - public IOR getIOR( org.omg.CORBA.Object obj, boolean connectIfNecessary ) { - IOR result ; + public IOR getIOR(org.omg.CORBA.Object obj, boolean connectIfNecessary) { + IOR result; if (connectIfNecessary) { try { - result = getIOR( obj ) ; + result = getIOR(obj); } catch (BAD_OPERATION bop) { if (StubAdapter.isStub(obj)) { try { - StubAdapter.connect( obj, this ) ; + StubAdapter.connect(obj, this); } catch (java.rmi.RemoteException exc) { - throw wrapper.connectingServant( exc ) ; + throw wrapper.connectingServant(exc); } } else { - connect( obj ) ; + connect(obj); } - result = getIOR( obj ) ; + result = getIOR(obj); } } else { // Let any exceptions propagate out - result = getIOR( obj ) ; + result = getIOR(obj); } - - return result ; + + return result; } - + @Override public ObjectKeyCacheEntry extractObjectKeyCacheEntry(byte[] objKey) { if (objKey == null) { @@ -2084,13 +1915,12 @@ public ObjectKeyCacheEntry extractObjectKeyCacheEntry(byte[] objKey) { ByteArrayWrapper newObjKeyWrapper = new ByteArrayWrapper(objKey); - return objectKeyCache.get( newObjKeyWrapper ) ; + return objectKeyCache.get(newObjKeyWrapper); } @Override public synchronized boolean orbIsShutdown() { - return ((status == STATUS_DESTROYED) || - (status == STATUS_SHUTDOWN)) ; + return ((status == STATUS_DESTROYED) || (status == STATUS_SHUTDOWN)); } } // Class ORBImpl @@ -2112,7 +1942,7 @@ public void set() { _flag = true; } - // get value + // get value public boolean value() { return _flag; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBSingleton.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBSingleton.java index ff376cc16..0ae235439 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBSingleton.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBSingleton.java @@ -27,8 +27,6 @@ import java.net.URL; - - import org.omg.CORBA.ORBPackage.InvalidName; import org.omg.CORBA.NVList; import org.omg.CORBA.TCKind; @@ -44,10 +42,10 @@ import org.omg.CORBA.portable.OutputStream; -import com.sun.corba.ee.spi.protocol.ClientInvocationInfo ; +import com.sun.corba.ee.spi.protocol.ClientInvocationInfo; import com.sun.corba.ee.spi.transport.ContactInfo; import com.sun.corba.ee.spi.transport.ConnectionCache; -import com.sun.corba.ee.spi.transport.Selector ; +import com.sun.corba.ee.spi.transport.Selector; import com.sun.corba.ee.spi.transport.TransportManager; import com.sun.corba.ee.spi.orb.ORBData; @@ -68,7 +66,7 @@ import com.sun.corba.ee.spi.ior.ObjectKey; import com.sun.corba.ee.spi.ior.ObjectKeyFactory; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.transport.ContactInfoListFactory ; +import com.sun.corba.ee.spi.transport.ContactInfoListFactory; import com.sun.corba.ee.spi.transport.TransportManager; import com.sun.corba.ee.spi.legacy.connection.LegacyServerSocketManager; import com.sun.corba.ee.spi.threadpool.ThreadPoolManager; @@ -98,43 +96,42 @@ /** * The restricted singleton ORB implementation. * - * For now, this class must implement just enough functionality to be - * used as a factory for immutable TypeCode instances. + * For now, this class must implement just enough functionality to be used as a factory for immutable TypeCode + * instances. * * See ORBImpl.java for the real ORB implementation. + * * @see ORBImpl */ -public class ORBSingleton extends ORB -{ +public class ORBSingleton extends ORB { // This is used to support read_Object. private static ORB fullORB; - private static PresentationManager.StubFactoryFactory staticStubFactoryFactory = - PresentationDefaults.getStaticStubFactoryFactory() ; + private static PresentationManager.StubFactoryFactory staticStubFactoryFactory = PresentationDefaults.getStaticStubFactoryFactory(); // private TimerManager timerManager ; public ORBSingleton() { // timerManager = makeTimerManager( null ) ; - initializePrimitiveTypeCodeConstants() ; + initializePrimitiveTypeCodeConstants(); } @Override - public void setParameters( String params[], Properties props ) { - // this is never called by ORB.init() + public void setParameters(String params[], Properties props) { + // this is never called by ORB.init() } @Override - public void set_parameters( Properties props ) { - // this is never called by ORB.init() + public void set_parameters(Properties props) { + // this is never called by ORB.init() } @Override protected void set_parameters(Applet app, Properties props) { - // this is never called by ORB.init() + // this is never called by ORB.init() } @Override - protected void set_parameters (String params[], Properties props) { - // this is never called by ORB.init() + protected void set_parameters(String params[], Properties props) { + // this is never called by ORB.init() } @Override @@ -143,112 +140,81 @@ public OutputStream create_output_stream() { } @Override - public TypeCode create_struct_tc(String id, - String name, - StructMember[] members) - { + public TypeCode create_struct_tc(String id, String name, StructMember[] members) { return new TypeCodeImpl(this, TCKind._tk_struct, id, name, members); } - + @Override - public TypeCode create_union_tc(String id, - String name, - TypeCode discriminator_type, - UnionMember[] members) - { - return new TypeCodeImpl(this, - TCKind._tk_union, - id, - name, - discriminator_type, - members); + public TypeCode create_union_tc(String id, String name, TypeCode discriminator_type, UnionMember[] members) { + return new TypeCodeImpl(this, TCKind._tk_union, id, name, discriminator_type, members); } - + @Override - public TypeCode create_enum_tc(String id, String name, String[] members) - { + public TypeCode create_enum_tc(String id, String name, String[] members) { return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members); } - + @Override - public TypeCode create_alias_tc(String id, String name, TypeCode original_type) - { + public TypeCode create_alias_tc(String id, String name, TypeCode original_type) { return new TypeCodeImpl(this, TCKind._tk_alias, id, name, original_type); } - + @Override - public TypeCode create_exception_tc(String id, String name, StructMember[] members) - { + public TypeCode create_exception_tc(String id, String name, StructMember[] members) { return new TypeCodeImpl(this, TCKind._tk_except, id, name, members); } - + @Override - public TypeCode create_interface_tc(String id, String name) - { + public TypeCode create_interface_tc(String id, String name) { return new TypeCodeImpl(this, TCKind._tk_objref, id, name); } - + @Override public TypeCode create_string_tc(int bound) { return new TypeCodeImpl(this, TCKind._tk_string, bound); } - + @Override public TypeCode create_wstring_tc(int bound) { return new TypeCodeImpl(this, TCKind._tk_wstring, bound); } - + @Override - public TypeCode create_sequence_tc(int bound, - TypeCode element_type) - { + public TypeCode create_sequence_tc(int bound, TypeCode element_type) { return new TypeCodeImpl(this, TCKind._tk_sequence, bound, element_type); } - + @Override - public TypeCode create_recursive_sequence_tc(int bound, int offset) - { + public TypeCode create_recursive_sequence_tc(int bound, int offset) { return new TypeCodeImpl(this, TCKind._tk_sequence, bound, offset); } - + @Override - public TypeCode create_array_tc(int length, TypeCode element_type) - { + public TypeCode create_array_tc(int length, TypeCode element_type) { return new TypeCodeImpl(this, TCKind._tk_array, length, element_type); } @Override - public org.omg.CORBA.TypeCode create_native_tc(String id, - String name) - { + public org.omg.CORBA.TypeCode create_native_tc(String id, String name) { return new TypeCodeImpl(this, TCKind._tk_native, id, name); } @Override - public org.omg.CORBA.TypeCode create_abstract_interface_tc( - String id, - String name) - { + public org.omg.CORBA.TypeCode create_abstract_interface_tc(String id, String name) { return new TypeCodeImpl(this, TCKind._tk_abstract_interface, id, name); } @Override - public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale) - { + public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale) { return new TypeCodeImpl(this, TCKind._tk_fixed, digits, scale); } // orbos 98-01-18: Objects By Value -- begin @Override - public org.omg.CORBA.TypeCode create_value_tc(String id, - String name, - short type_modifier, - TypeCode concrete_base, - ValueMember[] members) - { - return new TypeCodeImpl(this, TCKind._tk_value, id, name, - type_modifier, concrete_base, members); + public org.omg.CORBA.TypeCode create_value_tc(String id, String name, short type_modifier, TypeCode concrete_base, + ValueMember[] members) { + return new TypeCodeImpl(this, TCKind._tk_value, id, name, type_modifier, concrete_base, members); } @Override @@ -257,17 +223,13 @@ public org.omg.CORBA.TypeCode create_recursive_tc(String id) { } @Override - public org.omg.CORBA.TypeCode create_value_box_tc(String id, - String name, - TypeCode boxed_type) - { + public org.omg.CORBA.TypeCode create_value_box_tc(String id, String name, TypeCode boxed_type) { return new TypeCodeImpl(this, TCKind._tk_value_box, id, name, boxed_type); } @Override - public TypeCode get_primitive_tc( TCKind tckind ) - { - return get_primitive_tc( tckind.value() ) ; + public TypeCode get_primitive_tc(TCKind tckind) { + return get_primitive_tc(tckind.value()); } @Override @@ -278,8 +240,7 @@ public Any create_any() { // TypeCodeFactory interface methods. // Keeping track of type codes by repository id. /* - * Not strictly needed for TypeCode factory duty but these seem - * harmless enough. + * Not strictly needed for TypeCode factory duty but these seem harmless enough. */ @Override @@ -289,7 +250,7 @@ public NVList create_list(int count) { @Override public org.omg.CORBA.NVList create_operation_list(org.omg.CORBA.Object oper) { - throw wrapper.genericNoImpl() ; + throw wrapper.genericNoImpl(); } @Override @@ -308,21 +269,18 @@ public org.omg.CORBA.ContextList create_context_list() { } @Override - public org.omg.CORBA.Context get_default_context() - { - throw wrapper.genericNoImpl() ; + public org.omg.CORBA.Context get_default_context() { + throw wrapper.genericNoImpl(); } @Override - public org.omg.CORBA.Environment create_environment() - { + public org.omg.CORBA.Environment create_environment() { return new EnvironmentImpl(); } @Override - public org.omg.CORBA.Current get_current() - { - throw wrapper.genericNoImpl() ; + public org.omg.CORBA.Current get_current() { + throw wrapper.genericNoImpl(); } /* @@ -330,29 +288,25 @@ public org.omg.CORBA.Current get_current() */ @Override - public String[] list_initial_services () - { - throw wrapper.genericNoImpl() ; + public String[] list_initial_services() { + throw wrapper.genericNoImpl(); } @Override - public org.omg.CORBA.Object resolve_initial_references(String identifier) - throws InvalidName - { - throw wrapper.genericNoImpl() ; + public org.omg.CORBA.Object resolve_initial_references(String identifier) throws InvalidName { + throw wrapper.genericNoImpl(); } @Override - public void register_initial_reference(String id, org.omg.CORBA.Object obj ) throws InvalidName - { - throw wrapper.genericNoImpl() ; + public void register_initial_reference(String id, org.omg.CORBA.Object obj) throws InvalidName { + throw wrapper.genericNoImpl(); } @Override public void send_multiple_requests_oneway(Request[] req) { throw new SecurityException("ORBSingleton: access denied"); } - + @Override public void send_multiple_requests_deferred(Request[] req) { throw new SecurityException("ORBSingleton: access denied"); @@ -362,7 +316,7 @@ public void send_multiple_requests_deferred(Request[] req) { public boolean poll_next_response() { throw new SecurityException("ORBSingleton: access denied"); } - + @Override public org.omg.CORBA.Request get_next_response() { throw new SecurityException("ORBSingleton: access denied"); @@ -378,9 +332,7 @@ public org.omg.CORBA.Object string_to_object(String s) { throw new SecurityException("ORBSingleton: access denied"); } - public java.rmi.Remote string_to_remote(String s) - throws java.rmi.RemoteException - { + public java.rmi.Remote string_to_remote(String s) throws java.rmi.RemoteException { throw new SecurityException("ORBSingleton: access denied"); } @@ -395,14 +347,12 @@ public void disconnect(org.omg.CORBA.Object obj) { } @Override - public void run() - { + public void run() { throw new SecurityException("ORBSingleton: access denied"); } @Override - public void shutdown(boolean wait_for_completion) - { + public void shutdown(boolean wait_for_completion) { throw new SecurityException("ORBSingleton: access denied"); } @@ -420,80 +370,69 @@ public void destroy() { } @Override - public boolean work_pending() - { + public boolean work_pending() { throw new SecurityException("ORBSingleton: access denied"); } @Override - public void perform_work() - { + public void perform_work() { throw new SecurityException("ORBSingleton: access denied"); } @Override - public org.omg.CORBA.portable.ValueFactory register_value_factory(String repositoryID, org.omg.CORBA.portable.ValueFactory factory) - { + public org.omg.CORBA.portable.ValueFactory register_value_factory(String repositoryID, org.omg.CORBA.portable.ValueFactory factory) { throw new SecurityException("ORBSingleton: access denied"); } @Override - public void unregister_value_factory(String repositoryID) - { + public void unregister_value_factory(String repositoryID) { throw new SecurityException("ORBSingleton: access denied"); } - + @Override - public org.omg.CORBA.portable.ValueFactory lookup_value_factory(String repositoryID) - { + public org.omg.CORBA.portable.ValueFactory lookup_value_factory(String repositoryID) { throw new SecurityException("ORBSingleton: access denied"); } @Override - public TransportManager getTransportManager() - { + public TransportManager getTransportManager() { throw new SecurityException("ORBSingleton: access denied"); } @Override - public TransportManager getCorbaTransportManager() - { + public TransportManager getCorbaTransportManager() { throw new SecurityException("ORBSingleton: access denied"); } @Override - public LegacyServerSocketManager getLegacyServerSocketManager() - { + public LegacyServerSocketManager getLegacyServerSocketManager() { throw new SecurityException("ORBSingleton: access denied"); } -/************************************************************************* - These are methods from com.sun.corba.ee.impl.se.core.ORB - ************************************************************************/ + /************************************************************************* + * These are methods from com.sun.corba.ee.impl.se.core.ORB + ************************************************************************/ - private synchronized ORB getFullORB() - { + private synchronized ORB getFullORB() { if (fullORB == null) { - Properties props = new Properties() ; + Properties props = new Properties(); // Do NOT allow this special ORB to be created with the // empty name, which could conflict with app server // requirement that first ORB created with the empty name has - // root monitoring agent name "orb" - props.setProperty( ORBConstants.ORB_ID_PROPERTY, - "_$$$_INTERNAL_FULL_ORB_ID_$$$_" ) ; + // root monitoring agent name "orb" + props.setProperty(ORBConstants.ORB_ID_PROPERTY, "_$$$_INTERNAL_FULL_ORB_ID_$$$_"); // We do not want to initialize the activation code here, because it is - // not included in the GF ORB bundles. There is no need for + // not included in the GF ORB bundles. There is no need for // activation code, because this internal "full" ORB is only used // to create typecodes that require a full ORB. - props.setProperty( ORBConstants.DISABLE_ORBD_INIT_PROPERTY, - "true" ) ; + props.setProperty(ORBConstants.DISABLE_ORBD_INIT_PROPERTY, "true"); - fullORB = new ORBImpl() ; - fullORB.set_parameters( props ) ; + fullORB = new ORBImpl(); + fullORB.set_parameters(props); } - return fullORB ; + return fullORB; } @Override @@ -502,13 +441,12 @@ public InvocationInterceptor getInvocationInterceptor() { } @Override - public void setInvocationInterceptor(InvocationInterceptor interceptor ) { + public void setInvocationInterceptor(InvocationInterceptor interceptor) { throw new SecurityException("ORBSingleton: access denied"); } @Override - public RequestDispatcherRegistry getRequestDispatcherRegistry() - { + public RequestDispatcherRegistry getRequestDispatcherRegistry() { // To enable read_Object. return getFullORB().getRequestDispatcherRegistry(); @@ -516,77 +454,72 @@ public RequestDispatcherRegistry getRequestDispatcherRegistry() /* * Return the service context registry + * * @return throws {@link SecurityException} */ @Override - public ServiceContextFactoryRegistry getServiceContextFactoryRegistry() - { + public ServiceContextFactoryRegistry getServiceContextFactoryRegistry() { throw new SecurityException("ORBSingleton: access denied"); } /** * Return the service context cache as null + * * @return {@code null} */ @Override - public ServiceContextsCache getServiceContextsCache() - { + public ServiceContextsCache getServiceContextsCache() { return null; } /** * Get the transient server ID + * * @return throws {@link SecurityException} */ @Override - public int getTransientServerId() - { + public int getTransientServerId() { throw new SecurityException("ORBSingleton: access denied"); } /** * Return the bootstrap naming port specified in the ORBInitialPort param. + * * @return throws {@link SecurityException} */ - public int getORBInitialPort() - { + public int getORBInitialPort() { throw new SecurityException("ORBSingleton: access denied"); } /** * Return the bootstrap naming host specified in the ORBInitialHost param. + * * @return throws {@link SecurityException} */ - public String getORBInitialHost() - { + public String getORBInitialHost() { throw new SecurityException("ORBSingleton: access denied"); } - public String getORBServerHost() - { + public String getORBServerHost() { throw new SecurityException("ORBSingleton: access denied"); } - public int getORBServerPort() - { + public int getORBServerPort() { throw new SecurityException("ORBSingleton: access denied"); } - public CodeSetComponentInfo getCodeSetComponentInfo() - { - return new CodeSetComponentInfo(); + public CodeSetComponentInfo getCodeSetComponentInfo() { + return new CodeSetComponentInfo(); } @Override - public boolean isLocalHost( String host ) - { + public boolean isLocalHost(String host) { // To enable read_Object. return false; } @Override - public boolean isLocalServerId( int subcontractId, int serverId ) - { + public boolean isLocalServerId(int subcontractId, int serverId) { // To enable read_Object. return false; } @@ -595,37 +528,33 @@ public boolean isLocalServerId( int subcontractId, int serverId ) * Things from corba.ORB. */ @Override - public ORBVersion getORBVersion() - { + public ORBVersion getORBVersion() { // Always use our latest ORB version (latest fixes, etc) return ORBVersionFactory.getORBVersion(); } @Override - public void setORBVersion(ORBVersion verObj) - { + public void setORBVersion(ORBVersion verObj) { throw new SecurityException("ORBSingleton: access denied"); } - public String getAppletHost() - { + public String getAppletHost() { throw new SecurityException("ORBSingleton: access denied"); } - public URL getAppletCodeBase() - { + public URL getAppletCodeBase() { throw new SecurityException("ORBSingleton: access denied"); } - public int getHighWaterMark(){ + public int getHighWaterMark() { throw new SecurityException("ORBSingleton: access denied"); } - public int getLowWaterMark(){ + public int getLowWaterMark() { throw new SecurityException("ORBSingleton: access denied"); } - public int getNumberToReclaim(){ + public int getNumberToReclaim() { throw new SecurityException("ORBSingleton: access denied"); } @@ -638,234 +567,193 @@ public int getGIOPBuffMgrStrategy(GIOPVersion gv) { } @Override - public IOR getFVDCodeBaseIOR(){ + public IOR getFVDCodeBaseIOR() { throw new SecurityException("ORBSingleton: access denied"); } - + @Override - public Policy create_policy( int type, Any val ) throws PolicyError - { + public Policy create_policy(int type, Any val) throws PolicyError { throw new NO_IMPLEMENT(); } - public LegacyServerSocketEndPointInfo getServerEndpoint() - { - return null ; + public LegacyServerSocketEndPointInfo getServerEndpoint() { + return null; } - public void setPersistentServerId( int id ) - { + public void setPersistentServerId(int id) { } @Override - public TypeCodeImpl getTypeCodeForClass( Class c ) - { - return null ; + public TypeCodeImpl getTypeCodeForClass(Class c) { + return null; } @Override - public void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl ) - { + public void setTypeCodeForClass(Class c, TypeCodeImpl tcimpl) { } - public boolean alwaysSendCodeSetServiceContext() - { - return true ; + public boolean alwaysSendCodeSetServiceContext() { + return true; } @Override - public boolean isDuringDispatch() - { - return false ; + public boolean isDuringDispatch() { + return false; } @Override - public void notifyORB() { } + public void notifyORB() { + } @Override - public PIHandler getPIHandler() - { - return null ; + public PIHandler getPIHandler() { + return null; } @Override - public void createPIHandler() - { + public void createPIHandler() { } - public void checkShutdownState() - { + public void checkShutdownState() { } @Override - public void startingDispatch() - { + public void startingDispatch() { } @Override - public void finishedDispatch() - { + public void finishedDispatch() { } - public void registerInitialReference( String id, - NullaryFunction closure ) - { + public void registerInitialReference(String id, NullaryFunction closure) { } @Override - public ORBData getORBData() - { - return getFullORB().getORBData() ; + public ORBData getORBData() { + return getFullORB().getORBData(); } @Override - public void setClientDelegateFactory( ClientDelegateFactory factory ) - { + public void setClientDelegateFactory(ClientDelegateFactory factory) { } @Override - public ClientDelegateFactory getClientDelegateFactory() - { - return getFullORB().getClientDelegateFactory() ; + public ClientDelegateFactory getClientDelegateFactory() { + return getFullORB().getClientDelegateFactory(); } @Override - public void setCorbaContactInfoListFactory( ContactInfoListFactory factory ) - { + public void setCorbaContactInfoListFactory(ContactInfoListFactory factory) { } @Override - public ContactInfoListFactory getCorbaContactInfoListFactory() - { - return getFullORB().getCorbaContactInfoListFactory() ; + public ContactInfoListFactory getCorbaContactInfoListFactory() { + return getFullORB().getCorbaContactInfoListFactory(); } @Override - public Operation getURLOperation() - { - return null ; + public Operation getURLOperation() { + return null; } @Override - public void setINSDelegate( ServerRequestDispatcher sdel ) - { + public void setINSDelegate(ServerRequestDispatcher sdel) { } @Override - public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() - { - return getFullORB().getTaggedComponentFactoryFinder() ; + public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() { + return getFullORB().getTaggedComponentFactoryFinder(); } @Override - public IdentifiableFactoryFinder getTaggedProfileFactoryFinder() - { - return getFullORB().getTaggedProfileFactoryFinder() ; + public IdentifiableFactoryFinder getTaggedProfileFactoryFinder() { + return getFullORB().getTaggedProfileFactoryFinder(); } @Override - public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() - { - return getFullORB().getTaggedProfileTemplateFactoryFinder() ; + public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() { + return getFullORB().getTaggedProfileTemplateFactoryFinder(); } @Override - public ObjectKeyFactory getObjectKeyFactory() - { - return getFullORB().getObjectKeyFactory() ; + public ObjectKeyFactory getObjectKeyFactory() { + return getFullORB().getObjectKeyFactory(); } @Override - public void setObjectKeyFactory( ObjectKeyFactory factory ) - { + public void setObjectKeyFactory(ObjectKeyFactory factory) { throw new SecurityException("ORBSingleton: access denied"); } @Override - public void handleBadServerId( ObjectKey okey ) - { + public void handleBadServerId(ObjectKey okey) { } @Override - public OAInvocationInfo peekInvocationInfo() - { - return null ; + public OAInvocationInfo peekInvocationInfo() { + return null; } @Override - public void pushInvocationInfo( OAInvocationInfo info ) - { + public void pushInvocationInfo(OAInvocationInfo info) { } @Override - public OAInvocationInfo popInvocationInfo() - { - return null ; + public OAInvocationInfo popInvocationInfo() { + return null; } @Override - public ClientInvocationInfo createOrIncrementInvocationInfo() - { - return null ; + public ClientInvocationInfo createOrIncrementInvocationInfo() { + return null; } - + @Override - public void releaseOrDecrementInvocationInfo() - { + public void releaseOrDecrementInvocationInfo() { } - + @Override - public ClientInvocationInfo getInvocationInfo() - { - return null ; + public ClientInvocationInfo getInvocationInfo() { + return null; } - public ConnectionCache getConnectionCache(ContactInfo contactInfo) - { + public ConnectionCache getConnectionCache(ContactInfo contactInfo) { return null; } - + @Override - public void setResolver( Resolver resolver ) - { + public void setResolver(Resolver resolver) { } @Override - public Resolver getResolver() - { - return null ; + public Resolver getResolver() { + return null; } @Override - public void setLocalResolver( LocalResolver resolver ) - { + public void setLocalResolver(LocalResolver resolver) { } @Override - public LocalResolver getLocalResolver() - { - return null ; + public LocalResolver getLocalResolver() { + return null; } @Override - public void setURLOperation( Operation stringToObject ) - { + public void setURLOperation(Operation stringToObject) { } // NOTE: REMOVE THIS METHOD ONCE WE HAVE A ORT BASED ORBD @Override - public void setBadServerIdHandler( BadServerIdHandler handler ) - { + public void setBadServerIdHandler(BadServerIdHandler handler) { } // NOTE: REMOVE THIS METHOD ONCE WE HAVE A ORT BASED ORBD @Override - public void initBadServerIdHandler() - { + public void initBadServerIdHandler() { } - public Selector getSelector(int x) - { + public Selector getSelector(int x) { return null; } @@ -880,14 +768,12 @@ public ThreadPoolManager getThreadPoolManager() { @Override public CopierManager getCopierManager() { - return null ; + return null; } /* - public TimerManager getTimerManager() { - return timerManager ; - } - */ + * public TimerManager getTimerManager() { return timerManager ; } + */ } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBVersionImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBVersionImpl.java index 51569865a..e7b5fbd50 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBVersionImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ORBVersionImpl.java @@ -17,65 +17,53 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import org.omg.CORBA.portable.OutputStream ; +import org.omg.CORBA.portable.OutputStream; -import com.sun.corba.ee.spi.orb.ORBVersion ; +import com.sun.corba.ee.spi.orb.ORBVersion; public class ORBVersionImpl implements ORBVersion { - private byte orbType ; + private byte orbType; - public ORBVersionImpl( byte orbType ) - { - this.orbType = orbType ; + public ORBVersionImpl(byte orbType) { + this.orbType = orbType; } - public static final ORBVersion FOREIGN = new ORBVersionImpl( - ORBVersion.FOREIGN ) ; + public static final ORBVersion FOREIGN = new ORBVersionImpl(ORBVersion.FOREIGN); - public static final ORBVersion OLD = new ORBVersionImpl( - ORBVersion.OLD ) ; + public static final ORBVersion OLD = new ORBVersionImpl(ORBVersion.OLD); - public static final ORBVersion NEW = new ORBVersionImpl( - ORBVersion.NEW ) ; + public static final ORBVersion NEW = new ORBVersionImpl(ORBVersion.NEW); - public static final ORBVersion JDK1_3_1_01 = new ORBVersionImpl( - ORBVersion.JDK1_3_1_01 ) ; + public static final ORBVersion JDK1_3_1_01 = new ORBVersionImpl(ORBVersion.JDK1_3_1_01); - public static final ORBVersion NEWER = new ORBVersionImpl( - ORBVersion.NEWER ) ; + public static final ORBVersion NEWER = new ORBVersionImpl(ORBVersion.NEWER); - public static final ORBVersion PEORB = new ORBVersionImpl( - ORBVersion.PEORB ) ; + public static final ORBVersion PEORB = new ORBVersionImpl(ORBVersion.PEORB); - public byte getORBType() - { - return orbType ; + public byte getORBType() { + return orbType; } - public void write( OutputStream os ) - { - os.write_octet( (byte)orbType ) ; + public void write(OutputStream os) { + os.write_octet((byte) orbType); } - public String toString() - { - return "ORBVersionImpl[" + Byte.toString( orbType ) + "]" ; + public String toString() { + return "ORBVersionImpl[" + Byte.toString(orbType) + "]"; } - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (!(obj instanceof ORBVersion)) - return false ; + return false; - ORBVersion version = (ORBVersion)obj ; - return version.getORBType() == orbType ; + ORBVersion version = (ORBVersion) obj; + return version.getORBType() == orbType; } - public int hashCode() - { - return orbType ; + public int hashCode() { + return orbType; } public boolean lessThan(ORBVersion version) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryBase.java index 0b2ba3d94..89fd3258d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryBase.java @@ -17,23 +17,22 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import com.sun.corba.ee.spi.orb.ObjectKeyCacheEntry ; +import com.sun.corba.ee.spi.orb.ObjectKeyCacheEntry; -import com.sun.corba.ee.spi.ior.ObjectKey ; +import com.sun.corba.ee.spi.ior.ObjectKey; -import com.sun.corba.ee.spi.oa.ObjectAdapter ; +import com.sun.corba.ee.spi.oa.ObjectAdapter; public abstract class ObjectKeyCacheEntryBase implements ObjectKeyCacheEntry { - private ObjectKey okey ; + private ObjectKey okey; - public ObjectKeyCacheEntryBase( ObjectKey okey ) { - this.okey = okey ; + public ObjectKeyCacheEntryBase(ObjectKey okey) { + this.okey = okey; } public ObjectKey getObjectKey() { - return okey ; + return okey; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryImpl.java index 1af6764c7..9cd17b0a6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryImpl.java @@ -17,31 +17,31 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import com.sun.corba.ee.spi.orb.ObjectKeyCacheEntry ; +import com.sun.corba.ee.spi.orb.ObjectKeyCacheEntry; -import com.sun.corba.ee.spi.ior.ObjectKey ; +import com.sun.corba.ee.spi.ior.ObjectKey; -import com.sun.corba.ee.spi.oa.ObjectAdapter ; +import com.sun.corba.ee.spi.oa.ObjectAdapter; public class ObjectKeyCacheEntryImpl extends ObjectKeyCacheEntryBase { - private volatile ObjectAdapter oa ; + private volatile ObjectAdapter oa; - public ObjectKeyCacheEntryImpl( ObjectKey okey ) { - super( okey ) ; - oa = null ; + public ObjectKeyCacheEntryImpl(ObjectKey okey) { + super(okey); + oa = null; } public ObjectAdapter getObjectAdapter() { - return oa ; + return oa; } public void clearObjectAdapter() { - oa = null ; + oa = null; } - public void setObjectAdapter( ObjectAdapter oa ) { - this.oa = oa ; + public void setObjectAdapter(ObjectAdapter oa) { + this.oa = oa; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryNoObjectAdapterImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryNoObjectAdapterImpl.java index 6ff718483..137a9912f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryNoObjectAdapterImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ObjectKeyCacheEntryNoObjectAdapterImpl.java @@ -17,24 +17,26 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import com.sun.corba.ee.spi.orb.ObjectKeyCacheEntry ; +import com.sun.corba.ee.spi.orb.ObjectKeyCacheEntry; -import com.sun.corba.ee.spi.ior.ObjectKey ; +import com.sun.corba.ee.spi.ior.ObjectKey; -import com.sun.corba.ee.spi.oa.ObjectAdapter ; +import com.sun.corba.ee.spi.oa.ObjectAdapter; public class ObjectKeyCacheEntryNoObjectAdapterImpl extends ObjectKeyCacheEntryBase { - public ObjectKeyCacheEntryNoObjectAdapterImpl( ObjectKey okey ) { - super( okey ) ; + public ObjectKeyCacheEntryNoObjectAdapterImpl(ObjectKey okey) { + super(okey); } public ObjectAdapter getObjectAdapter() { - return null ; + return null; } - public void clearObjectAdapter() { } + public void clearObjectAdapter() { + } - public void setObjectAdapter( ObjectAdapter oa ) { } + public void setObjectAdapter(ObjectAdapter oa) { + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserAction.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserAction.java index 08e95acf8..c025fbec3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserAction.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserAction.java @@ -18,31 +18,37 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.util.Properties ; +import java.util.Properties; public interface ParserAction { - /** Return the property name or prefix for which this action - * is applied. + /** + * Return the property name or prefix for which this action is applied. + * * @return the property name or prefix. */ String getPropertyName(); - /** Return whether this action is for an exact match or a prefix - * match (true). + /** + * Return whether this action is for an exact match or a prefix match (true). + * * @return true if this action is for an exact or prefix match. */ boolean isPrefix(); - /** Return the field name in an object that is set with the result + /** + * Return the field name in an object that is set with the result + * * @return the field name */ String getFieldName(); - /** Apply this action to props and return the result. + /** + * Apply this action to props and return the result. + * * @param props properties to apply action to * @return result of action - */ - Object apply( Properties props ); + */ + Object apply(Properties props); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserActionBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserActionBase.java index a6199ae92..1f26d9980 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserActionBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserActionBase.java @@ -17,69 +17,57 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.util.Properties ; +import java.util.Properties; -import com.sun.corba.ee.spi.orb.Operation ; +import com.sun.corba.ee.spi.orb.Operation; public abstract class ParserActionBase implements ParserAction { - private String propertyName ; - private boolean prefix ; - private Operation operation ; - private String fieldName ; + private String propertyName; + private boolean prefix; + private Operation operation; + private String fieldName; - public int hashCode() - { - return propertyName.hashCode() ^ operation.hashCode() ^ - fieldName.hashCode() ^ (prefix ? 0 : 1) ; + public int hashCode() { + return propertyName.hashCode() ^ operation.hashCode() ^ fieldName.hashCode() ^ (prefix ? 0 : 1); } - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (obj == this) - return true ; + return true; if (!(obj instanceof ParserActionBase)) - return false ; + return false; - ParserActionBase other = (ParserActionBase)obj ; + ParserActionBase other = (ParserActionBase) obj; - return propertyName.equals( other.propertyName ) && - prefix == other.prefix && - operation.equals( other.operation ) && - fieldName.equals( other.fieldName ) ; + return propertyName.equals(other.propertyName) && prefix == other.prefix && operation.equals(other.operation) + && fieldName.equals(other.fieldName); } - public ParserActionBase( String propertyName, boolean prefix, - Operation operation, String fieldName ) - { - this.propertyName = propertyName ; - this.prefix = prefix ; - this.operation = operation ; - this.fieldName = fieldName ; + public ParserActionBase(String propertyName, boolean prefix, Operation operation, String fieldName) { + this.propertyName = propertyName; + this.prefix = prefix; + this.operation = operation; + this.fieldName = fieldName; } - public String getPropertyName() - { - return propertyName ; + public String getPropertyName() { + return propertyName; } - public boolean isPrefix() - { - return prefix ; + public boolean isPrefix() { + return prefix; } - public String getFieldName() - { - return fieldName ; + public String getFieldName() { + return fieldName; } - public abstract Object apply( Properties props ) ; + public abstract Object apply(Properties props); - protected Operation getOperation() - { - return operation ; + protected Operation getOperation() { + return operation; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserActionFactory.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserActionFactory.java index 213bbe2d4..91d30675a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserActionFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserActionFactory.java @@ -17,22 +17,19 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import com.sun.corba.ee.spi.orb.Operation ; +import com.sun.corba.ee.spi.orb.Operation; -public class ParserActionFactory{ - private ParserActionFactory() {} +public class ParserActionFactory { + private ParserActionFactory() { + } - public static ParserAction makeNormalAction( String propertyName, - Operation operation, String fieldName ) - { - return new NormalParserAction( propertyName, operation, fieldName ) ; + public static ParserAction makeNormalAction(String propertyName, Operation operation, String fieldName) { + return new NormalParserAction(propertyName, operation, fieldName); } - public static ParserAction makePrefixAction( String propertyName, - Operation operation, String fieldName, Class componentType ) - { - return new PrefixParserAction( propertyName, operation, fieldName, componentType ) ; + public static ParserAction makePrefixAction(String propertyName, Operation operation, String fieldName, Class componentType) { + return new PrefixParserAction(propertyName, operation, fieldName, componentType); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserDataBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserDataBase.java index 617005464..11e649473 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserDataBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserDataBase.java @@ -17,32 +17,43 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import com.sun.corba.ee.spi.orb.ParserData ; -import com.sun.corba.ee.spi.orb.Operation ; +import com.sun.corba.ee.spi.orb.ParserData; +import com.sun.corba.ee.spi.orb.Operation; public abstract class ParserDataBase implements ParserData { - private String propertyName ; - private Operation operation ; - private String fieldName ; - private Object defaultValue ; - private Object testValue ; - - protected ParserDataBase( String propertyName, - Operation operation, String fieldName, Object defaultValue, - Object testValue ) - { - this.propertyName = propertyName ; - this.operation = operation ; - this.fieldName = fieldName ; - this.defaultValue = defaultValue ; - this.testValue = testValue ; + private String propertyName; + private Operation operation; + private String fieldName; + private Object defaultValue; + private Object testValue; + + protected ParserDataBase(String propertyName, Operation operation, String fieldName, Object defaultValue, Object testValue) { + this.propertyName = propertyName; + this.operation = operation; + this.fieldName = fieldName; + this.defaultValue = defaultValue; + this.testValue = testValue; + } + + public String getPropertyName() { + return propertyName; + } + + public Operation getOperation() { + return operation; } - public String getPropertyName() { return propertyName ; } - public Operation getOperation() { return operation ; } - public String getFieldName() { return fieldName ; } - public Object getDefaultValue() { return defaultValue ; } - public Object getTestValue() { return testValue ; } + public String getFieldName() { + return fieldName; + } + + public Object getDefaultValue() { + return defaultValue; + } + + public Object getTestValue() { + return testValue; + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserTable.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserTable.java index d05942098..bde0d4f54 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserTable.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/ParserTable.java @@ -17,41 +17,41 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; import java.net.SocketException; import java.net.InetSocketAddress; -import java.net.Socket ; -import java.net.ServerSocket ; +import java.net.Socket; +import java.net.ServerSocket; -import java.util.HashMap ; +import java.util.HashMap; import java.util.List; -import java.util.Map ; +import java.util.Map; -import java.security.AccessController ; -import java.security.PrivilegedExceptionAction ; -import java.security.PrivilegedActionException ; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; -import javax.management.ObjectName ; +import javax.management.ObjectName; -import org.omg.PortableInterceptor.ORBInitializer ; -import org.omg.PortableInterceptor.ORBInitInfo ; +import org.omg.PortableInterceptor.ORBInitializer; +import org.omg.PortableInterceptor.ORBInitInfo; import com.sun.corba.ee.impl.encoding.CDROutputObject; import com.sun.corba.ee.spi.protocol.MessageMediator; import com.sun.corba.ee.spi.transport.ContactInfo; import com.sun.corba.ee.spi.transport.EventHandler; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.IORTemplate ; -import com.sun.corba.ee.spi.ior.ObjectKey ; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.IORTemplate; +import com.sun.corba.ee.spi.ior.ObjectKey; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.orb.Operation ; -import com.sun.corba.ee.spi.orb.OperationFactory ; -import com.sun.corba.ee.spi.orb.OperationFactoryExt ; -import com.sun.corba.ee.spi.orb.ParserData ; -import com.sun.corba.ee.spi.orb.ParserDataFactory ; +import com.sun.corba.ee.spi.orb.Operation; +import com.sun.corba.ee.spi.orb.OperationFactory; +import com.sun.corba.ee.spi.orb.OperationFactoryExt; +import com.sun.corba.ee.spi.orb.ParserData; +import com.sun.corba.ee.spi.orb.ParserDataFactory; import com.sun.corba.ee.spi.transport.Acceptor; import com.sun.corba.ee.spi.transport.ContactInfoList; import com.sun.corba.ee.spi.transport.ContactInfoListFactory; @@ -61,15 +61,15 @@ import com.sun.corba.ee.spi.transport.TcpTimeouts; import com.sun.corba.ee.impl.oa.poa.Policies; -import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo ; -import com.sun.corba.ee.impl.encoding.OSFCodeSetRegistry ; -import com.sun.corba.ee.impl.legacy.connection.USLPort ; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; -import com.sun.corba.ee.impl.oa.poa.BadServerIdHandler ; -import com.sun.corba.ee.spi.misc.ORBConstants ; -import com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr ; -import com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr ; -import com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr ; +import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; +import com.sun.corba.ee.impl.encoding.OSFCodeSetRegistry; +import com.sun.corba.ee.impl.legacy.connection.USLPort; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; +import com.sun.corba.ee.impl.oa.poa.BadServerIdHandler; +import com.sun.corba.ee.spi.misc.ORBConstants; +import com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr; +import com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr; +import com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr; import com.sun.corba.ee.impl.transport.DefaultIORToSocketInfoImpl; import com.sun.corba.ee.impl.transport.DefaultSocketFactoryImpl; import com.sun.corba.ee.impl.transport.TcpTimeoutsImpl; @@ -77,463 +77,289 @@ import org.glassfish.pfl.basic.contain.Pair; import org.glassfish.pfl.basic.func.UnaryFunction; -/** Initialize the parser data for the standard ORB parser. This is used both - * to implement ORBDataParserImpl and to provide the basic testing framework - * for ORBDataParserImpl. +/** + * Initialize the parser data for the standard ORB parser. This is used both to implement ORBDataParserImpl and to + * provide the basic testing framework for ORBDataParserImpl. */ public class ParserTable { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // There is a serious problem here with the DefaultSocketFactory. // It is NOT immutable: in particular is has a setORB method, so instances // of DefaultSocketFactoryImpl CANNOT be shared across ORBs. // To clean this up, we'll simply create a new ParserTable for each call to // get. - private static String MY_CLASS_NAME = ParserTable.class.getName() ; + private static String MY_CLASS_NAME = ParserTable.class.getName(); // private static final ParserTable myInstance = new ParserTable() ; - private Operation classAction ; + private Operation classAction; - public static ParserTable get( UnaryFunction> cnr ) - { + public static ParserTable get(UnaryFunction> cnr) { // return myInstance ; - return new ParserTable( cnr ) ; + return new ParserTable(cnr); } - private ParserData[] parserData ; + private ParserData[] parserData; - public ParserData[] getParserData() - { - return parserData ; + public ParserData[] getParserData() { + return parserData; } - public static ObjectName testGmbalRootParentName ; + public static ObjectName testGmbalRootParentName; - public final static String TEST_GMBAL_ROOT_PARENT_NAME = - "test:pp=\"/\",type=\"Foo\",name=\"1\"" ; + public final static String TEST_GMBAL_ROOT_PARENT_NAME = "test:pp=\"/\",type=\"Foo\",name=\"1\""; static { try { - testGmbalRootParentName = new ObjectName( TEST_GMBAL_ROOT_PARENT_NAME ) ; + testGmbalRootParentName = new ObjectName(TEST_GMBAL_ROOT_PARENT_NAME); } catch (Exception exc) { - testGmbalRootParentName = null ; + testGmbalRootParentName = null; } } - private ParserTable( UnaryFunction> cnr ) { - classAction = OperationFactory.classAction( cnr ) ; - - String codeSetTestString = - OSFCodeSetRegistry.ISO_8859_1_VALUE + "," + - OSFCodeSetRegistry.UTF_16_VALUE + "," + - OSFCodeSetRegistry.ISO_646_VALUE ; - - String[] debugTestData = { "subcontract", "poa", "transport" } ; - - USLPort[] USLPorts = { new USLPort( "FOO", 2701 ), new USLPort( "BAR", 3333 ) } ; - - TcpTimeouts testTcpTimeouts = TcpTimeouts.factory.create( - 2000, 6000, 20 ) ; - - TcpTimeouts defaultTcpTimeouts = TcpTimeouts.factory.create( - ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_BACKOFF_FACTOR); - - TcpTimeouts testTcpConnectTimeouts = TcpTimeouts.factory.create( - 20, 60000, 100, 5000 ) ; - - TcpTimeouts defaultTcpConnectTimeouts = TcpTimeouts.factory.create( - ORBConstants.TRANSPORT_TCP_CONNECT_INITIAL_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_CONNECT_MAX_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_CONNECT_BACKOFF_FACTOR, - ORBConstants.TRANSPORT_TCP_CONNECT_MAX_SINGLE_WAIT ); - - ORBInitializer[] TestORBInitializers = - { null, - new TestORBInitializer1(), - new TestORBInitializer2() } ; - Pair[] TestORBInitData = { - new Pair( "foo.bar.blech.NonExistent", "dummy" ), - new Pair( MY_CLASS_NAME + "$TestORBInitializer1", "dummy" ), - new Pair( MY_CLASS_NAME + "$TestORBInitializer2", "dummy" ) } ; - - Acceptor[] TestAcceptors = - { null, - new TestAcceptor2(), - new TestAcceptor1() - } ; + private ParserTable(UnaryFunction> cnr) { + classAction = OperationFactory.classAction(cnr); + + String codeSetTestString = OSFCodeSetRegistry.ISO_8859_1_VALUE + "," + OSFCodeSetRegistry.UTF_16_VALUE + "," + + OSFCodeSetRegistry.ISO_646_VALUE; + + String[] debugTestData = { "subcontract", "poa", "transport" }; + + USLPort[] USLPorts = { new USLPort("FOO", 2701), new USLPort("BAR", 3333) }; + + TcpTimeouts testTcpTimeouts = TcpTimeouts.factory.create(2000, 6000, 20); + + TcpTimeouts defaultTcpTimeouts = TcpTimeouts.factory.create(ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT, + ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT, ORBConstants.TRANSPORT_TCP_BACKOFF_FACTOR); + + TcpTimeouts testTcpConnectTimeouts = TcpTimeouts.factory.create(20, 60000, 100, 5000); + + TcpTimeouts defaultTcpConnectTimeouts = TcpTimeouts.factory.create(ORBConstants.TRANSPORT_TCP_CONNECT_INITIAL_TIME_TO_WAIT, + ORBConstants.TRANSPORT_TCP_CONNECT_MAX_TIME_TO_WAIT, ORBConstants.TRANSPORT_TCP_CONNECT_BACKOFF_FACTOR, + ORBConstants.TRANSPORT_TCP_CONNECT_MAX_SINGLE_WAIT); + + ORBInitializer[] TestORBInitializers = { null, new TestORBInitializer1(), new TestORBInitializer2() }; + Pair[] TestORBInitData = { new Pair("foo.bar.blech.NonExistent", "dummy"), + new Pair(MY_CLASS_NAME + "$TestORBInitializer1", "dummy"), + new Pair(MY_CLASS_NAME + "$TestORBInitializer2", "dummy") }; + + Acceptor[] TestAcceptors = { null, new TestAcceptor2(), new TestAcceptor1() }; // REVISIT: The test data gets put into a Properties object where - // order is not guaranteed. Thus the above array is in reverse. - Pair[] TestAcceptorData = { - new Pair( "foo.bar.blech.NonExistent", "dummy" ), - new Pair( MY_CLASS_NAME + "$TestAcceptor1", "dummy" ), - new Pair( MY_CLASS_NAME + "$TestAcceptor2", "dummy" ) } ; + // order is not guaranteed. Thus the above array is in reverse. + Pair[] TestAcceptorData = { new Pair("foo.bar.blech.NonExistent", "dummy"), + new Pair(MY_CLASS_NAME + "$TestAcceptor1", "dummy"), + new Pair(MY_CLASS_NAME + "$TestAcceptor2", "dummy") }; - Pair[] TestORBInitRefData = - { new Pair( "Foo", "ior:930492049394" ), - new Pair( "Bar", "ior:3453465785633576" ) } ; + Pair[] TestORBInitRefData = { new Pair("Foo", "ior:930492049394"), + new Pair("Bar", "ior:3453465785633576") }; // Why are we not handling INITIAL_SERVICES? // URL testServicesURL = null ; - // String testServicesString = "corbaloc::camelot/NameService" ; + // String testServicesString = "corbaloc::camelot/NameService" ; // try { - // testServicesURL = new URL( testServicesString ) ; + // testServicesURL = new URL( testServicesString ) ; // } catch (Exception exc) { // } - // propertyName, - // operation, - // fieldName, defaultValue, - // testValue, testData (string or Pair[]) + // propertyName, + // operation, + // fieldName, defaultValue, + // testValue, testData (string or Pair[]) ParserData[] pd = { - ParserDataFactory.make( ORBConstants.DEBUG_PROPERTY, - OperationFactory.listAction( ",", OperationFactory.stringAction()), - "debugFlags", new String[0], - debugTestData, "subcontract,poa,transport" ), - ParserDataFactory.make( ORBConstants.INITIAL_HOST_PROPERTY, - OperationFactory.stringAction(), - "ORBInitialHost", "", - "Foo", "Foo" ), - ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY, - OperationFactory.integerAction(), - "ORBInitialPort", Integer.valueOf( ORBConstants.DEFAULT_INITIAL_PORT ), - Integer.valueOf( 27314 ), "27314" ), - // Where did this come from? - //ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY, - //OperationFactory.booleanAction(), - //"ORBInitialPortInitialized", Boolean.FALSE, - //Boolean.TRUE, "27314" ), - ParserDataFactory.make( ORBConstants.SERVER_HOST_PROPERTY, - OperationFactory.stringAction(), - "ORBServerHost", "", - "camelot", "camelot" ), - ParserDataFactory.make( ORBConstants.SERVER_PORT_PROPERTY, - OperationFactory.integerAction(), - "ORBServerPort", Integer.valueOf( 0 ), - Integer.valueOf( 38143 ), "38143" ), - ParserDataFactory.make( ORBConstants.ORB_ID_PROPERTY, - OperationFactory.stringAction(), - "orbId", "", - "foo", "foo" ), - ParserDataFactory.make( ORBConstants.OLD_ORB_ID_PROPERTY, - OperationFactory.stringAction(), - "orbId", "", - "foo", "foo" ), - ParserDataFactory.make( ORBConstants.ORB_SERVER_ID_PROPERTY, - OperationFactory.integerAction(), - "persistentServerId", Integer.valueOf(-1), - Integer.valueOf( 1234), "1234" ), - ParserDataFactory.make( - ORBConstants.ORB_SERVER_ID_PROPERTY, - OperationFactory.setFlagAction(), - "persistentServerIdInitialized", Boolean.FALSE, - Boolean.TRUE, "1234" ), - // REVISIT after switch - // ParserDataFactory.make( ORBConstants.INITIAL_SERVICES_PROPERTY, - // OperationFactory.URLAction(), + ParserDataFactory.make(ORBConstants.DEBUG_PROPERTY, OperationFactory.listAction(",", OperationFactory.stringAction()), + "debugFlags", new String[0], debugTestData, "subcontract,poa,transport"), + ParserDataFactory.make(ORBConstants.INITIAL_HOST_PROPERTY, OperationFactory.stringAction(), "ORBInitialHost", "", "Foo", + "Foo"), + ParserDataFactory.make(ORBConstants.INITIAL_PORT_PROPERTY, OperationFactory.integerAction(), "ORBInitialPort", + Integer.valueOf(ORBConstants.DEFAULT_INITIAL_PORT), Integer.valueOf(27314), "27314"), + // Where did this come from? + // ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY, + // OperationFactory.booleanAction(), + // "ORBInitialPortInitialized", Boolean.FALSE, + // Boolean.TRUE, "27314" ), + ParserDataFactory.make(ORBConstants.SERVER_HOST_PROPERTY, OperationFactory.stringAction(), "ORBServerHost", "", "camelot", + "camelot"), + ParserDataFactory.make(ORBConstants.SERVER_PORT_PROPERTY, OperationFactory.integerAction(), "ORBServerPort", + Integer.valueOf(0), Integer.valueOf(38143), "38143"), + ParserDataFactory.make(ORBConstants.ORB_ID_PROPERTY, OperationFactory.stringAction(), "orbId", "", "foo", "foo"), + ParserDataFactory.make(ORBConstants.OLD_ORB_ID_PROPERTY, OperationFactory.stringAction(), "orbId", "", "foo", "foo"), + ParserDataFactory.make(ORBConstants.ORB_SERVER_ID_PROPERTY, OperationFactory.integerAction(), "persistentServerId", + Integer.valueOf(-1), Integer.valueOf(1234), "1234"), + ParserDataFactory.make(ORBConstants.ORB_SERVER_ID_PROPERTY, OperationFactory.setFlagAction(), + "persistentServerIdInitialized", Boolean.FALSE, Boolean.TRUE, "1234"), + // REVISIT after switch + // ParserDataFactory.make( ORBConstants.INITIAL_SERVICES_PROPERTY, + // OperationFactory.URLAction(), // "servicesUrl", null, // testServicesURL, testServicesString ), - // ParserDataFactory.make( ORBConstants.DEFAULT_INIT_REF_PROPERTY, - // OperationFactory.stringAction(), - // "defaultInitRef", null, + // ParserDataFactory.make( ORBConstants.DEFAULT_INIT_REF_PROPERTY, + // OperationFactory.stringAction(), + // "defaultInitRef", null, // "Fooref", "Fooref" ), - ParserDataFactory.make( ORBConstants.HIGH_WATER_MARK_PROPERTY, - OperationFactory.integerAction(), - "highWaterMark", Integer.valueOf( 240 ), - Integer.valueOf( 3745 ), "3745" ), - ParserDataFactory.make( ORBConstants.LOW_WATER_MARK_PROPERTY, - OperationFactory.integerAction(), - "lowWaterMark", Integer.valueOf( 100 ), - Integer.valueOf( 12 ), "12" ), - ParserDataFactory.make( ORBConstants.NUMBER_TO_RECLAIM_PROPERTY, - OperationFactory.integerAction(), - "numberToReclaim", Integer.valueOf( 5 ), - Integer.valueOf( 231 ), "231" ), - ParserDataFactory.make( ORBConstants.GIOP_VERSION, - makeGVOperation(), - "giopVersion", GIOPVersion.DEFAULT_VERSION, - new GIOPVersion( 2, 3 ), "2.3" ), - ParserDataFactory.make( ORBConstants.GIOP_FRAGMENT_SIZE, - makeFSOperation(), "giopFragmentSize", - Integer.valueOf( ORBConstants.GIOP_DEFAULT_FRAGMENT_SIZE ), - Integer.valueOf( 65536 ), "65536" ), - ParserDataFactory.make( ORBConstants.GIOP_BUFFER_SIZE, - OperationFactory.integerAction(), - "giopBufferSize", Integer.valueOf( ORBConstants.GIOP_DEFAULT_BUFFER_SIZE ), - Integer.valueOf( 234000 ), "234000" ), - ParserDataFactory.make( ORBConstants.GIOP_11_BUFFMGR, - makeBMGROperation(), - "giop11BuffMgr", Integer.valueOf( ORBConstants.DEFAULT_GIOP_11_BUFFMGR ), - Integer.valueOf( 1 ), "CLCT" ), - ParserDataFactory.make( ORBConstants.GIOP_12_BUFFMGR, - makeBMGROperation(), - "giop12BuffMgr", Integer.valueOf( ORBConstants.DEFAULT_GIOP_12_BUFFMGR ), - Integer.valueOf( 0 ), "GROW" ), - - // Note that the same property is used to set two different - // fields here. This requires that both entries use the same test - // data, or the test will fail. - ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING, - OperationFactory.compose( OperationFactory.integerRangeAction( 0, 3 ), - OperationFactory.convertIntegerToShort() ), - "giopTargetAddressPreference", - Short.valueOf( ORBConstants.ADDR_DISP_HANDLE_ALL ), - Short.valueOf( (short)2 ), "2" ), - ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING, - makeADOperation(), - "giopAddressDisposition", Short.valueOf( KeyAddr.value ), - Short.valueOf( (short)2 ), "2" ), - ParserDataFactory.make( ORBConstants.ALWAYS_SEND_CODESET_CTX_PROPERTY, - OperationFactory.booleanAction(), - "alwaysSendCodeSetCtx", Boolean.TRUE, - Boolean.FALSE, "false"), - ParserDataFactory.make( ORBConstants.USE_BOMS, - OperationFactory.booleanAction(), - "useByteOrderMarkers", - Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS ), - Boolean.FALSE, "false" ), - ParserDataFactory.make( ORBConstants.USE_BOMS_IN_ENCAPS, - OperationFactory.booleanAction(), - "useByteOrderMarkersInEncaps", - Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS ), - Boolean.FALSE, "false" ), - ParserDataFactory.make( ORBConstants.CHAR_CODESETS, - makeCSOperation(), - "charData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getCharComponent(), - CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ), - ParserDataFactory.make( ORBConstants.WCHAR_CODESETS, - makeCSOperation(), - "wcharData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getWCharComponent(), - CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ), - ParserDataFactory.make( ORBConstants.ALLOW_LOCAL_OPTIMIZATION, - OperationFactory.booleanAction(), - "allowLocalOptimization", Boolean.FALSE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.LEGACY_SOCKET_FACTORY_CLASS_PROPERTY, - makeLegacySocketFactoryOperation(), - // No default - must be set by user if they are using - // legacy socket factory. - "legacySocketFactory", null, - new TestLegacyORBSocketFactory(), - MY_CLASS_NAME + "$TestLegacyORBSocketFactory" ), - ParserDataFactory.make( ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY, - makeSocketFactoryOperation(), - "socketFactory", new DefaultSocketFactoryImpl(), - new TestORBSocketFactory(), - MY_CLASS_NAME + "$TestORBSocketFactory" ), - ParserDataFactory.make( ORBConstants.LISTEN_SOCKET_PROPERTY, - makeUSLOperation() , - "userSpecifiedListenPorts", new USLPort[0], - USLPorts, "FOO:2701,BAR:3333" ), - ParserDataFactory.make( ORBConstants.IOR_TO_SOCKET_INFO_CLASS_PROPERTY, - makeIORToSocketInfoOperation(), - "iorToSocketInfo", new DefaultIORToSocketInfoImpl(), - new TestIORToSocketInfo(), - MY_CLASS_NAME + "$TestIORToSocketInfo" ), - ParserDataFactory.make( ORBConstants.IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY, - makeIIOPPrimaryToContactInfoOperation(), - "iiopPrimaryToContactInfo", null, - new TestIIOPPrimaryToContactInfo(), - MY_CLASS_NAME + "$TestIIOPPrimaryToContactInfo" ), - ParserDataFactory.make( ORBConstants.CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY, - makeContactInfoListFactoryOperation(), - "corbaContactInfoListFactory", null, - new TestContactInfoListFactory(), - MY_CLASS_NAME + "$TestContactInfoListFactory" ), - ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, - OperationFactory.integerAction(), - "persistentServerPort", Integer.valueOf( 0 ), - Integer.valueOf( 2743 ), "2743" ), - ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, - OperationFactory.setFlagAction(), - "persistentPortInitialized", Boolean.FALSE, - Boolean.TRUE, "2743" ), - ParserDataFactory.make( ORBConstants.ACTIVATED_PROPERTY, - OperationFactory.booleanAction(), - "serverIsORBActivated", Boolean.FALSE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY, - classAction, - "badServerIdHandlerClass", null, - TestBadServerIdHandler.class, MY_CLASS_NAME + "$TestBadServerIdHandler" ), - ParserDataFactory.make( ORBConstants.PI_ORB_INITIALIZER_CLASS_PREFIX, - makeROIOperation(), - "orbInitializers", new ORBInitializer[0], - TestORBInitializers, TestORBInitData, ORBInitializer.class ), - ParserDataFactory.make( ORBConstants.ACCEPTOR_CLASS_PREFIX_PROPERTY, - makeAcceptorInstantiationOperation(), - "acceptors", new Acceptor[0], - TestAcceptors, TestAcceptorData, Acceptor.class ), - - // - // Socket/Channel control - // - - // Acceptor: - // useNIOSelector == true - // useSelectThreadToWait = true - // useWorkerThreadForEvent = false - // else - // useSelectThreadToWait = false - // useWorkerThreadForEvent = true - - // Connection: - // useNIOSelector == true - // useSelectThreadToWait = true - // useWorkerThreadForEvent = true - // else - // useSelectThreadToWait = false - // useWorkerThreadForEvent = true - - ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_TYPE_PROPERTY, - OperationFactory.stringAction(), - "acceptorSocketType", ORBConstants.SOCKETCHANNEL, - "foo", "foo" ), - - ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY, - OperationFactory.booleanAction(), - "acceptorSocketUseSelectThreadToWait", Boolean.TRUE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY, - OperationFactory.booleanAction(), - "acceptorSocketUseWorkerThreadForEvent", Boolean.TRUE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_TYPE_PROPERTY, - OperationFactory.stringAction(), - "connectionSocketType", ORBConstants.SOCKETCHANNEL, - "foo", "foo" ), - ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY, - OperationFactory.booleanAction(), - "connectionSocketUseSelectThreadToWait", Boolean.TRUE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( - ORBConstants.CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY, - OperationFactory.booleanAction(), - "connectionSocketUseWorkerThreadForEvent", Boolean.TRUE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.WAIT_FOR_RESPONSE_TIMEOUT, - OperationFactory.integerAction(), - "waitForResponseTimeout", 1000 * 60 * 30, - Integer.valueOf(1234), "1234"), - ParserDataFactory.make( ORBConstants.DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY, - OperationFactory.booleanAction(), - "disableDirectByteBufferUse", Boolean.TRUE, // was Boolean.FALSE, - Boolean.TRUE, "true" ), - ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_TIMEOUTS_PROPERTY, - OperationFactoryExt.convertAction( TcpTimeoutsImpl.class ), - "tcpTimeouts", defaultTcpTimeouts, - testTcpTimeouts, "2000:6000:20" ), - ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_CONNECT_TIMEOUTS_PROPERTY, - OperationFactoryExt.convertAction( TcpTimeoutsImpl.class ), - "tcpConnectTimeouts", defaultTcpConnectTimeouts, - testTcpConnectTimeouts, "20:60000:100:5000" ), - ParserDataFactory.make( - ORBConstants.ENABLE_JAVA_SERIALIZATION_PROPERTY, - OperationFactory.booleanAction(), - "enableJavaSerialization", Boolean.FALSE, - Boolean.FALSE, "false"), - ParserDataFactory.make( - ORBConstants.USE_REP_ID, - OperationFactory.booleanAction(), - "useRepId", Boolean.TRUE, - Boolean.TRUE, "true"), - ParserDataFactory.make( ORBConstants.ORB_INIT_REF_PROPERTY, - OperationFactory.identityAction(), - "orbInitialReferences", new Pair[0], - TestORBInitRefData, TestORBInitRefData, Pair.class ), - ParserDataFactory.make( - ORBConstants.SHOW_INFO_MESSAGES, - OperationFactory.booleanAction(), - "showInfoMessages", Boolean.FALSE, - Boolean.FALSE, "false" ), - ParserDataFactory.make( - ORBConstants.GET_SERVICE_CONTEXT_RETURNS_NULL, - OperationFactory.booleanAction(), - "getServiceContextReturnsNull", Boolean.FALSE, - Boolean.FALSE, "false" ), - ParserDataFactory.make( ORBConstants.APPSERVER_MODE, - OperationFactory.booleanAction(), - "isAppServerMode", Boolean.FALSE, - Boolean.FALSE, "FALSE"), - ParserDataFactory.make(ORBConstants.READ_BYTE_BUFFER_SIZE_PROPERTY, - OperationFactory.integerAction(), - "readByteBufferSize", - Integer.valueOf(ORBConstants.DEFAULT_READ_BYTE_BUFFER_SIZE), - Integer.valueOf(8192), "8192"), - ParserDataFactory.make(ORBConstants.MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD_PROPERTY, - OperationFactory.integerAction(), - "maxReadByteBufferSizeThreshold", - Integer.valueOf(ORBConstants.MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD), - Integer.valueOf(4000000), "4000000"), - ParserDataFactory.make( - ORBConstants.POOLED_DIRECT_BYTE_BUFFER_SLAB_SIZE_PROPERTY, - OperationFactory.integerAction(), - "pooledDirectByteBufferSlabSize", - Integer.valueOf(ORBConstants.DEFAULT_POOLED_DIRECT_BYTE_BUFFER_SLAB_SIZE), - Integer.valueOf(1048576), "1048576"), - ParserDataFactory.make( - ORBConstants.ALWAYS_ENTER_BLOCKING_READ_PROPERTY, - OperationFactory.booleanAction(), - "alwaysEnterBlockingRead", Boolean.TRUE, - Boolean.TRUE, "TRUE"), - ParserDataFactory.make( - ORBConstants.NON_BLOCKING_READ_CHECK_MESSAGE_PARSER_PROPERTY, - OperationFactory.booleanAction(), - "nonBlockingReadCheckMessageParser", Boolean.TRUE, - Boolean.TRUE, "TRUE"), - ParserDataFactory.make( - ORBConstants.BLOCKING_READ_CHECK_MESSAGE_PARSER_PROPERTY, - OperationFactory.booleanAction(), - "blockingReadCheckMessageParser", Boolean.FALSE, - Boolean.FALSE, "FALSE"), - ParserDataFactory.make( ORBConstants.TIMING_POINTS_ENABLED, - OperationFactory.booleanAction(), - "timingPointsEnabled", Boolean.FALSE, - Boolean.TRUE, "TRUE"), - ParserDataFactory.make( ORBConstants.USE_ENUM_DESC, - OperationFactory.booleanAction(), - "useEnumDesc", Boolean.TRUE, - Boolean.TRUE, "TRUE"), - ParserDataFactory.make( ORBConstants.ENV_IS_SERVER_PROPERTY, - OperationFactory.booleanAction(), - "environmentIsGFServer", Boolean.FALSE, - Boolean.TRUE, "TRUE"), - ParserDataFactory.make( ORBConstants.NO_DEFAULT_ACCEPTORS, - OperationFactory.booleanAction(), - "noDefaultAcceptors", Boolean.FALSE, - Boolean.TRUE, "TRUE" ), - ParserDataFactory.make( ORBConstants.REGISTER_MBEANS, - OperationFactory.booleanAction(), - "registerMBeans", Boolean.TRUE, - Boolean.FALSE, "FALSE" ), - ParserDataFactory.make( - ORBConstants.FRAGMENT_READ_TIMEOUT, - OperationFactory.integerAction(), - "fragmentReadTimeout", - Integer.valueOf(ORBConstants.DEFAULT_FRAGMENT_READ_TIMEOUT ), - Integer.valueOf(23000), "23000"), - ParserDataFactory.make( ORBConstants.DISABLE_ORBD_INIT_PROPERTY, - OperationFactory.booleanAction(), - "disableORBD", Boolean.FALSE, - Boolean.TRUE, "TRUE" ) - } ; - - parserData = pd ; - } - - public static final class TestBadServerIdHandler implements BadServerIdHandler - { + ParserDataFactory.make(ORBConstants.HIGH_WATER_MARK_PROPERTY, OperationFactory.integerAction(), "highWaterMark", + Integer.valueOf(240), Integer.valueOf(3745), "3745"), + ParserDataFactory.make(ORBConstants.LOW_WATER_MARK_PROPERTY, OperationFactory.integerAction(), "lowWaterMark", + Integer.valueOf(100), Integer.valueOf(12), "12"), + ParserDataFactory.make(ORBConstants.NUMBER_TO_RECLAIM_PROPERTY, OperationFactory.integerAction(), "numberToReclaim", + Integer.valueOf(5), Integer.valueOf(231), "231"), + ParserDataFactory.make(ORBConstants.GIOP_VERSION, makeGVOperation(), "giopVersion", GIOPVersion.DEFAULT_VERSION, + new GIOPVersion(2, 3), "2.3"), + ParserDataFactory.make(ORBConstants.GIOP_FRAGMENT_SIZE, makeFSOperation(), "giopFragmentSize", + Integer.valueOf(ORBConstants.GIOP_DEFAULT_FRAGMENT_SIZE), Integer.valueOf(65536), "65536"), + ParserDataFactory.make(ORBConstants.GIOP_BUFFER_SIZE, OperationFactory.integerAction(), "giopBufferSize", + Integer.valueOf(ORBConstants.GIOP_DEFAULT_BUFFER_SIZE), Integer.valueOf(234000), "234000"), + ParserDataFactory.make(ORBConstants.GIOP_11_BUFFMGR, makeBMGROperation(), "giop11BuffMgr", + Integer.valueOf(ORBConstants.DEFAULT_GIOP_11_BUFFMGR), Integer.valueOf(1), "CLCT"), + ParserDataFactory.make(ORBConstants.GIOP_12_BUFFMGR, makeBMGROperation(), "giop12BuffMgr", + Integer.valueOf(ORBConstants.DEFAULT_GIOP_12_BUFFMGR), Integer.valueOf(0), "GROW"), + + // Note that the same property is used to set two different + // fields here. This requires that both entries use the same test + // data, or the test will fail. + ParserDataFactory.make(ORBConstants.GIOP_TARGET_ADDRESSING, + OperationFactory.compose(OperationFactory.integerRangeAction(0, 3), OperationFactory.convertIntegerToShort()), + "giopTargetAddressPreference", Short.valueOf(ORBConstants.ADDR_DISP_HANDLE_ALL), Short.valueOf((short) 2), "2"), + ParserDataFactory.make(ORBConstants.GIOP_TARGET_ADDRESSING, makeADOperation(), "giopAddressDisposition", + Short.valueOf(KeyAddr.value), Short.valueOf((short) 2), "2"), + ParserDataFactory.make(ORBConstants.ALWAYS_SEND_CODESET_CTX_PROPERTY, OperationFactory.booleanAction(), + "alwaysSendCodeSetCtx", Boolean.TRUE, Boolean.FALSE, "false"), + ParserDataFactory.make(ORBConstants.USE_BOMS, OperationFactory.booleanAction(), "useByteOrderMarkers", + Boolean.valueOf(ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS), Boolean.FALSE, "false"), + ParserDataFactory.make(ORBConstants.USE_BOMS_IN_ENCAPS, OperationFactory.booleanAction(), "useByteOrderMarkersInEncaps", + Boolean.valueOf(ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS), Boolean.FALSE, "false"), + ParserDataFactory.make(ORBConstants.CHAR_CODESETS, makeCSOperation(), "charData", + CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getCharComponent(), + CodeSetComponentInfo.createFromString(codeSetTestString), codeSetTestString), + ParserDataFactory.make(ORBConstants.WCHAR_CODESETS, makeCSOperation(), "wcharData", + CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getWCharComponent(), + CodeSetComponentInfo.createFromString(codeSetTestString), codeSetTestString), + ParserDataFactory.make(ORBConstants.ALLOW_LOCAL_OPTIMIZATION, OperationFactory.booleanAction(), "allowLocalOptimization", + Boolean.FALSE, Boolean.TRUE, "true"), + ParserDataFactory.make(ORBConstants.LEGACY_SOCKET_FACTORY_CLASS_PROPERTY, makeLegacySocketFactoryOperation(), + // No default - must be set by user if they are using + // legacy socket factory. + "legacySocketFactory", null, new TestLegacyORBSocketFactory(), MY_CLASS_NAME + "$TestLegacyORBSocketFactory"), + ParserDataFactory.make(ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY, makeSocketFactoryOperation(), "socketFactory", + new DefaultSocketFactoryImpl(), new TestORBSocketFactory(), MY_CLASS_NAME + "$TestORBSocketFactory"), + ParserDataFactory.make(ORBConstants.LISTEN_SOCKET_PROPERTY, makeUSLOperation(), "userSpecifiedListenPorts", new USLPort[0], + USLPorts, "FOO:2701,BAR:3333"), + ParserDataFactory.make(ORBConstants.IOR_TO_SOCKET_INFO_CLASS_PROPERTY, makeIORToSocketInfoOperation(), "iorToSocketInfo", + new DefaultIORToSocketInfoImpl(), new TestIORToSocketInfo(), MY_CLASS_NAME + "$TestIORToSocketInfo"), + ParserDataFactory.make(ORBConstants.IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY, makeIIOPPrimaryToContactInfoOperation(), + "iiopPrimaryToContactInfo", null, new TestIIOPPrimaryToContactInfo(), + MY_CLASS_NAME + "$TestIIOPPrimaryToContactInfo"), + ParserDataFactory.make(ORBConstants.CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY, makeContactInfoListFactoryOperation(), + "corbaContactInfoListFactory", null, new TestContactInfoListFactory(), + MY_CLASS_NAME + "$TestContactInfoListFactory"), + ParserDataFactory.make(ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, OperationFactory.integerAction(), + "persistentServerPort", Integer.valueOf(0), Integer.valueOf(2743), "2743"), + ParserDataFactory.make(ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, OperationFactory.setFlagAction(), + "persistentPortInitialized", Boolean.FALSE, Boolean.TRUE, "2743"), + ParserDataFactory.make(ORBConstants.ACTIVATED_PROPERTY, OperationFactory.booleanAction(), "serverIsORBActivated", + Boolean.FALSE, Boolean.TRUE, "true"), + ParserDataFactory.make(ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY, classAction, "badServerIdHandlerClass", null, + TestBadServerIdHandler.class, MY_CLASS_NAME + "$TestBadServerIdHandler"), + ParserDataFactory.make(ORBConstants.PI_ORB_INITIALIZER_CLASS_PREFIX, makeROIOperation(), "orbInitializers", + new ORBInitializer[0], TestORBInitializers, TestORBInitData, ORBInitializer.class), + ParserDataFactory.make(ORBConstants.ACCEPTOR_CLASS_PREFIX_PROPERTY, makeAcceptorInstantiationOperation(), "acceptors", + new Acceptor[0], TestAcceptors, TestAcceptorData, Acceptor.class), + + // + // Socket/Channel control + // + + // Acceptor: + // useNIOSelector == true + // useSelectThreadToWait = true + // useWorkerThreadForEvent = false + // else + // useSelectThreadToWait = false + // useWorkerThreadForEvent = true + + // Connection: + // useNIOSelector == true + // useSelectThreadToWait = true + // useWorkerThreadForEvent = true + // else + // useSelectThreadToWait = false + // useWorkerThreadForEvent = true + + ParserDataFactory.make(ORBConstants.ACCEPTOR_SOCKET_TYPE_PROPERTY, OperationFactory.stringAction(), "acceptorSocketType", + ORBConstants.SOCKETCHANNEL, "foo", "foo"), + + ParserDataFactory.make(ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY, OperationFactory.booleanAction(), + "acceptorSocketUseSelectThreadToWait", Boolean.TRUE, Boolean.TRUE, "true"), + ParserDataFactory.make(ORBConstants.ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY, OperationFactory.booleanAction(), + "acceptorSocketUseWorkerThreadForEvent", Boolean.TRUE, Boolean.TRUE, "true"), + ParserDataFactory.make(ORBConstants.CONNECTION_SOCKET_TYPE_PROPERTY, OperationFactory.stringAction(), + "connectionSocketType", ORBConstants.SOCKETCHANNEL, "foo", "foo"), + ParserDataFactory.make(ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY, OperationFactory.booleanAction(), + "connectionSocketUseSelectThreadToWait", Boolean.TRUE, Boolean.TRUE, "true"), + ParserDataFactory.make(ORBConstants.CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY, + OperationFactory.booleanAction(), "connectionSocketUseWorkerThreadForEvent", Boolean.TRUE, Boolean.TRUE, "true"), + ParserDataFactory.make(ORBConstants.WAIT_FOR_RESPONSE_TIMEOUT, OperationFactory.integerAction(), "waitForResponseTimeout", + 1000 * 60 * 30, Integer.valueOf(1234), "1234"), + ParserDataFactory.make(ORBConstants.DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY, OperationFactory.booleanAction(), + "disableDirectByteBufferUse", Boolean.TRUE, // was Boolean.FALSE, + Boolean.TRUE, "true"), + ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_TIMEOUTS_PROPERTY, + OperationFactoryExt.convertAction(TcpTimeoutsImpl.class), "tcpTimeouts", defaultTcpTimeouts, testTcpTimeouts, + "2000:6000:20"), + ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_CONNECT_TIMEOUTS_PROPERTY, + OperationFactoryExt.convertAction(TcpTimeoutsImpl.class), "tcpConnectTimeouts", defaultTcpConnectTimeouts, + testTcpConnectTimeouts, "20:60000:100:5000"), + ParserDataFactory.make(ORBConstants.ENABLE_JAVA_SERIALIZATION_PROPERTY, OperationFactory.booleanAction(), + "enableJavaSerialization", Boolean.FALSE, Boolean.FALSE, "false"), + ParserDataFactory.make(ORBConstants.USE_REP_ID, OperationFactory.booleanAction(), "useRepId", Boolean.TRUE, Boolean.TRUE, + "true"), + ParserDataFactory.make(ORBConstants.ORB_INIT_REF_PROPERTY, OperationFactory.identityAction(), "orbInitialReferences", + new Pair[0], TestORBInitRefData, TestORBInitRefData, Pair.class), + ParserDataFactory.make(ORBConstants.SHOW_INFO_MESSAGES, OperationFactory.booleanAction(), "showInfoMessages", Boolean.FALSE, + Boolean.FALSE, "false"), + ParserDataFactory.make(ORBConstants.GET_SERVICE_CONTEXT_RETURNS_NULL, OperationFactory.booleanAction(), + "getServiceContextReturnsNull", Boolean.FALSE, Boolean.FALSE, "false"), + ParserDataFactory.make(ORBConstants.APPSERVER_MODE, OperationFactory.booleanAction(), "isAppServerMode", Boolean.FALSE, + Boolean.FALSE, "FALSE"), + ParserDataFactory.make(ORBConstants.READ_BYTE_BUFFER_SIZE_PROPERTY, OperationFactory.integerAction(), "readByteBufferSize", + Integer.valueOf(ORBConstants.DEFAULT_READ_BYTE_BUFFER_SIZE), Integer.valueOf(8192), "8192"), + ParserDataFactory.make(ORBConstants.MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD_PROPERTY, OperationFactory.integerAction(), + "maxReadByteBufferSizeThreshold", Integer.valueOf(ORBConstants.MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD), + Integer.valueOf(4000000), "4000000"), + ParserDataFactory.make(ORBConstants.POOLED_DIRECT_BYTE_BUFFER_SLAB_SIZE_PROPERTY, OperationFactory.integerAction(), + "pooledDirectByteBufferSlabSize", Integer.valueOf(ORBConstants.DEFAULT_POOLED_DIRECT_BYTE_BUFFER_SLAB_SIZE), + Integer.valueOf(1048576), "1048576"), + ParserDataFactory.make(ORBConstants.ALWAYS_ENTER_BLOCKING_READ_PROPERTY, OperationFactory.booleanAction(), + "alwaysEnterBlockingRead", Boolean.TRUE, Boolean.TRUE, "TRUE"), + ParserDataFactory.make(ORBConstants.NON_BLOCKING_READ_CHECK_MESSAGE_PARSER_PROPERTY, OperationFactory.booleanAction(), + "nonBlockingReadCheckMessageParser", Boolean.TRUE, Boolean.TRUE, "TRUE"), + ParserDataFactory.make(ORBConstants.BLOCKING_READ_CHECK_MESSAGE_PARSER_PROPERTY, OperationFactory.booleanAction(), + "blockingReadCheckMessageParser", Boolean.FALSE, Boolean.FALSE, "FALSE"), + ParserDataFactory.make(ORBConstants.TIMING_POINTS_ENABLED, OperationFactory.booleanAction(), "timingPointsEnabled", + Boolean.FALSE, Boolean.TRUE, "TRUE"), + ParserDataFactory.make(ORBConstants.USE_ENUM_DESC, OperationFactory.booleanAction(), "useEnumDesc", Boolean.TRUE, + Boolean.TRUE, "TRUE"), + ParserDataFactory.make(ORBConstants.ENV_IS_SERVER_PROPERTY, OperationFactory.booleanAction(), "environmentIsGFServer", + Boolean.FALSE, Boolean.TRUE, "TRUE"), + ParserDataFactory.make(ORBConstants.NO_DEFAULT_ACCEPTORS, OperationFactory.booleanAction(), "noDefaultAcceptors", + Boolean.FALSE, Boolean.TRUE, "TRUE"), + ParserDataFactory.make(ORBConstants.REGISTER_MBEANS, OperationFactory.booleanAction(), "registerMBeans", Boolean.TRUE, + Boolean.FALSE, "FALSE"), + ParserDataFactory.make(ORBConstants.FRAGMENT_READ_TIMEOUT, OperationFactory.integerAction(), "fragmentReadTimeout", + Integer.valueOf(ORBConstants.DEFAULT_FRAGMENT_READ_TIMEOUT), Integer.valueOf(23000), "23000"), + ParserDataFactory.make(ORBConstants.DISABLE_ORBD_INIT_PROPERTY, OperationFactory.booleanAction(), "disableORBD", + Boolean.FALSE, Boolean.TRUE, "TRUE") }; + + parserData = pd; + } + + public static final class TestBadServerIdHandler implements BadServerIdHandler { @Override - public boolean equals( Object other ) - { - return other instanceof TestBadServerIdHandler ; + public boolean equals(Object other) { + return other instanceof TestBadServerIdHandler; } - public void handle( ObjectKey objectKey ) - { + public void handle(ObjectKey objectKey) { } @Override @@ -543,72 +369,56 @@ public int hashCode() { } } - private Operation makeUSLOperation() - { - Operation[] siop = { OperationFactory.stringAction(), - OperationFactory.integerAction() } ; - Operation op2 = OperationFactory.sequenceAction( ":", siop ) ; + private Operation makeUSLOperation() { + Operation[] siop = { OperationFactory.stringAction(), OperationFactory.integerAction() }; + Operation op2 = OperationFactory.sequenceAction(":", siop); Operation uslop = new Operation() { - public Object operate( Object value ) - { - Object[] values = (Object[])value ; - String type = (String)(values[0]) ; - Integer port = (Integer)(values[1]) ; - return new USLPort( type, port.intValue() ) ; + public Object operate(Object value) { + Object[] values = (Object[]) value; + String type = (String) (values[0]); + Integer port = (Integer) (values[1]); + return new USLPort(type, port.intValue()); } - } ; - - Operation op3 = OperationFactory.compose( op2, uslop ) ; - Operation listenop = OperationFactory.listAction( ",", op3 ) ; - return listenop ; + }; + + Operation op3 = OperationFactory.compose(op2, uslop); + Operation listenop = OperationFactory.listAction(",", op3); + return listenop; } - - public static final class TestLegacyORBSocketFactory - implements com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory - { - public boolean equals( Object other ) - { - return other instanceof TestLegacyORBSocketFactory ; + + public static final class TestLegacyORBSocketFactory implements com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory { + public boolean equals(Object other) { + return other instanceof TestLegacyORBSocketFactory; } - public ServerSocket createServerSocket( String type, int port ) - { - return null ; + public ServerSocket createServerSocket(String type, int port) { + return null; } - public SocketInfo getEndPointInfo( org.omg.CORBA.ORB orb, - IOR ior, SocketInfo socketInfo ) - { - return null ; + public SocketInfo getEndPointInfo(org.omg.CORBA.ORB orb, IOR ior, SocketInfo socketInfo) { + return null; } - public Socket createSocket( SocketInfo socketInfo ) - { - return null ; + public Socket createSocket(SocketInfo socketInfo) { + return null; } } - public static final class TestORBSocketFactory - implements com.sun.corba.ee.spi.transport.ORBSocketFactory - { - public boolean equals( Object other ) - { - return other instanceof TestORBSocketFactory ; + public static final class TestORBSocketFactory implements com.sun.corba.ee.spi.transport.ORBSocketFactory { + public boolean equals(Object other) { + return other instanceof TestORBSocketFactory; } - public void setORB(ORB orb) - { + public void setORB(ORB orb) { } - public ServerSocket createServerSocket( String type, InetSocketAddress a ) - { - return null ; + public ServerSocket createServerSocket(String type, InetSocketAddress a) { + return null; } - public Socket createSocket( String type, InetSocketAddress a ) - { - return null ; + public Socket createSocket(String type, InetSocketAddress a) { + return null; } public void setAcceptedSocketOptions(Acceptor acceptor, ServerSocket serverSocket, Socket socket) throws SocketException { @@ -616,565 +426,580 @@ public void setAcceptedSocketOptions(Acceptor acceptor, ServerSocket serverSocke } } - public static final class TestIORToSocketInfo - implements IORToSocketInfo - { - public boolean equals( Object other ) - { + public static final class TestIORToSocketInfo implements IORToSocketInfo { + public boolean equals(Object other) { return other instanceof TestIORToSocketInfo; } - public List getSocketInfo(IOR ior, List previous) - { + public List getSocketInfo(IOR ior, List previous) { return null; } } - public static final class TestIIOPPrimaryToContactInfo - implements IIOPPrimaryToContactInfo - { - public void reset(ContactInfo primary) - { + public static final class TestIIOPPrimaryToContactInfo implements IIOPPrimaryToContactInfo { + public void reset(ContactInfo primary) { } - public boolean hasNext(ContactInfo primary, - ContactInfo previous, - List contactInfos) - { + public boolean hasNext(ContactInfo primary, ContactInfo previous, List contactInfos) { return true; } - public ContactInfo next(ContactInfo primary, - ContactInfo previous, - List contactInfos) - { + public ContactInfo next(ContactInfo primary, ContactInfo previous, List contactInfos) { return null; } } - public static final class TestContactInfoListFactory - implements ContactInfoListFactory - { - public boolean equals( Object other ) - { + public static final class TestContactInfoListFactory implements ContactInfoListFactory { + public boolean equals(Object other) { return other instanceof TestContactInfoListFactory; } - public void setORB(ORB orb) { } + public void setORB(ORB orb) { + } - public ContactInfoList create( IOR ior ) { return null; } + public ContactInfoList create(IOR ior) { + return null; + } } - private Operation makeMapOperation( final Map map ) - { + private Operation makeMapOperation(final Map map) { return new Operation() { - public Object operate( Object value ) - { - return map.get( value ) ; + public Object operate(Object value) { + return map.get(value); } - } ; + }; } - private Operation makeBMGROperation() - { - Map map = new HashMap() ; - map.put( "GROW", Integer.valueOf(0) ) ; - map.put( "CLCT", Integer.valueOf(1) ) ; - map.put( "STRM", Integer.valueOf(2) ) ; - return makeMapOperation( map ) ; + private Operation makeBMGROperation() { + Map map = new HashMap(); + map.put("GROW", Integer.valueOf(0)); + map.put("CLCT", Integer.valueOf(1)); + map.put("STRM", Integer.valueOf(2)); + return makeMapOperation(map); } - private Operation makeLegacySocketFactoryOperation() - { + private Operation makeLegacySocketFactoryOperation() { Operation sfop = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; + public Object operate(Object value) { + String param = (String) value; try { - Class legacySocketFactoryClass = - (Class)classAction.operate(param) ; + Class legacySocketFactoryClass = (Class) classAction.operate(param); // For security reasons avoid creating an instance if // this socket factory class is not one that would fail // the class cast anyway. - if (com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory.class - .isAssignableFrom(legacySocketFactoryClass)) { + if (com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) { return legacySocketFactoryClass.newInstance(); } else { - throw wrapper.illegalSocketFactoryType( - legacySocketFactoryClass.toString() ) ; + throw wrapper.illegalSocketFactoryType(legacySocketFactoryClass.toString()); } } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or + // ClassNotFoundException, IllegalAccessException, + // InstantiationException, SecurityException or // ClassCastException - throw wrapper.badCustomSocketFactory( ex, param ) ; + throw wrapper.badCustomSocketFactory(ex, param); } } - } ; + }; - return sfop ; + return sfop; } - - private Operation makeSocketFactoryOperation() - { + + private Operation makeSocketFactoryOperation() { Operation sfop = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; + public Object operate(Object value) { + String param = (String) value; try { - Class socketFactoryClass = - (Class)classAction.operate(param ) ; + Class socketFactoryClass = (Class) classAction.operate(param); // For security reasons avoid creating an instance if // this socket factory class is not one that would fail // the class cast anyway. - if (com.sun.corba.ee.spi.transport.ORBSocketFactory.class - .isAssignableFrom(socketFactoryClass)) { + if (com.sun.corba.ee.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) { return socketFactoryClass.newInstance(); } else { - throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ; + throw wrapper.illegalSocketFactoryType(socketFactoryClass.toString()); } } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or + // ClassNotFoundException, IllegalAccessException, + // InstantiationException, SecurityException or // ClassCastException - throw wrapper.badCustomSocketFactory( ex, param ) ; + throw wrapper.badCustomSocketFactory(ex, param); } } - } ; + }; - return sfop ; + return sfop; } - - private Operation makeIORToSocketInfoOperation() - { + + private Operation makeIORToSocketInfoOperation() { Operation op = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; + public Object operate(Object value) { + String param = (String) value; try { - Class iorToSocketInfoClass = - (Class)classAction.operate(param ) ; + Class iorToSocketInfoClass = (Class) classAction.operate(param); // For security reasons avoid creating an instance if // this socket factory class is not one that would fail // the class cast anyway. if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) { return iorToSocketInfoClass.newInstance(); } else { - throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ; + throw wrapper.illegalIorToSocketInfoType(iorToSocketInfoClass.toString()); } } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or + // ClassNotFoundException, IllegalAccessException, + // InstantiationException, SecurityException or // ClassCastException - throw wrapper.badCustomIorToSocketInfo( ex, param ) ; + throw wrapper.badCustomIorToSocketInfo(ex, param); } } - } ; + }; - return op ; + return op; } - - private Operation makeIIOPPrimaryToContactInfoOperation() - { + + private Operation makeIIOPPrimaryToContactInfoOperation() { Operation op = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; + public Object operate(Object value) { + String param = (String) value; try { - Class iiopPrimaryToContactInfoClass = - (Class)classAction.operate(param ) ; + Class iiopPrimaryToContactInfoClass = (Class) classAction.operate(param); // For security reasons avoid creating an instance if // this socket factory class is not one that would fail // the class cast anyway. - if (IIOPPrimaryToContactInfo.class - .isAssignableFrom(iiopPrimaryToContactInfoClass)) { + if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) { return iiopPrimaryToContactInfoClass.newInstance(); } else { - throw wrapper.illegalIiopPrimaryToContactInfoType( - iiopPrimaryToContactInfoClass.toString() ) ; + throw wrapper.illegalIiopPrimaryToContactInfoType(iiopPrimaryToContactInfoClass.toString()); } } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or + // ClassNotFoundException, IllegalAccessException, + // InstantiationException, SecurityException or // ClassCastException - throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ; + throw wrapper.badCustomIiopPrimaryToContactInfo(ex, param); } } - } ; + }; - return op ; + return op; } - - private Operation makeContactInfoListFactoryOperation() - { + + private Operation makeContactInfoListFactoryOperation() { Operation op = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; + public Object operate(Object value) { + String param = (String) value; try { - Class contactInfoListFactoryClass = - (Class)classAction.operate(param ) ; + Class contactInfoListFactoryClass = (Class) classAction.operate(param); // For security reasons avoid creating an instance if // this socket factory class is not one that would fail // the class cast anyway. - if (ContactInfoListFactory.class.isAssignableFrom( - contactInfoListFactoryClass)) { + if (ContactInfoListFactory.class.isAssignableFrom(contactInfoListFactoryClass)) { return contactInfoListFactoryClass.newInstance(); } else { - throw wrapper.illegalContactInfoListFactoryType( - contactInfoListFactoryClass.toString() ) ; + throw wrapper.illegalContactInfoListFactoryType(contactInfoListFactoryClass.toString()); } } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or + // ClassNotFoundException, IllegalAccessException, + // InstantiationException, SecurityException or // ClassCastException - throw wrapper.badContactInfoListFactory( ex, param ) ; + throw wrapper.badContactInfoListFactory(ex, param); } } - } ; + }; - return op ; + return op; } - - private Operation makeCSOperation() - { + + private Operation makeCSOperation() { Operation csop = new Operation() { - public Object operate( Object value ) - { - String val = (String)value ; - return CodeSetComponentInfo.createFromString( val ) ; + public Object operate(Object value) { + String val = (String) value; + return CodeSetComponentInfo.createFromString(val); } - } ; + }; - return csop ; + return csop; } - private Operation makeADOperation() - { + private Operation makeADOperation() { Operation admap = new Operation() { - private Integer[] map = { - Integer.valueOf( KeyAddr.value ), - Integer.valueOf( ProfileAddr.value ), - Integer.valueOf( ReferenceAddr.value ), - Integer.valueOf( KeyAddr.value ) } ; - - public Object operate( Object value ) - { - int val = ((Integer)value).intValue() ; - return map[val] ; + private Integer[] map = { Integer.valueOf(KeyAddr.value), Integer.valueOf(ProfileAddr.value), + Integer.valueOf(ReferenceAddr.value), Integer.valueOf(KeyAddr.value) }; + + public Object operate(Object value) { + int val = ((Integer) value).intValue(); + return map[val]; } - } ; + }; - Operation rangeop = OperationFactory.integerRangeAction( 0, 3 ) ; - Operation op1 = OperationFactory.compose( rangeop, admap ) ; - Operation result = OperationFactory.compose( op1, - OperationFactory.convertIntegerToShort() ) ; - return result ; + Operation rangeop = OperationFactory.integerRangeAction(0, 3); + Operation op1 = OperationFactory.compose(rangeop, admap); + Operation result = OperationFactory.compose(op1, OperationFactory.convertIntegerToShort()); + return result; } private Operation makeFSOperation() { Operation fschecker = new Operation() { - public Object operate( Object value ) - { - int giopFragmentSize = ((Integer)value).intValue() ; - if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE){ - throw wrapper.fragmentSizeMinimum( giopFragmentSize, - ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ; + public Object operate(Object value) { + int giopFragmentSize = ((Integer) value).intValue(); + if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE) { + throw wrapper.fragmentSizeMinimum(giopFragmentSize, ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE); } if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0) - throw wrapper.fragmentSizeDiv( giopFragmentSize, - ORBConstants.GIOP_FRAGMENT_DIVISOR ) ; + throw wrapper.fragmentSizeDiv(giopFragmentSize, ORBConstants.GIOP_FRAGMENT_DIVISOR); - return value ; + return value; } - } ; + }; - Operation result = OperationFactory.compose( OperationFactory.integerAction(), - fschecker ) ; - return result ; + Operation result = OperationFactory.compose(OperationFactory.integerAction(), fschecker); + return result; } private Operation makeGVOperation() { - Operation gvHelper = OperationFactory.listAction( ".", - OperationFactory.integerAction() ) ; + Operation gvHelper = OperationFactory.listAction(".", OperationFactory.integerAction()); Operation gvMain = new Operation() { - public Object operate( Object value ) - { - Object[] nums = (Object[])value ; - int major = ((Integer)(nums[0])).intValue() ; - int minor = ((Integer)(nums[1])).intValue() ; - - return new GIOPVersion( major, minor ) ; - } - } ; - - Operation result = OperationFactory.compose( gvHelper, gvMain ); - return result ; + public Object operate(Object value) { + Object[] nums = (Object[]) value; + int major = ((Integer) (nums[0])).intValue(); + int minor = ((Integer) (nums[1])).intValue(); + + return new GIOPVersion(major, minor); + } + }; + + Operation result = OperationFactory.compose(gvHelper, gvMain); + return result; } - public static final class TestORBInitializer1 extends org.omg.CORBA.LocalObject - implements ORBInitializer - { - public boolean equals( Object other ) - { - return other instanceof TestORBInitializer1 ; + public static final class TestORBInitializer1 extends org.omg.CORBA.LocalObject implements ORBInitializer { + public boolean equals(Object other) { + return other instanceof TestORBInitializer1; } - public void pre_init( ORBInitInfo info ) - { + public void pre_init(ORBInitInfo info) { } - public void post_init( ORBInitInfo info ) - { + public void post_init(ORBInitInfo info) { } } - public static final class TestORBInitializer2 extends org.omg.CORBA.LocalObject - implements ORBInitializer - { - public boolean equals( Object other ) - { - return other instanceof TestORBInitializer2 ; + public static final class TestORBInitializer2 extends org.omg.CORBA.LocalObject implements ORBInitializer { + public boolean equals(Object other) { + return other instanceof TestORBInitializer2; } - public void pre_init( ORBInitInfo info ) - { + public void pre_init(ORBInitInfo info) { } - public void post_init( ORBInitInfo info ) - { + public void post_init(ORBInitInfo info) { } } private Operation makeROIOperation() { - Operation indexOp = OperationFactory.suffixAction() ; - Operation op1 = OperationFactory.compose( indexOp, classAction ) ; - Operation mop = OperationFactory.maskErrorAction( op1 ) ; + Operation indexOp = OperationFactory.suffixAction(); + Operation op1 = OperationFactory.compose(indexOp, classAction); + Operation mop = OperationFactory.maskErrorAction(op1); Operation mkinst = new Operation() { - public Object operate( Object value ) - { - final Class initClass = (Class)value ; + public Object operate(Object value) { + final Class initClass = (Class) value; if (initClass == null) - return null ; + return null; - // For security reasons avoid creating an instance - // if this class is one that would fail the class cast + // For security reasons avoid creating an instance + // if this class is one that would fail the class cast // to ORBInitializer anyway. - if( org.omg.PortableInterceptor.ORBInitializer.class.isAssignableFrom( - initClass ) ) { + if (org.omg.PortableInterceptor.ORBInitializer.class.isAssignableFrom(initClass)) { // Now that we have a class object, instantiate one and // remember it: - ORBInitializer initializer = null ; + ORBInitializer initializer = null; try { - initializer = (ORBInitializer)AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() - throws InstantiationException, IllegalAccessException - { - return initClass.newInstance() ; - } - } - ) ; + initializer = (ORBInitializer) AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws InstantiationException, IllegalAccessException { + return initClass.newInstance(); + } + }); } catch (PrivilegedActionException exc) { // Unwrap the exception, as we don't care exc here - throw wrapper.orbInitializerFailure( exc.getException(), - initClass.getName() ) ; + throw wrapper.orbInitializerFailure(exc.getException(), initClass.getName()); } catch (Exception exc) { - throw wrapper.orbInitializerFailure( exc, initClass.getName() ) ; + throw wrapper.orbInitializerFailure(exc, initClass.getName()); } - return initializer ; + return initializer; } else { - throw wrapper.orbInitializerType( initClass.getName() ) ; + throw wrapper.orbInitializerType(initClass.getName()); } } - } ; + }; - Operation result = OperationFactory.compose( mop, mkinst ) ; + Operation result = OperationFactory.compose(mop, mkinst); - return result ; + return result; } - public static final class TestAcceptor1 - implements Acceptor - { - public boolean equals( Object other ) - { - return other instanceof TestAcceptor1 ; - } - public boolean initialize() { return true; } - public boolean initialized() { return true; } - public String getConnectionCacheType() { return "FOO"; } - public void setConnectionCache(InboundConnectionCache connectionCache){} - public InboundConnectionCache getConnectionCache() { return null; } - public boolean shouldRegisterAcceptEvent() { return true; } - public void setUseSelectThreadForConnections(boolean x) { } - public boolean shouldUseSelectThreadForConnections() { return true; } - public void setUseWorkerThreadForConnections(boolean x) { } - public boolean shouldUseWorkerThreadForConnections() { return true; } - public Socket getAcceptedSocket() { return null ; } - public void processSocket( Socket socket ) { } - public void close() { } - public EventHandler getEventHandler() { return null; } - - public CDROutputObject createOutputObject( - ORB broker, MessageMediator messageMediator) { return null; } - public String getObjectAdapterId() { return null ; } - public String getObjectAdapterManagerId() { return null ; } - public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, - String codebase) { } - public String getMonitoringName() { return null ; } + public static final class TestAcceptor1 implements Acceptor { + public boolean equals(Object other) { + return other instanceof TestAcceptor1; + } + + public boolean initialize() { + return true; + } + + public boolean initialized() { + return true; + } + + public String getConnectionCacheType() { + return "FOO"; + } + + public void setConnectionCache(InboundConnectionCache connectionCache) { + } + + public InboundConnectionCache getConnectionCache() { + return null; + } + + public boolean shouldRegisterAcceptEvent() { + return true; + } + + public void setUseSelectThreadForConnections(boolean x) { + } + + public boolean shouldUseSelectThreadForConnections() { + return true; + } + + public void setUseWorkerThreadForConnections(boolean x) { + } + + public boolean shouldUseWorkerThreadForConnections() { + return true; + } + + public Socket getAcceptedSocket() { + return null; + } + + public void processSocket(Socket socket) { + } + + public void close() { + } + + public EventHandler getEventHandler() { + return null; + } + + public CDROutputObject createOutputObject(ORB broker, MessageMediator messageMediator) { + return null; + } + + public String getObjectAdapterId() { + return null; + } + + public String getObjectAdapterManagerId() { + return null; + } + + public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, String codebase) { + } + + public String getMonitoringName() { + return null; + } public ServerSocket getServerSocket() { - return null ; + return null; } public int getPort() { - return 0 ; + return 0; } public String getName() { - return "" ; + return ""; } public String getInterfaceName() { - return "" ; + return ""; } public String getType() { - return "" ; + return ""; } public boolean isLazy() { - return false ; + return false; } } - public static final class TestAcceptor2 - implements Acceptor - { - public boolean equals( Object other ) - { - return other instanceof TestAcceptor2 ; - } - public boolean initialize() { return true; } - public boolean initialized() { return true; } - public String getConnectionCacheType() { return "FOO"; } - public void setConnectionCache(InboundConnectionCache connectionCache){} - public InboundConnectionCache getConnectionCache() { return null; } - public boolean shouldRegisterAcceptEvent() { return true; } - public void setUseSelectThreadForConnections(boolean x) { } - public boolean shouldUseSelectThreadForConnections() { return true; } - public void setUseWorkerThreadForConnections(boolean x) { } - public boolean shouldUseWorkerThreadForConnections() { return true; } - public Socket getAcceptedSocket() { return null ; } - public void processSocket( Socket socket ) { } - public void close() { } - public EventHandler getEventHandler() { return null; } - - public CDROutputObject createOutputObject( - ORB broker, MessageMediator messageMediator) { return null; } - public String getObjectAdapterId() { return null ; } - public String getObjectAdapterManagerId() { return null ; } - public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, - String codebase) { } - public String getMonitoringName() { return null ; } + public static final class TestAcceptor2 implements Acceptor { + public boolean equals(Object other) { + return other instanceof TestAcceptor2; + } + + public boolean initialize() { + return true; + } + + public boolean initialized() { + return true; + } + + public String getConnectionCacheType() { + return "FOO"; + } + + public void setConnectionCache(InboundConnectionCache connectionCache) { + } + + public InboundConnectionCache getConnectionCache() { + return null; + } + + public boolean shouldRegisterAcceptEvent() { + return true; + } + + public void setUseSelectThreadForConnections(boolean x) { + } + + public boolean shouldUseSelectThreadForConnections() { + return true; + } + + public void setUseWorkerThreadForConnections(boolean x) { + } + + public boolean shouldUseWorkerThreadForConnections() { + return true; + } + + public Socket getAcceptedSocket() { + return null; + } + + public void processSocket(Socket socket) { + } + + public void close() { + } + + public EventHandler getEventHandler() { + return null; + } + + public CDROutputObject createOutputObject(ORB broker, MessageMediator messageMediator) { + return null; + } + + public String getObjectAdapterId() { + return null; + } + + public String getObjectAdapterManagerId() { + return null; + } + + public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, String codebase) { + } + + public String getMonitoringName() { + return null; + } + public ServerSocket getServerSocket() { - return null ; + return null; } public int getPort() { - return 0 ; + return 0; } public String getName() { - return "" ; + return ""; } public String getInterfaceName() { - return "" ; + return ""; } public String getType() { - return "" ; + return ""; } public boolean isLazy() { - return false ; + return false; } } // REVISIT - this is a cut and paste modification of makeROIOperation. private Operation makeAcceptorInstantiationOperation() { - Operation indexOp = OperationFactory.suffixAction() ; - Operation op1 = OperationFactory.compose( indexOp, classAction ) ; - Operation mop = OperationFactory.maskErrorAction( op1 ) ; + Operation indexOp = OperationFactory.suffixAction(); + Operation op1 = OperationFactory.compose(indexOp, classAction); + Operation mop = OperationFactory.maskErrorAction(op1); Operation mkinst = new Operation() { - public Object operate( Object value ) - { - final Class initClass = (Class)value ; + public Object operate(Object value) { + final Class initClass = (Class) value; if (initClass == null) - return null ; + return null; - // For security reasons avoid creating an instance - // if this class is one that would fail the class cast + // For security reasons avoid creating an instance + // if this class is one that would fail the class cast // to ORBInitializer anyway. - if( Acceptor.class.isAssignableFrom( initClass ) ) { + if (Acceptor.class.isAssignableFrom(initClass)) { // Now that we have a class object, instantiate one and // remember it: - Acceptor acceptor = null ; + Acceptor acceptor = null; try { - acceptor = (Acceptor)AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() - throws InstantiationException, IllegalAccessException - { - return initClass.newInstance() ; - } - } - ) ; + acceptor = (Acceptor) AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws InstantiationException, IllegalAccessException { + return initClass.newInstance(); + } + }); } catch (PrivilegedActionException exc) { // Unwrap the exception, as we don't care exc here - throw wrapper.acceptorInstantiationFailure( exc.getException(), - initClass.getName() ) ; + throw wrapper.acceptorInstantiationFailure(exc.getException(), initClass.getName()); } catch (Exception exc) { - throw wrapper.acceptorInstantiationFailure( exc, initClass.getName() ) ; + throw wrapper.acceptorInstantiationFailure(exc, initClass.getName()); } - return acceptor ; + return acceptor; } else { - throw wrapper.acceptorInstantiationTypeFailure( initClass.getName() ) ; + throw wrapper.acceptorInstantiationTypeFailure(initClass.getName()); } } - } ; + }; - Operation result = OperationFactory.compose( mop, mkinst ) ; + Operation result = OperationFactory.compose(mop, mkinst); - return result ; + return result; } private Operation makeInitRefOperation() { return new Operation() { - public Object operate( Object value ) - { + public Object operate(Object value) { // Object is String[] of length 2. - String[] values = (String[])value ; + String[] values = (String[]) value; if (values.length != 2) - throw wrapper.orbInitialreferenceSyntax() ; + throw wrapper.orbInitialreferenceSyntax(); - return values[0] + "=" + values[1] ; + return values[0] + "=" + values[1]; } - } ; + }; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PrefixParserAction.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PrefixParserAction.java index 0fd5191ec..6d0526093 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PrefixParserAction.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PrefixParserAction.java @@ -17,95 +17,86 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.util.Properties ; -import java.util.List ; -import java.util.LinkedList ; -import java.util.Iterator ; +import java.util.Properties; +import java.util.List; +import java.util.LinkedList; +import java.util.Iterator; -import java.lang.reflect.Array ; +import java.lang.reflect.Array; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.orb.Operation ; +import com.sun.corba.ee.spi.orb.Operation; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import org.glassfish.pfl.basic.contain.Pair; public class PrefixParserAction extends ParserActionBase { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private Class componentType ; + private Class componentType; - public PrefixParserAction( String propertyName, - Operation operation, String fieldName, Class componentType ) - { - super( propertyName, true, operation, fieldName ) ; - this.componentType = componentType ; + public PrefixParserAction(String propertyName, Operation operation, String fieldName, Class componentType) { + super(propertyName, true, operation, fieldName); + this.componentType = componentType; } - /** For each String s that matches the prefix given by getPropertyName(), - * apply getOperation() to { suffix( s ), value } - * and add the result to an Object[] - * which forms the result of apply. Returns null if there are no - * matches. + /** + * For each String s that matches the prefix given by getPropertyName(), apply getOperation() to { suffix( s ), value } + * and add the result to an Object[] which forms the result of apply. Returns null if there are no matches. */ - public Object apply( Properties props ) - { - String prefix = getPropertyName() ; - int prefixLength = prefix.length() ; - if (prefix.charAt( prefixLength - 1 ) != '.') { - prefix += '.' ; - prefixLength++ ; + public Object apply(Properties props) { + String prefix = getPropertyName(); + int prefixLength = prefix.length(); + if (prefix.charAt(prefixLength - 1) != '.') { + prefix += '.'; + prefixLength++; } - - List matches = new LinkedList() ; + + List matches = new LinkedList(); // Find all keys in props that start with propertyName - Iterator iter = props.keySet().iterator() ; + Iterator iter = props.keySet().iterator(); while (iter.hasNext()) { - String key = (String)(iter.next()) ; - if (key.startsWith( prefix )) { - String suffix = key.substring( prefixLength ) ; - String value = props.getProperty( key ) ; - Pair data = new Pair( suffix, value ) ; - Object result = getOperation().operate( data ) ; - matches.add( result ) ; + String key = (String) (iter.next()); + if (key.startsWith(prefix)) { + String suffix = key.substring(prefixLength); + String value = props.getProperty(key); + Pair data = new Pair(suffix, value); + Object result = getOperation().operate(data); + matches.add(result); } } - int size = matches.size() ; + int size = matches.size(); if (size > 0) { // Convert the list into an array of the proper type. - // An Object[] as a result does NOT work. Also report + // An Object[] as a result does NOT work. Also report // any errors carefully, as errors here or in parsers that // use this Operation often show up at ORB.init(). - Object result = null ; + Object result = null; try { - result = Array.newInstance( componentType, size ) ; + result = Array.newInstance(componentType, size); } catch (Throwable thr) { - throw wrapper.couldNotCreateArray( thr, - getPropertyName(), componentType, size ) ; + throw wrapper.couldNotCreateArray(thr, getPropertyName(), componentType, size); } - Iterator iter2 = matches.iterator() ; - int ctr = 0 ; + Iterator iter2 = matches.iterator(); + int ctr = 0; while (iter2.hasNext()) { - Object obj = iter2.next() ; + Object obj = iter2.next(); try { - Array.set( result, ctr, obj ) ; + Array.set(result, ctr, obj); } catch (Throwable thr) { - throw wrapper.couldNotSetArray( thr, - getPropertyName(), ctr, componentType, size, - obj ) ; + throw wrapper.couldNotSetArray(thr, getPropertyName(), ctr, componentType, size, obj); } - ctr++ ; + ctr++; } - return result ; + return result; } else { return null; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PrefixParserData.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PrefixParserData.java index 45279a082..87c78dcb6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PrefixParserData.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PrefixParserData.java @@ -17,42 +17,37 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.util.Properties ; +import java.util.Properties; -import com.sun.corba.ee.spi.orb.Operation ; -import com.sun.corba.ee.spi.orb.PropertyParser ; +import com.sun.corba.ee.spi.orb.Operation; +import com.sun.corba.ee.spi.orb.PropertyParser; import org.glassfish.pfl.basic.contain.Pair; public class PrefixParserData extends ParserDataBase { - private Pair[] testData ; - private Class componentType ; + private Pair[] testData; + private Class componentType; - public PrefixParserData( String propertyName, - Operation operation, String fieldName, Object defaultValue, - Object testValue, Pair[] testData, Class componentType ) - { - super( propertyName, operation, fieldName, defaultValue, testValue ) ; - this.testData = testData ; - this.componentType = componentType ; + public PrefixParserData(String propertyName, Operation operation, String fieldName, Object defaultValue, Object testValue, + Pair[] testData, Class componentType) { + super(propertyName, operation, fieldName, defaultValue, testValue); + this.testData = testData; + this.componentType = componentType; } - public void addToParser( PropertyParser parser ) - { - parser.addPrefix( getPropertyName(), getOperation(), getFieldName(), - componentType ) ; + public void addToParser(PropertyParser parser) { + parser.addPrefix(getPropertyName(), getOperation(), getFieldName(), componentType); } - public void addToProperties( Properties props ) - { - for (Pair sp : testData) { - String propName = getPropertyName() ; - if (propName.charAt( propName.length() - 1 ) != '.') - propName += "." ; + public void addToProperties(Properties props) { + for (Pair sp : testData) { + String propName = getPropertyName(); + if (propName.charAt(propName.length() - 1) != '.') + propName += "."; - props.setProperty( propName + sp.first(), sp.second() ) ; + props.setProperty(propName + sp.first(), sp.second()); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PropertyOnlyDataCollector.java b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PropertyOnlyDataCollector.java index 5e2487647..c3fd97a13 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PropertyOnlyDataCollector.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/orb/PropertyOnlyDataCollector.java @@ -17,32 +17,27 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.orb ; +package com.sun.corba.ee.impl.orb; -import java.net.InetAddress ; +import java.net.InetAddress; -import java.util.Properties ; +import java.util.Properties; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.CompletionStatus ; +import org.omg.CORBA.INTERNAL; +import org.omg.CORBA.CompletionStatus; -public class PropertyOnlyDataCollector extends DataCollectorBase -{ - public PropertyOnlyDataCollector( Properties props, - String localHostName, String configurationHostName ) - { - super( props, localHostName, configurationHostName ) ; +public class PropertyOnlyDataCollector extends DataCollectorBase { + public PropertyOnlyDataCollector(Properties props, String localHostName, String configurationHostName) { + super(props, localHostName, configurationHostName); } - public boolean isApplet() - { - return false ; + public boolean isApplet() { + return false; } - protected void collect() - { - checkPropertyDefaults() ; + protected void collect() { + checkPropertyDefaults(); - findPropertiesFromProperties() ; + findPropertiesFromProperties(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/osgi/loader/OSGIListener.java b/orbmain/src/main/java/com/sun/corba/ee/impl/osgi/loader/OSGIListener.java index f48486349..d259eb2a2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/osgi/loader/OSGIListener.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/osgi/loader/OSGIListener.java @@ -17,273 +17,261 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.osgi.loader ; +package com.sun.corba.ee.impl.osgi.loader; import java.util.Dictionary; import java.util.Map; -import org.osgi.framework.Bundle ; -import org.osgi.framework.BundleActivator ; -import org.osgi.framework.SynchronousBundleListener ; -import org.osgi.framework.BundleContext ; -import org.osgi.framework.BundleEvent ; -import org.osgi.framework.ServiceReference ; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.SynchronousBundleListener; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleEvent; +import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin ; -import org.osgi.service.packageadmin.ExportedPackage ; +import org.osgi.service.packageadmin.PackageAdmin; +import org.osgi.service.packageadmin.ExportedPackage; -import com.sun.corba.ee.spi.orb.ClassCodeBaseHandler ; +import com.sun.corba.ee.spi.orb.ClassCodeBaseHandler; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.spi.trace.Osgi; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.security.PrivilegedAction ; -import java.security.PrivilegedExceptionAction ; -import java.security.PrivilegedActionException ; -import java.security.AccessController ; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; +import java.security.AccessController; import org.glassfish.pfl.basic.func.UnaryFunction; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; -/** OSGi class that monitors which bundles provide classes that the ORB - * needs to instantiate for initialization. +/** + * OSGi class that monitors which bundles provide classes that the ORB needs to instantiate for initialization. *

    - * Note that OSGIListener must be a Bundle-Activator in the glassfish-corba-orb - * bundle. + * Note that OSGIListener must be a Bundle-Activator in the glassfish-corba-orb bundle. *

    - * Any bundle that provides ORB classes to the ORB initialization code must - * declare all such classes in a comma-separated list in the bundle manifest - * with the keywork ORB-Class-Provider. + * Any bundle that provides ORB classes to the ORB initialization code must declare all such classes in a + * comma-separated list in the bundle manifest with the keywork ORB-Class-Provider. * * @author ken */ @Osgi public class OSGIListener implements BundleActivator, SynchronousBundleListener { - private static final ReadWriteLock lock = new ReentrantReadWriteLock() ; + private static final ReadWriteLock lock = new ReentrantReadWriteLock(); - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private static final String ORB_PROVIDER_KEY = "ORB-Class-Provider" ; + private static final String ORB_PROVIDER_KEY = "ORB-Class-Provider"; - private static PackageAdmin pkgAdmin ; + private static PackageAdmin pkgAdmin; - private static void setPackageAdmin( PackageAdmin pa ) { - pkgAdmin = pa ; + private static void setPackageAdmin(PackageAdmin pa) { + pkgAdmin = pa; } - private static Dictionary secureGetHeaders( final Bundle bundle ) { + private static Dictionary secureGetHeaders(final Bundle bundle) { if (System.getSecurityManager() == null) { - return bundle.getHeaders() ; + return bundle.getHeaders(); } else { - return AccessController.doPrivileged( - new PrivilegedAction() { - public Dictionary run() { - return bundle.getHeaders() ; - } + return AccessController.doPrivileged(new PrivilegedAction() { + public Dictionary run() { + return bundle.getHeaders(); } - ) ; + }); } } - private static Class secureLoadClass( final Bundle bundle, - final String className ) throws ClassNotFoundException { + private static Class secureLoadClass(final Bundle bundle, final String className) throws ClassNotFoundException { if (System.getSecurityManager() == null) { - return bundle.loadClass( className ) ; + return bundle.loadClass(className); } else { try { - return AccessController.doPrivileged( - new PrivilegedExceptionAction>() { - public Class run() throws ClassNotFoundException { - return bundle.loadClass( className ) ; - } + return AccessController.doPrivileged(new PrivilegedExceptionAction>() { + public Class run() throws ClassNotFoundException { + return bundle.loadClass(className); } - ) ; + }); } catch (PrivilegedActionException exc) { - throw (ClassNotFoundException)exc.getException() ; + throw (ClassNotFoundException) exc.getException(); } } } - // Map from class name to Bundle, which identifies all known + // Map from class name to Bundle, which identifies all known // ORB-Class-Providers. - private static Map classNameMap = - new ConcurrentHashMap() ; + private static Map classNameMap = new ConcurrentHashMap(); // Map from package name to Bundle, which identifies all known // exported packages. - private static Map packageNameMap = - new ConcurrentHashMap() ; + private static Map packageNameMap = new ConcurrentHashMap(); - private static String getBundleEventType( int type ) { + private static String getBundleEventType(int type) { if (type == BundleEvent.INSTALLED) { return "INSTALLED"; } else if (type == BundleEvent.LAZY_ACTIVATION) { return "LAZY_ACTIVATION"; } else if (type == BundleEvent.RESOLVED) { - return "RESOLVED" ; + return "RESOLVED"; } else if (type == BundleEvent.STARTED) { - return "STARTED" ; + return "STARTED"; } else if (type == BundleEvent.STARTING) { - return "STARTING" ; + return "STARTING"; } else if (type == BundleEvent.STOPPED) { - return "STOPPED" ; + return "STOPPED"; } else if (type == BundleEvent.STOPPING) { - return "STOPPING" ; + return "STOPPING"; } else if (type == BundleEvent.UNINSTALLED) { - return "UNINSTALLED" ; + return "UNINSTALLED"; } else if (type == BundleEvent.UNRESOLVED) { - return "UNRESOLVED" ; + return "UNRESOLVED"; } else if (type == BundleEvent.UPDATED) { - return "UPDATED" ; + return "UPDATED"; } else { - return "ILLEGAL-EVENT-TYPE" ; + return "ILLEGAL-EVENT-TYPE"; } } @InfoMethod - private void classNotFoundInBundle( String arg ) {} + private void classNotFoundInBundle(String arg) { + } @InfoMethod - private void foundClassInBundle( String arg, String name ) {} + private void foundClassInBundle(String arg, String name) { + } @Osgi - private static class ClassNameResolverImpl implements - UnaryFunction> { + private static class ClassNameResolverImpl implements UnaryFunction> { @InfoMethod - private void classNotFoundInBundle( String arg ) {} + private void classNotFoundInBundle(String arg) { + } @InfoMethod - private void foundClassInBundle( String arg, String name ) {} + private void foundClassInBundle(String arg, String name) { + } @Osgi public Class evaluate(String arg) { - Bundle bundle = getBundleForClass( arg ) ; + Bundle bundle = getBundleForClass(arg); if (bundle == null) { - classNotFoundInBundle( arg ) ; - return null ; + classNotFoundInBundle(arg); + return null; } else { - foundClassInBundle( arg, bundle.getSymbolicName() ) ; + foundClassInBundle(arg, bundle.getSymbolicName()); } try { - return secureLoadClass( bundle, arg ); + return secureLoadClass(bundle, arg); } catch (ClassNotFoundException ex) { - throw wrapper.bundleCouldNotLoadClass( ex, arg, - bundle.getSymbolicName() ) ; + throw wrapper.bundleCouldNotLoadClass(ex, arg, bundle.getSymbolicName()); } } @Override public String toString() { - return "OSGiClassNameResolver" ; + return "OSGiClassNameResolver"; } } - private static UnaryFunction> classNameResolver = - new ClassNameResolverImpl() ; + private static UnaryFunction> classNameResolver = new ClassNameResolverImpl(); @Osgi - public static UnaryFunction> classNameResolver() { - return classNameResolver ; + public static UnaryFunction> classNameResolver() { + return classNameResolver; } @Osgi private static class ClassCodeBaseHandlerImpl implements ClassCodeBaseHandler { - private static final String PREFIX = "osgi://" ; + private static final String PREFIX = "osgi://"; @InfoMethod - private void classNotFoundInBundle( String name ) {} + private void classNotFoundInBundle(String name) { + } @InfoMethod - private void foundClassInBundleVersion( Class cls, String name, - String version ) {} + private void foundClassInBundleVersion(Class cls, String name, String version) { + } @Osgi - public String getCodeBase( Class cls ) { + public String getCodeBase(Class cls) { if (cls == null) { - return null ; + return null; } if (pkgAdmin == null) { - return null ; + return null; } - Bundle bundle = pkgAdmin.getBundle( cls ) ; + Bundle bundle = pkgAdmin.getBundle(cls); if (bundle == null) { - classNotFoundInBundle( cls.getName() ) ; - return null ; + classNotFoundInBundle(cls.getName()); + return null; } - - String name = bundle.getSymbolicName() ; - Dictionary headers = secureGetHeaders( bundle ) ; - String version = "0.0.0" ; + String name = bundle.getSymbolicName(); + + Dictionary headers = secureGetHeaders(bundle); + String version = "0.0.0"; if (headers != null) { - String hver = (String)headers.get( "Bundle-Version" ) ; + String hver = (String) headers.get("Bundle-Version"); if (hver != null) { version = hver; } } - foundClassInBundleVersion( cls, name, version ) ; + foundClassInBundleVersion(cls, name, version); - return PREFIX + name + "/" + version ; + return PREFIX + name + "/" + version; } @InfoMethod - private void couldNotLoadClassInBundle( ClassNotFoundException exc, - String className, String bname ) {} + private void couldNotLoadClassInBundle(ClassNotFoundException exc, String className, String bname) { + } @InfoMethod - private void foundClassInBundleVersion( String cname, - String bname, String version ) {} + private void foundClassInBundleVersion(String cname, String bname, String version) { + } @InfoMethod - private void classNotFoundInBundleVersion( String cname, - String bname, String version ) {} + private void classNotFoundInBundleVersion(String cname, String bname, String version) { + } @Osgi - public Class loadClass( String codebase, String className ) { + public Class loadClass(String codebase, String className) { if (codebase == null) { - Bundle bundle = getBundleForClass( className ) ; + Bundle bundle = getBundleForClass(className); if (bundle != null) { try { - return secureLoadClass( bundle, className ) ; + return secureLoadClass(bundle, className); } catch (ClassNotFoundException exc) { - couldNotLoadClassInBundle( exc, className, - bundle.getSymbolicName() ) ; - return null ; + couldNotLoadClassInBundle(exc, className, bundle.getSymbolicName()); + return null; } } else { - return null ; + return null; } } - if (codebase.startsWith( PREFIX )) { - String rest = codebase.substring( PREFIX.length() ) ; - int index = rest.indexOf( '/') ; + if (codebase.startsWith(PREFIX)) { + String rest = codebase.substring(PREFIX.length()); + int index = rest.indexOf('/'); if (index > 0) { - String name = rest.substring( 0, index ) ; - String version = rest.substring( index+1 ) ; + String name = rest.substring(0, index); + String version = rest.substring(index + 1); // version is a version range if (pkgAdmin != null) { - Bundle[] defBundles = pkgAdmin.getBundles( name, - version ) ; + Bundle[] defBundles = pkgAdmin.getBundles(name, version); if (defBundles != null) { // I think this is the highest available version try { - foundClassInBundleVersion( - className, name, version ) ; - return secureLoadClass( defBundles[0], className ) ; + foundClassInBundleVersion(className, name, version); + return secureLoadClass(defBundles[0], className); } catch (ClassNotFoundException cnfe) { - classNotFoundInBundleVersion( - className, name, version ) ; + classNotFoundInBundleVersion(className, name, version); // fall through to return null } } @@ -291,162 +279,162 @@ public Class loadClass( String codebase, String className ) { } } - return null ; + return null; } } - private static ClassCodeBaseHandler ccbHandler = - new ClassCodeBaseHandlerImpl() ; + private static ClassCodeBaseHandler ccbHandler = new ClassCodeBaseHandlerImpl(); @Osgi public static ClassCodeBaseHandler classCodeBaseHandler() { - return ccbHandler ; + return ccbHandler; } @InfoMethod - private void insertOrbProvider( String cname, String bname ) {} + private void insertOrbProvider(String cname, String bname) { + } @InfoMethod - private void insertBundlePackage( String pname, String bname ) {} + private void insertBundlePackage(String pname, String bname) { + } @Osgi - private void insertClasses( Bundle bundle ) { - lock.writeLock().lock() ; + private void insertClasses(Bundle bundle) { + lock.writeLock().lock(); try { - final Dictionary dict = secureGetHeaders( bundle ) ; - final String name = bundle.getSymbolicName() ; + final Dictionary dict = secureGetHeaders(bundle); + final String name = bundle.getSymbolicName(); if (dict != null) { - final String orbProvider = (String)dict.get( ORB_PROVIDER_KEY ) ; + final String orbProvider = (String) dict.get(ORB_PROVIDER_KEY); if (orbProvider != null) { - for (String str : orbProvider.split(",") ) { - String className = str.trim() ; - classNameMap.put( className, bundle ) ; - insertOrbProvider( className, name ) ; + for (String str : orbProvider.split(",")) { + String className = str.trim(); + classNameMap.put(className, bundle); + insertOrbProvider(className, name); } } } if (pkgAdmin != null) { - final ExportedPackage[] epkgs = pkgAdmin.getExportedPackages( - bundle ) ; + final ExportedPackage[] epkgs = pkgAdmin.getExportedPackages(bundle); if (epkgs != null) { for (ExportedPackage ep : epkgs) { - final String pname = ep.getName() ; - packageNameMap.put( pname, bundle ) ; - insertBundlePackage( pname, - bundle.getSymbolicName() ) ; + final String pname = ep.getName(); + packageNameMap.put(pname, bundle); + insertBundlePackage(pname, bundle.getSymbolicName()); } } } } finally { - lock.writeLock().unlock() ; + lock.writeLock().unlock(); } } @InfoMethod - private void removeOrbProvider( String cname, String bname ) {} + private void removeOrbProvider(String cname, String bname) { + } @InfoMethod - private void removeBundlePackage( String pname, String bname ) {} + private void removeBundlePackage(String pname, String bname) { + } @Osgi - private void removeClasses( Bundle bundle ) { - lock.writeLock().lock() ; + private void removeClasses(Bundle bundle) { + lock.writeLock().lock(); try { - final Dictionary dict = secureGetHeaders( bundle ) ; - final String name = bundle.getSymbolicName() ; + final Dictionary dict = secureGetHeaders(bundle); + final String name = bundle.getSymbolicName(); if (dict != null) { - final String orbProvider = (String)dict.get( ORB_PROVIDER_KEY ) ; + final String orbProvider = (String) dict.get(ORB_PROVIDER_KEY); if (orbProvider != null) { - for (String className : orbProvider.split(",") ) { - classNameMap.remove( className ) ; - removeOrbProvider( className, name ) ; + for (String className : orbProvider.split(",")) { + classNameMap.remove(className); + removeOrbProvider(className, name); } } } if (pkgAdmin != null) { - final ExportedPackage[] epkgs = pkgAdmin.getExportedPackages( - bundle ) ; + final ExportedPackage[] epkgs = pkgAdmin.getExportedPackages(bundle); if (epkgs != null) { for (ExportedPackage ep : epkgs) { - final String pname = ep.getName() ; - packageNameMap.remove( pname ) ; - removeBundlePackage( pname, - bundle.getSymbolicName() ) ; + final String pname = ep.getName(); + packageNameMap.remove(pname); + removeBundlePackage(pname, bundle.getSymbolicName()); } } } } finally { - lock.writeLock().unlock() ; + lock.writeLock().unlock(); } } @Osgi - private static Bundle getBundleForClass( String className ) { - lock.readLock().lock() ; + private static Bundle getBundleForClass(String className) { + lock.readLock().lock(); try { - Bundle result = classNameMap.get( className ) ; + Bundle result = classNameMap.get(className); if (result == null) { // Get package prefix - final int index = className.lastIndexOf( '.') ; + final int index = className.lastIndexOf('.'); if (index > 0) { - final String packageName = className.substring( 0, index ) ; - result = packageNameMap.get( packageName ) ; + final String packageName = className.substring(0, index); + result = packageNameMap.get(packageName); } } - return result ; + return result; } finally { - lock.readLock().unlock() ; + lock.readLock().unlock(); } } @InfoMethod - private void probeBundlesForProviders() {} + private void probeBundlesForProviders() { + } @Osgi - public void start( BundleContext context ) { + public void start(BundleContext context) { // Get a referece to the PackageAdmin service before we // do ANYTHING else. - final ServiceReference sref = context.getServiceReference( - "org.osgi.service.packageadmin.PackageAdmin" ) ; - setPackageAdmin( (PackageAdmin)context.getService( sref ) ) ; + final ServiceReference sref = context.getServiceReference("org.osgi.service.packageadmin.PackageAdmin"); + setPackageAdmin((PackageAdmin) context.getService(sref)); if (pkgAdmin == null) { - wrapper.packageAdminServiceNotAvailable() ; + wrapper.packageAdminServiceNotAvailable(); } context.addBundleListener(this); - + // Probe all existing bundles for ORB providers - probeBundlesForProviders() ; + probeBundlesForProviders(); for (Bundle bundle : context.getBundles()) { - insertClasses( bundle ) ; + insertClasses(bundle); } } @Osgi - public void stop( BundleContext context ) { - final Bundle myBundle = context.getBundle() ; - removeClasses( myBundle ) ; + public void stop(BundleContext context) { + final Bundle myBundle = context.getBundle(); + removeClasses(myBundle); } @InfoMethod - private void receivedBundleEvent( String type, String name ) {} + private void receivedBundleEvent(String type, String name) { + } @Osgi public void bundleChanged(BundleEvent event) { - final int type = event.getType() ; - final Bundle bundle = event.getBundle() ; - final String name = bundle.getSymbolicName() ; + final int type = event.getType(); + final Bundle bundle = event.getBundle(); + final String name = bundle.getSymbolicName(); - receivedBundleEvent( getBundleEventType( type ), name ) ; + receivedBundleEvent(getBundleEventType(type), name); if (type == Bundle.INSTALLED) { - insertClasses( bundle ) ; + insertClasses(bundle); } else if (type == Bundle.UNINSTALLED) { - removeClasses( bundle ) ; + removeClasses(bundle); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/NoConnectionCacheImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/NoConnectionCacheImpl.java index d2a06846c..c4688d840 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/NoConnectionCacheImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/NoConnectionCacheImpl.java @@ -17,230 +17,224 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.plugin.hwlb ; +package com.sun.corba.ee.impl.plugin.hwlb; -import java.util.Collection ; -import java.util.Map ; -import java.util.HashMap ; +import java.util.Collection; +import java.util.Map; +import java.util.HashMap; -import org.omg.CORBA.LocalObject ; +import org.omg.CORBA.LocalObject; -import com.sun.corba.ee.spi.protocol.ClientRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.ClientRequestDispatcher; -import com.sun.corba.ee.spi.transport.Connection ; -import com.sun.corba.ee.spi.transport.OutboundConnectionCache ; +import com.sun.corba.ee.spi.transport.Connection; +import com.sun.corba.ee.spi.transport.OutboundConnectionCache; -import com.sun.corba.ee.impl.encoding.CDRInputObject ; +import com.sun.corba.ee.impl.encoding.CDRInputObject; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBConfigurator ; -import com.sun.corba.ee.spi.orb.DataCollector ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBConfigurator; +import com.sun.corba.ee.spi.orb.DataCollector; import com.sun.corba.ee.spi.transport.ContactInfo; -import com.sun.corba.ee.spi.transport.ContactInfoList ; -import com.sun.corba.ee.spi.transport.ContactInfoListFactory ; -import com.sun.corba.ee.spi.protocol.RequestDispatcherRegistry ; +import com.sun.corba.ee.spi.transport.ContactInfoList; +import com.sun.corba.ee.spi.transport.ContactInfoListFactory; +import com.sun.corba.ee.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.misc.ORBConstants; -import com.sun.corba.ee.impl.transport.ConnectionCacheBase ; -import com.sun.corba.ee.impl.transport.ConnectionImpl ; +import com.sun.corba.ee.impl.transport.ConnectionCacheBase; +import com.sun.corba.ee.impl.transport.ConnectionImpl; // The following 3 implementation classes are needed as base // classes. This needs some architectural changes, perhaps // adding a codegen-based proxy layer for dynamic inheritance. -import com.sun.corba.ee.impl.protocol.ClientRequestDispatcherImpl ; +import com.sun.corba.ee.impl.protocol.ClientRequestDispatcherImpl; -import com.sun.corba.ee.impl.transport.ContactInfoImpl ; -import com.sun.corba.ee.impl.transport.ContactInfoListImpl ; +import com.sun.corba.ee.impl.transport.ContactInfoImpl; +import com.sun.corba.ee.impl.transport.ContactInfoListImpl; import com.sun.corba.ee.spi.trace.Transport; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; - -/** Install this in an ORB using the property - * ORBConstants.USER_CONFIGURATOR_PREFIX + "corba.lb.NoConnectionCacheImpl" = "dummy" +/** + * Install this in an ORB using the property ORBConstants.USER_CONFIGURATOR_PREFIX + "corba.lb.NoConnectionCacheImpl" = + * "dummy" */ @Transport -public class NoConnectionCacheImpl - extends LocalObject - implements ORBConfigurator -{ +public class NoConnectionCacheImpl extends LocalObject implements ORBConfigurator { @Transport - private static class NCCConnectionCacheImpl extends ConnectionCacheBase - implements OutboundConnectionCache { + private static class NCCConnectionCacheImpl extends ConnectionCacheBase implements OutboundConnectionCache { // store is a dummy variable - private Map store = new HashMap() ; + private Map store = new HashMap(); // holds only one connection - private Connection connection = null ; + private Connection connection = null; - public NCCConnectionCacheImpl( ORB orb ) { - super( orb, "Dummy", "Dummy" ) ; + public NCCConnectionCacheImpl(ORB orb) { + super(orb, "Dummy", "Dummy"); } public Collection values() { - return store.values() ; + return store.values(); } protected Object backingStore() { - return store ; + return store; } public Connection get(ContactInfo contactInfo) { - return connection ; + return connection; } @Transport - public void put(ContactInfo contactInfo, Connection conn ) { - remove( contactInfo ) ; - connection = conn ; + public void put(ContactInfo contactInfo, Connection conn) { + remove(contactInfo); + connection = conn; } @InfoMethod - private void removeConnectionInfo( Connection conn ) { } + private void removeConnectionInfo(Connection conn) { + } @InfoMethod - private void connectionIsNull() { } + private void connectionIsNull() { + } @Transport public void remove(ContactInfo contactInfo) { if (connection != null) { removeConnectionInfo(connection); - connection.close() ; - connection = null ; + connection.close(); + connection = null; } else { connectionIsNull(); } } } - private static ThreadLocal connectionCache = new ThreadLocal() ; + private static ThreadLocal connectionCache = new ThreadLocal(); - private static NCCConnectionCacheImpl getConnectionCache( ORB orb ) { - NCCConnectionCacheImpl result = (NCCConnectionCacheImpl)connectionCache.get() ; + private static NCCConnectionCacheImpl getConnectionCache(ORB orb) { + NCCConnectionCacheImpl result = (NCCConnectionCacheImpl) connectionCache.get(); if (result == null) { - result = new NCCConnectionCacheImpl( orb ) ; - connectionCache.set( result ) ; + result = new NCCConnectionCacheImpl(orb); + connectionCache.set(result); } - return result ; + return result; } @Transport private static class NCCConnectionImpl extends ConnectionImpl { - private static int count = 0 ; - private int myCount ; + private static int count = 0; + private int myCount; @Transport - private void constructedNCCConnectionImpl( String str ) { + private void constructedNCCConnectionImpl(String str) { } - public NCCConnectionImpl(ORB orb, ContactInfo contactInfo, - String socketType, String hostname, int port) { + public NCCConnectionImpl(ORB orb, ContactInfo contactInfo, String socketType, String hostname, int port) { - super(orb,contactInfo, socketType, hostname, port); - myCount = count++ ; + super(orb, contactInfo, socketType, hostname, port); + myCount = count++; constructedNCCConnectionImpl(toString()); } @Override public String toString() { - return "NCCConnectionImpl(" + myCount + ")[" - + super.toString() + "]" ; + return "NCCConnectionImpl(" + myCount + ")[" + super.toString() + "]"; } @Transport @Override - public synchronized void close() { - super.closeConnectionResources() ; + public synchronized void close() { + super.closeConnectionResources(); } } @Transport private static class NCCContactInfoImpl extends ContactInfoImpl { - public NCCContactInfoImpl( ORB orb, - ContactInfoList contactInfoList, IOR effectiveTargetIOR, - short addressingDisposition, String socketType, String hostname, - int port) { + public NCCContactInfoImpl(ORB orb, ContactInfoList contactInfoList, IOR effectiveTargetIOR, short addressingDisposition, + String socketType, String hostname, int port) { - super( orb, contactInfoList, effectiveTargetIOR, addressingDisposition, - socketType, hostname, port ) ; + super(orb, contactInfoList, effectiveTargetIOR, addressingDisposition, socketType, hostname, port); } @Transport @Override public boolean shouldCacheConnection() { - return false ; + return false; } @InfoMethod - private void createdConnection( Connection conn ) { } + private void createdConnection(Connection conn) { + } @Transport @Override public Connection createConnection() { - Connection connection = new NCCConnectionImpl( orb, this, - socketType, hostname, port ) ; + Connection connection = new NCCConnectionImpl(orb, this, socketType, hostname, port); createdConnection(connection); - NCCConnectionCacheImpl cc = NoConnectionCacheImpl.getConnectionCache( orb ) ; - cc.put( this, connection ) ; - connection.setConnectionCache( cc ) ; + NCCConnectionCacheImpl cc = NoConnectionCacheImpl.getConnectionCache(orb); + cc.put(this, connection); + connection.setConnectionCache(cc); - return connection ; + return connection; } } public static class NCCContactInfoListImpl extends ContactInfoListImpl { - public NCCContactInfoListImpl( ORB orb, IOR ior ) { - super( orb, ior ) ; + public NCCContactInfoListImpl(ORB orb, IOR ior) { + super(orb, ior); } @Override - public ContactInfo createContactInfo( String type, String hostname, - int port ) { + public ContactInfo createContactInfo(String type, String hostname, int port) { - return new NCCContactInfoImpl( orb, this, effectiveTargetIOR, - orb.getORBData().getGIOPAddressDisposition(), type, hostname, port ) ; + return new NCCContactInfoImpl(orb, this, effectiveTargetIOR, orb.getORBData().getGIOPAddressDisposition(), type, hostname, + port); } } private static class NCCClientRequestDispatcherImpl extends ClientRequestDispatcherImpl { @Override - public void endRequest( ORB broker, Object self, CDRInputObject inputObject ) { - super.endRequest( broker, self, inputObject) ; - getConnectionCache( broker ).remove( null ) ; + public void endRequest(ORB broker, Object self, CDRInputObject inputObject) { + super.endRequest(broker, self, inputObject); + getConnectionCache(broker).remove(null); } } - public void configure( DataCollector dc, final ORB orb ) { + public void configure(DataCollector dc, final ORB orb) { ContactInfoListFactory factory = new ContactInfoListFactory() { - public void setORB(ORB orb) {} - public ContactInfoList create( IOR ior ) { - return new NCCContactInfoListImpl( orb, ior ) ; + public void setORB(ORB orb) { + } + + public ContactInfoList create(IOR ior) { + return new NCCContactInfoListImpl(orb, ior); } - } ; + }; // Disable a read optimization that forces a blocking read on all - // OP_READ events. It makes little sense to enable this optimization + // OP_READ events. It makes little sense to enable this optimization // when using a NCCConnectionCache because clients will close a - // Connection when a response to a request has been received. Hence, + // Connection when a response to a request has been received. Hence, // if the client knows when it receives a response to a request and - // then closes the Connection, there's no reason to enable an + // then closes the Connection, there's no reason to enable an // optimization that will force a blocking read which will wait for // more data to arrive after the client's response has been received. - orb.getORBData().alwaysEnterBlockingRead( false ) ; + orb.getORBData().alwaysEnterBlockingRead(false); - orb.setCorbaContactInfoListFactory( factory ) ; + orb.setCorbaContactInfoListFactory(factory); - ClientRequestDispatcher crd = new NCCClientRequestDispatcherImpl() ; - RequestDispatcherRegistry rdr = orb.getRequestDispatcherRegistry() ; - // Need to register crd with all scids. Assume range is 0 to MAX_POA_SCID. - for (int ctr=0; ctr= transientRetryTimeout) { + + } else if (System.currentTimeMillis() - getStartTime() >= transientRetryTimeout) { if (debug) { - System.out.println(msg - + "exceeded transientRetryTimeout: " - + transientRetryTimeout - + " - not retrying"); + System.out.println(msg + "exceeded transientRetryTimeout: " + transientRetryTimeout + " - not retrying"); } return; @@ -207,14 +184,12 @@ public void receive_exception(ClientRequestInfo ri) throw new ForwardRequest(ri.target()); } else { if (debug) { - System.out.println(msg + "unexpected: " - + ri.received_exception_id()); + System.out.println(msg + "unexpected: " + ri.received_exception_id()); } } } - public void receive_other(ClientRequestInfo ri) - { + public void receive_other(ClientRequestInfo ri) { setBackoff(initialBackoff); } @@ -223,12 +198,10 @@ public void receive_other(ClientRequestInfo ri) // ORBInitializer // - public void pre_init(ORBInitInfo info) - { + public void pre_init(ORBInitInfo info) { } - public void post_init(ORBInitInfo info) - { + public void post_init(ORBInitInfo info) { try { if (debug) { System.out.println(".post_init: registering: " + this); @@ -247,25 +220,19 @@ public void post_init(ORBInitInfo info) // Implementation // - private boolean isTransientException(ClientRequestInfo ri) - { + private boolean isTransientException(ClientRequestInfo ri) { return ri.received_exception_id().equals(TRANSIENT_REPOSITORY_ID); } - private boolean isBadServerIdException(ClientRequestInfo ri) - { - if (! ri.received_exception_id().equals(OBJECT_NOT_EXIST_REPOSITORY_ID)) { + private boolean isBadServerIdException(ClientRequestInfo ri) { + if (!ri.received_exception_id().equals(OBJECT_NOT_EXIST_REPOSITORY_ID)) { return false; } - SystemException se = - ORBUtility.extractSystemException(ri.received_exception()); + SystemException se = ORBUtility.extractSystemException(ri.received_exception()); - return - se instanceof org.omg.CORBA.OBJECT_NOT_EXIST - && se.minor == ORBUtilSystemException.BAD_SERVER_ID; + return se instanceof org.omg.CORBA.OBJECT_NOT_EXIST && se.minor == ORBUtilSystemException.BAD_SERVER_ID; } } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/RetryServerRequestInterceptor.java b/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/RetryServerRequestInterceptor.java index 01a318860..ad42d70f6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/RetryServerRequestInterceptor.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/RetryServerRequestInterceptor.java @@ -21,7 +21,7 @@ // Created : 2005 Jul 01 (Fri) 13:36:46 by Harold Carr. // -package com.sun.corba.ee.impl.plugin.hwlb ; +package com.sun.corba.ee.impl.plugin.hwlb; import java.util.Properties; @@ -36,12 +36,8 @@ /** * @author Harold Carr */ -public class RetryServerRequestInterceptor - extends org.omg.CORBA.LocalObject - implements ORBInitializer, ServerRequestInterceptor -{ - private static final String baseMsg = - RetryServerRequestInterceptor.class.getName(); +public class RetryServerRequestInterceptor extends org.omg.CORBA.LocalObject implements ORBInitializer, ServerRequestInterceptor { + private static final String baseMsg = RetryServerRequestInterceptor.class.getName(); private static boolean rejectingRequests = false; @@ -52,13 +48,11 @@ public class RetryServerRequestInterceptor // Application specific // - public static boolean getRejectingRequests() - { + public static boolean getRejectingRequests() { return rejectingRequests; } - public static void setRejectingRequests(boolean x) - { + public static void setRejectingRequests(boolean x) { rejectingRequests = x; } @@ -67,13 +61,11 @@ public static void setRejectingRequests(boolean x) // Interceptor operations // - public String name() - { - return baseMsg; + public String name() { + return baseMsg; } - public void destroy() - { + public void destroy() { } //////////////////////////////////////////////////// @@ -81,39 +73,28 @@ public void destroy() // ServerRequestInterceptor // - public void receive_request_service_contexts(ServerRequestInfo ri) - { + public void receive_request_service_contexts(ServerRequestInfo ri) { if (rejectingRequests) { if (debug) { - System.out.println(baseMsg - + ".receive_request_service_contexts:" - + " rejecting request: " - + ri.operation()); + System.out.println(baseMsg + ".receive_request_service_contexts:" + " rejecting request: " + ri.operation()); } throw new TRANSIENT(); } if (debug) { - System.out.println(baseMsg - + ".receive_request_service_contexts:" - + " accepting request: " - + ri.operation()); + System.out.println(baseMsg + ".receive_request_service_contexts:" + " accepting request: " + ri.operation()); } } - public void receive_request(ServerRequestInfo ri) - { + public void receive_request(ServerRequestInfo ri) { } - public void send_reply(ServerRequestInfo ri) - { + public void send_reply(ServerRequestInfo ri) { } - public void send_exception(ServerRequestInfo ri) - { + public void send_exception(ServerRequestInfo ri) { } - public void send_other(ServerRequestInfo ri) - { + public void send_other(ServerRequestInfo ri) { } //////////////////////////////////////////////////// @@ -121,12 +102,10 @@ public void send_other(ServerRequestInfo ri) // ORBInitializer // - public void pre_init(ORBInitInfo info) - { + public void pre_init(ORBInitInfo info) { } - public void post_init(ORBInitInfo info) - { + public void post_init(ORBInitInfo info) { try { if (debug) { System.out.println(".post_init: registering: " + this); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/VirtualAddressAgentImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/VirtualAddressAgentImpl.java index 7ca753e17..14272a14e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/VirtualAddressAgentImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/plugin/hwlb/VirtualAddressAgentImpl.java @@ -17,201 +17,181 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.plugin.hwlb ; +package com.sun.corba.ee.impl.plugin.hwlb; -import java.lang.reflect.Field ; +import java.lang.reflect.Field; -import java.security.AccessController ; -import java.security.PrivilegedAction ; +import java.security.AccessController; +import java.security.PrivilegedAction; -import java.util.Iterator ; +import java.util.Iterator; -import org.omg.CORBA.LocalObject ; +import org.omg.CORBA.LocalObject; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.IOP.TAG_INTERNET_IOP ; +import org.omg.IOP.TAG_INTERNET_IOP; -import org.omg.PortableInterceptor.ORBInitializer ; -import org.omg.PortableInterceptor.IORInterceptor_3_0 ; -import org.omg.PortableInterceptor.IORInfo ; -import org.omg.PortableInterceptor.ORBInitInfo ; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; +import org.omg.PortableInterceptor.ORBInitializer; +import org.omg.PortableInterceptor.IORInterceptor_3_0; +import org.omg.PortableInterceptor.IORInfo; +import org.omg.PortableInterceptor.ORBInitInfo; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBData ; -import com.sun.corba.ee.spi.orb.ORBConfigurator ; -import com.sun.corba.ee.spi.orb.DataCollector ; -import com.sun.corba.ee.spi.orb.ParserImplBase ; -import com.sun.corba.ee.spi.orb.PropertyParser ; -import com.sun.corba.ee.spi.orb.OperationFactory ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBData; +import com.sun.corba.ee.spi.orb.ORBConfigurator; +import com.sun.corba.ee.spi.orb.DataCollector; +import com.sun.corba.ee.spi.orb.ParserImplBase; +import com.sun.corba.ee.spi.orb.PropertyParser; +import com.sun.corba.ee.spi.orb.OperationFactory; -import com.sun.corba.ee.spi.ior.Identifiable ; -import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder ; -import com.sun.corba.ee.spi.ior.EncapsulationFactoryBase ; -import com.sun.corba.ee.spi.ior.IORTemplate ; -import com.sun.corba.ee.spi.ior.IORFactories ; -import com.sun.corba.ee.spi.ior.TaggedProfileTemplate ; -import com.sun.corba.ee.spi.ior.TaggedComponent ; -import com.sun.corba.ee.spi.ior.TaggedProfile ; -import com.sun.corba.ee.spi.ior.ObjectKey ; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; +import com.sun.corba.ee.spi.ior.Identifiable; +import com.sun.corba.ee.spi.ior.IdentifiableFactoryFinder; +import com.sun.corba.ee.spi.ior.EncapsulationFactoryBase; +import com.sun.corba.ee.spi.ior.IORTemplate; +import com.sun.corba.ee.spi.ior.IORFactories; +import com.sun.corba.ee.spi.ior.TaggedProfileTemplate; +import com.sun.corba.ee.spi.ior.TaggedComponent; +import com.sun.corba.ee.spi.ior.TaggedProfile; +import com.sun.corba.ee.spi.ior.ObjectKey; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.ee.spi.ior.iiop.IIOPFactories ; -import com.sun.corba.ee.spi.ior.iiop.AlternateIIOPAddressComponent ; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; +import com.sun.corba.ee.spi.ior.iiop.IIOPFactories; +import com.sun.corba.ee.spi.ior.iiop.AlternateIIOPAddressComponent; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; +import com.sun.corba.ee.impl.ior.iiop.IIOPProfileImpl; +import com.sun.corba.ee.impl.ior.iiop.IIOPProfileTemplateImpl; +import com.sun.corba.ee.spi.misc.ORBConstants; -import com.sun.corba.ee.impl.ior.iiop.IIOPProfileImpl ; -import com.sun.corba.ee.impl.ior.iiop.IIOPProfileTemplateImpl ; +import com.sun.corba.ee.impl.orb.ORBDataParserImpl; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.impl.oa.poa.BadServerIdHandler; -import com.sun.corba.ee.impl.orb.ORBDataParserImpl ; - - - -import com.sun.corba.ee.impl.oa.poa.BadServerIdHandler ; - -import com.sun.corba.ee.impl.interceptors.IORInfoImpl ; +import com.sun.corba.ee.impl.interceptors.IORInfoImpl; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.spi.trace.Subcontract; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Subcontract -public class VirtualAddressAgentImpl - extends LocalObject - implements ORBConfigurator, ORBInitializer, IORInterceptor_3_0 -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - - public static final String VAA_HOST_PROPERTY = ORBConstants.SUN_PREFIX + - "ORBVAAHost" ; - public static final String VAA_PORT_PROPERTY = ORBConstants.SUN_PREFIX + - "ORBVAAPort" ; +public class VirtualAddressAgentImpl extends LocalObject implements ORBConfigurator, ORBInitializer, IORInterceptor_3_0 { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + + public static final String VAA_HOST_PROPERTY = ORBConstants.SUN_PREFIX + "ORBVAAHost"; + public static final String VAA_PORT_PROPERTY = ORBConstants.SUN_PREFIX + "ORBVAAPort"; private static final long serialVersionUID = 5670615031510472636L; - private String host = null ; - private int port = 0 ; - private ORB orb = null ; - private IIOPAddress addr = null ; - private ORBInitializer[] newOrbInits = null ; + private String host = null; + private int port = 0; + private ORB orb = null; + private IIOPAddress addr = null; + private ORBInitializer[] newOrbInits = null; @Subcontract private class AddressParser extends ParserImplBase { - private String _host = null ; - private int _port = 0 ; + private String _host = null; + private int _port = 0; public PropertyParser makeParser() { - PropertyParser parser = new PropertyParser() ; - parser.add( VAA_HOST_PROPERTY, OperationFactory.stringAction(), - "_host" ) ; - parser.add( VAA_PORT_PROPERTY, OperationFactory.integerAction(), - "_port" ) ; - return parser ; + PropertyParser parser = new PropertyParser(); + parser.add(VAA_HOST_PROPERTY, OperationFactory.stringAction(), "_host"); + parser.add(VAA_PORT_PROPERTY, OperationFactory.integerAction(), "_port"); + return parser; } @Subcontract @Override protected void complete() { - host = _host ; - port = _port ; + host = _host; + port = _port; } } - @InfoMethod - private void agentAddress( IIOPAddress addr ) { } + @InfoMethod + private void agentAddress(IIOPAddress addr) { + } @Subcontract - public void configure( DataCollector dc, final ORB orb ) { - this.orb = orb ; + public void configure(DataCollector dc, final ORB orb) { + this.orb = orb; - orb.setBadServerIdHandler( - new BadServerIdHandler() { - public void handle( ObjectKey objectkey ) { - // NO-OP - } + orb.setBadServerIdHandler(new BadServerIdHandler() { + public void handle(ObjectKey objectkey) { + // NO-OP } - ) ; + }); // Create a new parser to extract the virtual address // host/port information from the data collector - final AddressParser parser = new AddressParser() ; - parser.init( dc ) ; - addr = IIOPFactories.makeIIOPAddress( host, port ) ; + final AddressParser parser = new AddressParser(); + parser.init(dc); + addr = IIOPFactories.makeIIOPAddress(host, port); agentAddress(addr); // Register the special IIOPProfile in the TaggedProfileFactoryFinder. // This means that the isLocal check will be handled properly even // when an objref leaves the server that created it and then comes // back and gets unmarshalled. - IdentifiableFactoryFinder finder = - orb.getTaggedProfileFactoryFinder() ; - finder.registerFactory( - new EncapsulationFactoryBase( TAG_INTERNET_IOP.value ) { - public Identifiable readContents( InputStream in ) { - Identifiable result = new SpecialIIOPProfileImpl( in ) ; - return result ; - } + IdentifiableFactoryFinder finder = orb.getTaggedProfileFactoryFinder(); + finder.registerFactory(new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) { + public Identifiable readContents(InputStream in) { + Identifiable result = new SpecialIIOPProfileImpl(in); + return result; } - ) ; + }); // Add this object to the initializer list // by using a PropertyParser in a rather unusual fashion - final ORBData odata = orb.getORBData() ; + final ORBData odata = orb.getORBData(); // Add this object to the end of a copy of the ORBInitializers // from the ORBData. - final ORBInitializer[] oldOrbInits = odata.getORBInitializers() ; - final int newIndex = oldOrbInits.length ; - newOrbInits = new ORBInitializer[newIndex+1] ; - for (int ctr=0; ctr 0 ; + public DynamicMethodMarshallerImpl(Method method) { + this.method = method; + ehandler = new ExceptionHandlerImpl(method.getExceptionTypes()); + needsArgumentCopy = false; + + Class[] argTypes = method.getParameterTypes(); + hasArguments = argTypes.length > 0; if (hasArguments) { - argRWs = new ReaderWriter[ argTypes.length ] ; - for (int ctr=0; ctr cls = null ; + Class cls = null; try { - cls = JDKBridge.loadClass( cname, null, null ) ; + cls = JDKBridge.loadClass(cname, null, null); } catch (ClassNotFoundException exc) { - Exceptions.self.readResolveClassNotFound( exc, cname ) ; + Exceptions.self.readResolveClassNotFound(exc, cname); } - PresentationManager pm = - com.sun.corba.ee.spi.orb.ORB.getPresentationManager() ; - PresentationManager.ClassData classData = pm.getClassData( cls ) ; - InvocationHandlerFactoryImpl ihfactory = - (InvocationHandlerFactoryImpl)classData.getInvocationHandlerFactory() ; - return ihfactory.getInvocationHandler( this ) ; + PresentationManager pm = com.sun.corba.ee.spi.orb.ORB.getPresentationManager(); + PresentationManager.ClassData classData = pm.getClassData(cls); + InvocationHandlerFactoryImpl ihfactory = (InvocationHandlerFactoryImpl) classData.getInvocationHandlerFactory(); + return ihfactory.getInvocationHandler(this); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ExceptionHandler.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ExceptionHandler.java index 8121f4ea2..29ad5cb37 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ExceptionHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ExceptionHandler.java @@ -18,40 +18,38 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA.portable.ApplicationException ; +import org.omg.CORBA.portable.ApplicationException; -public interface ExceptionHandler -{ - /** Return true iff cls is an exception class that is - * assignment compatible with an exception declared - * on the method used to create this ExceptionHandler. +public interface ExceptionHandler { + /** + * Return true iff cls is an exception class that is assignment compatible with an exception declared on the method used + * to create this ExceptionHandler. + * * @param cls Class to check * @return If class is a declared exception */ - boolean isDeclaredException( Class cls ); + boolean isDeclaredException(Class cls); - /** Write the exception ex to os. ex must be assignment - * compatible with an exception - * declared on the method used to create this - * ExceptionHandler. + /** + * Write the exception ex to os. ex must be assignment compatible with an exception declared on the method used to + * create this ExceptionHandler. + * * @param os Stream to write to. * @param ex Exception to write. */ - void writeException( OutputStream os, Exception ex ); + void writeException(OutputStream os, Exception ex); - /** Read the exception contained in the InputStream - * in the ApplicationException. If ae represents - * an exception that is assignment compatible with - * an exception on the method used to create this - * exception handler, return the exception, - * otherwise return an UnexpectedException wrapping - * the exception in ae. + /** + * Read the exception contained in the InputStream in the ApplicationException. If ae represents an exception that is + * assignment compatible with an exception on the method used to create this exception handler, return the exception, + * otherwise return an UnexpectedException wrapping the exception in ae. + * * @param ae Exception to get input stream to read exception from. * @return Exception from from stream. */ - Exception readException( ApplicationException ae ); + Exception readException(ApplicationException ae); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ExceptionHandlerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ExceptionHandlerImpl.java index 6d4aff35c..356f157ac 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ExceptionHandlerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ExceptionHandlerImpl.java @@ -17,262 +17,224 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; -import java.rmi.UnexpectedException ; +import java.rmi.UnexpectedException; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA.portable.ApplicationException ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; +import org.omg.CORBA.portable.ApplicationException; -import java.lang.reflect.Method ; +import java.lang.reflect.Method; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; -public class ExceptionHandlerImpl implements ExceptionHandler -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self; +public class ExceptionHandlerImpl implements ExceptionHandler { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private ExceptionRW[] rws ; + private ExceptionRW[] rws; /////////////////////////////////////////////////////////////////////////////// // ExceptionRW interface and implementations. // Used to read and write exceptions. /////////////////////////////////////////////////////////////////////////////// - public interface ExceptionRW - { - Class getExceptionClass() ; + public interface ExceptionRW { + Class getExceptionClass(); - String getId() ; + String getId(); - void write( OutputStream os, Exception ex ) ; + void write(OutputStream os, Exception ex); - Exception read( InputStream is ) ; + Exception read(InputStream is); } - public abstract class ExceptionRWBase implements ExceptionRW - { - private Class cls ; - private String id ; + public abstract class ExceptionRWBase implements ExceptionRW { + private Class cls; + private String id; - public ExceptionRWBase( Class cls ) - { - this.cls = cls ; + public ExceptionRWBase(Class cls) { + this.cls = cls; } - public Class getExceptionClass() - { - return cls ; + public Class getExceptionClass() { + return cls; } - public String getId() - { - return id ; + public String getId() { + return id; } - void setId( String id ) - { - this.id = id ; + void setId(String id) { + this.id = id; } } - public class ExceptionRWIDLImpl extends ExceptionRWBase - { - private Method readMethod ; - private Method writeMethod ; + public class ExceptionRWIDLImpl extends ExceptionRWBase { + private Method readMethod; + private Method writeMethod; - public ExceptionRWIDLImpl( Class cls ) - { - super( cls ) ; + public ExceptionRWIDLImpl(Class cls) { + super(cls); - String helperName = cls.getName() + "Helper" ; - ClassLoader loader = cls.getClassLoader() ; - Class helperClass ; + String helperName = cls.getName() + "Helper"; + ClassLoader loader = cls.getClassLoader(); + Class helperClass; try { - helperClass = Class.forName( helperName, true, loader ) ; - Method idMethod = helperClass.getDeclaredMethod( "id" ) ; - setId( (String)idMethod.invoke( null ) ) ; + helperClass = Class.forName(helperName, true, loader); + Method idMethod = helperClass.getDeclaredMethod("id"); + setId((String) idMethod.invoke(null)); } catch (Exception ex) { - throw wrapper.badHelperIdMethod( ex, helperName ) ; + throw wrapper.badHelperIdMethod(ex, helperName); } try { - writeMethod = helperClass.getDeclaredMethod( "write", - org.omg.CORBA.portable.OutputStream.class, cls ) ; + writeMethod = helperClass.getDeclaredMethod("write", org.omg.CORBA.portable.OutputStream.class, cls); } catch (Exception ex) { - throw wrapper.badHelperWriteMethod( ex, helperName ) ; + throw wrapper.badHelperWriteMethod(ex, helperName); } try { - readMethod = helperClass.getDeclaredMethod( "read", - org.omg.CORBA.portable.InputStream.class ) ; + readMethod = helperClass.getDeclaredMethod("read", org.omg.CORBA.portable.InputStream.class); } catch (Exception ex) { - throw wrapper.badHelperReadMethod( ex, helperName ) ; + throw wrapper.badHelperReadMethod(ex, helperName); } } - public void write( OutputStream os, Exception ex ) - { + public void write(OutputStream os, Exception ex) { try { - writeMethod.invoke( null, os, ex ) ; + writeMethod.invoke(null, os, ex); } catch (Exception exc) { - throw wrapper.badHelperWriteMethod( exc, - writeMethod.getDeclaringClass().getName() ) ; + throw wrapper.badHelperWriteMethod(exc, writeMethod.getDeclaringClass().getName()); } } - public Exception read( InputStream is ) - { + public Exception read(InputStream is) { try { - return (Exception)readMethod.invoke( null, is ) ; + return (Exception) readMethod.invoke(null, is); } catch (Exception ex) { - throw wrapper.badHelperReadMethod( ex, - readMethod.getDeclaringClass().getName() ) ; + throw wrapper.badHelperReadMethod(ex, readMethod.getDeclaringClass().getName()); } } } - public class ExceptionRWRMIImpl extends ExceptionRWBase - { - public ExceptionRWRMIImpl( Class cls ) - { - super( cls ) ; - setId( IDLNameTranslatorImpl.getExceptionId( cls ) ) ; + public class ExceptionRWRMIImpl extends ExceptionRWBase { + public ExceptionRWRMIImpl(Class cls) { + super(cls); + setId(IDLNameTranslatorImpl.getExceptionId(cls)); } - public void write( OutputStream os, Exception ex ) - { - os.write_string( getId() ) ; - os.write_value( ex, getExceptionClass() ) ; + public void write(OutputStream os, Exception ex) { + os.write_string(getId()); + os.write_value(ex, getExceptionClass()); } - public Exception read( InputStream is ) - { - is.read_string() ; // read and ignore! - return (Exception)is.read_value( getExceptionClass() ) ; + public Exception read(InputStream is) { + is.read_string(); // read and ignore! + return (Exception) is.read_value(getExceptionClass()); } } /////////////////////////////////////////////////////////////////////////////// - public ExceptionHandlerImpl( Class[] exceptions ) - { - int count = 0 ; - for (int ctr=0; ctr 0) { - ExceptionRW duprw = rws[duplicateIndex] ; - String firstClassName = - erw.getExceptionClass().getName() ; - String secondClassName = - duprw.getExceptionClass().getName() ; - throw wrapper.duplicateExceptionRepositoryId( - firstClassName, secondClassName, repositoryId ) ; - } - - */ - - rws[index++] = erw ; + erw = new ExceptionRWRMIImpl(cls); + + /* + * The following check is not performed in order to maintain compatibility with rmic. See bug 4989312. + * + * // Check for duplicate repository ID String repositoryId = erw.getId() ; int duplicateIndex = findDeclaredException( + * repositoryId ) ; if (duplicateIndex > 0) { ExceptionRW duprw = rws[duplicateIndex] ; String firstClassName = + * erw.getExceptionClass().getName() ; String secondClassName = duprw.getExceptionClass().getName() ; throw + * wrapper.duplicateExceptionRepositoryId( firstClassName, secondClassName, repositoryId ) ; } + * + */ + + rws[index++] = erw; } } } - private int findDeclaredException( Class cls ) - { + private int findDeclaredException(Class cls) { for (int ctr = 0; ctr < rws.length; ctr++) { - Class next = rws[ctr].getExceptionClass() ; + Class next = rws[ctr].getExceptionClass(); if (next.isAssignableFrom(cls)) - return ctr ; + return ctr; } - return -1 ; + return -1; } - private int findDeclaredException( String repositoryId ) - { - for (int ctr=0; ctr= 0 ; + public boolean isDeclaredException(Class cls) { + return findDeclaredException(cls) >= 0; } - public void writeException( OutputStream os, Exception ex ) - { - int index = findDeclaredException( ex.getClass() ) ; + public void writeException(OutputStream os, Exception ex) { + int index = findDeclaredException(ex.getClass()); if (index < 0) - throw wrapper.writeUndeclaredException( ex, - ex.getClass().getName() ) ; + throw wrapper.writeUndeclaredException(ex, ex.getClass().getName()); - rws[index].write( os, ex ) ; + rws[index].write(os, ex); } - public Exception readException( ApplicationException ae ) - { - // Note that the exception ID is present in both ae - // and in the input stream from ae. The exception + public Exception readException(ApplicationException ae) { + // Note that the exception ID is present in both ae + // and in the input stream from ae. The exception // reader must actually read the exception ID from // the stream. - InputStream is = (InputStream)ae.getInputStream() ; - String excName = ae.getId() ; - int index = findDeclaredException( excName ) ; + InputStream is = (InputStream) ae.getInputStream(); + String excName = ae.getId(); + int index = findDeclaredException(excName); if (index < 0) { - excName = is.read_string() ; - Exception res = new UnexpectedException( excName ) ; - res.initCause( ae ) ; - return res ; + excName = is.read_string(); + Exception res = new UnexpectedException(excName); + res.initCause(ae); + return res; } - return rws[index].read( is ) ; + return rws[index].read(is); } // This is here just for the dynamicrmiiiop test - public ExceptionRW getRMIExceptionRW( Class cls ) - { - return new ExceptionRWRMIImpl( cls ) ; + public ExceptionRW getRMIExceptionRW(Class cls) { + return new ExceptionRWRMIImpl(cls); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/Exceptions.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/Exceptions.java index c8de19a11..b03b9ac80 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/Exceptions.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/Exceptions.java @@ -32,33 +32,32 @@ * * @author ken */ -@ExceptionWrapper( idPrefix="ORBPRES" ) +@ExceptionWrapper(idPrefix = "ORBPRES") public interface Exceptions { - Exceptions self = WrapperGenerator.makeWrapper( Exceptions.class, - StandardLogger.self ) ; + Exceptions self = WrapperGenerator.makeWrapper(Exceptions.class, StandardLogger.self); - int EXCEPTIONS_PER_CLASS = 100 ; + int EXCEPTIONS_PER_CLASS = 100; // JNDISateFactoryImpl - int JSFI_START = 0 ; + int JSFI_START = 0; - @Message( "No stub could be created" ) - @Log( level=LogLevel.FINE, id = JSFI_START + 1 ) + @Message("No stub could be created") + @Log(level = LogLevel.FINE, id = JSFI_START + 1) void noStub(@Chain Exception exc); - @Message( "Could not connect stub" ) - @Log( level=LogLevel.FINE, id = JSFI_START + 2 ) + @Message("Could not connect stub") + @Log(level = LogLevel.FINE, id = JSFI_START + 2) void couldNotConnect(@Chain Exception exc); - @Message( "Could not get ORB from naming context" ) - @Log( level=LogLevel.FINE, id = JSFI_START + 2 ) - void couldNotGetORB(@Chain Exception exc, Context nc ); + @Message("Could not get ORB from naming context") + @Log(level = LogLevel.FINE, id = JSFI_START + 2) + void couldNotGetORB(@Chain Exception exc, Context nc); // DynamicStubImpl - int DSI_START = JSFI_START + EXCEPTIONS_PER_CLASS ; + int DSI_START = JSFI_START + EXCEPTIONS_PER_CLASS; - @Message( "ClassNotFound exception in readResolve on class {0}") - @Log( level=LogLevel.FINE, id = DSI_START + 1 ) + @Message("ClassNotFound exception in readResolve on class {0}") + @Log(level = LogLevel.FINE, id = DSI_START + 1) void readResolveClassNotFound(@Chain ClassNotFoundException exc, String cname); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLNameTranslatorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLNameTranslatorImpl.java index 27b9af8b8..5df6f8fbe 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLNameTranslatorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLNameTranslatorImpl.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; import java.security.AccessController; import java.security.PrivilegedAction; @@ -30,47 +30,37 @@ import java.util.HashMap; import java.util.StringTokenizer; -import com.sun.corba.ee.spi.presentation.rmi.IDLNameTranslator ; -import com.sun.corba.ee.spi.presentation.rmi.PresentationDefaults ; -import org.glassfish.pfl.basic.proxy.DynamicAccessPermission ; +import com.sun.corba.ee.spi.presentation.rmi.IDLNameTranslator; +import com.sun.corba.ee.spi.presentation.rmi.PresentationDefaults; +import org.glassfish.pfl.basic.proxy.DynamicAccessPermission; /** - * Bidirectional translator between RMI-IIOP interface methods and - * and IDL Names. + * Bidirectional translator between RMI-IIOP interface methods and and IDL Names. */ public class IDLNameTranslatorImpl implements IDLNameTranslator { // From CORBA Spec, Table 6 Keywords. - // Note that since all IDL identifiers are case + // Note that since all IDL identifiers are case // insensitive, java identifier comparisons to these // will be case insensitive also. private static String[] IDL_KEYWORDS = { - "abstract", "any", "attribute", "boolean", "case", "char", - "const", "context", "custom", "default", "double", "enum", - "exception", "factory", "FALSE", "fixed", "float", "in", "inout", - "interface", "long", "module", "native", "Object", "octet", - "oneway", "out", "private", "public", "raises", "readonly", "sequence", - "short", "string", "struct", "supports", "switch", "TRUE", "truncatable", - "typedef", "unsigned", "union", "ValueBase", "valuetype", "void", - "wchar", "wstring" + "abstract", "any", "attribute", "boolean", "case", "char", "const", "context", "custom", "default", "double", "enum", + "exception", "factory", "FALSE", "fixed", "float", "in", "inout", "interface", "long", "module", "native", "Object", "octet", + "oneway", "out", "private", "public", "raises", "readonly", "sequence", "short", "string", "struct", "supports", "switch", + "TRUE", "truncatable", "typedef", "unsigned", "union", "ValueBase", "valuetype", "void", "wchar", "wstring" }; - private static char[] HEX_DIGITS = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F' - }; - + private static char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + private static final String UNDERSCORE = "_"; // used to mangle java inner class names - private static final String INNER_CLASS_SEPARATOR = - UNDERSCORE + UNDERSCORE; + private static final String INNER_CLASS_SEPARATOR = UNDERSCORE + UNDERSCORE; // used to form IDL array type names - private static final String[] BASE_IDL_ARRAY_MODULE_TYPE= - new String[] { "org", "omg", "boxedRMI" } ; + private static final String[] BASE_IDL_ARRAY_MODULE_TYPE = new String[] { "org", "omg", "boxedRMI" }; private static final String BASE_IDL_ARRAY_ELEMENT_TYPE = "seq"; @@ -79,58 +69,53 @@ public class IDLNameTranslatorImpl implements IDLNameTranslator { private static final String ID_CONTAINER_CLASH_CHAR = UNDERSCORE; // separator used between types in a mangled overloaded method name - private static final String OVERLOADED_TYPE_SEPARATOR = - UNDERSCORE + UNDERSCORE; + private static final String OVERLOADED_TYPE_SEPARATOR = UNDERSCORE + UNDERSCORE; // string appended to attribute if it clashes with a method name - private static final String ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS = - UNDERSCORE + UNDERSCORE; + private static final String ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS = UNDERSCORE + UNDERSCORE; // strings prepended to the attribute names in order to form their // IDL names. private static final String GET_ATTRIBUTE_PREFIX = "_get_"; private static final String SET_ATTRIBUTE_PREFIX = "_set_"; - private static final String IS_ATTRIBUTE_PREFIX = "_get_"; + private static final String IS_ATTRIBUTE_PREFIX = "_get_"; private static Set idlKeywords_; static { idlKeywords_ = new HashSet(); - for ( String str : IDL_KEYWORDS) { - idlKeywords_.add( str.toUpperCase() ) ; + for (String str : IDL_KEYWORDS) { + idlKeywords_.add(str.toUpperCase()); } } // // Instance state // - - // Remote interface for name translation. + + // Remote interface for name translation. private Class[] interf_; - // Maps used to hold name translations. These do not need to be + // Maps used to hold name translations. These do not need to be // synchronized since the translation is never modified after // initialization. - private Map methodToIDLNameMap_; - private Map IDLNameToMethodMap_; + private Map methodToIDLNameMap_; + private Map IDLNameToMethodMap_; private Method[] methods_; - + /** - * Return an IDLNameTranslator for the given interface. + * Return an IDLNameTranslator for the given interface. * * @param interf Interface to get translator for. * @return IDLNameTranslator for specified interface. - * @throws IllegalStateException if given class is not a valid - * RMI/IIOP Remote Interface + * @throws IllegalStateException if given class is not a valid RMI/IIOP Remote Interface */ - public static IDLNameTranslator get( final Class interf ) - { - return AccessController.doPrivileged( - new PrivilegedAction() { - public IDLNameTranslator run() { - return new IDLNameTranslatorImpl( new Class[] { interf } ) ; - } - } ) ; + public static IDLNameTranslator get(final Class interf) { + return AccessController.doPrivileged(new PrivilegedAction() { + public IDLNameTranslator run() { + return new IDLNameTranslatorImpl(new Class[] { interf }); + } + }); } /** @@ -138,86 +123,74 @@ public IDLNameTranslator run() { * * @param interfaces Interfaces to get a translator for * @return IDLNameTranslator for specified interfaces. - * @throws IllegalStateException if given classes are not valid - * RMI/IIOP Remote Interfaces + * @throws IllegalStateException if given classes are not valid RMI/IIOP Remote Interfaces */ - public static IDLNameTranslator get( final Class[] interfaces ) - { - return AccessController.doPrivileged( - new PrivilegedAction() { - public IDLNameTranslator run() { - return new IDLNameTranslatorImpl( interfaces ) ; - } - } ) ; + public static IDLNameTranslator get(final Class[] interfaces) { + return AccessController.doPrivileged(new PrivilegedAction() { + public IDLNameTranslator run() { + return new IDLNameTranslatorImpl(interfaces); + } + }); } - public static String getExceptionId( Class cls ) - { + public static String getExceptionId(Class cls) { // Requirements for this method: // 1. cls must be an exception but not a RemoteException. // 2. If cls has an IDL keyword name, an underscore is prepended (1.3.2.2). // 3. If cls jas a leading underscore, J is prepended (1.3.2.3). // 4. If cls has an illegal IDL ident char, it is mapped to UXXXX where - // XXXX is the unicode value in hex of the char (1.3.2.4). + // XXXX is the unicode value in hex of the char (1.3.2.4). // 5. double underscore for inner class (1.3.2.5). // 6. The ID is "IDL:" + name with / separators + ":1.0". - IDLType itype = classToIDLType( cls ) ; - return itype.getExceptionName() ; + IDLType itype = classToIDLType(cls); + return itype.getExceptionName(); } - public Class[] getInterfaces() - { + public Class[] getInterfaces() { return interf_; } - public Method[] getMethods() - { - return methods_ ; + public Method[] getMethods() { + return methods_; } - public Method getMethod( String idlName ) - { + public Method getMethod(String idlName) { return IDLNameToMethodMap_.get(idlName); } - public String getIDLName( Method method ) - { + public String getIDLName(Method method) { return methodToIDLNameMap_.get(method); } /** - * Initialize an IDLNameTranslator for the given interface. + * Initialize an IDLNameTranslator for the given interface. * - * @throws IllegalStateException if given class is not a valid - * RMI/IIOP Remote Interface + * @throws IllegalStateException if given class is not a valid RMI/IIOP Remote Interface */ - private IDLNameTranslatorImpl(Class[] interfaces) - { + private IDLNameTranslatorImpl(Class[] interfaces) { if (!PresentationDefaults.inAppServer()) { - SecurityManager s = System.getSecurityManager() ; + SecurityManager s = System.getSecurityManager(); if (s != null) { - s.checkPermission( new DynamicAccessPermission( "access" ) ) ; + s.checkPermission(new DynamicAccessPermission("access")); } } try { IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); - for (int ctr=0; ctr allMethodInfo = - new HashMap() ; + Map allMethodInfo = new HashMap(); for (Class interf : interf_) { IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); @@ -225,86 +198,79 @@ private void buildNameTranslation() // Handle the case of a non-public interface! AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - Method.setAccessible( methods, true ) ; - return null ; - } - } ) ; + Method.setAccessible(methods, true); + return null; + } + }); // Take an initial pass through all the methods and create some - // information that will be used to track the IDL name + // information that will be used to track the IDL name // transformation. for (Method nextMethod : methods) { IDLMethodInfo methodInfo = new IDLMethodInfo(); - methodInfo.method = nextMethod; + methodInfo.method = nextMethod; if (idlTypesUtil.isPropertyAccessorMethod(nextMethod, interf)) { methodInfo.isProperty = true; - String attributeName = idlTypesUtil. - getAttributeNameForProperty(nextMethod.getName()); + String attributeName = idlTypesUtil.getAttributeNameForProperty(nextMethod.getName()); methodInfo.originalName = attributeName; - methodInfo.mangledName = attributeName; + methodInfo.mangledName = attributeName; } else { methodInfo.isProperty = false; methodInfo.originalName = nextMethod.getName(); - methodInfo.mangledName = nextMethod.getName(); + methodInfo.mangledName = nextMethod.getName(); } - + allMethodInfo.put(nextMethod, methodInfo); } } // - // Perform case sensitivity test first. This applies to all - // method names AND attributes. Compare each method name and - // attribute to all other method names and attributes. If names + // Perform case sensitivity test first. This applies to all + // method names AND attributes. Compare each method name and + // attribute to all other method names and attributes. If names // differ only in case, apply mangling as defined in section 1.3.2.7 - // of Java2IDL spec. Note that we compare using the original names. + // of Java2IDL spec. Note that we compare using the original names. // for (IDLMethodInfo outer : allMethodInfo.values()) { for (IDLMethodInfo inner : allMethodInfo.values()) { - if( (outer != inner) && - (!outer.originalName.equals(inner.originalName)) && - outer.originalName.equalsIgnoreCase(inner.originalName) ) { - outer.mangledName = - mangleCaseSensitiveCollision(outer.originalName); + if ((outer != inner) && (!outer.originalName.equals(inner.originalName)) + && outer.originalName.equalsIgnoreCase(inner.originalName)) { + outer.mangledName = mangleCaseSensitiveCollision(outer.originalName); break; } } } for (IDLMethodInfo next : allMethodInfo.values()) { - next.mangledName = - mangleIdentifier(next.mangledName, next.isProperty); - } + next.mangledName = mangleIdentifier(next.mangledName, next.isProperty); + } // // Now check for overloaded method names and apply 1.3.2.6. // for (IDLMethodInfo outer : allMethodInfo.values()) { - if( outer.isProperty ) { + if (outer.isProperty) { continue; } for (IDLMethodInfo inner : allMethodInfo.values()) { - if( (outer != inner) && !inner.isProperty && - outer.originalName.equals(inner.originalName) ) { - outer.mangledName = mangleOverloadedMethod - (outer.mangledName, outer.method); + if ((outer != inner) && !inner.isProperty && outer.originalName.equals(inner.originalName)) { + outer.mangledName = mangleOverloadedMethod(outer.mangledName, outer.method); break; } } } - + // // Now mangle any properties that clash with method names. // for (IDLMethodInfo outer : allMethodInfo.values()) { - if( !outer.isProperty ) { + if (!outer.isProperty) { continue; } for (IDLMethodInfo inner : allMethodInfo.values()) { - if( (outer != inner) && !inner.isProperty && - outer.mangledName.equals(inner.mangledName) ) { + if ((outer != inner) && !inner.isProperty && outer.mangledName.equals(inner.mangledName)) { outer.mangledName += ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS; break; } @@ -313,36 +279,33 @@ public Object run() { // // Ensure that no mapped method names clash with mapped name - // of container(1.3.2.9). This is a case insensitive comparison. + // of container(1.3.2.9). This is a case insensitive comparison. // for (Class interf : interf_) { String mappedContainerName = getMappedContainerName(interf); for (IDLMethodInfo next : allMethodInfo.values()) { - if( !next.isProperty && - identifierClashesWithContainer(mappedContainerName, - next.mangledName)) { + if (!next.isProperty && identifierClashesWithContainer(mappedContainerName, next.mangledName)) { next.mangledName = mangleContainerClash(next.mangledName); } - } + } } // // Populate name translation maps. // - methodToIDLNameMap_ = new HashMap(); - IDLNameToMethodMap_ = new HashMap(); - methods_ = allMethodInfo.keySet().toArray( - new Method[0] ) ; + methodToIDLNameMap_ = new HashMap(); + IDLNameToMethodMap_ = new HashMap(); + methods_ = allMethodInfo.keySet().toArray(new Method[0]); for (IDLMethodInfo next : allMethodInfo.values()) { String idlName = next.mangledName; - if( next.isProperty ) { + if (next.isProperty) { String origMethodName = next.method.getName(); String prefix = ""; - if( origMethodName.startsWith("get") ) { + if (origMethodName.startsWith("get")) { prefix = GET_ATTRIBUTE_PREFIX; - } else if( origMethodName.startsWith("set") ) { + } else if (origMethodName.startsWith("set")) { prefix = SET_ATTRIBUTE_PREFIX; } else { prefix = IS_ATTRIBUTE_PREFIX; @@ -350,18 +313,17 @@ public Object run() { idlName = prefix + next.mangledName; } - + methodToIDLNameMap_.put(next.method, idlName); // Final check to see if there are any clashes after all the - // manglings have been applied. If so, this is treated as an - // invalid interface. Currently, we do a CASE-SENSITIVE - // comparison since that matches the rmic behavior. - if( IDLNameToMethodMap_.containsKey(idlName) ) { + // manglings have been applied. If so, this is treated as an + // invalid interface. Currently, we do a CASE-SENSITIVE + // comparison since that matches the rmic behavior. + if (IDLNameToMethodMap_.containsKey(idlName)) { Method clash = IDLNameToMethodMap_.get(idlName); - throw new IllegalStateException("Error : methods " + - clash + " and " + next.method + - " both result in IDL name '" + idlName + "'"); + throw new IllegalStateException( + "Error : methods " + clash + " and " + next.method + " both result in IDL name '" + idlName + "'"); } else { IDLNameToMethodMap_.put(idlName, next.method); } @@ -371,14 +333,11 @@ public Object run() { } - /** - * Perform all necessary stand-alone identifier mangling operations - * on a java identifier that is being transformed into an IDL name. - * That is, mangling operations that don't require looking at anything - * else but the identifier itself. This covers sections 1.3.2.2, 1.3.2.3, - * and 1.3.2.4 of the Java2IDL spec. Method overloading and - * case-sensitivity checks are handled elsewhere. + * Perform all necessary stand-alone identifier mangling operations on a java identifier that is being transformed into + * an IDL name. That is, mangling operations that don't require looking at anything else but the identifier itself. This + * covers sections 1.3.2.2, 1.3.2.3, and 1.3.2.4 of the Java2IDL spec. Method overloading and case-sensitivity checks + * are handled elsewhere. */ private static String mangleIdentifier(String identifier) { @@ -390,48 +349,46 @@ private static String mangleIdentifier(String identifier, boolean attribute) { String mangledName = identifier; // - // Apply leading underscore test (1.3.2.3) - // This should be done before IDL Keyword clash test, since clashing + // Apply leading underscore test (1.3.2.3) + // This should be done before IDL Keyword clash test, since clashing // IDL keywords are mangled by adding a leading underscore. // - if( hasLeadingUnderscore(mangledName) ) { - mangledName = mangleLeadingUnderscore(mangledName); - } - + if (hasLeadingUnderscore(mangledName)) { + mangledName = mangleLeadingUnderscore(mangledName); + } + // // Apply IDL keyword clash test (1.3.2.2). - // This is not needed for attributes since when the full property + // This is not needed for attributes since when the full property // name is composed it cannot clash with an IDL keyword. // (Also, rmic doesn't do it.) // - - if( !attribute && isIDLKeyword(mangledName) ) { - mangledName = mangleIDLKeywordClash(mangledName); - } + + if (!attribute && isIDLKeyword(mangledName)) { + mangledName = mangleIDLKeywordClash(mangledName); + } // - // Replace illegal IDL identifier characters (1.3.2.4) + // Replace illegal IDL identifier characters (1.3.2.4) // for all method names and attributes. // - if( !isIDLIdentifier(mangledName) ) { + if (!isIDLIdentifier(mangledName)) { mangledName = mangleUnicodeChars(mangledName); - } - + } + return mangledName; } // isIDLKeyword and mangleIDLKeywordClash are exposed here so that - // IDLType can use them. - + // IDLType can use them. + /** - * Checks whether a java identifier clashes with an - * IDL keyword. Note that this is a case-insensitive - * comparison. + * Checks whether a java identifier clashes with an IDL keyword. Note that this is a case-insensitive comparison. * * Used to implement section 1.3.2.2 of Java2IDL spec. - */ + */ static boolean isIDLKeyword(String identifier) { - + String identifierAllCaps = identifier.toUpperCase(); return idlKeywords_.contains(identifierAllCaps); @@ -446,65 +403,60 @@ private static String mangleLeadingUnderscore(String identifier) { } /** - * Checks whether a java identifier starts with an underscore. - * Used to implement section 1.3.2.3 of Java2IDL spec. + * Checks whether a java identifier starts with an underscore. Used to implement section 1.3.2.3 of Java2IDL spec. */ private static boolean hasLeadingUnderscore(String identifier) { return identifier.startsWith(UNDERSCORE); } /** - * Implements Section 1.3.2.4 of Java2IDL Mapping. - * All non-IDL identifier characters must be replaced - * with their Unicode representation. + * Implements Section 1.3.2.4 of Java2IDL Mapping. All non-IDL identifier characters must be replaced with their Unicode + * representation. */ static String mangleUnicodeChars(String identifier) { StringBuilder mangledIdentifier = new StringBuilder(); - for(int i = 0; i < identifier.length(); i++) { + for (int i = 0; i < identifier.length(); i++) { char nextChar = identifier.charAt(i); - if( isIDLIdentifierChar(nextChar) ) { + if (isIDLIdentifierChar(nextChar)) { mangledIdentifier.append(nextChar); } else { String unicode = charToUnicodeRepresentation(nextChar); mangledIdentifier.append(unicode); } } - + return mangledIdentifier.toString(); } /** - * Implements mangling portion of Section 1.3.2.7 of Java2IDL spec. - * This method only deals with the actual mangling. Decision about - * whether case-sensitive collision mangling is required is made - * elsewhere. + * Implements mangling portion of Section 1.3.2.7 of Java2IDL spec. This method only deals with the actual mangling. + * Decision about whether case-sensitive collision mangling is required is made elsewhere. * * - * "...a mangled name is generated consisting of the original name - * followed by an underscore separated list of decimal indices - * into the string, where the indices identify all the upper case - * characters in the original string. Indices are zero based." + * "...a mangled name is generated consisting of the original name followed by an underscore separated list of decimal + * indices into the string, where the indices identify all the upper case characters in the original string. Indices are + * zero based." * - */ + */ String mangleCaseSensitiveCollision(String identifier) { StringBuilder mangledIdentifier = new StringBuilder(identifier); - // There is always at least one trailing underscore, whether or + // There is always at least one trailing underscore, whether or // not the identifier has uppercase letters. mangledIdentifier.append(UNDERSCORE); boolean needUnderscore = false; - for(int i = 0; i < identifier.length(); i++) { + for (int i = 0; i < identifier.length(); i++) { char next = identifier.charAt(i); - if( Character.isUpperCase(next) ) { + if (Character.isUpperCase(next)) { // This bit of logic is needed to ensure that we have - // an underscore separated list of indices but no - // trailing underscores. Basically, after we have at least + // an underscore separated list of indices but no + // trailing underscores. Basically, after we have at least // one uppercase letter, we always put an undercore before // printing the next one. - if( needUnderscore ) { + if (needUnderscore) { mangledIdentifier.append(UNDERSCORE); } mangledIdentifier.append(i); @@ -520,37 +472,32 @@ private static String mangleContainerClash(String identifier) { } /** - * Implements Section 1.3.2.9 of Java2IDL Mapping. Container in this - * context means the name of the java Class(excluding package) in which - * the identifier is defined. Comparison is case-insensitive. + * Implements Section 1.3.2.9 of Java2IDL Mapping. Container in this context means the name of the java Class(excluding + * package) in which the identifier is defined. Comparison is case-insensitive. */ - private static boolean identifierClashesWithContainer - (String mappedContainerName, String identifier) { + private static boolean identifierClashesWithContainer(String mappedContainerName, String identifier) { return identifier.equalsIgnoreCase(mappedContainerName); } /** - * Returns Unicode mangling as defined in Section 1.3.2.4 of - * Java2IDL spec. + * Returns Unicode mangling as defined in Section 1.3.2.4 of Java2IDL spec. * - * "For Java identifiers that contain illegal OMG IDL identifier - * characters such as '$' or Unicode characters outside of ISO Latin 1, - * any such illegal characters are replaced by "U" followed by the - * 4 hexadecimal characters(in upper case) representing the Unicode - * value. So, the Java name a$b is mapped to aU0024b and - * x\u03bCy is mapped to xU03BCy." + * "For Java identifiers that contain illegal OMG IDL identifier characters such as '$' or Unicode characters outside of + * ISO Latin 1, any such illegal characters are replaced by "U" followed by the 4 hexadecimal characters(in upper case) + * representing the Unicode value. So, the Java name a$b is mapped to aU0024b and x\u03bCy is mapped to xU03BCy." + * * @param c character to convert * @return Unicode String */ public static String charToUnicodeRepresentation(char c) { - + int orig = (int) c; StringBuilder hexString = new StringBuilder(); - + int value = orig; - while( value > 0 ) { + while (value > 0) { int div = value / 16; int mod = value % 16; hexString.insert(0, HEX_DIGITS[mod]); @@ -558,7 +505,7 @@ public static String charToUnicodeRepresentation(char c) { } int numZerosToAdd = 4 - hexString.length(); - for(int i = 0; i < numZerosToAdd; i++) { + for (int i = 0; i < numZerosToAdd; i++) { hexString.insert(0, "0"); } @@ -570,76 +517,67 @@ private static boolean isIDLIdentifier(String identifier) { boolean isIdentifier = true; - for(int i = 0; i < identifier.length(); i++) { + for (int i = 0; i < identifier.length(); i++) { char nextChar = identifier.charAt(i); // 1st char must be alphbetic. - isIdentifier = (i == 0) ? - isIDLAlphabeticChar(nextChar) : - isIDLIdentifierChar(nextChar); - if( !isIdentifier ) { + isIdentifier = (i == 0) ? isIDLAlphabeticChar(nextChar) : isIDLIdentifierChar(nextChar); + if (!isIdentifier) { break; } } return isIdentifier; - + } private static boolean isIDLIdentifierChar(char c) { - return (isIDLAlphabeticChar(c) || - isIDLDecimalDigit(c) || - isUnderscore(c)); + return (isIDLAlphabeticChar(c) || isIDLDecimalDigit(c) || isUnderscore(c)); } /** - * True if character is one of 114 Alphabetic characters as - * specified in Table 2 of Chapter 3 in CORBA spec. - */ + * True if character is one of 114 Alphabetic characters as specified in Table 2 of Chapter 3 in CORBA spec. + */ private static boolean isIDLAlphabeticChar(char c) { // NOTE that we can't use the java.lang.Character // isUpperCase, isLowerCase, etc. methods since they // include many characters other than the Alphabetic list in - // the CORBA spec. Instead, we test for inclusion in the + // the CORBA spec. Instead, we test for inclusion in the // Unicode value ranges for the corresponding legal characters. - boolean alphaChar = - ( - // A - Z - ((c >= 0x0041) && (c <= 0x005A)) - - || - - // a - z - ((c >= 0x0061) && (c <= 0x007A)) - - || - - // other letter uppercase, other letter lowercase, which is - // the entire upper half of C1 Controls except X and / - ((c >= 0x00C0) && (c <= 0x00FF) - && (c != 0x00D7) && (c != 0x00F7))); - + boolean alphaChar = ( + // A - Z + ((c >= 0x0041) && (c <= 0x005A)) + + || + + // a - z + ((c >= 0x0061) && (c <= 0x007A)) + + || + + // other letter uppercase, other letter lowercase, which is + // the entire upper half of C1 Controls except X and / + ((c >= 0x00C0) && (c <= 0x00FF) && (c != 0x00D7) && (c != 0x00F7))); + return alphaChar; } /** - * True if character is one of 10 Decimal Digits - * specified in Table 3 of Chapter 3 in CORBA spec. - */ + * True if character is one of 10 Decimal Digits specified in Table 3 of Chapter 3 in CORBA spec. + */ private static boolean isIDLDecimalDigit(char c) { - return ( (c >= 0x0030) && (c <= 0x0039) ); + return ((c >= 0x0030) && (c <= 0x0039)); } private static boolean isUnderscore(char c) { - return ( c == 0x005F ); + return (c == 0x005F); } - + /** - * Mangle an overloaded method name as defined in Section 1.3.2.6 of - * Java2IDL spec. Current value of method name is passed in as argument. - * We can't start from original method name since the name might have - * been partially mangled as a result of the other rules. + * Mangle an overloaded method name as defined in Section 1.3.2.6 of Java2IDL spec. Current value of method name is + * passed in as argument. We can't start from original method name since the name might have been partially mangled as a + * result of the other rules. */ private static String mangleOverloadedMethod(String mangledName, Method m) { @@ -647,76 +585,68 @@ private static String mangleOverloadedMethod(String mangledName, Method m) { // Start by appending the separator string String newMangledName = mangledName + OVERLOADED_TYPE_SEPARATOR; - + Class[] parameterTypes = m.getParameterTypes(); - - for(int i = 0; i < parameterTypes.length; i++) { + + for (int i = 0; i < parameterTypes.length; i++) { Class nextParamType = parameterTypes[i]; - - if( i > 0 ) { + + if (i > 0) { newMangledName += OVERLOADED_TYPE_SEPARATOR; - } + } IDLType idlType = classToIDLType(nextParamType); String moduleName = idlType.getModuleName(); String memberName = idlType.getMemberName(); - String typeName = (moduleName.length() > 0) ? - moduleName + UNDERSCORE + memberName : memberName; - - if( !idlTypesUtil.isPrimitive(nextParamType) && - (idlTypesUtil.getSpecialCaseIDLTypeMapping(nextParamType) - == null) && - isIDLKeyword(typeName) ) { + String typeName = (moduleName.length() > 0) ? moduleName + UNDERSCORE + memberName : memberName; + + if (!idlTypesUtil.isPrimitive(nextParamType) && (idlTypesUtil.getSpecialCaseIDLTypeMapping(nextParamType) == null) + && isIDLKeyword(typeName)) { typeName = mangleIDLKeywordClash(typeName); } typeName = mangleUnicodeChars(typeName); newMangledName += typeName; - } + } - return newMangledName; + return newMangledName; } - private static IDLType classToIDLType(Class c) { - + IDLType idlType = null; IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); - if( idlTypesUtil.isPrimitive(c) ) { + if (idlTypesUtil.isPrimitive(c)) { idlType = idlTypesUtil.getPrimitiveIDLTypeMapping(c); - } else if( c.isArray() ) { - + } else if (c.isArray()) { + // Calculate array depth, as well as base element type. Class componentType = c.getComponentType(); int numArrayDimensions = 1; - while(componentType.isArray()) { + while (componentType.isArray()) { componentType = componentType.getComponentType(); numArrayDimensions++; } IDLType componentIdlType = classToIDLType(componentType); - + String[] modules = BASE_IDL_ARRAY_MODULE_TYPE; - if( componentIdlType.hasModule() ) { - final String[] cModules = componentIdlType.getModules() ; - final String[] newModules = new String[ modules.length + - cModules.length ] ; + if (componentIdlType.hasModule()) { + final String[] cModules = componentIdlType.getModules(); + final String[] newModules = new String[modules.length + cModules.length]; System.arraycopy(modules, 0, newModules, 0, modules.length); - System.arraycopy(cModules, 0, newModules, modules.length, - cModules.length); - modules = newModules ; + System.arraycopy(cModules, 0, newModules, modules.length, cModules.length); + modules = newModules; } - String memberName = BASE_IDL_ARRAY_ELEMENT_TYPE + - numArrayDimensions + UNDERSCORE + - componentIdlType.getMemberName(); - + String memberName = BASE_IDL_ARRAY_ELEMENT_TYPE + numArrayDimensions + UNDERSCORE + componentIdlType.getMemberName(); + idlType = new IDLType(c, modules, memberName); - + } else { idlType = idlTypesUtil.getSpecialCaseIDLTypeMapping(c); @@ -726,46 +656,43 @@ private static IDLType classToIDLType(Class c) { String memberName = getUnmappedContainerName(c); // replace inner class separator with double underscore - memberName = memberName.replaceAll("\\$", - INNER_CLASS_SEPARATOR); - - if( hasLeadingUnderscore(memberName) ) { + memberName = memberName.replaceAll("\\$", INNER_CLASS_SEPARATOR); + + if (hasLeadingUnderscore(memberName)) { memberName = mangleLeadingUnderscore(memberName); - } + } - // Get raw package name. If there is a package, it + // Get raw package name. If there is a package, it // will still have the "." separators and none of the // mangling rules will have been applied. - String packageName = getPackageName(c); - + String packageName = getPackageName(c); + if (packageName == null) { - idlType = new IDLType( c, memberName ) ; + idlType = new IDLType(c, memberName); } else { // If this is a generated IDL Entity Type we need to // prepend org_omg_boxedIDL per sections 1.3.5 and 1.3.9 if (idlTypesUtil.isEntity(c)) { - packageName = "org.omg.boxedIDL." + packageName ; + packageName = "org.omg.boxedIDL." + packageName; } - - // Section 1.3.2.1 and 1.3.2.6 of Java2IDL spec defines - // rules for mapping java packages to IDL modules and for - // mangling module name portion of type name. NOTE that - // of the individual identifier mangling rules, - // only the leading underscore test is done here. + + // Section 1.3.2.1 and 1.3.2.6 of Java2IDL spec defines + // rules for mapping java packages to IDL modules and for + // mangling module name portion of type name. NOTE that + // of the individual identifier mangling rules, + // only the leading underscore test is done here. // The other two(IDL Keyword, Illegal Unicode chars) are - // done in mangleOverloadedMethodName. - StringTokenizer tokenizer = - new StringTokenizer(packageName, "."); - - String[] modules = new String[ tokenizer.countTokens() ] ; - int index = 0 ; + // done in mangleOverloadedMethodName. + StringTokenizer tokenizer = new StringTokenizer(packageName, "."); + + String[] modules = new String[tokenizer.countTokens()]; + int index = 0; while (tokenizer.hasMoreElements()) { String next = tokenizer.nextToken(); - String moreMangled = hasLeadingUnderscore( next ) ? - mangleLeadingUnderscore( next ) : next; + String moreMangled = hasLeadingUnderscore(next) ? mangleLeadingUnderscore(next) : next; - modules[index++] = moreMangled ; - } + modules[index++] = moreMangled; + } idlType = new IDLType(c, modules, memberName); } @@ -782,20 +709,19 @@ private static String getPackageName(Class c) { Package thePackage = c.getPackage(); String packageName = null; - // Try to get package name by introspection. Some classloaders might + // Try to get package name by introspection. Some classloaders might // not provide this information, so check for null. - if( thePackage != null ) { + if (thePackage != null) { packageName = thePackage.getName(); } else { // brute force method String fullyQualifiedClassName = c.getName(); int lastDot = fullyQualifiedClassName.indexOf('.'); - packageName = (lastDot == -1) ? null : - fullyQualifiedClassName.substring(0, lastDot); + packageName = (lastDot == -1) ? null : fullyQualifiedClassName.substring(0, lastDot); } return packageName; } - + private static String getMappedContainerName(Class c) { String unmappedName = getUnmappedContainerName(c); @@ -807,12 +733,12 @@ private static String getMappedContainerName(Class c) { */ private static String getUnmappedContainerName(Class c) { - String memberName = null; + String memberName = null; String packageName = getPackageName(c); String fullyQualifiedClassName = c.getName(); - - if( packageName != null ) { + + if (packageName != null) { int packageLength = packageName.length(); memberName = fullyQualifiedClassName.substring(packageLength + 1); } else { @@ -824,21 +750,20 @@ private static String getUnmappedContainerName(Class c) { } /** - * Internal helper class for tracking information related to each - * interface method while we're building the name translation table. + * Internal helper class for tracking information related to each interface method while we're building the name + * translation table. */ - private static class IDLMethodInfo - { + private static class IDLMethodInfo { public Method method; public boolean isProperty; - - // If this is a property, originalName holds the original + + // If this is a property, originalName holds the original // attribute name. Otherwise, it holds the original method name. public String originalName; - // If this is a property, mangledName holds the mangled attribute - // name. Otherwise, it holds the mangled method name. - public String mangledName; + // If this is a property, mangledName holds the mangled attribute + // name. Otherwise, it holds the mangled method name. + public String mangledName; } @@ -846,20 +771,20 @@ private static class IDLMethodInfo public String toString() { StringBuilder contents = new StringBuilder(); - contents.append("IDLNameTranslator[" ); - for( int ctr=0; ctr0) - sbuff.append( separator ) ; - + + public String makeConcatenatedName(char separator, boolean fixIDLKeywords) { + StringBuilder sbuff = new StringBuilder(); + for (int ctr = 0; ctr < modules_.length; ctr++) { + String mod = modules_[ctr]; + if (ctr > 0) + sbuff.append(separator); + if (fixIDLKeywords && IDLNameTranslatorImpl.isIDLKeyword(mod)) - mod = IDLNameTranslatorImpl.mangleIDLKeywordClash( mod ) ; + mod = IDLNameTranslatorImpl.mangleIDLKeywordClash(mod); - sbuff.append( mod ) ; + sbuff.append(mod); } - return sbuff.toString() ; + return sbuff.toString(); } - + public String getModuleName() { // Note that this should probably be makeConcatenatedName( '/', true ) // for spec compliance, // but rmic does it this way, so we'll leave this. // The effect is that an overloaded method like - // void foo( bar.typedef.Baz ) + // void foo( bar.typedef.Baz ) // will get an IDL name of foo__bar_typedef_Baz instead of // foo__bar__typedef_Baz (note the extra _ before typedef). - return makeConcatenatedName( '_', false ) ; + return makeConcatenatedName('_', false); } public String getExceptionName() { // Here we will check for IDL keyword collisions (see bug 5010332). - // This means that the repository ID for + // This means that the repository ID for // foo.exception.SomeException is // "IDL:foo/_exception/SomeEx:1.0" (note the underscore in front // of the exception module name). - String modName = makeConcatenatedName( '/', true ) ; + String modName = makeConcatenatedName('/', true); - String suffix = "Exception" ; - String excName = memberName_ ; - if (excName.endsWith( suffix )) { - int last = excName.length() - suffix.length() ; - excName = excName.substring( 0, last ) ; + String suffix = "Exception"; + String excName = memberName_; + if (excName.endsWith(suffix)) { + int last = excName.length() - suffix.length(); + excName = excName.substring(0, last); } - + // See bug 4989312: we must always add the Ex. - excName += "Ex" ; + excName += "Ex"; if (modName.length() == 0) - return "IDL:" + excName + ":1.0" ; + return "IDL:" + excName + ":1.0"; else - return "IDL:" + modName + '/' + excName + ":1.0" ; + return "IDL:" + modName + '/' + excName + ":1.0"; } public String getMemberName() { return memberName_; } - + /** - * True if this type doesn't have a containing module. This - * would be true of a java type defined in the default package + * True if this type doesn't have a containing module. This would be true of a java type defined in the default package * or a primitive. + * * @return if there is a contained module. */ public boolean hasModule() { - return (modules_.length > 0) ; + return (modules_.length > 0); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLTypeException.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLTypeException.java index 89118766f..966fe9c10 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLTypeException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLTypeException.java @@ -17,15 +17,15 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; /** - * Checked exception containing information about an - * an IDL type validation. + * Checked exception containing information about an an IDL type validation. */ public class IDLTypeException extends Exception { - public IDLTypeException() {} + public IDLTypeException() { + } public IDLTypeException(String message) { super(message); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLTypesUtil.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLTypesUtil.java index 925bec392..3bf6ef39d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLTypesUtil.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/IDLTypesUtil.java @@ -18,7 +18,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; import java.io.Serializable; import java.lang.reflect.Method; @@ -28,60 +28,54 @@ import java.util.Iterator; /** - * Utility class for testing RMI/IDL Types as defined in - * Section 1.2 of The Java Language to IDL Mapping. Note that - * these are static checks only. Runtime checks, such as those - * described in Section 1.2.3, #3, are not covered. + * Utility class for testing RMI/IDL Types as defined in Section 1.2 of The Java Language to IDL Mapping. Note that + * these are static checks only. Runtime checks, such as those described in Section 1.2.3, #3, are not covered. */ public final class IDLTypesUtil { private static final String GET_PROPERTY_PREFIX = "get"; private static final String SET_PROPERTY_PREFIX = "set"; - private static final String IS_PROPERTY_PREFIX = "is"; + private static final String IS_PROPERTY_PREFIX = "is"; - public static final int VALID_TYPE = 0; + public static final int VALID_TYPE = 0; public static final int INVALID_TYPE = 1; - /* rmic -iiop does not correctly implement the clause in 1.3.4.3 - * about is/get conflicts. The spec says that - * is is the property and get is left alone, - * but rmic does the opposite. We will follow rmic in this, - * but it's easy to change. + /* + * rmic -iiop does not correctly implement the clause in 1.3.4.3 about is/get conflicts. The spec says that + * is is the property and get is left alone, but rmic does the opposite. We will follow rmic in this, but + * it's easy to change. */ - public static final boolean FOLLOW_RMIC = true ; + public static final boolean FOLLOW_RMIC = true; /** - * Validate a class to ensure it conforms to the rules for a - * Java RMI/IIOP interface. + * Validate a class to ensure it conforms to the rules for a Java RMI/IIOP interface. * * @param c Class to validate * @throws IDLTypeException if not a valid RMI/IIOP interface. */ - public void validateRemoteInterface(Class c) throws IDLTypeException - { - if( c == null ) { + public void validateRemoteInterface(Class c) throws IDLTypeException { + if (c == null) { throw new IllegalArgumentException(); - } + } - if( !c.isInterface() ) { + if (!c.isInterface()) { String msg = "Class " + c + " must be a java interface."; throw new IDLTypeException(msg); } - if( !java.rmi.Remote.class.isAssignableFrom(c) ) { - String msg = "Class " + c + " must extend java.rmi.Remote, " + - "either directly or indirectly."; + if (!java.rmi.Remote.class.isAssignableFrom(c)) { + String msg = "Class " + c + " must extend java.rmi.Remote, " + "either directly or indirectly."; throw new IDLTypeException(msg); } // Get all methods, including super-interface methods. Method[] methods = c.getMethods(); - - for(int i = 0; i < methods.length; i++) { + + for (int i = 0; i < methods.length; i++) { Method next = methods[i]; validateExceptions(next); } - + // Removed because of bug 4989053 // validateDirectInterfaces(c); validateConstants(c); @@ -91,15 +85,15 @@ public void validateRemoteInterface(Class c) throws IDLTypeException /** * Checks if a class if a valid Java RMI/IIOP interface + * * @param c Class to check * @return If it is a remote interface */ - public boolean isRemoteInterface(Class c) - { + public boolean isRemoteInterface(Class c) { boolean remoteInterface = true; try { validateRemoteInterface(c); - } catch(IDLTypeException ite) { + } catch (IDLTypeException ite) { remoteInterface = false; } @@ -107,255 +101,215 @@ public boolean isRemoteInterface(Class c) } /** - * Section 1.2.2 Primitive Types - * Checks if a class is a primitive type - * @param c Class to check + * Section 1.2.2 Primitive Types Checks if a class is a primitive type + * + * @param c Class to check * @return If the class is a primitive type. * @see Class#isPrimitive() - */ - public boolean isPrimitive(Class c) - { - if( c == null ) { + */ + public boolean isPrimitive(Class c) { + if (c == null) { throw new IllegalArgumentException(); - } + } return c.isPrimitive(); } /** - * Section 1.2.4 - * Checks if a class is a {@link Serializable} value + * Section 1.2.4 Checks if a class is a {@link Serializable} value + * * @param c class to check * @return if the class is Serializable */ - public boolean isValue(Class c) - { - if( c == null ) { + public boolean isValue(Class c) { + if (c == null) { throw new IllegalArgumentException(); - } + } - return - (!c.isInterface() && - java.io.Serializable.class.isAssignableFrom(c) && - !java.rmi.Remote.class.isAssignableFrom(c)); + return (!c.isInterface() && java.io.Serializable.class.isAssignableFrom(c) && !java.rmi.Remote.class.isAssignableFrom(c)); } /** - * Section 1.2.5 - * Checks if a class is an array of a primitive, Remote Interface, - * {@link org.omg.CORBA.portable.IDLEntity}, {@link Exception}, - * {@link Serializable} value or CORBA {@link org.omg.CORBA.Object}. + * Section 1.2.5 Checks if a class is an array of a primitive, Remote Interface, + * {@link org.omg.CORBA.portable.IDLEntity}, {@link Exception}, {@link Serializable} value or CORBA + * {@link org.omg.CORBA.Object}. + * * @param c Class to check * @return If the class is an array */ - public boolean isArray(Class c) - { + public boolean isArray(Class c) { boolean arrayType = false; - if( c == null ) { + if (c == null) { throw new IllegalArgumentException(); - } + } - if( c.isArray() ) { + if (c.isArray()) { Class componentType = c.getComponentType(); - arrayType = - (isPrimitive(componentType) || isRemoteInterface(componentType) || - isEntity(componentType) || isException(componentType) || - isValue(componentType) || isObjectReference(componentType) ); + arrayType = (isPrimitive(componentType) || isRemoteInterface(componentType) || isEntity(componentType) + || isException(componentType) || isValue(componentType) || isObjectReference(componentType)); } return arrayType; } /** - * Section 1.2.6 - * Checks if a class is an {@link Exception} + * Section 1.2.6 Checks if a class is an {@link Exception} + * * @param c Class to check if it is an exception. * @return True if a subclass of {@link Exception} */ - public boolean isException(Class c) - { - if( c == null ) { + public boolean isException(Class c) { + if (c == null) { throw new IllegalArgumentException(); - } + } // Must be a checked exception, not including RemoteException or // its subclasses. return isCheckedException(c) && !isRemoteException(c) && isValue(c); } - public boolean isRemoteException(Class c) - { - if( c == null ) { + public boolean isRemoteException(Class c) { + if (c == null) { throw new IllegalArgumentException(); - } + } - return java.rmi.RemoteException.class.isAssignableFrom(c) ; + return java.rmi.RemoteException.class.isAssignableFrom(c); } - public boolean isCheckedException(Class c) - { - if( c == null ) { + public boolean isCheckedException(Class c) { + if (c == null) { throw new IllegalArgumentException(); - } + } - return Throwable.class.isAssignableFrom(c) && - !RuntimeException.class.isAssignableFrom(c) && - !Error.class.isAssignableFrom(c) ; + return Throwable.class.isAssignableFrom(c) && !RuntimeException.class.isAssignableFrom(c) && !Error.class.isAssignableFrom(c); } /** - * Section 1.2.7 - * If the class is a CORBA {@link org.omg.CORBA.Object} + * Section 1.2.7 If the class is a CORBA {@link org.omg.CORBA.Object} + * * @param c class to check if it is a CORBA Object * @return if it is an object. - */ - public boolean isObjectReference(Class c) - { - if( c == null ) { + */ + public boolean isObjectReference(Class c) { + if (c == null) { throw new IllegalArgumentException(); - } + } - return (c.isInterface() && - org.omg.CORBA.Object.class.isAssignableFrom(c)); + return (c.isInterface() && org.omg.CORBA.Object.class.isAssignableFrom(c)); } /** - * Section 1.2.8 - * Checks if a class is assignable to {@link org.omg.CORBA.portable.IDLEntity} + * Section 1.2.8 Checks if a class is assignable to {@link org.omg.CORBA.portable.IDLEntity} + * * @param c Class to check if it is an entity * @return if the class is an entity. - */ - public boolean isEntity(Class c) - { - if( c == null ) { + */ + public boolean isEntity(Class c) { + if (c == null) { throw new IllegalArgumentException(); - } + } Class superClass = c.getSuperclass(); - return (!c.isInterface() && - (superClass != null) && - (org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(c))); + return (!c.isInterface() && (superClass != null) && (org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(c))); } /** - * Return true if given method is legal property accessor as defined in - * Section 1.3.4.3 of Java2IDL spec. + * Return true if given method is legal property accessor as defined in Section 1.3.4.3 of Java2IDL spec. + * * @param method Method to check * @param clazz Class containing method * @return If method if a legal accessor. */ public boolean isPropertyAccessorMethod(Method method, Class clazz) { - + String methodName = method.getName(); - Class returnType = method.getReturnType(); + Class returnType = method.getReturnType(); Class[] parameters = method.getParameterTypes(); Class[] exceptionTypes = method.getExceptionTypes(); String propertyType = null; - if( methodName.startsWith(GET_PROPERTY_PREFIX) ) { + if (methodName.startsWith(GET_PROPERTY_PREFIX)) { - if((parameters.length == 0) && (returnType != Void.TYPE) && - !readHasCorrespondingIsProperty(method, clazz)) { + if ((parameters.length == 0) && (returnType != Void.TYPE) && !readHasCorrespondingIsProperty(method, clazz)) { propertyType = GET_PROPERTY_PREFIX; } - - } else if( methodName.startsWith(SET_PROPERTY_PREFIX) ) { - - if((returnType == Void.TYPE) && (parameters.length == 1)) { - if (hasCorrespondingReadProperty(method, clazz, GET_PROPERTY_PREFIX) || - hasCorrespondingReadProperty(method, clazz, IS_PROPERTY_PREFIX)) { + + } else if (methodName.startsWith(SET_PROPERTY_PREFIX)) { + + if ((returnType == Void.TYPE) && (parameters.length == 1)) { + if (hasCorrespondingReadProperty(method, clazz, GET_PROPERTY_PREFIX) + || hasCorrespondingReadProperty(method, clazz, IS_PROPERTY_PREFIX)) { propertyType = SET_PROPERTY_PREFIX; } } - } else if( methodName.startsWith(IS_PROPERTY_PREFIX) ) { - if((parameters.length == 0) && (returnType == Boolean.TYPE) && - !isHasCorrespondingReadProperty(method, clazz)) { - propertyType = IS_PROPERTY_PREFIX; + } else if (methodName.startsWith(IS_PROPERTY_PREFIX)) { + if ((parameters.length == 0) && (returnType == Boolean.TYPE) && !isHasCorrespondingReadProperty(method, clazz)) { + propertyType = IS_PROPERTY_PREFIX; } } - // Some final checks that apply to all properties. - if( propertyType != null ) { - if(!validPropertyExceptions(method) || - (methodName.length() <= propertyType.length())) { + // Some final checks that apply to all properties. + if (propertyType != null) { + if (!validPropertyExceptions(method) || (methodName.length() <= propertyType.length())) { propertyType = null; - } + } } return (propertyType != null); } - private boolean hasCorrespondingReadProperty - (Method writeProperty, Class c, String readPropertyPrefix) - { + private boolean hasCorrespondingReadProperty(Method writeProperty, Class c, String readPropertyPrefix) { String writePropertyMethodName = writeProperty.getName(); Class[] writePropertyParameters = writeProperty.getParameterTypes(); boolean foundReadProperty = false; - try { + try { // Look for a valid corresponding Read property - String readPropertyMethodName = - writePropertyMethodName.replaceFirst - (SET_PROPERTY_PREFIX, readPropertyPrefix); - Method readPropertyMethod = c.getMethod(readPropertyMethodName, - new Class[] {}); - foundReadProperty = - ( isPropertyAccessorMethod(readPropertyMethod, c) && - (readPropertyMethod.getReturnType() == - writePropertyParameters[0]) ); - } catch(Exception e) { + String readPropertyMethodName = writePropertyMethodName.replaceFirst(SET_PROPERTY_PREFIX, readPropertyPrefix); + Method readPropertyMethod = c.getMethod(readPropertyMethodName, new Class[] {}); + foundReadProperty = (isPropertyAccessorMethod(readPropertyMethod, c) + && (readPropertyMethod.getReturnType() == writePropertyParameters[0])); + } catch (Exception e) { // ignore. this means we didn't find a corresponding get property. } return foundReadProperty; } - private boolean readHasCorrespondingIsProperty(Method readProperty, - Class c) - { + private boolean readHasCorrespondingIsProperty(Method readProperty, Class c) { if (FOLLOW_RMIC) - return false ; + return false; String readPropertyMethodName = readProperty.getName(); boolean foundIsProperty = false; - try { + try { // Look for a valid corresponding Is property - String isPropertyMethodName = - readPropertyMethodName.replaceFirst(GET_PROPERTY_PREFIX, - IS_PROPERTY_PREFIX); - Method isPropertyMethod = c.getMethod( isPropertyMethodName, - new Class[] {}); - foundIsProperty = isPropertyAccessorMethod(isPropertyMethod, - c) ; - } catch(Exception e) { + String isPropertyMethodName = readPropertyMethodName.replaceFirst(GET_PROPERTY_PREFIX, IS_PROPERTY_PREFIX); + Method isPropertyMethod = c.getMethod(isPropertyMethodName, new Class[] {}); + foundIsProperty = isPropertyAccessorMethod(isPropertyMethod, c); + } catch (Exception e) { // ignore. this means we didn't find a corresponding Is property. } return foundIsProperty; } - private boolean isHasCorrespondingReadProperty(Method readProperty, - Class c) - { + private boolean isHasCorrespondingReadProperty(Method readProperty, Class c) { if (!FOLLOW_RMIC) - return false ; + return false; String readPropertyMethodName = readProperty.getName(); boolean foundIsProperty = false; - try { + try { // Look for a valid corresponding Read property - String isPropertyMethodName = - readPropertyMethodName.replaceFirst(IS_PROPERTY_PREFIX, - GET_PROPERTY_PREFIX); - Method isPropertyMethod = c.getMethod( isPropertyMethodName, - new Class[] {}); - foundIsProperty = isPropertyAccessorMethod(isPropertyMethod, - c) ; - } catch(Exception e) { + String isPropertyMethodName = readPropertyMethodName.replaceFirst(IS_PROPERTY_PREFIX, GET_PROPERTY_PREFIX); + Method isPropertyMethod = c.getMethod(isPropertyMethodName, new Class[] {}); + foundIsProperty = isPropertyAccessorMethod(isPropertyMethod, c); + } catch (Exception e) { // ignore. this means we didn't find a corresponding read property. } @@ -366,25 +320,22 @@ public String getAttributeNameForProperty(String propertyName) { String attributeName = null; String prefix = null; - if( propertyName.startsWith(GET_PROPERTY_PREFIX) ) { - prefix = GET_PROPERTY_PREFIX; - } else if( propertyName.startsWith(SET_PROPERTY_PREFIX) ) { + if (propertyName.startsWith(GET_PROPERTY_PREFIX)) { + prefix = GET_PROPERTY_PREFIX; + } else if (propertyName.startsWith(SET_PROPERTY_PREFIX)) { prefix = SET_PROPERTY_PREFIX; - } else if( propertyName.startsWith(IS_PROPERTY_PREFIX) ) { + } else if (propertyName.startsWith(IS_PROPERTY_PREFIX)) { prefix = IS_PROPERTY_PREFIX; } - if( (prefix != null) && (prefix.length() < propertyName.length()) ) { + if ((prefix != null) && (prefix.length() < propertyName.length())) { String remainder = propertyName.substring(prefix.length()); - if( (remainder.length() >= 2) && - Character.isUpperCase(remainder.charAt(0)) && - Character.isUpperCase(remainder.charAt(1)) ) { - // don't set the first letter to lower-case if the + if ((remainder.length() >= 2) && Character.isUpperCase(remainder.charAt(0)) && Character.isUpperCase(remainder.charAt(1))) { + // don't set the first letter to lower-case if the // first two are upper-case attributeName = remainder; } else { - attributeName = Character.toLowerCase(remainder.charAt(0)) + - remainder.substring(1); + attributeName = Character.toLowerCase(remainder.charAt(0)) + remainder.substring(1); } } @@ -392,77 +343,70 @@ public String getAttributeNameForProperty(String propertyName) { } /** - * Return IDL Type name for primitive types as defined in - * Section 1.3.3 of Java2IDL spec or null if not a primitive type. + * Return IDL Type name for primitive types as defined in Section 1.3.3 of Java2IDL spec or null if not a primitive + * type. + * * @param c the class to get the mapping for - * @return the IDLType of the primitive, or {@code null} if the - * class is not a primitive. - */ + * @return the IDLType of the primitive, or {@code null} if the class is not a primitive. + */ public IDLType getPrimitiveIDLTypeMapping(Class c) { - - if( c == null ) { + + if (c == null) { throw new IllegalArgumentException(); - } - - if( c.isPrimitive() ) { - if( c == Void.TYPE ) { - return new IDLType( c, "void" ) ; - } else if( c == Boolean.TYPE ) { - return new IDLType( c, "boolean" ) ; - } else if( c == Character.TYPE ) { - return new IDLType( c, "wchar" ) ; - } else if( c == Byte.TYPE ) { - return new IDLType( c, "octet" ) ; - } else if( c == Short.TYPE ) { - return new IDLType( c, "short" ) ; - } else if( c == Integer.TYPE ) { - return new IDLType( c, "long" ) ; - } else if( c == Long.TYPE ) { - return new IDLType( c, "long_long" ) ; - } else if( c == Float.TYPE ) { - return new IDLType( c, "float" ) ; - } else if( c == Double.TYPE ) { - return new IDLType( c, "double" ) ; + } + + if (c.isPrimitive()) { + if (c == Void.TYPE) { + return new IDLType(c, "void"); + } else if (c == Boolean.TYPE) { + return new IDLType(c, "boolean"); + } else if (c == Character.TYPE) { + return new IDLType(c, "wchar"); + } else if (c == Byte.TYPE) { + return new IDLType(c, "octet"); + } else if (c == Short.TYPE) { + return new IDLType(c, "short"); + } else if (c == Integer.TYPE) { + return new IDLType(c, "long"); + } else if (c == Long.TYPE) { + return new IDLType(c, "long_long"); + } else if (c == Float.TYPE) { + return new IDLType(c, "float"); + } else if (c == Double.TYPE) { + return new IDLType(c, "double"); } } - + return null; } /** - * Return IDL Type name for special case type mappings as defined in - * Table 1-1 of Java2IDL spec or null if given class is not a special - * type. + * Return IDL Type name for special case type mappings as defined in Table 1-1 of Java2IDL spec or null if given class + * is not a special type. + * * @param c class to get special case mapping for - * @return The IDLType for the special case, or {@code null} if it is - * not a special case. + * @return The IDLType for the special case, or {@code null} if it is not a special case. */ public IDLType getSpecialCaseIDLTypeMapping(Class c) { - if( c == null ) { + if (c == null) { throw new IllegalArgumentException(); - } - - if( c == java.lang.Object.class ) { - return new IDLType( c, new String[] { "java", "lang" }, - "Object" ) ; - } else if( c == java.lang.String.class ) { - return new IDLType( c, new String[] { "CORBA" }, - "WStringValue" ) ; - } else if( c == java.lang.Class.class ) { - return new IDLType( c, new String[] { "javax", "rmi", "CORBA" }, - "ClassDesc" ) ; - } else if( c == java.io.Serializable.class ) { - return new IDLType( c, new String[] { "java", "io" }, - "Serializable" ) ; - } else if( c == java.io.Externalizable.class ) { - return new IDLType( c, new String[] { "java", "io" }, - "Externalizable" ) ; - } else if( c == java.rmi.Remote.class ) { - return new IDLType( c, new String[] { "java", "rmi" }, - "Remote" ) ; - } else if( c == org.omg.CORBA.Object.class ) { - return new IDLType( c, "Object" ) ; + } + + if (c == java.lang.Object.class) { + return new IDLType(c, new String[] { "java", "lang" }, "Object"); + } else if (c == java.lang.String.class) { + return new IDLType(c, new String[] { "CORBA" }, "WStringValue"); + } else if (c == java.lang.Class.class) { + return new IDLType(c, new String[] { "javax", "rmi", "CORBA" }, "ClassDesc"); + } else if (c == java.io.Serializable.class) { + return new IDLType(c, new String[] { "java", "io" }, "Serializable"); + } else if (c == java.io.Externalizable.class) { + return new IDLType(c, new String[] { "java", "io" }, "Externalizable"); + } else if (c == java.rmi.Remote.class) { + return new IDLType(c, new String[] { "java", "rmi" }, "Remote"); + } else if (c == org.omg.CORBA.Object.class) { + return new IDLType(c, "Object"); } else { return null; } @@ -472,39 +416,35 @@ public IDLType getSpecialCaseIDLTypeMapping(Class c) { * Implements 1.2.3 #2 and #4 */ private void validateExceptions(Method method) throws IDLTypeException { - + Class[] exceptions = method.getExceptionTypes(); boolean declaresRemoteExceptionOrSuperClass = false; // Section 1.2.3, #2 - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { + for (int eIndex = 0; eIndex < exceptions.length; eIndex++) { Class exception = exceptions[eIndex]; - if( isRemoteExceptionOrSuperClass(exception) ) { + if (isRemoteExceptionOrSuperClass(exception)) { declaresRemoteExceptionOrSuperClass = true; break; } } - if( !declaresRemoteExceptionOrSuperClass ) { - String msg = "Method '" + method + "' must throw at least one " + - "exception of type java.rmi.RemoteException or one of its " + - "super-classes"; + if (!declaresRemoteExceptionOrSuperClass) { + String msg = "Method '" + method + "' must throw at least one " + "exception of type java.rmi.RemoteException or one of its " + + "super-classes"; throw new IDLTypeException(msg); - } + } // Section 1.2.3, #4 // See also bug 4972402 - // For all exceptions E in exceptions, + // For all exceptions E in exceptions, // (isCheckedException(E) => (isValue(E) || RemoteException.isAssignableFrom( E ) ) - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { + for (int eIndex = 0; eIndex < exceptions.length; eIndex++) { Class exception = exceptions[eIndex]; - if (isCheckedException(exception) && !isValue(exception) && - !isRemoteException(exception)) - { - String msg = "Exception '" + exception + "' on method '" + - method + "' is not a allowed RMI/IIOP exception type"; + if (isCheckedException(exception) && !isValue(exception) && !isRemoteException(exception)) { + String msg = "Exception '" + exception + "' on method '" + method + "' is not a allowed RMI/IIOP exception type"; throw new IDLTypeException(msg); } } @@ -513,69 +453,63 @@ private void validateExceptions(Method method) throws IDLTypeException { } /** - * Returns true if the method's throw clause conforms to the exception - * restrictions for properties as defined in Section 1.3.4.3 of - * Java2IDL spec. This means that for all exceptions E declared on the - * method, E isChecked => RemoteException.isAssignableFrom( E ). + * Returns true if the method's throw clause conforms to the exception restrictions for properties as defined in Section + * 1.3.4.3 of Java2IDL spec. This means that for all exceptions E declared on the method, E isChecked => + * RemoteException.isAssignableFrom( E ). */ - private boolean validPropertyExceptions(Method method) - { + private boolean validPropertyExceptions(Method method) { Class[] exceptions = method.getExceptionTypes(); - - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { + + for (int eIndex = 0; eIndex < exceptions.length; eIndex++) { Class exception = exceptions[eIndex]; - if (isCheckedException(exception) && !isRemoteException(exception)) - return false ; + if (isCheckedException(exception) && !isRemoteException(exception)) + return false; } return true; } /** - * Implements Section 1.2.3, #2. + * Implements Section 1.2.3, #2. */ private boolean isRemoteExceptionOrSuperClass(Class c) { - return - ((c == java.rmi.RemoteException.class) || - (c == java.io.IOException.class) || - (c == java.lang.Exception.class) || - (c == java.lang.Throwable.class)); + return ((c == java.rmi.RemoteException.class) || (c == java.io.IOException.class) || (c == java.lang.Exception.class) + || (c == java.lang.Throwable.class)); } /** * Implements Section 1.2.3, #5. - */ + */ private void validateDirectInterfaces(Class c) throws IDLTypeException { Class[] directInterfaces = c.getInterfaces(); - if( directInterfaces.length < 2 ) { + if (directInterfaces.length < 2) { return; } Set allMethodNames = new HashSet(); Set currentMethodNames = new HashSet(); - for(int i = 0; i < directInterfaces.length; i++) { + for (int i = 0; i < directInterfaces.length; i++) { Class next = directInterfaces[i]; Method[] methods = next.getMethods(); - // Comparison is based on method names only. First collect + // Comparison is based on method names only. First collect // all methods from current interface, eliminating duplicate // names. currentMethodNames.clear(); - for(int m = 0; m < methods.length; m++) { + for (int m = 0; m < methods.length; m++) { currentMethodNames.add(methods[m].getName()); } // Now check each method against list of all unique method // names processed so far. - for(Iterator iter=currentMethodNames.iterator(); iter.hasNext();) { + for (Iterator iter = currentMethodNames.iterator(); iter.hasNext();) { String methodName = (String) iter.next(); - if( allMethodNames.contains(methodName) ) { - String msg = "Class " + c + " inherits method " + - methodName + " from multiple direct interfaces."; + if (allMethodNames.contains(methodName)) { + String msg = "Class " + c + " inherits method " + methodName + " from multiple direct interfaces."; throw new IDLTypeException(msg); } else { allMethodNames.add(methodName); @@ -589,40 +523,33 @@ private void validateDirectInterfaces(Class c) throws IDLTypeException { /** * Implements 1.2.3 #6 */ - private void validateConstants(final Class c) - throws IDLTypeException { + private void validateConstants(final Class c) throws IDLTypeException { Field[] fields = null; try { - fields = (Field[]) - java.security.AccessController.doPrivileged - (new java.security.PrivilegedExceptionAction() { - public java.lang.Object run() throws Exception { - return c.getFields(); - } - }); - } catch(java.security.PrivilegedActionException pae) { + fields = (Field[]) java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction() { + public java.lang.Object run() throws Exception { + return c.getFields(); + } + }); + } catch (java.security.PrivilegedActionException pae) { IDLTypeException ite = new IDLTypeException(); ite.initCause(pae); throw ite; } - - for(int i = 0; i < fields.length; i++) { + + for (int i = 0; i < fields.length; i++) { Field next = fields[i]; Class fieldType = next.getType(); - if( (fieldType != java.lang.String.class) && - !isPrimitive(fieldType) ) { - String msg = "Constant field '" + next.getName() + - "' in class '" + next.getDeclaringClass().getName() + - "' has invalid type' " + next.getType() + "'. Constants" + - " in RMI/IIOP interfaces can only have primitive" + - " types and java.lang.String types."; + if ((fieldType != java.lang.String.class) && !isPrimitive(fieldType)) { + String msg = "Constant field '" + next.getName() + "' in class '" + next.getDeclaringClass().getName() + + "' has invalid type' " + next.getType() + "'. Constants" + " in RMI/IIOP interfaces can only have primitive" + + " types and java.lang.String types."; throw new IDLTypeException(msg); } } - return; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/InvocationHandlerFactoryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/InvocationHandlerFactoryImpl.java index ceadf915f..5005bf615 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/InvocationHandlerFactoryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/InvocationHandlerFactoryImpl.java @@ -17,137 +17,112 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; -import java.lang.reflect.InvocationHandler ; -import java.lang.reflect.Proxy ; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; +import java.io.ObjectStreamException; +import java.io.Serializable; -import java.io.ObjectStreamException ; -import java.io.Serializable ; - -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.ee.spi.presentation.rmi.DynamicStub ; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; +import com.sun.corba.ee.spi.presentation.rmi.DynamicStub; import org.glassfish.pfl.basic.proxy.CompositeInvocationHandler; import org.glassfish.pfl.basic.proxy.CompositeInvocationHandlerImpl; import org.glassfish.pfl.basic.proxy.DelegateInvocationHandlerImpl; import org.glassfish.pfl.basic.proxy.InvocationHandlerFactory; import org.glassfish.pfl.basic.proxy.LinkedInvocationHandler; -public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory -{ - private final PresentationManager.ClassData classData ; - private final PresentationManager pm ; - private Class[] proxyInterfaces ; - - public InvocationHandlerFactoryImpl( PresentationManager pm, - PresentationManager.ClassData classData ) - { - this.classData = classData ; - this.pm = pm ; - - Class[] remoteInterfaces = - classData.getIDLNameTranslator().getInterfaces() ; - proxyInterfaces = new Class[ remoteInterfaces.length + 1 ] ; - System.arraycopy(remoteInterfaces, 0, proxyInterfaces, 0, - remoteInterfaces.length); - - proxyInterfaces[remoteInterfaces.length] = DynamicStub.class ; +public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory { + private final PresentationManager.ClassData classData; + private final PresentationManager pm; + private Class[] proxyInterfaces; + + public InvocationHandlerFactoryImpl(PresentationManager pm, PresentationManager.ClassData classData) { + this.classData = classData; + this.pm = pm; + + Class[] remoteInterfaces = classData.getIDLNameTranslator().getInterfaces(); + proxyInterfaces = new Class[remoteInterfaces.length + 1]; + System.arraycopy(remoteInterfaces, 0, proxyInterfaces, 0, remoteInterfaces.length); + + proxyInterfaces[remoteInterfaces.length] = DynamicStub.class; } - private static class CustomCompositeInvocationHandlerImpl extends - CompositeInvocationHandlerImpl implements LinkedInvocationHandler, - Serializable - { - private transient DynamicStub stub ; + private static class CustomCompositeInvocationHandlerImpl extends CompositeInvocationHandlerImpl + implements LinkedInvocationHandler, Serializable { + private transient DynamicStub stub; - public void setProxy( Proxy proxy ) - { + public void setProxy(Proxy proxy) { if (proxy instanceof DynamicStub) { - ((DynamicStubImpl)stub).setSelf( (DynamicStub)proxy ) ; + ((DynamicStubImpl) stub).setSelf((DynamicStub) proxy); } else { - throw new RuntimeException( - "Proxy not instance of DynamicStub" ) ; + throw new RuntimeException("Proxy not instance of DynamicStub"); } } - public Proxy getProxy() - { - return (Proxy)((DynamicStubImpl)stub).getSelf() ; + public Proxy getProxy() { + return (Proxy) ((DynamicStubImpl) stub).getSelf(); } - public CustomCompositeInvocationHandlerImpl( DynamicStub stub ) - { - this.stub = stub ; + public CustomCompositeInvocationHandlerImpl(DynamicStub stub) { + this.stub = stub; } - /** Return the stub, which will actually be written to the stream. - * It will be custom marshaled, with the actual writing done in - * StubIORImpl. There is a corresponding readResolve method on - * DynamicStubImpl which will re-create the full invocation - * handler on read, and return the invocation handler on the - * readResolve method. + /** + * Return the stub, which will actually be written to the stream. It will be custom marshaled, with the actual writing + * done in StubIORImpl. There is a corresponding readResolve method on DynamicStubImpl which will re-create the full + * invocation handler on read, and return the invocation handler on the readResolve method. */ - public Object writeReplace() throws ObjectStreamException - { - return stub ; + public Object writeReplace() throws ObjectStreamException { + return stub; } } - public InvocationHandler getInvocationHandler() - { - final DynamicStub stub = new DynamicStubImpl( - classData.getTypeIds() ) ; + public InvocationHandler getInvocationHandler() { + final DynamicStub stub = new DynamicStubImpl(classData.getTypeIds()); - return getInvocationHandler( stub ) ; + return getInvocationHandler(stub); } // This is also used in DynamicStubImpl to implement readResolve. - InvocationHandler getInvocationHandler( DynamicStub stub ) - { + InvocationHandler getInvocationHandler(DynamicStub stub) { // Create an invocation handler for the methods defined on DynamicStub, - // which extends org.omg.CORBA.Object. This handler delegates all - // calls directly to a DynamicStubImpl, which extends + // which extends org.omg.CORBA.Object. This handler delegates all + // calls directly to a DynamicStubImpl, which extends // org.omg.CORBA.portable.ObjectImpl. - InvocationHandler dynamicStubHandler = - DelegateInvocationHandlerImpl.create( stub ) ; + InvocationHandler dynamicStubHandler = DelegateInvocationHandlerImpl.create(stub); // Create an invocation handler that handles any remote interface // methods. - InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl( - pm, classData, stub ) ; + InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl(pm, classData, stub); // Create a composite handler that handles the DynamicStub interface // as well as the remote interfaces. - final CompositeInvocationHandler handler = - new CustomCompositeInvocationHandlerImpl( stub ) ; - handler.addInvocationHandler( DynamicStub.class, - dynamicStubHandler ) ; - handler.addInvocationHandler( org.omg.CORBA.Object.class, - dynamicStubHandler ) ; - handler.addInvocationHandler( Object.class, - dynamicStubHandler ) ; + final CompositeInvocationHandler handler = new CustomCompositeInvocationHandlerImpl(stub); + handler.addInvocationHandler(DynamicStub.class, dynamicStubHandler); + handler.addInvocationHandler(org.omg.CORBA.Object.class, dynamicStubHandler); + handler.addInvocationHandler(Object.class, dynamicStubHandler); // If the method passed to invoke is not from DynamicStub or its superclasses, // it must be from an implemented interface, so we just handle - // all of these with the stubMethodHandler. This used to be - // done be adding explicit entries for stubMethodHandler for + // all of these with the stubMethodHandler. This used to be + // done be adding explicit entries for stubMethodHandler for // each remote interface, but that does not work correctly // for abstract interfaces, since the graph analysis ignores - // abstract interfaces in order to compute the type ids + // abstract interfaces in order to compute the type ids // correctly (see PresentationManagerImpl.NodeImpl.getChildren). // Rather than produce more graph traversal code to handle this // problem, we simply use a default. // This also points to a possible optimization: just use explict // checks for the three special classes, rather than a general // table lookup that usually fails. - handler.setDefaultHandler( stubMethodHandler ) ; + handler.setDefaultHandler(stubMethodHandler); - return handler ; + return handler; } - public Class[] getProxyInterfaces() - { - return proxyInterfaces ; + public Class[] getProxyInterfaces() { + return proxyInterfaces; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/JNDIStateFactoryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/JNDIStateFactoryImpl.java index 7a7df8f6f..87cfbabcc 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/JNDIStateFactoryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/JNDIStateFactoryImpl.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; @@ -40,35 +40,32 @@ // of the CosNaming service provider. /** - * StateFactory that turns java.rmi.Remote objects to org.omg.CORBA.Object. - * This version works either with standard RMI-IIOP or Dynamic RMI-IIOP. - * - * @author Ken Cavanaugh - */ + * StateFactory that turns java.rmi.Remote objects to org.omg.CORBA.Object. This version works either with standard + * RMI-IIOP or Dynamic RMI-IIOP. + * + * @author Ken Cavanaugh + */ public class JNDIStateFactoryImpl implements StateFactory { @SuppressWarnings("WeakerAccess") - public JNDIStateFactoryImpl() { } + public JNDIStateFactoryImpl() { + } /** - * Returns the CORBA object for a Remote object. - * If input is not a Remote object, or if Remote object uses JRMP, return null. - * If the RMI-IIOP library is not available, throw ConfigurationException. + * Returns the CORBA object for a Remote object. If input is not a Remote object, or if Remote object uses JRMP, return + * null. If the RMI-IIOP library is not available, throw ConfigurationException. * - * @param orig The object to turn into a CORBA object. If not Remote, - * or if is a JRMP stub or impl, return null. + * @param orig The object to turn into a CORBA object. If not Remote, or if is a JRMP stub or impl, return null. * @param name Ignored * @param ctx The non-null CNCtx whose ORB to use. * @param env Ignored * @return The CORBA object for orig or null. - * @exception ConfigurationException If the CORBA object cannot be obtained - * due to configuration problems - * @exception NamingException If some other problem prevented a CORBA - * object from being obtained from the Remote object. + * @exception ConfigurationException If the CORBA object cannot be obtained due to configuration problems + * @exception NamingException If some other problem prevented a CORBA object from being obtained from the Remote object. */ @Override - public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable env) throws NamingException { + public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable env) throws NamingException { if (orig instanceof org.omg.CORBA.Object) { return orig; } @@ -77,35 +74,35 @@ public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable return null; } - ORB orb = getORB( ctx ) ; + ORB orb = getORB(ctx); if (orb == null) { // Wrong kind of context, so just give up and let another StateFactory // try to satisfy getStateToBind. - return null ; + return null; } Remote stub; try { - stub = PortableRemoteObject.toStub( (Remote)orig ) ; + stub = PortableRemoteObject.toStub((Remote) orig); } catch (Exception exc) { - Exceptions.self.noStub( exc ) ; + Exceptions.self.noStub(exc); // Wrong sort of object: just return null to allow another StateFactory - // to handle this. This can happen easily because this StateFactory + // to handle this. This can happen easily because this StateFactory // is specified for the application, not the service context provider. - return null ; + return null; } - if (StubAdapter.isStub( stub )) { + if (StubAdapter.isStub(stub)) { try { - StubAdapter.connect( stub, orb ) ; + StubAdapter.connect(stub, orb); } catch (Exception exc) { - Exceptions.self.couldNotConnect( exc ) ; + Exceptions.self.couldNotConnect(exc); if (!(exc instanceof java.rmi.RemoteException)) { // Wrong sort of object: just return null to allow another StateFactory // to handle this call. - return null ; + return null; } // ignore RemoteException because stub might have already @@ -113,20 +110,20 @@ public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable } } - return stub ; + return stub; } - // This is necessary because the _orb field is package private in - // com.sun.jndi.cosnaming.CNCtx. This is not an ideal solution. + // This is necessary because the _orb field is package private in + // com.sun.jndi.cosnaming.CNCtx. This is not an ideal solution. // The best solution for our ORB is to change the CosNaming provider - // to use the StubAdapter. But this has problems as well, because + // to use the StubAdapter. But this has problems as well, because // other vendors may use the CosNaming provider with a different ORB // entirely. - private ORB getORB( Context ctx ) { + private ORB getORB(Context ctx) { try { - return (ORB) getOrbField(ctx).get( ctx ) ; + return (ORB) getOrbField(ctx).get(ctx); } catch (Exception exc) { - Exceptions.self.couldNotGetORB( exc, ctx ); + Exceptions.self.couldNotGetORB(exc, ctx); return null; } } @@ -135,7 +132,8 @@ private ORB getORB( Context ctx ) { private Field getOrbField(Context ctx) { Field orbField = orbFields.get(ctx.getClass()); - if (orbField != null) return orbField; + if (orbField != null) + return orbField; orbField = AccessController.doPrivileged((PrivilegedAction) () -> getField(ctx.getClass(), "_orb")); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/PresentationManagerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/PresentationManagerImpl.java index 55499e65e..83b4d6e7a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/PresentationManagerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/PresentationManagerImpl.java @@ -17,151 +17,136 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; -import java.io.PrintStream ; +import java.io.PrintStream; -import java.util.Map ; -import java.util.HashMap ; -import java.util.Set ; -import java.util.HashSet ; -import java.util.List ; -import java.util.ArrayList ; +import java.util.Map; +import java.util.HashMap; +import java.util.Set; +import java.util.HashSet; +import java.util.List; +import java.util.ArrayList; -import java.lang.reflect.Method ; +import java.lang.reflect.Method; -import java.rmi.Remote ; +import java.rmi.Remote; -import javax.rmi.CORBA.Tie ; +import javax.rmi.CORBA.Tie; import java.security.AccessController; import java.security.PrivilegedAction; -import org.omg.PortableServer.POA ; -import org.omg.PortableServer.Servant ; +import org.omg.PortableServer.POA; +import org.omg.PortableServer.Servant; -import com.sun.corba.ee.spi.presentation.rmi.IDLNameTranslator ; -import com.sun.corba.ee.spi.presentation.rmi.DynamicMethodMarshaller ; -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; +import com.sun.corba.ee.spi.presentation.rmi.IDLNameTranslator; +import com.sun.corba.ee.spi.presentation.rmi.DynamicMethodMarshaller; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -import com.sun.corba.ee.impl.util.RepositoryId ; +import com.sun.corba.ee.impl.util.RepositoryId; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; import org.glassfish.pfl.basic.concurrent.WeakCache; -import org.glassfish.pfl.basic.graph.Graph ; -import org.glassfish.pfl.basic.graph.GraphImpl ; -import org.glassfish.pfl.basic.graph.Node ; -import org.glassfish.pfl.basic.graph.NodeData ; +import org.glassfish.pfl.basic.graph.Graph; +import org.glassfish.pfl.basic.graph.GraphImpl; +import org.glassfish.pfl.basic.graph.Node; +import org.glassfish.pfl.basic.graph.NodeData; import org.glassfish.pfl.basic.proxy.InvocationHandlerFactory; -public final class PresentationManagerImpl implements PresentationManager -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public final class PresentationManagerImpl implements PresentationManager { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private WeakCache,ClassData> classToClassData ; - private WeakCache methodToDMM ; - private PresentationManager.StubFactoryFactory staticStubFactoryFactory ; - private PresentationManager.StubFactoryFactory dynamicStubFactoryFactory ; - private boolean useDynamicStubs ; - private boolean debug ; - private PrintStream ps ; + private WeakCache, ClassData> classToClassData; + private WeakCache methodToDMM; + private PresentationManager.StubFactoryFactory staticStubFactoryFactory; + private PresentationManager.StubFactoryFactory dynamicStubFactoryFactory; + private boolean useDynamicStubs; + private boolean debug; + private PrintStream ps; - public PresentationManagerImpl( boolean useDynamicStubs ) - { - this.useDynamicStubs = useDynamicStubs ; + public PresentationManagerImpl(boolean useDynamicStubs) { + this.useDynamicStubs = useDynamicStubs; - classToClassData = new WeakCache,ClassData>() { + classToClassData = new WeakCache, ClassData>() { @Override protected ClassData lookup(Class key) { - return new ClassDataImpl( key ) ; + return new ClassDataImpl(key); } - } ; + }; - methodToDMM = new WeakCache() { + methodToDMM = new WeakCache() { @Override protected DynamicMethodMarshaller lookup(Method key) { - return new DynamicMethodMarshallerImpl( key ) ; + return new DynamicMethodMarshallerImpl(key); } - } ; + }; } //////////////////////////////////////////////////////////////////////////////// // PresentationManager interface //////////////////////////////////////////////////////////////////////////////// - public synchronized DynamicMethodMarshaller getDynamicMethodMarshaller( - Method method ) - { + public synchronized DynamicMethodMarshaller getDynamicMethodMarshaller(Method method) { if (method == null) { return null; } - return methodToDMM.get(method) ; + return methodToDMM.get(method); } - public synchronized ClassData getClassData( Class cls ) - { - return classToClassData.get(cls) ; + public synchronized ClassData getClassData(Class cls) { + return classToClassData.get(cls); } - private class ClassDataImpl implements PresentationManager.ClassData - { - private Class cls ; - private IDLNameTranslator nameTranslator ; - private String[] typeIds ; - private InvocationHandlerFactory ihfactory ; - private Map dictionary ; + private class ClassDataImpl implements PresentationManager.ClassData { + private Class cls; + private IDLNameTranslator nameTranslator; + private String[] typeIds; + private InvocationHandlerFactory ihfactory; + private Map dictionary; - ClassDataImpl( Class cls ) { - this.cls = cls ; - Graph gr = new GraphImpl() ; - NodeImpl root = new NodeImpl( cls ) ; - Set rootSet = getRootSet( cls, root, gr ) ; + ClassDataImpl(Class cls) { + this.cls = cls; + Graph gr = new GraphImpl(); + NodeImpl root = new NodeImpl(cls); + Set rootSet = getRootSet(cls, root, gr); // At this point, rootSet contains those remote interfaces // that are not related by inheritance, and gr contains // all reachable remote interfaces. - Class[] interfaces = getInterfaces( rootSet ) ; - nameTranslator = IDLNameTranslatorImpl.get( interfaces ) ; - typeIds = makeTypeIds( root, gr, rootSet ) ; - ihfactory = new InvocationHandlerFactoryImpl( - PresentationManagerImpl.this, this ) ; - dictionary = new HashMap() ; + Class[] interfaces = getInterfaces(rootSet); + nameTranslator = IDLNameTranslatorImpl.get(interfaces); + typeIds = makeTypeIds(root, gr, rootSet); + ihfactory = new InvocationHandlerFactoryImpl(PresentationManagerImpl.this, this); + dictionary = new HashMap(); } - public Class getMyClass() - { - return cls ; + public Class getMyClass() { + return cls; } - public IDLNameTranslator getIDLNameTranslator() - { - return nameTranslator ; + public IDLNameTranslator getIDLNameTranslator() { + return nameTranslator; } - public String[] getTypeIds() - { - return typeIds.clone() ; + public String[] getTypeIds() { + return typeIds.clone(); } - public InvocationHandlerFactory getInvocationHandlerFactory() - { - return ihfactory ; + public InvocationHandlerFactory getInvocationHandlerFactory() { + return ihfactory; } - public Map getDictionary() - { - return dictionary ; + public Map getDictionary() { + return dictionary; } } - public PresentationManager.StubFactoryFactory getStubFactoryFactory( - boolean isDynamic ) - { + public PresentationManager.StubFactoryFactory getStubFactoryFactory(boolean isDynamic) { if (isDynamic) { return getDynamicStubFactoryFactory(); } else { @@ -179,60 +164,54 @@ public StubFactoryFactory getDynamicStubFactoryFactory() { return dynamicStubFactoryFactory; } - - /** Register the dynamic StubFactoryFactory. Note that - * a dynamic StubFactoryFactory is optional. + /** + * Register the dynamic StubFactoryFactory. Note that a dynamic StubFactoryFactory is optional. + * * @param sff Factory to register */ public void setStaticStubFactoryFactory(StubFactoryFactory sff) { staticStubFactoryFactory = sff; } - /** Register the static StubFactoryFactory. Note that - * a static StubFactoryFactory is always required for IDL. + /** + * Register the static StubFactoryFactory. Note that a static StubFactoryFactory is always required for IDL. + * * @param sff Factory to Register */ public void setDynamicStubFactoryFactory(StubFactoryFactory sff) { dynamicStubFactoryFactory = sff; } - public Tie getTie() - { - return dynamicStubFactoryFactory.getTie( null ) ; + public Tie getTie() { + return dynamicStubFactoryFactory.getTie(null); } - public String getRepositoryId( java.rmi.Remote impl ) - { + public String getRepositoryId(java.rmi.Remote impl) { // Get an empty reflective Tie. - Tie tie = getTie() ; - + Tie tie = getTie(); + // Setting the target causes the ReflectiveTieImpl to // compute all of the required repo ID information. - tie.setTarget( impl ) ; + tie.setTarget(impl); - return Servant.class.cast( tie )._all_interfaces( - (POA)null, (byte[])null)[0] ; + return Servant.class.cast(tie)._all_interfaces((POA) null, (byte[]) null)[0]; } - public boolean useDynamicStubs() - { - return useDynamicStubs ; + public boolean useDynamicStubs() { + return useDynamicStubs; } - public void flushClass( final Class cls ) - { - classToClassData.remove( cls ) ; + public void flushClass(final Class cls) { + classToClassData.remove(cls); - Method[] methods = (Method[])AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return cls.getMethods() ; - } - } - ) ; + Method[] methods = (Method[]) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return cls.getMethods(); + } + }); - for( int ctr=0; ctr getRootSet( Class target, NodeImpl root, - Graph gr ) - { - Set rootSet = null ; + private Set getRootSet(Class target, NodeImpl root, Graph gr) { + Set rootSet = null; if (ClassInfoCache.get(target).isInterface()) { - gr.add( root ) ; - rootSet = gr.getRoots() ; // rootSet just contains root here + gr.add(root); + rootSet = gr.getRoots(); // rootSet just contains root here } else { // Use this class and its superclasses (not Object) as initial roots - Class superclass = target ; - Set initialRootSet = new HashSet() ; - while ((superclass != null) && !superclass.equals( Object.class )) { - NodeImpl node = new NodeImpl( superclass ) ; - gr.add( node ) ; - initialRootSet.add( node ) ; - superclass = superclass.getSuperclass() ; + Class superclass = target; + Set initialRootSet = new HashSet(); + while ((superclass != null) && !superclass.equals(Object.class)) { + NodeImpl node = new NodeImpl(superclass); + gr.add(node); + initialRootSet.add(node); + superclass = superclass.getSuperclass(); } // Expand all nodes into the graph - gr.getRoots() ; + gr.getRoots(); // remove the roots and find roots again - gr.removeAll( initialRootSet ) ; - rootSet = gr.getRoots() ; + gr.removeAll(initialRootSet); + rootSet = gr.getRoots(); } - return rootSet ; + return rootSet; } - private Class[] getInterfaces( Set roots ) - { - int ctr = 0 ; - Class[] classes = new Class[ roots.size() ] ; + private Class[] getInterfaces(Set roots) { + int ctr = 0; + Class[] classes = new Class[roots.size()]; for (NodeImpl node : roots) { - classes[ctr] = node.getInterface() ; - ctr++ ; + classes[ctr] = node.getInterface(); + ctr++; } - return classes ; + return classes; } - private String[] makeTypeIds( NodeImpl root, Graph gr, - Set rootSet ) - { - Set nonRootSet = new HashSet( gr ) ; - nonRootSet.removeAll( rootSet ) ; + private String[] makeTypeIds(NodeImpl root, Graph gr, Set rootSet) { + Set nonRootSet = new HashSet(gr); + nonRootSet.removeAll(rootSet); // Handle the case of a remote reference that only implements // java.rmi.Remote. if (rootSet.isEmpty()) { - return new String[]{""}; + return new String[] { "" }; } // List for the typeids - List result = new ArrayList() ; + List result = new ArrayList(); if (rootSet.size() > 1) { // If the rootSet has more than one element, we must // put the type id of the implementation class first. // Root represents the implementation class here. - result.add( root.getTypeId() ) ; + result.add(root.getTypeId()); } - addNodes( result, rootSet ) ; - addNodes( result, nonRootSet ) ; + addNodes(result, rootSet); + addNodes(result, nonRootSet); - return result.toArray(new String[result.size()]) ; + return result.toArray(new String[result.size()]); } - private void addNodes( List resultList, Set nodeSet ) - { + private void addNodes(List resultList, Set nodeSet) { for (NodeImpl node : nodeSet) { - String typeId = node.getTypeId() ; - resultList.add( typeId ) ; + String typeId = node.getTypeId(); + resultList.add(typeId); } } - private static class NodeImpl implements Node - { - private Class interf ; + private static class NodeImpl implements Node { + private Class interf; - public Class getInterface() - { - return interf ; + public Class getInterface() { + return interf; } - NodeImpl( Class interf ) - { - this.interf = interf ; + NodeImpl(Class interf) { + this.interf = interf; } - public String getTypeId() - { - return RepositoryId.createForJavaType( interf ) ; + public String getTypeId() { + return RepositoryId.createForJavaType(interf); // return "RMI:" + interf.getName() + ":0000000000000000" ; } - public Set getChildren() - { - Set result = new HashSet() ; - Class[] interfaces = interf.getInterfaces() ; - for (int ctr=0; ctr cls = interfaces[ctr] ; - ClassInfoCache.ClassInfo cinfo = - ClassInfoCache.get( cls ) ; - if (cinfo.isARemote(cls) && - !Remote.class.equals(cls)) { + public Set getChildren() { + Set result = new HashSet(); + Class[] interfaces = interf.getInterfaces(); + for (int ctr = 0; ctr < interfaces.length; ctr++) { + Class cls = interfaces[ctr]; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(cls); + if (cinfo.isARemote(cls) && !Remote.class.equals(cls)) { result.add(new NodeImpl(cls)); } } - return result ; + return result; } @Override - public String toString() - { - return "NodeImpl[" + interf + "]" ; + public String toString() { + return "NodeImpl[" + interf + "]"; } @Override - public int hashCode() - { - return interf.hashCode() ; + public int hashCode() { + return interf.hashCode(); } @Override - public boolean equals( Object obj ) - { + public boolean equals(Object obj) { if (this == obj) { return true; } @@ -378,31 +341,32 @@ public boolean equals( Object obj ) return false; } - NodeImpl other = (NodeImpl)obj ; + NodeImpl other = (NodeImpl) obj; - return other.getInterface().equals( interf ) ; + return other.getInterface().equals(interf); } } - /** Turn on internal debugging flags, which dump information - * about stub code generation to the PrintStream. + /** + * Turn on internal debugging flags, which dump information about stub code generation to the PrintStream. + * * @param ps Output stream. */ - public void enableDebug( PrintStream ps ) { - this.debug = true ; - this.ps = ps ; + public void enableDebug(PrintStream ps) { + this.debug = true; + this.ps = ps; } public void disableDebug() { - this.debug = false ; - this.ps = null ; + this.debug = false; + this.ps = null; } public boolean getDebug() { - return debug ; + return debug; } public PrintStream getPrintStream() { - return ps ; + return ps; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ReflectiveTie.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ReflectiveTie.java index e07ef6d04..4ec72c45e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ReflectiveTie.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/ReflectiveTie.java @@ -17,14 +17,14 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; import java.rmi.Remote; import javax.rmi.CORBA.Tie; -import java.lang.reflect.Method ; -import java.lang.reflect.InvocationTargetException ; +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; import org.omg.CORBA.SystemException; import org.omg.CORBA_2_3.portable.InputStream; @@ -33,25 +33,22 @@ import org.omg.CORBA.portable.UnknownException; import org.omg.PortableServer.Servant; -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.ee.spi.presentation.rmi.PresentationDefaults ; -import com.sun.corba.ee.spi.presentation.rmi.DynamicMethodMarshaller ; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; +import com.sun.corba.ee.spi.presentation.rmi.PresentationDefaults; +import com.sun.corba.ee.spi.presentation.rmi.DynamicMethodMarshaller; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -import org.glassfish.pfl.basic.proxy.DynamicAccessPermission ; +import org.glassfish.pfl.basic.proxy.DynamicAccessPermission; -public final class ReflectiveTie extends Servant implements Tie -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public final class ReflectiveTie extends Servant implements Tie { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private Remote target = null ; - private PresentationManager pm ; - private PresentationManager.ClassData classData = null ; + private Remote target = null; + private PresentationManager pm; + private PresentationManager.ClassData classData = null; - public ReflectiveTie( PresentationManager pm ) - { + public ReflectiveTie(PresentationManager pm) { if (!PresentationDefaults.inAppServer()) { SecurityManager s = System.getSecurityManager(); if (s != null) { @@ -59,117 +56,102 @@ public ReflectiveTie( PresentationManager pm ) } } - this.pm = pm ; + this.pm = pm; } - public String[] _all_interfaces(org.omg.PortableServer.POA poa, - byte[] objectId) - { - return classData.getTypeIds() ; + public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte[] objectId) { + return classData.getTypeIds(); } - public void setTarget(Remote target) - { + public void setTarget(Remote target) { this.target = target; if (target == null) { - classData = null ; + classData = null; } else { - Class targetClass = target.getClass() ; - classData = pm.getClassData( targetClass ) ; + Class targetClass = target.getClass(); + classData = pm.getClassData(targetClass); } } - - public Remote getTarget() - { + + public Remote getTarget() { return target; } - - public org.omg.CORBA.Object thisObject() - { + + public org.omg.CORBA.Object thisObject() { return _this_object(); } - - public void deactivate() - { - try{ + + public void deactivate() { + try { _poa().deactivate_object(_poa().servant_to_id(this)); - } catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){ - // ignore - } catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception){ - // ignore - } catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){ - // ignore + } catch (org.omg.PortableServer.POAPackage.WrongPolicy exception) { + // ignore + } catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception) { + // ignore + } catch (org.omg.PortableServer.POAPackage.ServantNotActive exception) { + // ignore } } - + public org.omg.CORBA.ORB orb() { return _orb(); } - + public void orb(org.omg.CORBA.ORB orb) { try { - ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this); + ((org.omg.CORBA_2_3.ORB) orb).set_delegate(this); } catch (ClassCastException e) { - throw wrapper.badOrbForServant( e ) ; + throw wrapper.badOrbForServant(e); } } - - public Object dispatchToMethod( Method javaMethod, Remote target, Object[] args ) - throws InvocationTargetException { + + public Object dispatchToMethod(Method javaMethod, Remote target, Object[] args) throws InvocationTargetException { try { - return javaMethod.invoke( target, args ) ; + return javaMethod.invoke(target, args); } catch (IllegalAccessException ex) { - throw wrapper.invocationErrorInReflectiveTie( ex, - javaMethod.getName(), - javaMethod.getDeclaringClass().getName() ) ; + throw wrapper.invocationErrorInReflectiveTie(ex, javaMethod.getName(), javaMethod.getDeclaringClass().getName()); } catch (IllegalArgumentException ex) { - throw wrapper.invocationErrorInReflectiveTie( ex, - javaMethod.getName(), - javaMethod.getDeclaringClass().getName() ) ; + throw wrapper.invocationErrorInReflectiveTie(ex, javaMethod.getName(), javaMethod.getDeclaringClass().getName()); } } - public org.omg.CORBA.portable.OutputStream _invoke(String method, - org.omg.CORBA.portable.InputStream _in, ResponseHandler reply) - { - Method javaMethod = null ; + public org.omg.CORBA.portable.OutputStream _invoke(String method, org.omg.CORBA.portable.InputStream _in, ResponseHandler reply) { + Method javaMethod = null; DynamicMethodMarshaller dmm = null; try { InputStream in = (InputStream) _in; - javaMethod = classData.getIDLNameTranslator().getMethod( method ) ; + javaMethod = classData.getIDLNameTranslator().getMethod(method); if (javaMethod == null) - throw wrapper.methodNotFoundInTie( method, - target.getClass().getName() ) ; + throw wrapper.methodNotFoundInTie(method, target.getClass().getName()); - dmm = pm.getDynamicMethodMarshaller( javaMethod ) ; + dmm = pm.getDynamicMethodMarshaller(javaMethod); - Object[] args = dmm.readArguments( in ) ; + Object[] args = dmm.readArguments(in); - Object result = dispatchToMethod( javaMethod, target, args ) ; + Object result = dispatchToMethod(javaMethod, target, args); - OutputStream os = (OutputStream)reply.createReply() ; + OutputStream os = (OutputStream) reply.createReply(); - dmm.writeResult( os, result ) ; + dmm.writeResult(os, result); - return os ; + return os; } catch (InvocationTargetException ex) { // Unwrap the actual exception so that it can be wrapped by an // UnknownException or thrown if it is a system exception. // This is expected in the server dispatcher code. - Throwable thr = ex.getCause() ; + Throwable thr = ex.getCause(); if (thr instanceof SystemException) - throw (SystemException)thr ; - else if ((thr instanceof Exception) && - dmm.isDeclaredException( thr )) { - OutputStream os = (OutputStream)reply.createExceptionReply() ; - dmm.writeException( os, (Exception)thr ) ; - return os ; + throw (SystemException) thr; + else if ((thr instanceof Exception) && dmm.isDeclaredException(thr)) { + OutputStream os = (OutputStream) reply.createExceptionReply(); + dmm.writeException(os, (Exception) thr); + return os; } else - throw new UnknownException( thr ) ; + throw new UnknownException(thr); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubConnectImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubConnectImpl.java index 75c25f449..b2ad20821 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubConnectImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubConnectImpl.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; import java.rmi.RemoteException; @@ -35,76 +35,75 @@ import com.sun.corba.ee.impl.util.Utility; -import com.sun.corba.ee.impl.ior.StubIORImpl ; +import com.sun.corba.ee.impl.ior.StubIORImpl; -import com.sun.corba.ee.spi.logging.UtilSystemException ; +import com.sun.corba.ee.spi.logging.UtilSystemException; -import com.sun.corba.ee.impl.corba.CORBAObjectImpl ; +import com.sun.corba.ee.impl.corba.CORBAObjectImpl; -public abstract class StubConnectImpl -{ - private static UtilSystemException wrapper = - UtilSystemException.self ; +public abstract class StubConnectImpl { + private static UtilSystemException wrapper = UtilSystemException.self; - /** Connect the stub to the orb if necessary. - * @param ior The StubIORImpl for this stub (may be null) - * @param proxy The externally visible stub seen by the user (may be the same as stub) - * @param stub The stub implementation that extends ObjectImpl - * @param orb The ORB to which we connect the stub. - * @return The IOR - * @throws RemoteException If an exception occurs - */ - public static StubIORImpl connect( StubIORImpl ior, org.omg.CORBA.Object proxy, - org.omg.CORBA.portable.ObjectImpl stub, ORB orb ) throws RemoteException - { - Delegate del = null ; + /** + * Connect the stub to the orb if necessary. + * + * @param ior The StubIORImpl for this stub (may be null) + * @param proxy The externally visible stub seen by the user (may be the same as stub) + * @param stub The stub implementation that extends ObjectImpl + * @param orb The ORB to which we connect the stub. + * @return The IOR + * @throws RemoteException If an exception occurs + */ + public static StubIORImpl connect(StubIORImpl ior, org.omg.CORBA.Object proxy, org.omg.CORBA.portable.ObjectImpl stub, ORB orb) + throws RemoteException { + Delegate del = null; try { try { - del = StubAdapter.getDelegate( stub ); - - if (del.orb(stub) != orb) - throw wrapper.connectWrongOrb() ; - } catch (org.omg.CORBA.BAD_OPERATION err) { + del = StubAdapter.getDelegate(stub); + + if (del.orb(stub) != orb) + throw wrapper.connectWrongOrb(); + } catch (org.omg.CORBA.BAD_OPERATION err) { if (ior == null) { // No IOR, can we get a Tie for this stub? Tie tie = (javax.rmi.CORBA.Tie) Utility.getAndForgetTie(proxy); - if (tie == null) - throw wrapper.connectNoTie() ; + if (tie == null) + throw wrapper.connectNoTie(); - // Is the tie already connected? If it is, check that it's + // Is the tie already connected? If it is, check that it's // connected to the same ORB, otherwise connect it. - ORB existingOrb = orb ; + ORB existingOrb = orb; try { existingOrb = tie.orb(); - } catch (BAD_OPERATION exc) { + } catch (BAD_OPERATION exc) { // Thrown when tie is an ObjectImpl and its delegate is not set. tie.orb(orb); - } catch (BAD_INV_ORDER exc) { + } catch (BAD_INV_ORDER exc) { // Thrown when tie is a Servant and its delegate is not set. tie.orb(orb); } - if (existingOrb != orb) - throw wrapper.connectTieWrongOrb() ; - + if (existingOrb != orb) + throw wrapper.connectTieWrongOrb(); + // Get the delegate for the stub from the tie. - del = StubAdapter.getDelegate( tie ) ; - ObjectImpl objref = new CORBAObjectImpl() ; - objref._set_delegate( del ) ; - ior = new StubIORImpl( objref ) ; + del = StubAdapter.getDelegate(tie); + ObjectImpl objref = new CORBAObjectImpl(); + objref._set_delegate(del); + ior = new StubIORImpl(objref); } else { // ior is initialized, so convert ior to an object, extract // the delegate, and set it on ourself - del = ior.getDelegate( orb ) ; + del = ior.getDelegate(orb); } - StubAdapter.setDelegate( stub, del ) ; + StubAdapter.setDelegate(stub, del); } } catch (SystemException exc) { - throw new RemoteException("CORBA SystemException", exc ); + throw new RemoteException("CORBA SystemException", exc); } - return ior ; + return ior; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryBase.java index ecce83a57..4963615d3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryBase.java @@ -17,39 +17,36 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; -import javax.rmi.CORBA.Tie ; +import javax.rmi.CORBA.Tie; -import java.lang.reflect.InvocationHandler ; -import java.lang.reflect.Proxy ; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.ee.spi.presentation.rmi.DynamicStub ; -import com.sun.corba.ee.spi.presentation.rmi.StubAdapter ; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; +import com.sun.corba.ee.spi.presentation.rmi.DynamicStub; +import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; -public abstract class StubFactoryBase implements PresentationManager.StubFactory -{ - private String[] typeIds = null ; +public abstract class StubFactoryBase implements PresentationManager.StubFactory { + private String[] typeIds = null; - protected final PresentationManager.ClassData classData ; + protected final PresentationManager.ClassData classData; - protected StubFactoryBase( PresentationManager.ClassData classData ) - { - this.classData = classData ; + protected StubFactoryBase(PresentationManager.ClassData classData) { + this.classData = classData; } - public synchronized String[] getTypeIds() - { + public synchronized String[] getTypeIds() { if (typeIds == null) { if (classData == null) { - org.omg.CORBA.Object stub = makeStub() ; - typeIds = StubAdapter.getTypeIds( stub ) ; + org.omg.CORBA.Object stub = makeStub(); + typeIds = StubAdapter.getTypeIds(stub); } else { - typeIds = classData.getTypeIds() ; + typeIds = classData.getTypeIds(); } } - return typeIds ; + return typeIds; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryDynamicBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryDynamicBase.java index b653c3671..b2413c044 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryDynamicBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryDynamicBase.java @@ -17,47 +17,41 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; import java.io.SerializablePermission; -import com.sun.corba.ee.spi.misc.ORBClassLoader ; +import com.sun.corba.ee.spi.misc.ORBClassLoader; + +public abstract class StubFactoryDynamicBase extends StubFactoryBase { + protected final ClassLoader loader; -public abstract class StubFactoryDynamicBase extends StubFactoryBase -{ - protected final ClassLoader loader ; - private static Void checkPermission() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new SerializablePermission( - "enableSubclassImplementation")); + sm.checkPermission(new SerializablePermission("enableSubclassImplementation")); } return null; } - private StubFactoryDynamicBase( Void unused, PresentationManager.ClassData classData, - ClassLoader loader ) - { - super( classData ) ; + private StubFactoryDynamicBase(Void unused, PresentationManager.ClassData classData, ClassLoader loader) { + super(classData); // this.loader must not be null, or the newProxyInstance call - // will fail. + // will fail. if (loader == null) { - this.loader = ORBClassLoader.getClassLoader() ; + this.loader = ORBClassLoader.getClassLoader(); } else { - this.loader = loader ; + this.loader = loader; } } - - public StubFactoryDynamicBase( PresentationManager.ClassData classData, - ClassLoader loader ) - { - this(checkPermission(), classData, loader); + + public StubFactoryDynamicBase(PresentationManager.ClassData classData, ClassLoader loader) { + this(checkPermission(), classData, loader); } - public abstract org.omg.CORBA.Object makeStub() ; + public abstract org.omg.CORBA.Object makeStub(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryBase.java index 08cb076cb..278ab4c2d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryBase.java @@ -21,18 +21,15 @@ import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; -import com.sun.corba.ee.impl.util.Utility ; +import com.sun.corba.ee.impl.util.Utility; -public abstract class StubFactoryFactoryBase implements - PresentationManager.StubFactoryFactory -{ +public abstract class StubFactoryFactoryBase implements PresentationManager.StubFactoryFactory { /** * Returns the stub classname for the given interface name. * * @param fullName fully qualified name remote class */ - public String getStubName(String fullName) - { - return Utility.stubName( fullName ) ; + public String getStubName(String fullName) { + return Utility.stubName(fullName); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java index d5101808f..c24b88733 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java @@ -19,7 +19,7 @@ package com.sun.corba.ee.impl.presentation.rmi; -import javax.rmi.CORBA.Tie ; +import javax.rmi.CORBA.Tie; import org.omg.CORBA.CompletionStatus; @@ -27,59 +27,50 @@ import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; -public abstract class StubFactoryFactoryDynamicBase extends - StubFactoryFactoryBase -{ - protected static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public abstract class StubFactoryFactoryDynamicBase extends StubFactoryFactoryBase { + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; public StubFactoryFactoryDynamicBase() { } - public PresentationManager.StubFactory createStubFactory( - String className, boolean isIDLStub, String remoteCodeBase, - Class expectedClass, ClassLoader classLoader) - { - Class cls = null ; + public PresentationManager.StubFactory createStubFactory(String className, boolean isIDLStub, String remoteCodeBase, + Class expectedClass, ClassLoader classLoader) { + Class cls = null; try { - cls = Util.getInstance().loadClass( className, remoteCodeBase, - classLoader ) ; + cls = Util.getInstance().loadClass(className, remoteCodeBase, classLoader); } catch (ClassNotFoundException exc) { - throw wrapper.classNotFound3( exc, className ) ; + throw wrapper.classNotFound3(exc, className); } - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(cls) ; - PresentationManager pm = ORB.getPresentationManager() ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(cls); + PresentationManager pm = ORB.getPresentationManager(); if (cinfo.isAIDLEntity(cls) && !cinfo.isARemote(cls)) { // IDL stubs must always use static factories. PresentationManager.StubFactoryFactory sff = pm.getStaticStubFactoryFactory(); - return sff.createStubFactory( className, true, remoteCodeBase, expectedClass, classLoader ); + return sff.createStubFactory(className, true, remoteCodeBase, expectedClass, classLoader); } else { - PresentationManager.ClassData classData = pm.getClassData( cls ) ; - return makeDynamicStubFactory( pm, classData, classLoader ) ; + PresentationManager.ClassData classData = pm.getClassData(cls); + return makeDynamicStubFactory(pm, classData, classLoader); } } - public abstract PresentationManager.StubFactory makeDynamicStubFactory( - PresentationManager pm, PresentationManager.ClassData classData, - ClassLoader classLoader ) ; + public abstract PresentationManager.StubFactory makeDynamicStubFactory(PresentationManager pm, PresentationManager.ClassData classData, + ClassLoader classLoader); - public Tie getTie( Class cls ) - { - PresentationManager pm = ORB.getPresentationManager() ; - return new ReflectiveTie( pm ) ; + public Tie getTie(Class cls) { + PresentationManager pm = ORB.getPresentationManager(); + return new ReflectiveTie(pm); } - public boolean createsDynamicStubs() - { - return true ; + public boolean createsDynamicStubs() { + return true; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java index 805165559..dfb27aebc 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java @@ -19,7 +19,7 @@ package com.sun.corba.ee.impl.presentation.rmi; -import javax.rmi.CORBA.Tie ; +import javax.rmi.CORBA.Tie; import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; @@ -28,64 +28,52 @@ import com.sun.corba.ee.spi.misc.ORBClassLoader; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; -public class StubFactoryFactoryStaticImpl extends - StubFactoryFactoryBase -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class StubFactoryFactoryStaticImpl extends StubFactoryFactoryBase { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - public PresentationManager.StubFactory createStubFactory( - String className, boolean isIDLStub, String remoteCodeBase, Class - expectedClass, ClassLoader classLoader) - { - String stubName = null ; + public PresentationManager.StubFactory createStubFactory(String className, boolean isIDLStub, String remoteCodeBase, + Class expectedClass, ClassLoader classLoader) { + String stubName = null; if (isIDLStub) { stubName = Utility.idlStubName(className); } else { - stubName = - Utility.stubNameForCompiler(className); + stubName = Utility.stubNameForCompiler(className); } - ClassLoader expectedTypeClassLoader = - (expectedClass == null ? classLoader : - expectedClass.getClassLoader()); + ClassLoader expectedTypeClassLoader = (expectedClass == null ? classLoader : expectedClass.getClassLoader()); // The old code was optimized to try to guess which way to load classes - // first. The real stub class name could either be className or - // "org.omg.stub." + className. We will compute this as follows: + // first. The real stub class name could either be className or + // "org.omg.stub." + className. We will compute this as follows: // If stubName starts with a "forbidden" package, try the prefixed // version first, otherwise try the non-prefixed version first. // In any case, try both forms if necessary. - String firstStubName = stubName ; - String secondStubName = stubName ; + String firstStubName = stubName; + String secondStubName = stubName; if (PackagePrefixChecker.hasOffendingPrefix(stubName)) { - firstStubName = - PackagePrefixChecker.packagePrefix() + stubName; + firstStubName = PackagePrefixChecker.packagePrefix() + stubName; } else { - secondStubName = - PackagePrefixChecker.packagePrefix() + stubName; + secondStubName = PackagePrefixChecker.packagePrefix() + stubName; } Class clz = null; try { - clz = Util.getInstance().loadClass( firstStubName, remoteCodeBase, - expectedTypeClassLoader ) ; + clz = Util.getInstance().loadClass(firstStubName, remoteCodeBase, expectedTypeClassLoader); } catch (ClassNotFoundException e1) { // log only at FINE level - wrapper.classNotFound1( e1, firstStubName ) ; + wrapper.classNotFound1(e1, firstStubName); try { - clz = Util.getInstance().loadClass( secondStubName, remoteCodeBase, - expectedTypeClassLoader ) ; + clz = Util.getInstance().loadClass(secondStubName, remoteCodeBase, expectedTypeClassLoader); } catch (ClassNotFoundException e2) { - throw wrapper.classNotFound2( e2, secondStubName ) ; + throw wrapper.classNotFound2(e2, secondStubName); } } @@ -93,47 +81,41 @@ public PresentationManager.StubFactory createStubFactory( // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? - if ((clz == null) || - ((expectedClass != null) && !expectedClass.isAssignableFrom(clz))) { + if ((clz == null) || ((expectedClass != null) && !expectedClass.isAssignableFrom(clz))) { try { clz = ORBClassLoader.loadClass(className); } catch (Exception exc) { // XXX use framework - throw new IllegalStateException("Could not load class " + - stubName, exc) ; + throw new IllegalStateException("Could not load class " + stubName, exc); } } - return new StubFactoryStaticImpl( clz ) ; + return new StubFactoryStaticImpl(clz); } - public Tie getTie( Class cls ) - { - Class tieClass = null ; + public Tie getTie(Class cls) { + Class tieClass = null; String className = Utility.tieName(cls.getName()); // XXX log exceptions at FINE level try { try { - //_REVISIT_ The spec does not specify a loadingContext parameter for - //the following call. Would it be useful to pass one? - tieClass = Utility.loadClassForClass(className, Util.getInstance().getCodebase(cls), - null, cls, cls.getClassLoader()); + // _REVISIT_ The spec does not specify a loadingContext parameter for + // the following call. Would it be useful to pass one? + tieClass = Utility.loadClassForClass(className, Util.getInstance().getCodebase(cls), null, cls, cls.getClassLoader()); return (Tie) tieClass.newInstance(); } catch (Exception err) { - tieClass = Utility.loadClassForClass( - PackagePrefixChecker.packagePrefix() + className, - Util.getInstance().getCodebase(cls), null, cls, cls.getClassLoader()); + tieClass = Utility.loadClassForClass(PackagePrefixChecker.packagePrefix() + className, Util.getInstance().getCodebase(cls), + null, cls, cls.getClassLoader()); return (Tie) tieClass.newInstance(); } } catch (Exception err) { - return null; + return null; } } - public boolean createsDynamicStubs() - { - return false ; + public boolean createsDynamicStubs() { + return false; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryStaticImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryStaticImpl.java index d5a3edd3e..20be7c86a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryStaticImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubFactoryStaticImpl.java @@ -19,22 +19,19 @@ package com.sun.corba.ee.impl.presentation.rmi; -import java.lang.reflect.InvocationHandler ; +import java.lang.reflect.InvocationHandler; import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; -public class StubFactoryStaticImpl extends StubFactoryBase -{ - private Class stubClass ; +public class StubFactoryStaticImpl extends StubFactoryBase { + private Class stubClass; - public StubFactoryStaticImpl(Class cls) - { - super( null ) ; + public StubFactoryStaticImpl(Class cls) { + super(null); this.stubClass = cls; } - - public org.omg.CORBA.Object makeStub() - { + + public org.omg.CORBA.Object makeStub() { org.omg.CORBA.Object stub = null; try { stub = (org.omg.CORBA.Object) stubClass.newInstance(); @@ -43,6 +40,6 @@ public org.omg.CORBA.Object makeStub() } catch (IllegalAccessException e) { throw new RuntimeException(e); } - return stub ; + return stub; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubInvocationHandlerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubInvocationHandlerImpl.java index 8d85c1af3..02adefd76 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubInvocationHandlerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/StubInvocationHandlerImpl.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi ; +package com.sun.corba.ee.impl.presentation.rmi; import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; import com.sun.corba.ee.spi.orb.ORB; @@ -46,26 +46,21 @@ import java.security.PrivilegedAction; @IsLocal -public final class StubInvocationHandlerImpl implements LinkedInvocationHandler -{ - private transient PresentationManager.ClassData classData ; - private transient PresentationManager pm ; - private transient org.omg.CORBA.Object stub ; - private transient Proxy self ; - - public void setProxy( Proxy self ) - { - this.self = self ; +public final class StubInvocationHandlerImpl implements LinkedInvocationHandler { + private transient PresentationManager.ClassData classData; + private transient PresentationManager pm; + private transient org.omg.CORBA.Object stub; + private transient Proxy self; + + public void setProxy(Proxy self) { + this.self = self; } - public Proxy getProxy() - { - return self ; + public Proxy getProxy() { + return self; } - public StubInvocationHandlerImpl( PresentationManager pm, - PresentationManager.ClassData classData, org.omg.CORBA.Object stub ) - { + public StubInvocationHandlerImpl(PresentationManager pm, PresentationManager.ClassData classData, org.omg.CORBA.Object stub) { if (!PresentationDefaults.inAppServer()) { SecurityManager s = System.getSecurityManager(); if (s != null) { @@ -73,146 +68,139 @@ public StubInvocationHandlerImpl( PresentationManager pm, } } - this.classData = classData ; - this.pm = pm ; - this.stub = stub ; + this.classData = classData; + this.pm = pm; + this.stub = stub; } @IsLocal - private boolean isLocal(Delegate delegate) - { - boolean result = false ; + private boolean isLocal(Delegate delegate) { + boolean result = false; if (delegate instanceof ClientDelegate) { - ClientDelegate cdel = (ClientDelegate)delegate ; - ContactInfoList cil = cdel.getContactInfoList() ; - LocalClientRequestDispatcher lcrd = - cil.getLocalClientRequestDispatcher() ; - result = lcrd.useLocalInvocation( null ) ; + ClientDelegate cdel = (ClientDelegate) delegate; + ContactInfoList cil = cdel.getContactInfoList(); + LocalClientRequestDispatcher lcrd = cil.getLocalClientRequestDispatcher(); + result = lcrd.useLocalInvocation(null); } - - return result ; + + return result; } - - public Object invoke( Object proxy, final Method method, - Object[] args ) throws Throwable { - Delegate delegate = null ; + public Object invoke(Object proxy, final Method method, Object[] args) throws Throwable { + + Delegate delegate = null; try { - delegate = StubAdapter.getDelegate( stub ) ; + delegate = StubAdapter.getDelegate(stub); } catch (SystemException ex) { - throw Util.getInstance().mapSystemException(ex) ; - } + throw Util.getInstance().mapSystemException(ex); + } - org.omg.CORBA.ORB delORB = delegate.orb( stub ) ; + org.omg.CORBA.ORB delORB = delegate.orb(stub); if (delORB instanceof ORB) { - ORB orb = (ORB)delORB ; + ORB orb = (ORB) delORB; - InvocationInterceptor interceptor = orb.getInvocationInterceptor() ; + InvocationInterceptor interceptor = orb.getInvocationInterceptor(); try { - interceptor.preInvoke() ; + interceptor.preInvoke(); } catch (Exception exc) { // XXX Should we log this? } try { - return privateInvoke( delegate, proxy, method, args ) ; + return privateInvoke(delegate, proxy, method, args); } finally { try { - interceptor.postInvoke() ; + interceptor.postInvoke(); } catch (Exception exc) { // XXX Should we log this? } } } else { // Not our ORB: so handle without invocation interceptor. - return privateInvoke( delegate, proxy, method, args ) ; + return privateInvoke(delegate, proxy, method, args); } } @InfoMethod - private void takingRemoteBranch() {} + private void takingRemoteBranch() { + } @InfoMethod - private void takingLocalBranch() {} + private void takingLocalBranch() { + } - /** Invoke the given method with the args and return the result. - * This may result in a remote invocation. - * @param proxy The proxy used for this class (null if not using java.lang.reflect.Proxy) + /** + * Invoke the given method with the args and return the result. This may result in a remote invocation. + * + * @param proxy The proxy used for this class (null if not using java.lang.reflect.Proxy) */ @IsLocal - private Object privateInvoke( Delegate delegate, Object proxy, final Method method, - Object[] args ) throws Throwable - { + private Object privateInvoke(Delegate delegate, Object proxy, final Method method, Object[] args) throws Throwable { boolean retry; do { retry = false; - String giopMethodName = classData.getIDLNameTranslator(). - getIDLName( method ) ; - DynamicMethodMarshaller dmm = - pm.getDynamicMethodMarshaller( method ) ; - + String giopMethodName = classData.getIDLNameTranslator().getIDLName(method); + DynamicMethodMarshaller dmm = pm.getDynamicMethodMarshaller(method); + if (!isLocal(delegate)) { try { - takingRemoteBranch() ; - org.omg.CORBA_2_3.portable.InputStream in = null ; + takingRemoteBranch(); + org.omg.CORBA_2_3.portable.InputStream in = null; try { // create request - org.omg.CORBA_2_3.portable.OutputStream out = - (org.omg.CORBA_2_3.portable.OutputStream) - delegate.request( stub, giopMethodName, true); + org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) delegate.request(stub, + giopMethodName, true); // marshal arguments - dmm.writeArguments( out, args ) ; + dmm.writeArguments(out, args); // finish invocation - in = (org.omg.CORBA_2_3.portable.InputStream) - delegate.invoke( stub, out); + in = (org.omg.CORBA_2_3.portable.InputStream) delegate.invoke(stub, out); // unmarshal result - return dmm.readResult( in ) ; + return dmm.readResult(in); } catch (ApplicationException ex) { - throw dmm.readException( ex ) ; + throw dmm.readException(ex); } catch (RemarshalException ex) { - //return privateInvoke( delegate, proxy, method, args ) ; - retry = true; + // return privateInvoke( delegate, proxy, method, args ) ; + retry = true; } finally { - delegate.releaseReply( stub, in ); + delegate.releaseReply(stub, in); } } catch (SystemException ex) { - throw Util.getInstance().mapSystemException(ex) ; - } + throw Util.getInstance().mapSystemException(ex); + } } else { takingLocalBranch(); - org.omg.CORBA.ORB orb = delegate.orb( stub ) ; - ServantObject so = delegate.servant_preinvoke( stub, giopMethodName, - method.getDeclaringClass() ); + org.omg.CORBA.ORB orb = delegate.orb(stub); + ServantObject so = delegate.servant_preinvoke(stub, giopMethodName, method.getDeclaringClass()); if (so == null) { - //return privateInvoke( delegate, proxy, method, args ) ; + // return privateInvoke( delegate, proxy, method, args ) ; retry = true; continue; } try { - Object[] copies = dmm.copyArguments( args, orb ) ; + Object[] copies = dmm.copyArguments(args, orb); - if (!method.isAccessible()) { + if (!method.isAccessible()) { // Make sure that we can invoke a method from a normally // inaccessible package, as this reflective class must always // be able to invoke a non-public method. AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - method.setAccessible( true ) ; - return null ; - } - } ) ; + method.setAccessible(true); + return null; + } + }); } - Object result = method.invoke( so.servant, copies ) ; + Object result = method.invoke(so.servant, copies); - return dmm.copyResult( result, orb ) ; + return dmm.copyResult(result, orb); } catch (InvocationTargetException ex) { - Throwable mex = ex.getCause() ; + Throwable mex = ex.getCause(); // mex should never be null, as null cannot be thrown - if (dmm.isDeclaredException( mex )) - throw mex ; + if (dmm.isDeclaredException(mex)) + throw mex; else throw Util.getInstance().wrapException(mex); } catch (Throwable thr) { @@ -220,11 +208,11 @@ public Object run() { throw thr; // This is not a user thrown exception from the - // method call, so don't copy it. This is either + // method call, so don't copy it. This is either // an error or a reflective invoke exception. - throw Util.getInstance().wrapException( thr ) ; - } finally { - delegate.servant_postinvoke( stub, so); + throw Util.getInstance().wrapException(thr); + } finally { + delegate.servant_postinvoke(stub, so); } } } while (retry); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/CodegenProxyCreator.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/CodegenProxyCreator.java index fd04b0cc8..1b0174229 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/CodegenProxyCreator.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/CodegenProxyCreator.java @@ -62,51 +62,49 @@ import org.glassfish.pfl.dynamic.codegen.spi.Utility; import org.glassfish.pfl.dynamic.codegen.spi.Variable; -/** Generate a proxy with a specified base class. +/** + * Generate a proxy with a specified base class. */ public class CodegenProxyCreator { - private String className ; - private Type superClass ; - private List interfaces ; - private List methods ; + private String className; + private Type superClass; + private List interfaces; + private List methods; - private static final Properties debugProps = new Properties() ; - private static final Properties emptyProps = new Properties() ; + private static final Properties debugProps = new Properties(); + private static final Properties emptyProps = new Properties(); static { - debugProps.setProperty( DUMP_AFTER_SETUP_VISITOR, "true" ) ; - debugProps.setProperty( TRACE_BYTE_CODE_GENERATION, "true" ) ; - debugProps.setProperty( USE_ASM_VERIFIER, "true" ) ; + debugProps.setProperty(DUMP_AFTER_SETUP_VISITOR, "true"); + debugProps.setProperty(TRACE_BYTE_CODE_GENERATION, "true"); + debugProps.setProperty(USE_ASM_VERIFIER, "true"); } - public CodegenProxyCreator( String className, Class sc, - Class[] interfaces, Method[] methods ) { + public CodegenProxyCreator(String className, Class sc, Class[] interfaces, Method[] methods) { - this.className = className ; - this.superClass = Type.type( sc ) ; + this.className = className; + this.superClass = Type.type(sc); - this.interfaces = new ArrayList() ; + this.interfaces = new ArrayList(); for (Class cls : interfaces) { - this.interfaces.add( Type.type( cls ) ) ; + this.interfaces.add(Type.type(cls)); } - this.methods = new ArrayList() ; + this.methods = new ArrayList(); for (Method method : methods) { - this.methods.add( Utility.getMethodInfo( method ) ) ; + this.methods.add(Utility.getMethodInfo(method)); } } - /** Construct a generator for a proxy class - * that implements the given interfaces and extends superClass. - * superClass must satisfy the following requirements: + /** + * Construct a generator for a proxy class that implements the given interfaces and extends superClass. superClass must + * satisfy the following requirements: *
      *
    1. It must have an accessible no args constructor
    2. *
    3. It must have a method satisfying the signature * Object invoke( int methodNumber, Object[] args ) throws Throwable - * - *
    4. - *
    5. The invoke method described above must be accessible - * to the generated class (generally either public or + *
    6. + *
    7. The invoke method described above must be accessible to the generated class (generally either public or * protected.
    8. *
    *

    @@ -115,17 +113,15 @@ public CodegenProxyCreator( String className, Class sc, *

  • Creates an array sized to hold the args
  • *
  • Wraps args of primitive type in the appropriate wrapper.
  • *
  • Copies each arg or wrapper arg into the array.
  • - *
  • Calls invoke with a method number corresponding to the - * index of the method in methods. Note that the invoke implementation - * must use the same method array to figure out which method has been - * invoked.
  • - *
  • Return the result (if any), extracting values from wrappers - * as needed to handle a return value of a primitive type.
  • + *
  • Calls invoke with a method number corresponding to the index of the method in methods. Note that the invoke + * implementation must use the same method array to figure out which method has been invoked.
  • + *
  • Return the result (if any), extracting values from wrappers as needed to handle a return value of a primitive + * type.
  • * *

    - * Note that the generated methods ignore exceptions. - * It is assumed that the invoke method may throw any - * desired exception. + * Note that the generated methods ignore exceptions. It is assumed that the invoke method may throw any desired + * exception. + * * @param pd the protection domain of the generated class * @param cl the classloader in which to generate the class * @param debug if true, generate debug messages @@ -134,45 +130,43 @@ public CodegenProxyCreator( String className, Class sc, * @deprecated use {@link #create(Class, boolean, PrintStream)} */ @Deprecated - public Class create( ProtectionDomain pd, ClassLoader cl, boolean debug, PrintStream ps ) { + public Class create(ProtectionDomain pd, ClassLoader cl, boolean debug, PrintStream ps) { - Pair nm = splitClassName( className ) ; + Pair nm = splitClassName(className); - _clear() ; - _setClassLoader( cl ) ; - _package( nm.first() ) ; - _class( PUBLIC, nm.second(), superClass, interfaces ) ; + _clear(); + _setClassLoader(cl); + _package(nm.first()); + _class(PUBLIC, nm.second(), superClass, interfaces); - _constructor( PUBLIC ) ; - _body() ; - _expr(_super()); - _end() ; + _constructor(PUBLIC); + _body(); + _expr(_super()); + _end(); - _method( PRIVATE, _Object(), "writeReplace" ) ; - _body() ; - _return(_call(_this(), "selfAsBaseClass" )) ; - _end() ; + _method(PRIVATE, _Object(), "writeReplace"); + _body(); + _return(_call(_this(), "selfAsBaseClass")); + _end(); - int ctr=0 ; - for (MethodInfo method : methods) - createMethod( ctr++, method ) ; - - _end() ; // of _class + int ctr = 0; + for (MethodInfo method : methods) + createMethod(ctr++, method); + + _end(); // of _class - return _generate( cl, pd, debug ? debugProps : emptyProps, ps ) ; + return _generate(cl, pd, debug ? debugProps : emptyProps, ps); } - /** Construct a generator for a proxy class - * that implements the given interfaces and extends superClass. - * superClass must satisfy the following requirements: + /** + * Construct a generator for a proxy class that implements the given interfaces and extends superClass. superClass must + * satisfy the following requirements: *

      *
    1. It must have an accessible no args constructor
    2. *
    3. It must have a method satisfying the signature * Object invoke( int methodNumber, Object[] args ) throws Throwable - * - *
    4. - *
    5. The invoke method described above must be accessible - * to the generated class (generally either public or + *
    6. + *
    7. The invoke method described above must be accessible to the generated class (generally either public or * protected.
    8. *
    *

    @@ -181,94 +175,90 @@ public Class create( ProtectionDomain pd, ClassLoader cl, boolean debug, Prin *

  • Creates an array sized to hold the args
  • *
  • Wraps args of primitive type in the appropriate wrapper.
  • *
  • Copies each arg or wrapper arg into the array.
  • - *
  • Calls invoke with a method number corresponding to the - * index of the method in methods. Note that the invoke implementation - * must use the same method array to figure out which method has been - * invoked.
  • - *
  • Return the result (if any), extracting values from wrappers - * as needed to handle a return value of a primitive type.
  • + *
  • Calls invoke with a method number corresponding to the index of the method in methods. Note that the invoke + * implementation must use the same method array to figure out which method has been invoked.
  • + *
  • Return the result (if any), extracting values from wrappers as needed to handle a return value of a primitive + * type.
  • * *

    - * Note that the generated methods ignore exceptions. - * It is assumed that the invoke method may throw any - * desired exception. + * Note that the generated methods ignore exceptions. It is assumed that the invoke method may throw any desired + * exception. + * * @param anchorClass a class in whose classloader the new class should be generated * @param debug if true, generate debug messages * @param ps a PrintStream to which the debug messages should be written * @return Generator for class * @since 4.2.1 */ - public Class create( Class anchorClass, boolean debug, PrintStream ps ) { + public Class create(Class anchorClass, boolean debug, PrintStream ps) { - Pair nm = splitClassName( className ) ; + Pair nm = splitClassName(className); - _clear() ; - _setClassLoader( anchorClass.getClassLoader() ) ; - _package( nm.first() ) ; - _class( PUBLIC, nm.second(), superClass, interfaces ) ; + _clear(); + _setClassLoader(anchorClass.getClassLoader()); + _package(nm.first()); + _class(PUBLIC, nm.second(), superClass, interfaces); - _constructor( PUBLIC ) ; - _body() ; - _expr(_super()); - _end() ; + _constructor(PUBLIC); + _body(); + _expr(_super()); + _end(); - _method( PRIVATE, _Object(), "writeReplace" ) ; - _body() ; - _return(_call(_this(), "selfAsBaseClass" )) ; - _end() ; + _method(PRIVATE, _Object(), "writeReplace"); + _body(); + _return(_call(_this(), "selfAsBaseClass")); + _end(); - int ctr=0 ; + int ctr = 0; for (MethodInfo method : methods) - createMethod( ctr++, method ) ; + createMethod(ctr++, method); - _end() ; // of _class + _end(); // of _class - return _generate( anchorClass, debug ? debugProps : emptyProps, ps ) ; + return _generate(anchorClass, debug ? debugProps : emptyProps, ps); } - private static final Type objectArrayType = Type._array(_Object()) ; + private static final Type objectArrayType = Type._array(_Object()); - private static void createMethod( int mnum, MethodInfo method ) { - Type rtype = method.returnType() ; - _method( method.modifiers() & ~ABSTRACT, rtype, method.name()) ; - - List args = new ArrayList() ; - for (Variable var : method.arguments() ) - args.add( _arg( var.type(), var.ident() ) ) ; + private static void createMethod(int mnum, MethodInfo method) { + Type rtype = method.returnType(); + _method(method.modifiers() & ~ABSTRACT, rtype, method.name()); - _body() ; - List wrappedArgs = new ArrayList() ; - for (Expression arg : args) { - wrappedArgs.add( Primitives.wrap( arg ) ) ; - } - - Expression invokeArgs = _define( objectArrayType, "args", - _new_array_init( _Object(), wrappedArgs ) ) ; - - // create expression to call the invoke method - Expression invokeExpression = _call( - _this(), "invoke", _const(mnum), invokeArgs ) ; - - // return result if non-void - if (rtype == _void()) { - _expr( invokeExpression ) ; - _return() ; - } else { - Expression resultExpr = _define( _Object(), "result", invokeExpression ) ; - - if (rtype != _Object()) { - if (rtype.isPrimitive()) { - // Must cast resultExpr to expected type, or unwrap won't work! - Type ctype = Primitives.getWrapperTypeForPrimitive( rtype ) ; - Expression cexpr = _cast( ctype, resultExpr ) ; - _return( Primitives.unwrap( cexpr ) ) ; - } else { - _return(_cast(rtype, resultExpr )) ; - } + List args = new ArrayList(); + for (Variable var : method.arguments()) + args.add(_arg(var.type(), var.ident())); + + _body(); + List wrappedArgs = new ArrayList(); + for (Expression arg : args) { + wrappedArgs.add(Primitives.wrap(arg)); + } + + Expression invokeArgs = _define(objectArrayType, "args", _new_array_init(_Object(), wrappedArgs)); + + // create expression to call the invoke method + Expression invokeExpression = _call(_this(), "invoke", _const(mnum), invokeArgs); + + // return result if non-void + if (rtype == _void()) { + _expr(invokeExpression); + _return(); + } else { + Expression resultExpr = _define(_Object(), "result", invokeExpression); + + if (rtype != _Object()) { + if (rtype.isPrimitive()) { + // Must cast resultExpr to expected type, or unwrap won't work! + Type ctype = Primitives.getWrapperTypeForPrimitive(rtype); + Expression cexpr = _cast(ctype, resultExpr); + _return(Primitives.unwrap(cexpr)); } else { - _return( resultExpr ) ; + _return(_cast(rtype, resultExpr)); } + } else { + _return(resultExpr); } - _end() ; // of method + } + _end(); // of method } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/CodegenStubBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/CodegenStubBase.java index 10ee21c49..5f5acc9b3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/CodegenStubBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/CodegenStubBase.java @@ -17,192 +17,167 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi.codegen ; +package com.sun.corba.ee.impl.presentation.rmi.codegen; -import java.io.ObjectInputStream ; -import java.io.IOException ; -import java.io.ObjectStreamException ; +import java.io.ObjectInputStream; +import java.io.IOException; +import java.io.ObjectStreamException; -import java.lang.reflect.InvocationHandler ; -import java.lang.reflect.Method ; -import java.lang.reflect.Field ; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Field; -import java.security.AccessController ; -import java.security.PrivilegedAction ; +import java.security.AccessController; +import java.security.PrivilegedAction; -import javax.rmi.CORBA.Stub ; +import javax.rmi.CORBA.Stub; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; +import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.ee.spi.presentation.rmi.StubAdapter ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; +import com.sun.corba.ee.impl.util.JDKBridge; +import com.sun.corba.ee.impl.util.RepositoryId; +import com.sun.corba.ee.impl.ior.StubIORImpl; +import com.sun.corba.ee.impl.javax.rmi.CORBA.StubDelegateImpl; +import com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; -import com.sun.corba.ee.impl.util.JDKBridge ; -import com.sun.corba.ee.impl.util.RepositoryId ; -import com.sun.corba.ee.impl.ior.StubIORImpl ; -import com.sun.corba.ee.impl.javax.rmi.CORBA.StubDelegateImpl ; -import com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl ; +public class CodegenStubBase extends Stub { + private transient String[] typeIds; + private transient Method[] methods; + private transient PresentationManager.ClassData classData; + private transient InvocationHandler handler; -public class CodegenStubBase extends Stub -{ - private transient String[] typeIds ; - private transient Method[] methods ; - private transient PresentationManager.ClassData classData ; - private transient InvocationHandler handler ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - - private Object readResolve( ) throws ObjectStreamException - { - // Note that we cannot use PRO.narrow here, because the - // delegate is not set by deserializing the stub. Only + private Object readResolve() throws ObjectStreamException { + // Note that we cannot use PRO.narrow here, because the + // delegate is not set by deserializing the stub. Only // the IOR is set, because a deserialized stub is not connected // to an ORB. - PresentationManager pm = ORB.getPresentationManager() ; + PresentationManager pm = ORB.getPresentationManager(); PresentationManager.StubFactoryFactory sff = pm.getDynamicStubFactoryFactory(); - PresentationManager.StubFactory sf = sff.createStubFactory( - classData.getMyClass().getName(), false, null, null, null ) ; - org.omg.CORBA.Object stub = sf.makeStub() ; - StubDelegateImpl stubSDI = getStubDelegateImpl( stub ) ; - StubDelegateImpl mySDI = getStubDelegateImpl( this ) ; - stubSDI.setIOR( mySDI.getIOR() ) ; - return stub ; + PresentationManager.StubFactory sf = sff.createStubFactory(classData.getMyClass().getName(), false, null, null, null); + org.omg.CORBA.Object stub = sf.makeStub(); + StubDelegateImpl stubSDI = getStubDelegateImpl(stub); + StubDelegateImpl mySDI = getStubDelegateImpl(this); + stubSDI.setIOR(mySDI.getIOR()); + return stub; } - // Get the StubDelegateImpl from the superclass. Unfortunately stubDelegate + // Get the StubDelegateImpl from the superclass. Unfortunately stubDelegate // is private in javax.rmi.CORBA.Stub, and Stub must follow - // the OMG standard. So, we use reflection to get stubDelegate. + // the OMG standard. So, we use reflection to get stubDelegate. // We also need to handle the case where the stubDelegate has not - // been set yet. This reqires a call to the private method + // been set yet. This reqires a call to the private method // setDefaultDelegate. // - private static StubDelegateImpl getStubDelegateImpl( - final org.omg.CORBA.Object stub ) - { - StubDelegateImpl sdi = getStubDelegateImplField( stub ) ; + private static StubDelegateImpl getStubDelegateImpl(final org.omg.CORBA.Object stub) { + StubDelegateImpl sdi = getStubDelegateImplField(stub); if (sdi == null) { setDefaultDelegate(stub); } - sdi = getStubDelegateImplField( stub ) ; - return sdi ; + sdi = getStubDelegateImplField(stub); + return sdi; } - private static StubDelegateImpl getStubDelegateImplField( - final org.omg.CORBA.Object stub ) - { - return (StubDelegateImpl)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - try { - Field fld = Stub.class.getDeclaredField( "stubDelegate" ) ; - fld.setAccessible( true ) ; - return fld.get( stub ) ; - } catch (Exception exc) { - throw wrapper.couldNotAccessStubDelegate() ; - } + private static StubDelegateImpl getStubDelegateImplField(final org.omg.CORBA.Object stub) { + return (StubDelegateImpl) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + try { + Field fld = Stub.class.getDeclaredField("stubDelegate"); + fld.setAccessible(true); + return fld.get(stub); + } catch (Exception exc) { + throw wrapper.couldNotAccessStubDelegate(); } } - ) ; + }); } - private static Method setDefaultDelegateMethod = null ; - - private static void setDefaultDelegate( final org.omg.CORBA.Object stub ) - { - AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - try { - if (setDefaultDelegateMethod == null) { - setDefaultDelegateMethod = - Stub.class.getDeclaredMethod( "setDefaultDelegate") ; - setDefaultDelegateMethod.setAccessible( true ) ; - } - - setDefaultDelegateMethod.invoke( stub ) ; - } catch (Exception exc) { - throw wrapper.couldNotAccessStubDelegate( exc ) ; + private static Method setDefaultDelegateMethod = null; + + private static void setDefaultDelegate(final org.omg.CORBA.Object stub) { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + try { + if (setDefaultDelegateMethod == null) { + setDefaultDelegateMethod = Stub.class.getDeclaredMethod("setDefaultDelegate"); + setDefaultDelegateMethod.setAccessible(true); } - return null ; + + setDefaultDelegateMethod.invoke(stub); + } catch (Exception exc) { + throw wrapper.couldNotAccessStubDelegate(exc); } + return null; } - ) ; + }); } - private void readObject( ObjectInputStream stream ) throws - IOException, ClassNotFoundException - { + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { // Let the superclass do the read of the internal IOR, - // but we need to restore our transient fields. But + // but we need to restore our transient fields. But // let defaultReadObject do its normal processing. - stream.defaultReadObject() ; + stream.defaultReadObject(); - StubDelegateImpl sdi = getStubDelegateImpl( this ) ; + StubDelegateImpl sdi = getStubDelegateImpl(this); - StubIORImpl ior = sdi.getIOR() ; - String repositoryId = ior.getRepositoryId() ; - String cname = RepositoryId.cache.getId( repositoryId ).getClassName() ; + StubIORImpl ior = sdi.getIOR(); + String repositoryId = ior.getRepositoryId(); + String cname = RepositoryId.cache.getId(repositoryId).getClassName(); - Class cls = null ; + Class cls = null; try { - cls = JDKBridge.loadClass( cname, null, null ) ; + cls = JDKBridge.loadClass(cname, null, null); } catch (ClassNotFoundException exc) { - throw wrapper.couldNotLoadInterface( exc, cname ) ; + throw wrapper.couldNotLoadInterface(exc, cname); } - PresentationManager pm = ORB.getPresentationManager() ; - classData = pm.getClassData( cls ) ; + PresentationManager pm = ORB.getPresentationManager(); + classData = pm.getClassData(cls); - InvocationHandler handler = new StubInvocationHandlerImpl( pm, - classData, this ) ; - initialize( classData, handler ) ; + InvocationHandler handler = new StubInvocationHandlerImpl(pm, classData, this); + initialize(classData, handler); } - public String[] _ids() - { - return typeIds.clone() ; + public String[] _ids() { + return typeIds.clone(); } - /** Must be called to complete the initialization of the stub. - * Note that we have mutual dependence between the InvocationHandler - * and the Stub: the InvocationHandler needs the stub in order - * to get the delegate, and the Stub needs the InvocationHandler - * to perform an invocation. We resolve this dependency by - * constructing the Stub first, using the stub to construct the - * InvocationHandler, and then completing the initialization of - * the Stub by calling initialize. + /** + * Must be called to complete the initialization of the stub. Note that we have mutual dependence between the + * InvocationHandler and the Stub: the InvocationHandler needs the stub in order to get the delegate, and the Stub needs + * the InvocationHandler to perform an invocation. We resolve this dependency by constructing the Stub first, using the + * stub to construct the InvocationHandler, and then completing the initialization of the Stub by calling initialize. + * * @param classData ClassData for codegen * @param handler InvocationHandler to use */ - public void initialize( PresentationManager.ClassData classData, InvocationHandler handler ) - { - this.classData = classData ; - this.handler = handler ; - typeIds = classData.getTypeIds() ; - methods = classData.getIDLNameTranslator().getMethods() ; + public void initialize(PresentationManager.ClassData classData, InvocationHandler handler) { + this.classData = classData; + this.handler = handler; + typeIds = classData.getTypeIds(); + methods = classData.getIDLNameTranslator().getMethods(); } // Needed in generated code: clone self (which is the generated class) - // as the base class. This is needed for a generated writeReplace method. + // as the base class. This is needed for a generated writeReplace method. // This allows the readResolve method on this class to construct the // appropriate codegen proxy when this class is deserialized. - protected Object selfAsBaseClass() - { - CodegenStubBase result = new CodegenStubBase() ; - StubAdapter.setDelegate( result, - StubAdapter.getDelegate( this )) ; - return result ; + protected Object selfAsBaseClass() { + CodegenStubBase result = new CodegenStubBase(); + StubAdapter.setDelegate(result, StubAdapter.getDelegate(this)); + return result; } - + // Needed in generated code - protected Object invoke( int methodNumber, Object[] args ) throws Throwable - { - Method method = methods[methodNumber] ; - + protected Object invoke(int methodNumber, Object[] args) throws Throwable { + Method method = methods[methodNumber]; + // Pass null for the Proxy since we don't have one. - return handler.invoke( null, method, args ) ; + return handler.invoke(null, method, args); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/StubFactoryCodegenImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/StubFactoryCodegenImpl.java index e678beb68..d4e893b5b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/StubFactoryCodegenImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/StubFactoryCodegenImpl.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi.codegen ; +package com.sun.corba.ee.impl.presentation.rmi.codegen; import com.sun.corba.ee.impl.presentation.rmi.StubFactoryDynamicBase; import com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl; @@ -32,48 +32,42 @@ import java.security.PrivilegedExceptionAction; import java.util.Map; -public class StubFactoryCodegenImpl extends StubFactoryDynamicBase -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class StubFactoryCodegenImpl extends StubFactoryDynamicBase { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private static final String CODEGEN_KEY = "CodegenStubClass" ; - private final PresentationManager pm ; + private static final String CODEGEN_KEY = "CodegenStubClass"; + private final PresentationManager pm; - public StubFactoryCodegenImpl( PresentationManager pm, - PresentationManager.ClassData classData, ClassLoader loader ) - { - super( classData, loader ) ; - this.pm = pm ; + public StubFactoryCodegenImpl(PresentationManager pm, PresentationManager.ClassData classData, ClassLoader loader) { + super(classData, loader); + this.pm = pm; } private Class getStubClass() { // IMPORTANT: A get & put to classData's dictionary can occur - // by two or more threads in this method at the same - // time. Therefore, classData must be synchronized here. + // by two or more threads in this method at the same + // time. Therefore, classData must be synchronized here. synchronized (classData) { - final Map dictionary = classData.getDictionary(); + final Map dictionary = classData.getDictionary(); return (Class) dictionary.computeIfAbsent(CODEGEN_KEY, k -> createStubClass()); } } private Class createStubClass() { - final IDLNameTranslator nt = classData.getIDLNameTranslator() ; - final Class theClass = classData.getMyClass() ; - final String stubClassName = Utility.dynamicStubName(theClass.getName() ) ; - final Class baseClass = CodegenStubBase.class ; - final Class[] interfaces = nt.getInterfaces() ; - final Method[] methods = nt.getMethods() ; + final IDLNameTranslator nt = classData.getIDLNameTranslator(); + final Class theClass = classData.getMyClass(); + final String stubClassName = Utility.dynamicStubName(theClass.getName()); + final Class baseClass = CodegenStubBase.class; + final Class[] interfaces = nt.getInterfaces(); + final Method[] methods = nt.getMethods(); // Create a StubGenerator that generates this stub class final CodegenProxyCreator creator = new CodegenProxyCreator(stubClassName, baseClass, interfaces, methods); // Invoke creator in a doPrivileged block if there is a security manager installed. - return System.getSecurityManager() == null - ? createStubClass(creator) - : AccessController.doPrivileged((PrivilegedAction>) () -> createStubClass(creator) - ); + return System.getSecurityManager() == null ? createStubClass(creator) + : AccessController.doPrivileged((PrivilegedAction>) () -> createStubClass(creator)); } private Class createStubClass(CodegenProxyCreator creator) { @@ -81,23 +75,22 @@ private Class createStubClass(CodegenProxyCreator creator) { } public org.omg.CORBA.Object makeStub() { - final Class stubClass = getStubClass( ) ; + final Class stubClass = getStubClass(); - CodegenStubBase stub = null ; + CodegenStubBase stub = null; try { // Added doPriv for issue 778 - stub = AccessController.doPrivileged( - (PrivilegedExceptionAction) () -> (CodegenStubBase) stubClass.newInstance() - ) ; + stub = AccessController + .doPrivileged((PrivilegedExceptionAction) () -> (CodegenStubBase) stubClass.newInstance()); } catch (Exception exc) { - wrapper.couldNotInstantiateStubClass(exc, stubClass.getName()) ; + wrapper.couldNotInstantiateStubClass(exc, stubClass.getName()); } - - InvocationHandler handler = new StubInvocationHandlerImpl(pm, classData, stub) ; - stub.initialize( classData, handler ) ; + InvocationHandler handler = new StubInvocationHandlerImpl(pm, classData, stub); - return stub ; + stub.initialize(classData, handler); + + return stub; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/StubFactoryFactoryCodegenImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/StubFactoryFactoryCodegenImpl.java index b21e237f4..aaca50129 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/StubFactoryFactoryCodegenImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/codegen/StubFactoryFactoryCodegenImpl.java @@ -17,23 +17,19 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi.codegen ; +package com.sun.corba.ee.impl.presentation.rmi.codegen; -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; -import com.sun.corba.ee.impl.presentation.rmi.StubFactoryFactoryDynamicBase ; +import com.sun.corba.ee.impl.presentation.rmi.StubFactoryFactoryDynamicBase; -public class StubFactoryFactoryCodegenImpl extends StubFactoryFactoryDynamicBase -{ - public StubFactoryFactoryCodegenImpl() - { - super() ; +public class StubFactoryFactoryCodegenImpl extends StubFactoryFactoryDynamicBase { + public StubFactoryFactoryCodegenImpl() { + super(); } - public PresentationManager.StubFactory makeDynamicStubFactory( - PresentationManager pm, PresentationManager.ClassData classData, - ClassLoader classLoader ) - { - return new StubFactoryCodegenImpl( pm, classData, classLoader ) ; + public PresentationManager.StubFactory makeDynamicStubFactory(PresentationManager pm, PresentationManager.ClassData classData, + ClassLoader classLoader) { + return new StubFactoryCodegenImpl(pm, classData, classLoader); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/proxy/StubFactoryFactoryProxyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/proxy/StubFactoryFactoryProxyImpl.java index 02c7959cf..d7becd1eb 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/proxy/StubFactoryFactoryProxyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/proxy/StubFactoryFactoryProxyImpl.java @@ -24,23 +24,19 @@ import com.sun.corba.ee.impl.presentation.rmi.*; import com.sun.corba.ee.impl.presentation.rmi.proxy.StubFactoryProxyImpl; -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; import com.sun.corba.ee.spi.presentation.rmi.PresentationManager.StubFactory; -public class StubFactoryFactoryProxyImpl extends StubFactoryFactoryDynamicBase -{ - public PresentationManager.StubFactory makeDynamicStubFactory( - PresentationManager pm, final PresentationManager.ClassData classData, - final ClassLoader classLoader ) - { - return AccessController.doPrivileged( - new PrivilegedAction() { +public class StubFactoryFactoryProxyImpl extends StubFactoryFactoryDynamicBase { + public PresentationManager.StubFactory makeDynamicStubFactory(PresentationManager pm, final PresentationManager.ClassData classData, + final ClassLoader classLoader) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public StubFactory run() { + return new StubFactoryProxyImpl(classData, classLoader); + } - @Override - public StubFactory run() { - return new StubFactoryProxyImpl( classData, classLoader ) ; - } - }); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/proxy/StubFactoryProxyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/proxy/StubFactoryProxyImpl.java index 3b239a5e3..ee46b4a54 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/proxy/StubFactoryProxyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/presentation/rmi/proxy/StubFactoryProxyImpl.java @@ -17,35 +17,29 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.presentation.rmi.proxy ; +package com.sun.corba.ee.impl.presentation.rmi.proxy; import com.sun.corba.ee.impl.presentation.rmi.*; -import java.lang.reflect.Proxy ; +import java.lang.reflect.Proxy; -import com.sun.corba.ee.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.ee.spi.presentation.rmi.DynamicStub ; +import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; +import com.sun.corba.ee.spi.presentation.rmi.DynamicStub; import org.glassfish.pfl.basic.proxy.InvocationHandlerFactory; import org.glassfish.pfl.basic.proxy.LinkedInvocationHandler; -public class StubFactoryProxyImpl extends StubFactoryDynamicBase -{ - public StubFactoryProxyImpl( PresentationManager.ClassData classData, - ClassLoader loader ) - { - super( classData, loader ) ; +public class StubFactoryProxyImpl extends StubFactoryDynamicBase { + public StubFactoryProxyImpl(PresentationManager.ClassData classData, ClassLoader loader) { + super(classData, loader); } - public org.omg.CORBA.Object makeStub() - { + public org.omg.CORBA.Object makeStub() { // Construct the dynamic proxy that implements this stub // using the composite handler - InvocationHandlerFactory factory = classData.getInvocationHandlerFactory() ; - LinkedInvocationHandler handler = - (LinkedInvocationHandler)factory.getInvocationHandler() ; - Class[] interfaces = factory.getProxyInterfaces() ; - DynamicStub stub = (DynamicStub)Proxy.newProxyInstance( loader, interfaces, - handler ) ; - handler.setProxy( (Proxy)stub ) ; - return stub ; + InvocationHandlerFactory factory = classData.getInvocationHandlerFactory(); + LinkedInvocationHandler handler = (LinkedInvocationHandler) factory.getInvocationHandler(); + Class[] interfaces = factory.getProxyInterfaces(); + DynamicStub stub = (DynamicStub) Proxy.newProxyInstance(loader, interfaces, handler); + handler.setProxy((Proxy) stub); + return stub; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/AddressingDispositionException.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/AddressingDispositionException.java index 41f4c473f..5f895e05c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/AddressingDispositionException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/AddressingDispositionException.java @@ -22,17 +22,13 @@ import com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr; /** - * This exception is thrown while reading GIOP 1.2 Request, LocateRequest - * to indicate that a TargetAddress disposition is unacceptable. - * If this exception is caught explicitly, this need to be rethrown. This - * is eventually handled within RequestPRocessor and an appropriate reply - * is sent back to the client. + * This exception is thrown while reading GIOP 1.2 Request, LocateRequest to indicate that a TargetAddress disposition + * is unacceptable. If this exception is caught explicitly, this need to be rethrown. This is eventually handled within + * RequestPRocessor and an appropriate reply is sent back to the client. * - * GIOP 1.2 allows three dispositions : KeyAddr (ObjectKey), ProfileAddr (ior - * profile), IORAddressingInfo (IOR). If the ORB does not support the - * disposition contained in the GIOP Request / LocateRequest 1.2 message, - * then it sends a Reply / LocateReply indicating the correct disposition, - * which the client ORB shall use to transparently retry the request + * GIOP 1.2 allows three dispositions : KeyAddr (ObjectKey), ProfileAddr (ior profile), IORAddressingInfo (IOR). If the + * ORB does not support the disposition contained in the GIOP Request / LocateRequest 1.2 message, then it sends a Reply + * / LocateReply indicating the correct disposition, which the client ORB shall use to transparently retry the request * with the correct disposition. * */ diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/BootstrapServerRequestDispatcher.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/BootstrapServerRequestDispatcher.java index 8a2b77faa..9986e41c7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/BootstrapServerRequestDispatcher.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/BootstrapServerRequestDispatcher.java @@ -17,126 +17,111 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.protocol ; +package com.sun.corba.ee.impl.protocol; -import java.util.Iterator ; +import java.util.Iterator; -import org.omg.CORBA.SystemException ; +import org.omg.CORBA.SystemException; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.ObjectKey ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.ObjectKey; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; import com.sun.corba.ee.spi.protocol.MessageMediator; -import com.sun.corba.ee.impl.encoding.MarshalInputStream ; -import com.sun.corba.ee.impl.encoding.MarshalOutputStream ; +import com.sun.corba.ee.impl.encoding.MarshalInputStream; +import com.sun.corba.ee.impl.encoding.MarshalOutputStream; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** - * Class BootstrapServerRequestDispatcher handles the requests coming to the - * BootstrapServer. It implements Server so that it can be registered - * as a subcontract. It is passed a BootstrapServiceProperties object - * which contains - * the supported ids and their values for the bootstrap service. This - * Properties object is only read from, never written to, and is shared - * among all threads. + * Class BootstrapServerRequestDispatcher handles the requests coming to the BootstrapServer. It implements Server so + * that it can be registered as a subcontract. It is passed a BootstrapServiceProperties object which contains the + * supported ids and their values for the bootstrap service. This Properties object is only read from, never written to, + * and is shared among all threads. *

    - * The BootstrapServerRequestDispatcher responds primarily to GIOP requests, - * but LocateRequests are also handled for graceful interoperability. - * The BootstrapServerRequestDispatcher handles one request at a time. + * The BootstrapServerRequestDispatcher responds primarily to GIOP requests, but LocateRequests are also handled for + * graceful interoperability. The BootstrapServerRequestDispatcher handles one request at a time. */ -public class BootstrapServerRequestDispatcher - implements ServerRequestDispatcher -{ +public class BootstrapServerRequestDispatcher implements ServerRequestDispatcher { private ORB orb; - static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private static final boolean debug = false; - public BootstrapServerRequestDispatcher(ORB orb ) - { + public BootstrapServerRequestDispatcher(ORB orb) { this.orb = orb; } - + /** - * Dispatch is called by the ORB and will serve get(key) and list() - * invocations on the initial object key. + * Dispatch is called by the ORB and will serve get(key) and list() invocations on the initial object key. */ - public void dispatch(MessageMediator messageMediator) - { + public void dispatch(MessageMediator messageMediator) { MessageMediator request = (MessageMediator) messageMediator; MessageMediator response = null; try { - MarshalInputStream is = (MarshalInputStream) - request.getInputObject(); + MarshalInputStream is = (MarshalInputStream) request.getInputObject(); String method = request.getOperationName(); response = request.getProtocolHandler().createResponse(request, null); - MarshalOutputStream os = (MarshalOutputStream) - response.getOutputObject(); + MarshalOutputStream os = (MarshalOutputStream) response.getOutputObject(); if (method.equals("get")) { // Get the name of the requested service String serviceKey = is.read_string(); // Look it up - org.omg.CORBA.Object serviceObject = - orb.getLocalResolver().resolve( serviceKey ) ; + org.omg.CORBA.Object serviceObject = orb.getLocalResolver().resolve(serviceKey); // Write reply value os.write_Object(serviceObject); } else if (method.equals("list")) { - java.util.Set keys = orb.getLocalResolver().list() ; - os.write_long( keys.size() ) ; - Iterator iter = keys.iterator() ; + java.util.Set keys = orb.getLocalResolver().list(); + os.write_long(keys.size()); + Iterator iter = keys.iterator(); while (iter.hasNext()) { - String obj = (String)iter.next() ; - os.write_string( obj ) ; + String obj = (String) iter.next(); + os.write_string(obj); } } else { - throw wrapper.illegalBootstrapOperation( method ) ; + throw wrapper.illegalBootstrapOperation(method); } } catch (org.omg.CORBA.SystemException ex) { // Marshal the exception thrown - response = request.getProtocolHandler().createSystemExceptionResponse( - request, ex, null); + response = request.getProtocolHandler().createSystemExceptionResponse(request, ex, null); } catch (java.lang.RuntimeException ex) { // Unknown exception - SystemException sysex = wrapper.bootstrapRuntimeException( ex ) ; - response = request.getProtocolHandler().createSystemExceptionResponse( - request, sysex, null ) ; + SystemException sysex = wrapper.bootstrapRuntimeException(ex); + response = request.getProtocolHandler().createSystemExceptionResponse(request, sysex, null); } catch (java.lang.Exception ex) { // Unknown exception - SystemException sysex = wrapper.bootstrapException( ex ) ; - response = request.getProtocolHandler().createSystemExceptionResponse( - request, sysex, null ) ; + SystemException sysex = wrapper.bootstrapException(ex); + response = request.getProtocolHandler().createSystemExceptionResponse(request, sysex, null); } return; } /** - * Locates the object mentioned in the locate requests, and returns - * object here iff the object is the initial object key. A SystemException - * thrown if the object key is not the initial object key. + * Locates the object mentioned in the locate requests, and returns object here iff the object is the initial object + * key. A SystemException thrown if the object key is not the initial object key. + * * @param objectKey ignored * @return {@code null} */ @Override - public IOR locate( ObjectKey objectKey) { + public IOR locate(ObjectKey objectKey) { return null; } /** * Not implemented + * * @return never */ public int getId() { - throw wrapper.genericNoImpl() ; + throw wrapper.genericNoImpl(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ClientDelegateImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ClientDelegateImpl.java index 42f62b89a..4dd639f9c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ClientDelegateImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ClientDelegateImpl.java @@ -43,7 +43,7 @@ import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.protocol.ClientDelegate ; +import com.sun.corba.ee.spi.protocol.ClientDelegate; import com.sun.corba.ee.spi.transport.ContactInfo; import com.sun.corba.ee.spi.transport.ContactInfoList; import com.sun.corba.ee.spi.transport.ContactInfoListIterator; @@ -72,88 +72,87 @@ */ @Subcontract @IsLocal -public class ClientDelegateImpl extends ClientDelegate -{ +public class ClientDelegateImpl extends ClientDelegate { private ORB orb; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private ContactInfoList contactInfoList; - public ClientDelegateImpl(ORB orb, - ContactInfoList contactInfoList) - { + public ClientDelegateImpl(ORB orb, ContactInfoList contactInfoList) { this.orb = orb; // this.tp = orb.getTimerManager().points() ; this.contactInfoList = contactInfoList; } - + // // framework.subcontract.Delegate // - public ORB getBroker() - { + public ORB getBroker() { return orb; } - public ContactInfoList getContactInfoList() - { + public ContactInfoList getContactInfoList() { return contactInfoList; } // // CORBA_2_3.portable.Delegate // - + @InfoMethod - private void requestInfo( String operation, ContactInfo info ) { } + private void requestInfo(String operation, ContactInfo info) { + } @InfoMethod - private void retryingRequest( Exception exc ) { } + private void retryingRequest(Exception exc) { + } - @InfoMethod( tpName="totalInvocation", tpType=TimingPointType.ENTER ) - private void enter_totalInvocation() { } + @InfoMethod(tpName = "totalInvocation", tpType = TimingPointType.ENTER) + private void enter_totalInvocation() { + } - @InfoMethod( tpName="totalInvocation", tpType=TimingPointType.EXIT ) - private void exit_totalInvocation() { } + @InfoMethod(tpName = "totalInvocation", tpType = TimingPointType.EXIT) + private void exit_totalInvocation() { + } - @InfoMethod( tpName="hasNextNext", tpType=TimingPointType.ENTER ) - private void enter_hasNextNext() { } + @InfoMethod(tpName = "hasNextNext", tpType = TimingPointType.ENTER) + private void enter_hasNextNext() { + } - @InfoMethod( tpName="hasNextNext", tpType=TimingPointType.EXIT ) - private void exit_hasNextNext() { } + @InfoMethod(tpName = "hasNextNext", tpType = TimingPointType.EXIT) + private void exit_hasNextNext() { + } - private IIOPAddress getPrimaryAddress( final IOR ior ) { + private IIOPAddress getPrimaryAddress(final IOR ior) { if (ior != null) { for (TaggedProfile tprof : ior) { - final TaggedProfileTemplate tpt = tprof.getTaggedProfileTemplate() ; + final TaggedProfileTemplate tpt = tprof.getTaggedProfileTemplate(); if (tpt instanceof IIOPProfileTemplate) { - final IIOPProfileTemplate ipt = (IIOPProfileTemplate)tpt ; - return ipt.getPrimaryAddress() ; + final IIOPProfileTemplate ipt = (IIOPProfileTemplate) tpt; + return ipt.getPrimaryAddress(); } } } - return null ; + return null; } @InfoMethod - private void targetIOR( IOR ior ) {} + private void targetIOR(IOR ior) { + } @InfoMethod - private void effectiveTargetIOR( IOR ior ) {} + private void effectiveTargetIOR(IOR ior) { + } @Subcontract @Override - public OutputStream request(org.omg.CORBA.Object self, - String operation, - boolean responseExpected) - { + public OutputStream request(org.omg.CORBA.Object self, String operation, boolean responseExpected) { - targetIOR( contactInfoList.getTargetIOR() ) ; - effectiveTargetIOR( contactInfoList.getEffectiveTargetIOR() ); - enter_totalInvocation() ; + targetIOR(contactInfoList.getTargetIOR()); + effectiveTargetIOR(contactInfoList.getEffectiveTargetIOR()); + enter_totalInvocation(); try { OutputStream result = null; @@ -174,31 +173,31 @@ public OutputStream request(org.omg.CORBA.Object self, } try { - enter_hasNextNext() ; + enter_hasNextNext(); - if (! contactInfoListIterator.hasNext()) { + if (!contactInfoListIterator.hasNext()) { // REVISIT: When we unwind the retry stack // these are necessary. orb.getPIHandler().initiateClientPIRequest(false); ORBUtility.pushEncVersionToThreadLocalState(ORBConstants.JAVA_ENC_VERSION); - throw ((ContactInfoListIterator)contactInfoListIterator).getFailureException(); + throw ((ContactInfoListIterator) contactInfoListIterator).getFailureException(); } contactInfo = (ContactInfo) contactInfoListIterator.next(); - requestInfo( operation, contactInfo ) ; + requestInfo(operation, contactInfo); } finally { - exit_hasNextNext() ; + exit_hasNextNext(); } ClientRequestDispatcher subcontract = contactInfo.getClientRequestDispatcher(); // Remember chosen subcontract for invoke and releaseReply. - // + // // NOTE: This is necessary since a stream is not available // in releaseReply if there is a client marshaling error // or an error in _invoke. invocationInfo.setClientRequestDispatcher(subcontract); result = subcontract.beginRequest(self, operation, !responseExpected, contactInfo); } catch (RuntimeException e) { - // REVISIT: + // REVISIT: // this part similar to BufferManagerWriteStream.overflow() retry = contactInfoListIterator != null && ((ContactInfoListIterator) contactInfoListIterator).reportException(contactInfo, e); @@ -215,68 +214,60 @@ public OutputStream request(org.omg.CORBA.Object self, } finally { // Enable operation tracing for argument marshaling if (orb.operationTraceDebugFlag) { - OperationTracer.enable() ; + OperationTracer.enable(); } - OperationTracer.begin( "client argument marshaling:op=" + operation ) ; + OperationTracer.begin("client argument marshaling:op=" + operation); } } - + @Subcontract @Override - public InputStream invoke(org.omg.CORBA.Object self, OutputStream output) - throws - ApplicationException, - RemarshalException - { + public InputStream invoke(org.omg.CORBA.Object self, OutputStream output) throws ApplicationException, RemarshalException { // Disable operation tracing for argment marshaling - OperationTracer.disable() ; - OperationTracer.finish() ; + OperationTracer.disable(); + OperationTracer.finish(); ClientRequestDispatcher subcontract = getClientRequestDispatcher(); try { - return (InputStream) - subcontract.marshalingComplete((Object)self, (CDROutputObject)output); + return (InputStream) subcontract.marshalingComplete((Object) self, (CDROutputObject) output); } finally { // Enable operation tracing for result unmarshaling if (orb.operationTraceDebugFlag) { - OperationTracer.enable() ; + OperationTracer.enable(); } - OperationTracer.begin( "client result unmarshaling" ) ; + OperationTracer.begin("client result unmarshaling"); } } - + @Subcontract @Override - public void releaseReply(org.omg.CORBA.Object self, InputStream input) - { + public void releaseReply(org.omg.CORBA.Object self, InputStream input) { try { // NOTE: InputStream may be null (e.g., exception request from PI). ClientRequestDispatcher subcontract = getClientRequestDispatcher(); if (subcontract != null) { // Important: avoid an NPE. // ie: Certain errors may happen before a subcontract is selected. - subcontract.endRequest(orb, self, (CDRInputObject)input); + subcontract.endRequest(orb, self, (CDRInputObject) input); } orb.releaseOrDecrementInvocationInfo(); } finally { - exit_totalInvocation() ; - + exit_totalInvocation(); + // Disable operation tracing for result unmarshaling - OperationTracer.disable() ; - OperationTracer.finish() ; + OperationTracer.disable(); + OperationTracer.finish(); } } - private ClientRequestDispatcher getClientRequestDispatcher() - { + private ClientRequestDispatcher getClientRequestDispatcher() { return ((InvocationInfo) orb.getInvocationInfo()).getClientRequestDispatcher(); } - public org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object obj) - { + public org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object obj) { InputStream is = null; // instantiate the stub - org.omg.CORBA.Object stub = null ; + org.omg.CORBA.Object stub = null; try { OutputStream os = request(null, "_interface", true); @@ -285,47 +276,49 @@ public org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object obj) org.omg.CORBA.Object objimpl = is.read_Object(); // check if returned object is of correct type - if ( !objimpl._is_a("IDL:omg.org/CORBA/InterfaceDef:1.0") ) { + if (!objimpl._is_a("IDL:omg.org/CORBA/InterfaceDef:1.0")) { throw wrapper.wrongInterfaceDef(); } try { - stub = (org.omg.CORBA.Object) - JDKBridge.loadClass("org.omg.CORBA._InterfaceDefStub"). - newInstance(); + stub = (org.omg.CORBA.Object) JDKBridge.loadClass("org.omg.CORBA._InterfaceDefStub").newInstance(); } catch (Exception ex) { - throw wrapper.noInterfaceDefStub( ex ) ; + throw wrapper.noInterfaceDefStub(ex); } - org.omg.CORBA.portable.Delegate del = - StubAdapter.getDelegate( objimpl ) ; - StubAdapter.setDelegate( stub, del ) ; + org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(objimpl); + StubAdapter.setDelegate(stub, del); } catch (ApplicationException e) { // This cannot happen. - throw wrapper.applicationExceptionInSpecialMethod( e ) ; + throw wrapper.applicationExceptionInSpecialMethod(e); } catch (RemarshalException e) { return get_interface_def(obj); } finally { - releaseReply((org.omg.CORBA.Object)null, is); + releaseReply((org.omg.CORBA.Object) null, is); } return stub; } @InfoMethod - private void foundMyId() { } + private void foundMyId() { + } @InfoMethod - private void foundIdInRepostioryId() { } + private void foundIdInRepostioryId() { + } @InfoMethod - private void callingServer() { } + private void callingServer() { + } @InfoMethod - private void serverReturned() { } + private void serverReturned() { + } @InfoMethod - private void retryingRequest() { } + private void retryingRequest() { + } @Subcontract public boolean is_a(org.omg.CORBA.Object obj, String dest) { @@ -334,15 +327,15 @@ public boolean is_a(org.omg.CORBA.Object obj, String dest) { // repositoryIds is the list of typeIds that the stub knows about. // First we look for an answer using local information. - String [] repositoryIds = StubAdapter.getTypeIds( obj ) ; + String[] repositoryIds = StubAdapter.getTypeIds(obj); String myid = contactInfoList.getTargetIOR().getTypeId(); - if ( dest.equals(myid) ) { + if (dest.equals(myid)) { foundMyId(); return true; } - for ( int i=0; i maximum ) { + if (h > maximum) { return 0; } return h; } - + public Request request(org.omg.CORBA.Object obj, String operation) { - return new RequestImpl(orb, obj, null, operation, null, null, null, - null); - } - - public Request create_request(org.omg.CORBA.Object obj, - Context ctx, - String operation, - NVList arg_list, - NamedValue result) { - return new RequestImpl(orb, obj, ctx, operation, arg_list, - result, null, null); - } - - public Request create_request(org.omg.CORBA.Object obj, - Context ctx, - String operation, - NVList arg_list, - NamedValue result, - ExceptionList exclist, - ContextList ctxlist) { - return new RequestImpl(orb, obj, ctx, operation, arg_list, result, - exclist, ctxlist); - } - + return new RequestImpl(orb, obj, null, operation, null, null, null, null); + } + + public Request create_request(org.omg.CORBA.Object obj, Context ctx, String operation, NVList arg_list, NamedValue result) { + return new RequestImpl(orb, obj, ctx, operation, arg_list, result, null, null); + } + + public Request create_request(org.omg.CORBA.Object obj, Context ctx, String operation, NVList arg_list, NamedValue result, + ExceptionList exclist, ContextList ctxlist) { + return new RequestImpl(orb, obj, ctx, operation, arg_list, result, exclist, ctxlist); + } + @Override public org.omg.CORBA.ORB orb(org.omg.CORBA.Object obj) { return this.orb; } - + /** * Returns true if this object is implemented by a local servant. * - * REVISIT: locatedIOR should be replaced with a method call that - * returns the current IOR for this request (e.g. ContactInfoChooser). + * REVISIT: locatedIOR should be replaced with a method call that returns the current IOR for this request (e.g. + * ContactInfoChooser). * * @param self The object reference which delegated to this delegate. - * @return true only if the servant incarnating this object is located in - * this ORB. + * @return true only if the servant incarnating this object is located in this ORB. */ @Override @IsLocal public boolean is_local(org.omg.CORBA.Object self) { - return contactInfoList.getEffectiveTargetIOR().getProfile(). - isLocal(); + return contactInfoList.getEffectiveTargetIOR().getProfile().isLocal(); } - + @Override - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType) { - return - contactInfoList.getLocalClientRequestDispatcher() - .servant_preinvoke(self, operation, expectedType); - } - + public ServantObject servant_preinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) { + return contactInfoList.getLocalClientRequestDispatcher().servant_preinvoke(self, operation, expectedType); + } + @Override - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servant) { - contactInfoList.getLocalClientRequestDispatcher() - .servant_postinvoke(self, servant); + public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servant) { + contactInfoList.getLocalClientRequestDispatcher().servant_postinvoke(self, servant); } - - /* Returns the codebase for object reference provided. + + /* + * Returns the codebase for object reference provided. + * * @param self the object reference whose codebase needs to be returned. - * @return the codebase as a space delimited list of url strings or - * null if none. + * + * @return the codebase as a space delimited list of url strings or null if none. */ @Override public String get_codebase(org.omg.CORBA.Object self) { @@ -572,4 +544,3 @@ public int hashCode() { } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ClientRequestDispatcherImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ClientRequestDispatcherImpl.java index 6cfe6da1a..377f85df9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ClientRequestDispatcherImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ClientRequestDispatcherImpl.java @@ -59,124 +59,136 @@ import java.util.concurrent.ConcurrentMap; /** - * ClientDelegate is the RMI client-side subcontract or representation - * It implements RMI delegate as well as our internal ClientRequestDispatcher - * interface. + * ClientDelegate is the RMI client-side subcontract or representation It implements RMI delegate as well as our + * internal ClientRequestDispatcher interface. */ @Subcontract -public class ClientRequestDispatcherImpl - implements - ClientRequestDispatcher -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class ClientRequestDispatcherImpl implements ClientRequestDispatcher { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Used for locking private final Object lock = new Object(); - private ORBVersionServiceContext ovsc = - ServiceContextDefaults.makeORBVersionServiceContext(); + private ORBVersionServiceContext ovsc = ServiceContextDefaults.makeORBVersionServiceContext(); + private MaxStreamFormatVersionServiceContext msfvc = ServiceContextDefaults.getMaxStreamFormatVersionServiceContext(); - private MaxStreamFormatVersionServiceContext msfvc = - ServiceContextDefaults.getMaxStreamFormatVersionServiceContext(); - - private ConcurrentMap locks = - new ConcurrentHashMap() ; + private ConcurrentMap locks = new ConcurrentHashMap(); @InfoMethod - private void usingCachedConnection( Connection conn ) { } + private void usingCachedConnection(Connection conn) { + } @InfoMethod - private void usingCreatedConnection( Connection conn ) { } + private void usingCreatedConnection(Connection conn) { + } @InfoMethod - private void connectionCached( Connection conn ) { } + private void connectionCached(Connection conn) { + } @InfoMethod - private void connectionRegistered( Connection conn ) { } + private void connectionRegistered(Connection conn) { + } @InfoMethod - private void createdMessageMediator( MessageMediator med ) { } + private void createdMessageMediator(MessageMediator med) { + } @InfoMethod - private void createOutputObject( CDROutputObject out ) { } + private void createOutputObject(CDROutputObject out) { + } @InfoMethod - private void generalMessage ( String msg ) { } + private void generalMessage(String msg) { + } @InfoMethod - private void remarshalWithHasNextTrue( ContactInfo info ) { } + private void remarshalWithHasNextTrue(ContactInfo info) { + } - @InfoMethod( tpName="totalRequest", tpType=TimingPointType.ENTER ) - private void enter_totalRequest() { } + @InfoMethod(tpName = "totalRequest", tpType = TimingPointType.ENTER) + private void enter_totalRequest() { + } - @InfoMethod( tpName="totalRequest", tpType=TimingPointType.EXIT ) - private void exit_totalRequest() { } + @InfoMethod(tpName = "totalRequest", tpType = TimingPointType.EXIT) + private void exit_totalRequest() { + } - @InfoMethod( tpName="connectionSetup", tpType=TimingPointType.ENTER ) - private void enter_connectionSetup() { } + @InfoMethod(tpName = "connectionSetup", tpType = TimingPointType.ENTER) + private void enter_connectionSetup() { + } - @InfoMethod( tpName="connectionSetup", tpType=TimingPointType.EXIT ) - private void exit_connectionSetup() { } + @InfoMethod(tpName = "connectionSetup", tpType = TimingPointType.EXIT) + private void exit_connectionSetup() { + } - @InfoMethod( tpName="clientDecoding", tpType=TimingPointType.ENTER ) - private void enter_clientDecoding() { } + @InfoMethod(tpName = "clientDecoding", tpType = TimingPointType.ENTER) + private void enter_clientDecoding() { + } - @InfoMethod( tpName="clientDecoding", tpType=TimingPointType.EXIT ) - private void exit_clientDecoding() { } + @InfoMethod(tpName = "clientDecoding", tpType = TimingPointType.EXIT) + private void exit_clientDecoding() { + } - @InfoMethod( tpName="clientEncoding", tpType=TimingPointType.ENTER ) - private void enter_clientEncoding() { } + @InfoMethod(tpName = "clientEncoding", tpType = TimingPointType.ENTER) + private void enter_clientEncoding() { + } - @InfoMethod( tpName="clientEncoding", tpType=TimingPointType.EXIT ) - private void exit_clientEncoding() { } + @InfoMethod(tpName = "clientEncoding", tpType = TimingPointType.EXIT) + private void exit_clientEncoding() { + } - @InfoMethod( tpName="clientTransportAndWait", tpType=TimingPointType.ENTER ) - private void enter_clientTransportAndWait() { } + @InfoMethod(tpName = "clientTransportAndWait", tpType = TimingPointType.ENTER) + private void enter_clientTransportAndWait() { + } - @InfoMethod( tpName="clientTransportAndWait", tpType=TimingPointType.EXIT ) - private void exit_clientTransportAndWait() { } + @InfoMethod(tpName = "clientTransportAndWait", tpType = TimingPointType.EXIT) + private void exit_clientTransportAndWait() { + } - @InfoMethod( tpName="processResponse", tpType=TimingPointType.ENTER ) - private void enter_processResponse() { } + @InfoMethod(tpName = "processResponse", tpType = TimingPointType.ENTER) + private void enter_processResponse() { + } - @InfoMethod( tpName="processResponse", tpType=TimingPointType.EXIT ) - private void exit_processResponse() { } + @InfoMethod(tpName = "processResponse", tpType = TimingPointType.EXIT) + private void exit_processResponse() { + } - @InfoMethod( tpName="requestAddServiceContexts", tpType=TimingPointType.ENTER ) - private void enter_requestAddServiceContexts() { } + @InfoMethod(tpName = "requestAddServiceContexts", tpType = TimingPointType.ENTER) + private void enter_requestAddServiceContexts() { + } - @InfoMethod( tpName="requestAddServiceContexts", tpType=TimingPointType.EXIT ) - private void exit_requestAddServiceContexts() { } + @InfoMethod(tpName = "requestAddServiceContexts", tpType = TimingPointType.EXIT) + private void exit_requestAddServiceContexts() { + } @Subcontract - public CDROutputObject beginRequest(Object self, String opName, - boolean isOneWay, ContactInfo contactInfo) { + public CDROutputObject beginRequest(Object self, String opName, boolean isOneWay, ContactInfo contactInfo) { final ORB orb = contactInfo.getBroker(); - enter_totalRequest() ; + enter_totalRequest(); // Portable Interceptor initialization. - orb.getPIHandler().initiateClientPIRequest( false ); + orb.getPIHandler().initiateClientPIRequest(false); Connection connection = null; - Object lock = locks.get( contactInfo ) ; + Object lock = locks.get(contactInfo); if (lock == null) { - Object newLock = new Object() ; - lock = locks.putIfAbsent( contactInfo, newLock ) ; + Object newLock = new Object(); + lock = locks.putIfAbsent(contactInfo, newLock); if (lock == null) { - lock = newLock ; + lock = newLock; } } // This locking is done so that multiple connections are not created - // for the same endpoint. Note that we are locking here on the + // for the same endpoint. Note that we are locking here on the // same lock for different contactInfos that are equal, which is really - // what's required. This is a fix for 7016182. + // what's required. This is a fix for 7016182. // // TODO NEW CACHE: all of this is replaced with the get() call, except // the code needed to add the connection to the selector. @@ -188,36 +200,30 @@ public CDROutputObject beginRequest(Object self, String opName, enter_connectionSetup(); if (contactInfo.shouldCacheConnection()) { - connection = orb.getTransportManager() - .getOutboundConnectionCache(contactInfo) - .get(contactInfo); + connection = orb.getTransportManager().getOutboundConnectionCache(contactInfo).get(contactInfo); } if (connection != null) { - usingCachedConnection( connection ) ; + usingCachedConnection(connection); } else { - connection = - contactInfo.createConnection(); - usingCreatedConnection( connection ) ; + connection = contactInfo.createConnection(); + usingCreatedConnection(connection); if (connection.shouldRegisterReadEvent()) { - orb.getTransportManager().getSelector(0) - .registerForEvent(connection.getEventHandler()); + orb.getTransportManager().getSelector(0).registerForEvent(connection.getEventHandler()); connection.setState("ESTABLISHED"); - connectionRegistered( connection ) ; + connectionRegistered(connection); } - // Do not do connection reclaim here since the + // Do not do connection reclaim here since the // connections are marked in use by registerWaiter() // call and since this call happens later do it after // that. if (contactInfo.shouldCacheConnection()) { - OutboundConnectionCache connectionCache = - orb.getTransportManager() - .getOutboundConnectionCache(contactInfo); + OutboundConnectionCache connectionCache = orb.getTransportManager().getOutboundConnectionCache(contactInfo); connectionCache.stampTime(connection); connectionCache.put(contactInfo, connection); - connectionCached( connection ) ; + connectionCached(connection); } } } finally { @@ -226,9 +232,7 @@ public CDROutputObject beginRequest(Object self, String opName, } } - MessageMediator messageMediator = - contactInfo.createMessageMediator(orb, contactInfo, connection, - opName, isOneWay); + MessageMediator messageMediator = contactInfo.createMessageMediator(orb, contactInfo, connection, opName, isOneWay); createdMessageMediator(messageMediator); // NOTE: Thread data so we can get the mediator in release reply @@ -244,11 +248,11 @@ public CDROutputObject beginRequest(Object self, String opName, performCodeSetNegotiation(messageMediator); - enter_requestAddServiceContexts() ; + enter_requestAddServiceContexts(); try { addServiceContexts(messageMediator); } finally { - exit_requestAddServiceContexts() ; + exit_requestAddServiceContexts(); } CDROutputObject outputObject = contactInfo.createOutputObject(messageMediator); @@ -264,9 +268,8 @@ public CDROutputObject beginRequest(Object self, String opName, synchronized (lock) { if (contactInfo.isConnectionBased()) { if (contactInfo.shouldCacheConnection()) { - generalMessage( "reclaiming connections" ); - OutboundConnectionCache connectionCache = orb.getTransportManager() - .getOutboundConnectionCache(contactInfo); + generalMessage("reclaiming connections"); + OutboundConnectionCache connectionCache = orb.getTransportManager().getOutboundConnectionCache(contactInfo); connectionCache.reclaim(); } } @@ -278,16 +281,16 @@ public CDROutputObject beginRequest(Object self, String opName, // service contexts may be added by PI because // initial fragments may be sent during message initialization. orb.getPIHandler().invokeClientPIStartingPoint(); - } catch( RemarshalException e ) { - generalMessage( "Remarshal" ) ; + } catch (RemarshalException e) { + generalMessage("Remarshal"); // NOTE: We get here because an interceptor raised ForwardRequest - // and updated the IOR/Iterator. Since we have a fresh iterator + // and updated the IOR/Iterator. Since we have a fresh iterator // hasNext should succeed. // REVISIT: We should feed ALL interceptor exceptions to // iterator.reportException so it can determine if it wants - // to retry. Right now, SystemExceptions will flow to the + // to retry. Right now, SystemExceptions will flow to the // client code. // REVISIT: @@ -299,20 +302,19 @@ public CDROutputObject beginRequest(Object self, String opName, remarshalWithHasNextTrue(contactInfo); // Fix for 6763340: Complete the first attempt before starting another. - orb.getPIHandler().makeCompletedClientRequest( - ReplyMessage.LOCATION_FORWARD, null ) ; - unregisterWaiter( orb ) ; - orb.getPIHandler().cleanupClientPIRequest() ; + orb.getPIHandler().makeCompletedClientRequest(ReplyMessage.LOCATION_FORWARD, null); + unregisterWaiter(orb); + orb.getPIHandler().cleanupClientPIRequest(); return beginRequest(self, opName, isOneWay, contactInfo); } else { - retryMessage( "RemarshalException: hasNext false" ) ; + retryMessage("RemarshalException: hasNext false"); throw wrapper.remarshalWithNowhereToGo(); } } messageMediator.initializeMessage(); - generalMessage( "initialized message"); + generalMessage("initialized message"); enter_clientEncoding(); @@ -320,26 +322,22 @@ public CDROutputObject beginRequest(Object self, String opName, } @InfoMethod - private void operationAndId( String op, int rid ) { } + private void operationAndId(String op, int rid) { + } @Subcontract - public CDRInputObject marshalingComplete(java.lang.Object self, - CDROutputObject outputObject) - throws - ApplicationException, - org.omg.CORBA.portable.RemarshalException - { + public CDRInputObject marshalingComplete(java.lang.Object self, CDROutputObject outputObject) + throws ApplicationException, org.omg.CORBA.portable.RemarshalException { MessageMediator messageMediator = outputObject.getMessageMediator(); ORB orb = messageMediator.getBroker(); - operationAndId(messageMediator.getOperationName(), - messageMediator.getRequestId() ); + operationAndId(messageMediator.getOperationName(), messageMediator.getRequestId()); try { exit_clientEncoding(); enter_clientTransportAndWait(); - CDRInputObject inputObject = null ; + CDRInputObject inputObject = null; try { inputObject = marshalingComplete1(orb, messageMediator); } finally { @@ -350,28 +348,26 @@ public CDRInputObject marshalingComplete(java.lang.Object self, } finally { // We must ALWAYS call enter_ClientDecoding, so that the // corresponding exit_clientDecoding gets called in endRequest(). - enter_clientDecoding() ; + enter_clientDecoding(); } } @InfoMethod - private void retryMessage( String msg ) { } + private void retryMessage(String msg) { + } @InfoMethod - private void reportException( Throwable exc ) { } + private void reportException(Throwable exc) { + } @InfoMethod - private void reportException( String msg, Throwable exc ) { } + private void reportException(String msg, Throwable exc) { + } @Subcontract - public CDRInputObject marshalingComplete1( - ORB orb, MessageMediator messageMediator) - throws - ApplicationException, - org.omg.CORBA.portable.RemarshalException - { - operationAndId(messageMediator.getOperationName(), - messageMediator.getRequestId() ); + public CDRInputObject marshalingComplete1(ORB orb, MessageMediator messageMediator) + throws ApplicationException, org.omg.CORBA.portable.RemarshalException { + operationAndId(messageMediator.getOperationName(), messageMediator.getRequestId()); try { messageMediator.finishSendingRequest(); @@ -382,38 +378,32 @@ public CDRInputObject marshalingComplete1( return messageMediator.waitForResponse(); } catch (RuntimeException e) { - reportException( e ) ; + reportException(e); - boolean retry = - getContactInfoListIterator(orb) - .reportException(messageMediator.getContactInfo(), e); + boolean retry = getContactInfoListIterator(orb).reportException(messageMediator.getContactInfo(), e); // Bug 6382377: must not lose exception in PI // Must run interceptor end point before retrying. - Exception newException = - orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, e); + Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.SYSTEM_EXCEPTION, e); if (retry) { if (newException == e) { - retryMessage( "Retry true; same exception" ) ; - continueOrThrowSystemOrRemarshal(messageMediator, - new RemarshalException()); + retryMessage("Retry true; same exception"); + continueOrThrowSystemOrRemarshal(messageMediator, new RemarshalException()); } else { - retryMessage( "Retry true; new exception" ) ; - continueOrThrowSystemOrRemarshal(messageMediator, - newException); + retryMessage("Retry true; new exception"); + continueOrThrowSystemOrRemarshal(messageMediator, newException); } } else { // NOTE: Interceptor ending point will run in releaseReply. if (newException instanceof RuntimeException) { - retryMessage( "Retry false; RuntimeException" ) ; - throw (RuntimeException)newException ; + retryMessage("Retry false; RuntimeException"); + throw (RuntimeException) newException; } else if (newException instanceof RemarshalException) { - throw (RemarshalException) newException; + throw (RemarshalException) newException; } else { - retryMessage( "Retry false; other exception" ) ; - throw e ; + retryMessage("Retry false; other exception"); + throw e; } } @@ -422,28 +412,29 @@ public CDRInputObject marshalingComplete1( } @InfoMethod - private void receivedUserException( String repoid ) { } + private void receivedUserException(String repoid) { + } @InfoMethod - private void receivedUserExceptionDII( Throwable exc, Throwable newExc ) { } + private void receivedUserExceptionDII(Throwable exc, Throwable newExc) { + } @InfoMethod - private void receivedUserExceptionNotDII( Throwable exc, Throwable newExc ) { } + private void receivedUserExceptionNotDII(Throwable exc, Throwable newExc) { + } @Subcontract - protected CDRInputObject processResponse(ORB orb, - MessageMediator messageMediator, CDRInputObject inputObject) - throws ApplicationException, org.omg.CORBA.portable.RemarshalException { + protected CDRInputObject processResponse(ORB orb, MessageMediator messageMediator, CDRInputObject inputObject) + throws ApplicationException, org.omg.CORBA.portable.RemarshalException { - operationAndId(messageMediator.getOperationName(), - messageMediator.getRequestId() ); + operationAndId(messageMediator.getOperationName(), messageMediator.getRequestId()); - enter_processResponse() ; + enter_processResponse(); try { // We know for sure now that we've sent a message. // So OK to not send initial again. if (messageMediator.getConnection() != null) { - generalMessage( "Non-null connection" ) ; + generalMessage("Non-null connection"); messageMediator.getConnection().setPostInitialContexts(); } @@ -455,12 +446,10 @@ protected CDRInputObject processResponse(ORB orb, Exception exception = null; if (messageMediator.isOneWay()) { - generalMessage( "One way request" ) ; - getContactInfoListIterator(orb) - .reportSuccess(messageMediator.getContactInfo()); + generalMessage("One way request"); + getContactInfoListIterator(orb).reportSuccess(messageMediator.getContactInfo()); // Invoke Portable Interceptors with receive_other - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.NO_EXCEPTION, exception ); + exception = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.NO_EXCEPTION, exception); reportException(exception); continueOrThrowSystemOrRemarshal(messageMediator, exception); return null; @@ -475,85 +464,72 @@ protected CDRInputObject processResponse(ORB orb, if (messageMediator.isSystemExceptionReply()) { SystemException se = messageMediator.getSystemExceptionReply(); - reportException( "received system exception", se); + reportException("received system exception", se); - boolean doRemarshal = - getContactInfoListIterator(orb) - .reportException(messageMediator.getContactInfo(), se); + boolean doRemarshal = getContactInfoListIterator(orb).reportException(messageMediator.getContactInfo(), se); if (doRemarshal) { - reportException( "Do remarshal", se); - + reportException("Do remarshal", se); + // Invoke Portable Interceptors with receive_exception: - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, se ); + exception = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.SYSTEM_EXCEPTION, se); // If PI did not change the exception, throw a // Remarshal. - if( se == exception ) { - generalMessage( "Do remarshal: same exception"); + if (se == exception) { + generalMessage("Do remarshal: same exception"); // exception = null is to maintain symmetry with // GenericPOAClientSC. exception = null; - continueOrThrowSystemOrRemarshal(messageMediator, - new RemarshalException()); - throw wrapper.statementNotReachable1() ; + continueOrThrowSystemOrRemarshal(messageMediator, new RemarshalException()); + throw wrapper.statementNotReachable1(); } else { - reportException( "Do remarshal: new exception", exception ); - // Otherwise, throw the exception PI wants thrown. - continueOrThrowSystemOrRemarshal(messageMediator, - exception); - throw wrapper.statementNotReachable2() ; + reportException("Do remarshal: new exception", exception); + // Otherwise, throw the exception PI wants thrown. + continueOrThrowSystemOrRemarshal(messageMediator, exception); + throw wrapper.statementNotReachable2(); } } // No retry, so see if was unknown. - reportException( "NO remarshal", se); + reportException("NO remarshal", se); - ServiceContexts contexts = - messageMediator.getReplyServiceContexts(); + ServiceContexts contexts = messageMediator.getReplyServiceContexts(); if (contexts != null) { - UEInfoServiceContext usc = - (UEInfoServiceContext) - contexts.get(UEInfoServiceContext.SERVICE_CONTEXT_ID); + UEInfoServiceContext usc = (UEInfoServiceContext) contexts.get(UEInfoServiceContext.SERVICE_CONTEXT_ID); if (usc != null) { - Throwable unknown = usc.getUE() ; + Throwable unknown = usc.getUE(); UnknownException ue = new UnknownException(unknown); - reportException( "NO remarshal: UserException available", - unknown ); + reportException("NO remarshal: UserException available", unknown); // Invoke Portable Interceptors with receive_exception: - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, ue ); + exception = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.SYSTEM_EXCEPTION, ue); - reportException( "NO remarshal: UserException available: PI exception ", - exception ); + reportException("NO remarshal: UserException available: PI exception ", exception); continueOrThrowSystemOrRemarshal(messageMediator, exception); - throw wrapper.statementNotReachable3() ; + throw wrapper.statementNotReachable3(); } } // It was not a comm failure nor unknown. // This is the general case. - reportException( "general exception", se); + reportException("general exception", se); // Invoke Portable Interceptors with receive_exception: - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, se ); + exception = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.SYSTEM_EXCEPTION, se); - reportException( "general exception: PI exception", exception ); + reportException("general exception: PI exception", exception); continueOrThrowSystemOrRemarshal(messageMediator, exception); // Note: We should never need to execute this line, but // we should assert in case exception is null somehow. - throw wrapper.statementNotReachable4() ; + throw wrapper.statementNotReachable4(); } else if (messageMediator.isUserExceptionReply()) { - getContactInfoListIterator(orb) - .reportSuccess(messageMediator.getContactInfo()); + getContactInfoListIterator(orb).reportSuccess(messageMediator.getContactInfo()); String exceptionRepoId = peekUserExceptionId(inputObject); receivedUserException(exceptionRepoId); @@ -561,99 +537,87 @@ protected CDRInputObject processResponse(ORB orb, Exception newException = null; if (messageMediator.isDIIRequest()) { - exception = messageMediator.unmarshalDIIUserException( - exceptionRepoId, (InputStream)inputObject); - newException = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.USER_EXCEPTION, exception ); + exception = messageMediator.unmarshalDIIUserException(exceptionRepoId, (InputStream) inputObject); + newException = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.USER_EXCEPTION, exception); messageMediator.setDIIException(newException); receivedUserExceptionDII(exception, newException); } else { - ApplicationException appException = new ApplicationException( - exceptionRepoId, (org.omg.CORBA.portable.InputStream)inputObject); + ApplicationException appException = new ApplicationException(exceptionRepoId, + (org.omg.CORBA.portable.InputStream) inputObject); exception = appException; - newException = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.USER_EXCEPTION, appException ); + newException = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.USER_EXCEPTION, appException); receivedUserExceptionNotDII(exception, newException); } if (newException != exception) { - continueOrThrowSystemOrRemarshal(messageMediator,newException); + continueOrThrowSystemOrRemarshal(messageMediator, newException); } if (newException instanceof ApplicationException) { - throw (ApplicationException)newException; + throw (ApplicationException) newException; } - // For DII: + // For DII: // This return will be ignored - already unmarshaled above. return inputObject; } else if (messageMediator.isLocationForwardReply()) { - generalMessage( "received location forward"); - + generalMessage("received location forward"); + // NOTE: Expects iterator to update target IOR - getContactInfoListIterator(orb).reportRedirect( - messageMediator.getContactInfo(), - messageMediator.getForwardedIOR()); + getContactInfoListIterator(orb).reportRedirect(messageMediator.getContactInfo(), messageMediator.getForwardedIOR()); // Invoke Portable Interceptors with receive_other: - Exception newException = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.LOCATION_FORWARD, null ); + Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.LOCATION_FORWARD, null); - if( !(newException instanceof RemarshalException) ) { + if (!(newException instanceof RemarshalException)) { exception = newException; } // If PI did not change exception, throw Remarshal, else // throw the exception PI wants thrown. // KMC: GenericPOAClientSC did not check exception != null - if( exception != null ) { + if (exception != null) { continueOrThrowSystemOrRemarshal(messageMediator, exception); } - continueOrThrowSystemOrRemarshal(messageMediator, - new RemarshalException()); - throw wrapper.statementNotReachable5() ; + continueOrThrowSystemOrRemarshal(messageMediator, new RemarshalException()); + throw wrapper.statementNotReachable5(); - } else if (messageMediator.isDifferentAddrDispositionRequestedReply()){ - generalMessage( "received different addressing dispostion request"); + } else if (messageMediator.isDifferentAddrDispositionRequestedReply()) { + generalMessage("received different addressing dispostion request"); // Set the desired target addressing disposition. - getContactInfoListIterator(orb).reportAddrDispositionRetry( - messageMediator.getContactInfo(), - messageMediator.getAddrDispositionReply()); + getContactInfoListIterator(orb).reportAddrDispositionRetry(messageMediator.getContactInfo(), + messageMediator.getAddrDispositionReply()); // Invoke Portable Interceptors with receive_other: - Exception newException = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.NEEDS_ADDRESSING_MODE, null); + Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.NEEDS_ADDRESSING_MODE, null); // For consistency with corresponding code in GenericPOAClientSC: - if( !(newException instanceof RemarshalException) ) { + if (!(newException instanceof RemarshalException)) { exception = newException; } // If PI did not change exception, throw Remarshal, else // throw the exception PI wants thrown. // KMC: GenericPOAClientSC did not include exception != null check - if( exception != null ) { + if (exception != null) { continueOrThrowSystemOrRemarshal(messageMediator, exception); } - continueOrThrowSystemOrRemarshal(messageMediator, - new RemarshalException()); - throw wrapper.statementNotReachable6() ; + continueOrThrowSystemOrRemarshal(messageMediator, new RemarshalException()); + throw wrapper.statementNotReachable6(); } else /* normal response */ { - generalMessage( "received normal response"); + generalMessage("received normal response"); - getContactInfoListIterator(orb) - .reportSuccess(messageMediator.getContactInfo()); + getContactInfoListIterator(orb).reportSuccess(messageMediator.getContactInfo()); - messageMediator.handleDIIReply((InputStream)inputObject); + messageMediator.handleDIIReply((InputStream) inputObject); // Invoke Portable Interceptors with receive_reply: - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.NO_EXCEPTION, null ); + exception = orb.getPIHandler().invokeClientPIEndingPoint(ReplyMessage.NO_EXCEPTION, null); // Remember: not thrown if exception is null. continueOrThrowSystemOrRemarshal(messageMediator, exception); @@ -661,42 +625,39 @@ protected CDRInputObject processResponse(ORB orb, return inputObject; } } finally { - exit_processResponse() ; + exit_processResponse(); } } // Filters the given exception into a SystemException or a - // RemarshalException and throws it. Assumes the given exception is - // of one of these two types. This is a utility method for + // RemarshalException and throws it. Assumes the given exception is + // of one of these two types. This is a utility method for // the above invoke code which must do this numerous times. // If the exception is null, no exception is thrown. // Note that this code is duplicated in GenericPOAClientSC.java @Subcontract - protected void continueOrThrowSystemOrRemarshal( - MessageMediator messageMediator, Exception exception) - throws - SystemException, RemarshalException - { + protected void continueOrThrowSystemOrRemarshal(MessageMediator messageMediator, Exception exception) + throws SystemException, RemarshalException { final ORB orb = messageMediator.getBroker(); - if ( exception == null ) { + if (exception == null) { // do nothing. - } else if( exception instanceof RemarshalException ) { + } else if (exception instanceof RemarshalException) { // REVISIT - unify with PI handling orb.getInvocationInfo().setIsRetryInvocation(true); // NOTE - We must unregister the waiter NOW for this request - // since the retry will result in a new request id. Therefore + // since the retry will result in a new request id. Therefore // the old request id would be lost and we would have a memory // leak in the responseWaitingRoom. unregisterWaiter(orb); - throw (RemarshalException)exception; + throw (RemarshalException) exception; } else { - throw (SystemException)exception; + throw (SystemException) exception; } } - protected ContactInfoListIterator getContactInfoListIterator(ORB orb) { + protected ContactInfoListIterator getContactInfoListIterator(ORB orb) { return (ContactInfoListIterator) orb.getInvocationInfo().getContactInfoListIterator(); } @@ -709,9 +670,8 @@ protected void registerWaiter(MessageMediator messageMediator) { @Subcontract protected void unregisterWaiter(ORB orb) { - MessageMediator messageMediator = - orb.getInvocationInfo().getMessageMediator(); - if (messageMediator!=null && messageMediator.getConnection() != null) { + MessageMediator messageMediator = orb.getInvocationInfo().getMessageMediator(); + if (messageMediator != null && messageMediator.getConnection() != null) { // REVISIT: // The messageMediator may be null if COMM_FAILURE before // it is created. @@ -728,25 +688,18 @@ protected void addServiceContexts(MessageMediator messageMediator) { ServiceContexts contexts = null; // If Java serialization is used. - if (ORBUtility.getEncodingVersion() != ORBConstants.CDR_ENC_VERSION) { + if (ORBUtility.getEncodingVersion() != ORBConstants.CDR_ENC_VERSION) { contexts = messageMediator.getRequestServiceContexts(); - ORBVersionServiceContext lsc = - ServiceContextDefaults.getORBVersionServiceContext() ; + ORBVersionServiceContext lsc = ServiceContextDefaults.getORBVersionServiceContext(); contexts.put(lsc); return; } - if (c != null && - giopVersion.equals(GIOPVersion.V1_2) && - c.getBroker().getORBData().alwaysSendCodeSetServiceContext()) { - if (!c.isPostInitialContexts()) { - contexts = (messageMediator.getBroker()). - getServiceContextsCache().get( - ServiceContextsCache.CASE.CLIENT_INITIAL); + if (c != null && giopVersion.equals(GIOPVersion.V1_2) && c.getBroker().getORBData().alwaysSendCodeSetServiceContext()) { + if (!c.isPostInitialContexts()) { + contexts = (messageMediator.getBroker()).getServiceContextsCache().get(ServiceContextsCache.CASE.CLIENT_INITIAL); } else { - contexts = messageMediator.getBroker() - .getServiceContextsCache().get( - ServiceContextsCache.CASE.CLIENT_SUBSEQUENT); + contexts = messageMediator.getBroker().getServiceContextsCache().get(ServiceContextsCache.CASE.CLIENT_SUBSEQUENT); } addCodeSetServiceContext(c, contexts, giopVersion); @@ -755,19 +708,19 @@ protected void addServiceContexts(MessageMediator messageMediator) { } else { contexts = messageMediator.getRequestServiceContexts(); - + addCodeSetServiceContext(c, contexts, giopVersion); // Add the RMI-IIOP max stream format version - // service context to every request. Once we have GIOP 1.3, + // service context to every request. Once we have GIOP 1.3, // we could skip it since we now support version 2, but // probably safer to always send it. - - contexts.put( msfvc ); + + contexts.put(msfvc); // ORBVersion servicecontext needs to be sent - contexts.put( ovsc ) ; + contexts.put(ovsc); // NOTE : We only want to send the runtime context the first time if ((c != null) && !c.isPostInitialContexts()) { @@ -775,31 +728,26 @@ protected void addServiceContexts(MessageMediator messageMediator) { // If a client interceptor send_request does a ForwardRequest // which ends up using the same connection then the service // context would not be sent. - SendingContextServiceContext scsc = - ServiceContextDefaults.makeSendingContextServiceContext( - orb.getFVDCodeBaseIOR() ) ; - contexts.put( scsc ) ; + SendingContextServiceContext scsc = ServiceContextDefaults.makeSendingContextServiceContext(orb.getFVDCodeBaseIOR()); + contexts.put(scsc); } - } + } } @Subcontract - protected void consumeServiceContexts(ORB orb, - MessageMediator messageMediator) - { + protected void consumeServiceContexts(ORB orb, MessageMediator messageMediator) { ServiceContexts ctxts = messageMediator.getReplyServiceContexts(); - ServiceContext sc ; + ServiceContext sc; if (ctxts == null) { return; // no service context available, return gracefully. } - sc = ctxts.get( SendingContextServiceContext.SERVICE_CONTEXT_ID ) ; + sc = ctxts.get(SendingContextServiceContext.SERVICE_CONTEXT_ID); if (sc != null) { - SendingContextServiceContext scsc = - (SendingContextServiceContext)sc ; - IOR ior = scsc.getIOR() ; + SendingContextServiceContext scsc = (SendingContextServiceContext) sc; + IOR ior = scsc.getIOR(); try { // set the codebase returned by the server @@ -807,65 +755,56 @@ protected void consumeServiceContexts(ORB orb, messageMediator.getConnection().setCodeBaseIOR(ior); } } catch (ThreadDeath td) { - throw td ; + throw td; } catch (Throwable t) { - throw wrapper.badStringifiedIor( t ) ; + throw wrapper.badStringifiedIor(t); } - } + } // see if the version subcontract is present, if yes, then set // the ORBversion - sc = ctxts.get( ORBVersionServiceContext.SERVICE_CONTEXT_ID ) ; + sc = ctxts.get(ORBVersionServiceContext.SERVICE_CONTEXT_ID); if (sc != null) { - ORBVersionServiceContext lsc = - (ORBVersionServiceContext) sc; + ORBVersionServiceContext lsc = (ORBVersionServiceContext) sc; ORBVersion version = lsc.getVersion(); - orb.setORBVersion( version ) ; + orb.setORBVersion(version); } getExceptionDetailMessage(messageMediator, wrapper); } @Subcontract - protected void getExceptionDetailMessage( - MessageMediator messageMediator, - ORBUtilSystemException wrapper) - { - ServiceContext sc = messageMediator.getReplyServiceContexts() - .get(ExceptionDetailMessage.value); + protected void getExceptionDetailMessage(MessageMediator messageMediator, ORBUtilSystemException wrapper) { + ServiceContext sc = messageMediator.getReplyServiceContexts().get(ExceptionDetailMessage.value); if (sc == null) { return; } - if (! (sc instanceof UnknownServiceContext)) { + if (!(sc instanceof UnknownServiceContext)) { throw wrapper.badExceptionDetailMessageServiceContextType(); } - byte[] data = ((UnknownServiceContext)sc).getData(); + byte[] data = ((UnknownServiceContext) sc).getData(); EncapsInputStream in = new EncapsInputStream(messageMediator.getBroker(), data, data.length); in.consumeEndian(); - String msg = - "----------BEGIN server-side stack trace----------\n" - + in.read_wstring() + "\n" - + "----------END server-side stack trace----------"; + String msg = "----------BEGIN server-side stack trace----------\n" + in.read_wstring() + "\n" + + "----------END server-side stack trace----------"; messageMediator.setReplyExceptionDetailMessage(msg); } @Subcontract - public void endRequest(ORB orb, Object self, CDRInputObject inputObject) - { + public void endRequest(ORB orb, Object self, CDRInputObject inputObject) { try { exit_clientDecoding(); // Note: the inputObject may be null if an error occurs - // in request or before _invoke returns. + // in request or before _invoke returns. // Note: self may be null also (e.g., compiler generates null in stub). - MessageMediator messageMediator = - orb.getInvocationInfo().getMessageMediator(); + MessageMediator messageMediator = orb.getInvocationInfo().getMessageMediator(); if (messageMediator != null) { ORBUtility.popEncVersionFromThreadLocalState(); @@ -891,27 +830,27 @@ public void endRequest(ORB orb, Object self, CDRInputObject inputObject) // XREVISIT NOTE - Assumes unregistering the waiter for // location forwards has already happened somewhere else. // The code below is only going to unregister the final successful - // request. + // request. // NOTE: In the case of a recursive stack of endRequests in a // finally block (because of Remarshal) only the first call to - // unregisterWaiter will remove the waiter. The rest will be + // unregisterWaiter will remove the waiter. The rest will be // noops. unregisterWaiter(orb); - // Invoke Portable Interceptors cleanup. This is done to handle - // exceptions during stream marshaling. More generally, exceptions + // Invoke Portable Interceptors cleanup. This is done to handle + // exceptions during stream marshaling. More generally, exceptions // that occur in the ORB after send_request (which includes // after returning from _request) before _invoke: orb.getPIHandler().cleanupClientPIRequest(); - + // REVISIT: Early replies? - } catch (IOException ex) { + } catch (IOException ex) { // See CDRInput/OutputObject.close() for more info. // This won't result in a Corba error if an IOException happens. - reportException("ignoring IOException", ex ); + reportException("ignoring IOException", ex); } finally { - exit_totalRequest() ; + exit_totalRequest(); } } @@ -929,19 +868,18 @@ protected void performCodeSetNegotiation(MessageMediator messageMediator) { IOR ior = (messageMediator.getContactInfo()).getEffectiveTargetIOR(); - synchronized( conn ) { + synchronized (conn) { if (conn.getCodeSetContext() != null) { return; } - - // This only looks at the first code set component. If + + // This only looks at the first code set component. If // there can be multiple locations with multiple code sets, // this requires more work. - IIOPProfileTemplate temp = (IIOPProfileTemplate)ior.getProfile(). - getTaggedProfileTemplate(); + IIOPProfileTemplate temp = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate(); Iterator iter = temp.iteratorById(TAG_CODE_SETS.value); if (!iter.hasNext()) { - // Didn't have a code set component. The default will + // Didn't have a code set component. The default will // be to use ISO8859-1 for char data and throw an // exception if wchar data is used. return; @@ -949,66 +887,60 @@ protected void performCodeSetNegotiation(MessageMediator messageMediator) { // Get the native and conversion code sets the // server specified in its IOR - CodeSetComponentInfo serverCodeSets - = ((CodeSetsComponent)iter.next()).getCodeSetComponentInfo(); + CodeSetComponentInfo serverCodeSets = ((CodeSetsComponent) iter.next()).getCodeSetComponentInfo(); // Perform the negotiation between this ORB's code sets and // the ones from the IOR - CodeSetComponentInfo.CodeSetContext result - = CodeSetConversion.impl().negotiate( - conn.getBroker().getORBData().getCodeSetComponentInfo(), - serverCodeSets); - + CodeSetComponentInfo.CodeSetContext result = CodeSetConversion.impl() + .negotiate(conn.getBroker().getORBData().getCodeSetComponentInfo(), serverCodeSets); + conn.setCodeSetContext(result); } } @Subcontract - protected void addCodeSetServiceContext(Connection conn, - ServiceContexts ctxs, GIOPVersion giopVersion) { + protected void addCodeSetServiceContext(Connection conn, ServiceContexts ctxs, GIOPVersion giopVersion) { - // REVISIT. OMG issue 3318 concerning sending the code set + // REVISIT. OMG issue 3318 concerning sending the code set // service context more than once was deemed too much for the - // RTF. Here's our strategy for the moment: + // RTF. Here's our strategy for the moment: // // Send it on every request (necessary in cases of fragmentation // with multithreaded clients or when the first thing on a - // connection is a LocateRequest). Provide an ORB property + // connection is a LocateRequest). Provide an ORB property // to disable multiple sends. // // Note that the connection is null in the local case and no - // service context is included. We use the ORB provided + // service context is included. We use the ORB provided // encapsulation streams. // // Also, there will be no negotiation or service context - // in GIOP 1.0. ISO8859-1 is used for char/string, and + // in GIOP 1.0. ISO8859-1 is used for char/string, and // wchar/wstring are illegal. // if (giopVersion.equals(GIOPVersion.V1_0) || conn == null) { return; } - + CodeSetComponentInfo.CodeSetContext codeSetCtx = null; - if (conn.getBroker().getORBData().alwaysSendCodeSetServiceContext() || - !conn.isPostInitialContexts()) { + if (conn.getBroker().getORBData().alwaysSendCodeSetServiceContext() || !conn.isPostInitialContexts()) { // Get the negotiated code sets (if any) out of the connection codeSetCtx = conn.getCodeSetContext(); } - + // Either we shouldn't send the code set service context, or // for some reason, the connection doesn't have its code sets. - // Perhaps the server didn't include them in the IOR. Uses + // Perhaps the server didn't include them in the IOR. Uses // ISO8859-1 for char and makes wchar/wstring illegal. if (codeSetCtx == null) { return; } - CodeSetServiceContext cssc = - ServiceContextDefaults.makeCodeSetServiceContext(codeSetCtx); + CodeSetServiceContext cssc = ServiceContextDefaults.makeCodeSetServiceContext(codeSetCtx); ctxs.put(cssc); - } + } @Subcontract protected String peekUserExceptionId(CDRInputObject inputObject) { @@ -1018,7 +950,7 @@ protected String peekUserExceptionId(CDRInputObject inputObject) { String result = cdrInputObject.read_string(); cdrInputObject.reset(); return result; - } + } } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/FullServantCacheLocalCRDImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/FullServantCacheLocalCRDImpl.java index 2883584da..abeae3a90 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/FullServantCacheLocalCRDImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/FullServantCacheLocalCRDImpl.java @@ -19,56 +19,53 @@ package com.sun.corba.ee.impl.protocol; -import org.omg.CORBA.portable.ServantObject ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.oa.OAInvocationInfo ; +import org.omg.CORBA.portable.ServantObject; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.oa.OAInvocationInfo; import com.sun.corba.ee.spi.oa.OADestroyed; import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.trace.Subcontract; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Subcontract -public class FullServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase -{ - public FullServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior ) - { - super( orb, scid, ior ) ; +public class FullServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase { + public FullServantCacheLocalCRDImpl(ORB orb, int scid, IOR ior) { + super(orb, scid, ior); } @Subcontract @Override - public ServantObject internalPreinvoke( org.omg.CORBA.Object self, - String operation, Class expectedType ) throws OADestroyed { + public ServantObject internalPreinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) throws OADestroyed { - OAInvocationInfo cachedInfo = getCachedInfo() ; - if (!checkForCompatibleServant( cachedInfo, expectedType )) { + OAInvocationInfo cachedInfo = getCachedInfo(); + if (!checkForCompatibleServant(cachedInfo, expectedType)) { return null; } // Note that info is shared across multiple threads // using the same subcontract, each of which may - // have its own operation. Therefore we need to clone it. - OAInvocationInfo newInfo = new OAInvocationInfo( cachedInfo, operation ) ; - newInfo.oa().enter() ; - orb.pushInvocationInfo( newInfo ) ; - return newInfo ; + // have its own operation. Therefore we need to clone it. + OAInvocationInfo newInfo = new OAInvocationInfo(cachedInfo, operation); + newInfo.oa().enter(); + orb.pushInvocationInfo(newInfo); + return newInfo; } @Subcontract - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servantobj) { + public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servantobj) { try { - OAInvocationInfo cachedInfo = getCachedInfo() ; - cachedInfo.oa().exit() ; + OAInvocationInfo cachedInfo = getCachedInfo(); + cachedInfo.oa().exit(); } catch (OADestroyed oades) { - caughtOADestroyed() ; + caughtOADestroyed(); // ignore this: if I can't get the OA, I don't // need to call exit on it. } finally { - orb.popInvocationInfo() ; + orb.popInvocationInfo(); } } @InfoMethod - private void caughtOADestroyed() { } + private void caughtOADestroyed() { + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/INSServerRequestDispatcher.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/INSServerRequestDispatcher.java index 3fa0af086..aa44bea7e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/INSServerRequestDispatcher.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/INSServerRequestDispatcher.java @@ -29,55 +29,46 @@ import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** - * INSServerRequestDispatcher handles all INS related discovery request. The INS Service - * can be registered using ORB.register_initial_reference(). - * This Singleton subcontract just - * finds the target IOR and does location forward. - * XXX PI points are not invoked in either dispatch() or locate() method this - * should be fixed in Tiger. - */ -public class INSServerRequestDispatcher - implements ServerRequestDispatcher -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + * INSServerRequestDispatcher handles all INS related discovery request. The INS Service can be registered using + * ORB.register_initial_reference(). This Singleton subcontract just finds the target IOR and does location forward. XXX + * PI points are not invoked in either dispatch() or locate() method this should be fixed in Tiger. + */ +public class INSServerRequestDispatcher implements ServerRequestDispatcher { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private ORB orb = null; - public INSServerRequestDispatcher( ORB orb ) { + public INSServerRequestDispatcher(ORB orb) { this.orb = orb; } // Need to signal one of OBJECT_HERE, OBJECT_FORWARD, OBJECT_NOT_EXIST. - public IOR locate(ObjectKey okey) { - // send a locate forward with the right IOR. If the insKey is not + public IOR locate(ObjectKey okey) { + // send a locate forward with the right IOR. If the insKey is not // registered then it will throw OBJECT_NOT_EXIST Exception - String insKey = new String( okey.getBytes(orb) ); - return getINSReference( insKey ); + String insKey = new String(okey.getBytes(orb)); + return getINSReference(insKey); } - public void dispatch(MessageMediator request) - { - // send a locate forward with the right IOR. If the insKey is not + public void dispatch(MessageMediator request) { + // send a locate forward with the right IOR. If the insKey is not // registered then it will throw OBJECT_NOT_EXIST Exception - String insKey = new String( - request.getObjectKeyCacheEntry().getObjectKey().getBytes(orb) ); - request.getProtocolHandler() - .createLocationForward(request, getINSReference( insKey ), null); + String insKey = new String(request.getObjectKeyCacheEntry().getObjectKey().getBytes(orb)); + request.getProtocolHandler().createLocationForward(request, getINSReference(insKey), null); return; } /** * getINSReference if it is registered in INSObjectKeyMap. */ - private IOR getINSReference( String insKey ) { - IOR entry = orb.getIOR( orb.getLocalResolver().resolve( insKey ), false ) ; - if( entry != null ) { + private IOR getINSReference(String insKey) { + IOR entry = orb.getIOR(orb.getLocalResolver().resolve(insKey), false); + if (entry != null) { // If entry is not null then the locate is with an INS Object key, // so send a location forward with the right IOR. return entry; } - throw wrapper.servantNotFound() ; + throw wrapper.servantNotFound(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java index d3ea9278d..2fc1842b5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java @@ -19,44 +19,38 @@ package com.sun.corba.ee.impl.protocol; -import org.omg.CORBA.portable.ServantObject ; +import org.omg.CORBA.portable.ServantObject; -import com.sun.corba.ee.spi.oa.OAInvocationInfo ; +import com.sun.corba.ee.spi.oa.OAInvocationInfo; import com.sun.corba.ee.spi.oa.OADestroyed; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher; import com.sun.corba.ee.spi.ior.IOR; -public class InfoOnlyServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase -{ - public InfoOnlyServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior ) - { - super( (com.sun.corba.ee.spi.orb.ORB)orb, scid, ior ) ; +public class InfoOnlyServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase { + public InfoOnlyServantCacheLocalCRDImpl(ORB orb, int scid, IOR ior) { + super((com.sun.corba.ee.spi.orb.ORB) orb, scid, ior); } - public ServantObject internalPreinvoke( org.omg.CORBA.Object self, - String operation, Class expectedType ) throws OADestroyed - { - OAInvocationInfo cachedInfo = getCachedInfo() ; - if (!checkForCompatibleServant( cachedInfo, expectedType )) - return null ; + public ServantObject internalPreinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) throws OADestroyed { + OAInvocationInfo cachedInfo = getCachedInfo(); + if (!checkForCompatibleServant(cachedInfo, expectedType)) + return null; // Note that info is shared across multiple threads // using the same subcontract, each of which may - // have its own operation. Therefore we need to copy it. - OAInvocationInfo info = new OAInvocationInfo(cachedInfo, operation) ; - orb.pushInvocationInfo( info ) ; + // have its own operation. Therefore we need to copy it. + OAInvocationInfo info = new OAInvocationInfo(cachedInfo, operation); + orb.pushInvocationInfo(info); - return info ; + return info; } - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servantobj) - { - orb.popInvocationInfo() ; + public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servantobj) { + orb.popInvocationInfo(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/InvocationInfo.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/InvocationInfo.java index c2c10029b..5de79184f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/InvocationInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/InvocationInfo.java @@ -31,8 +31,7 @@ /** * @author Harold Carr */ -public class InvocationInfo implements ClientInvocationInfo -{ +public class InvocationInfo implements ClientInvocationInfo { // REVISIT - these needs to be an interface-based impl. private boolean isRetryInvocation; @@ -40,65 +39,53 @@ public class InvocationInfo implements ClientInvocationInfo private Iterator contactInfoListIterator; private ClientRequestDispatcher clientRequestDispatcher; private MessageMediator messageMediator; - - public InvocationInfo() - { + + public InvocationInfo() { isRetryInvocation = false; entryCount = 0; } - - public Iterator getContactInfoListIterator() - { + + public Iterator getContactInfoListIterator() { return contactInfoListIterator; } - - public void setContactInfoListIterator(Iterator contactInfoListIterator) - { + + public void setContactInfoListIterator(Iterator contactInfoListIterator) { this.contactInfoListIterator = contactInfoListIterator; } - - public boolean isRetryInvocation() - { + + public boolean isRetryInvocation() { return isRetryInvocation; } - - public void setIsRetryInvocation(boolean isRetryInvocation) - { + + public void setIsRetryInvocation(boolean isRetryInvocation) { this.isRetryInvocation = isRetryInvocation; } - - public int getEntryCount() - { + + public int getEntryCount() { return entryCount; } - - public void incrementEntryCount() - { + + public void incrementEntryCount() { entryCount++; } - - public void decrementEntryCount() - { + + public void decrementEntryCount() { entryCount--; } - - public void setClientRequestDispatcher(ClientRequestDispatcher clientRequestDispatcher) - { + + public void setClientRequestDispatcher(ClientRequestDispatcher clientRequestDispatcher) { this.clientRequestDispatcher = clientRequestDispatcher; } - public ClientRequestDispatcher getClientRequestDispatcher() - { + public ClientRequestDispatcher getClientRequestDispatcher() { return clientRequestDispatcher; } - public void setMessageMediator(MessageMediator messageMediator) - { + public void setMessageMediator(MessageMediator messageMediator) { this.messageMediator = messageMediator; } - public MessageMediator getMessageMediator() - { + public MessageMediator getMessageMediator() { return messageMediator; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/JIDLLocalCRDImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/JIDLLocalCRDImpl.java index ad85a9e5e..3911be22c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/JIDLLocalCRDImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/JIDLLocalCRDImpl.java @@ -23,55 +23,45 @@ import org.omg.CORBA.portable.ServantObject; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.ior.IOR ; - - -public class JIDLLocalCRDImpl extends LocalClientRequestDispatcherBase -{ - public JIDLLocalCRDImpl( ORB orb, int scid, IOR ior ) - { - super( (com.sun.corba.ee.spi.orb.ORB)orb, scid, ior ) ; +public class JIDLLocalCRDImpl extends LocalClientRequestDispatcherBase { + public JIDLLocalCRDImpl(ORB orb, int scid, IOR ior) { + super((com.sun.corba.ee.spi.orb.ORB) orb, scid, ior); } protected ServantObject servant; - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType) - { - if (!checkForCompatibleServant( servant, expectedType )) - return null ; + public ServantObject servant_preinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) { + if (!checkForCompatibleServant(servant, expectedType)) + return null; return servant; } - public void servant_postinvoke( org.omg.CORBA.Object self, - ServantObject servant ) - { + public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servant) { // NO-OP } // REVISIT - This is called from TOAImpl. - public void setServant( java.lang.Object servant ) - { + public void setServant(java.lang.Object servant) { if (servant != null && servant instanceof Tie) { this.servant = new ServantObject(); - this.servant.servant = ((Tie)servant).getTarget(); + this.servant.servant = ((Tie) servant).getTarget(); } else { this.servant = null; - } + } } public void unexport() { - // DO NOT set the IOR to null. (Un)exporting is only concerns - // the servant not the IOR. If the ior is set to null then + // DO NOT set the IOR to null. (Un)exporting is only concerns + // the servant not the IOR. If the ior is set to null then // null pointer exceptions happen during a colocated invocation. // It is better to let the invocation proceed and get OBJECT_NOT_EXIST // from the server side. - //ior = null; + // ior = null; servant = null; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/LocalClientRequestDispatcherBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/LocalClientRequestDispatcherBase.java index be382673c..24cc13f96 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/LocalClientRequestDispatcherBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/LocalClientRequestDispatcherBase.java @@ -19,26 +19,25 @@ package com.sun.corba.ee.impl.protocol; -import org.omg.CORBA.TRANSIENT ; -import org.omg.CORBA.SystemException ; +import org.omg.CORBA.TRANSIENT; +import org.omg.CORBA.SystemException; import org.omg.CORBA.portable.ServantObject; - import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher; import com.sun.corba.ee.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.ee.spi.protocol.ForwardException ; +import com.sun.corba.ee.spi.protocol.ForwardException; import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.oa.ObjectAdapterFactory; -import com.sun.corba.ee.spi.oa.OADestroyed ; +import com.sun.corba.ee.spi.oa.OADestroyed; import com.sun.corba.ee.spi.ior.ObjectAdapterId; import com.sun.corba.ee.spi.ior.TaggedProfile; import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; -import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.ObjectId; import com.sun.corba.ee.spi.logging.POASystemException; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; @@ -49,32 +48,29 @@ @Subcontract @IsLocal -public abstract class LocalClientRequestDispatcherBase implements LocalClientRequestDispatcher -{ - protected static final POASystemException poaWrapper = - POASystemException.self ; - protected static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public abstract class LocalClientRequestDispatcherBase implements LocalClientRequestDispatcher { + protected static final POASystemException poaWrapper = POASystemException.self; + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // XXX May want to make some of this configuratble as in the remote case - // Should this be unified? How can we better handle this retry/backoff + // Should this be unified? How can we better handle this retry/backoff // implementation with a single implementation? - private static final int INITIAL_BACKOFF = 1 ; // initially start off very small - // because 1 millisecond is a long time for a local call. - - private static final int MAX_BACKOFF = 1000 ; // Never sleep longer than this - private static final int MAX_WAIT_TIME = 10 * 1000 ; // Total time to wait for a local request. + private static final int INITIAL_BACKOFF = 1; // initially start off very small + // because 1 millisecond is a long time for a local call. + + private static final int MAX_BACKOFF = 1000; // Never sleep longer than this + private static final int MAX_WAIT_TIME = 10 * 1000; // Total time to wait for a local request. protected ORB orb; private int scid; // Cached information needed for local dispatch - protected boolean servantIsLocal ; - protected ObjectAdapterFactory oaf ; - protected ObjectAdapterId oaid ; - protected byte[] objectId ; + protected boolean servantIsLocal; + protected ObjectAdapterFactory oaf; + protected ObjectAdapterId oaid; + protected byte[] objectId; - // If isNextIsLocalValid.get() == Boolean.TRUE, + // If isNextIsLocalValid.get() == Boolean.TRUE, // the next call to isLocal should be valid private static final ThreadLocal isNextCallValid = new ThreadLocal() { @Override @@ -83,193 +79,178 @@ protected synchronized Object initialValue() { } }; - protected LocalClientRequestDispatcherBase(ORB orb, int scid, IOR ior) - { - this.orb = orb ; - - TaggedProfile prof = ior.getProfile() ; - servantIsLocal = orb.getORBData().isLocalOptimizationAllowed() && - prof.isLocal(); - - ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate() ; - this.scid = oktemp.getSubcontractId() ; - RequestDispatcherRegistry sreg = orb.getRequestDispatcherRegistry() ; - oaf = sreg.getObjectAdapterFactory( scid ) ; - oaid = oktemp.getObjectAdapterId() ; - ObjectId oid = prof.getObjectId() ; - objectId = oid.getId() ; + protected LocalClientRequestDispatcherBase(ORB orb, int scid, IOR ior) { + this.orb = orb; + + TaggedProfile prof = ior.getProfile(); + servantIsLocal = orb.getORBData().isLocalOptimizationAllowed() && prof.isLocal(); + + ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate(); + this.scid = oktemp.getSubcontractId(); + RequestDispatcherRegistry sreg = orb.getRequestDispatcherRegistry(); + oaf = sreg.getObjectAdapterFactory(scid); + oaid = oktemp.getObjectAdapterId(); + ObjectId oid = prof.getObjectId(); + objectId = oid.getId(); } - public byte[] getObjectId() - { - return objectId ; + public byte[] getObjectId() { + return objectId; } @IsLocal - public boolean is_local(org.omg.CORBA.Object self) - { + public boolean is_local(org.omg.CORBA.Object self) { return false; } /* - * Possible paths through - * useLocalInvocation/servant_preinvoke/servant_postinvoke: - * - * A: call useLocalInvocation - * If useLocalInvocation returns false, servant_preinvoke is not called. - * If useLocalInvocation returns true, - * call servant_preinvoke - * If servant_preinvoke returns null, - * goto A - * else - * (local invocation proceeds normally) - * servant_postinvoke is called - * - */ + * Possible paths through useLocalInvocation/servant_preinvoke/servant_postinvoke: + * + * A: call useLocalInvocation If useLocalInvocation returns false, servant_preinvoke is not called. If + * useLocalInvocation returns true, call servant_preinvoke If servant_preinvoke returns null, goto A else (local + * invocation proceeds normally) servant_postinvoke is called + * + */ @IsLocal - public boolean useLocalInvocation( org.omg.CORBA.Object self ) - { + public boolean useLocalInvocation(org.omg.CORBA.Object self) { if (isNextCallValid.get() == Boolean.TRUE) { return servantIsLocal; } else { isNextCallValid.set(Boolean.TRUE); } - return false ; + return false; } @InfoMethod - private void servantNotCompatible() {} + private void servantNotCompatible() { + } - /** Check that the servant in info (which must not be null) is - * an instance of the expectedType. If not, set the thread local flag - * and return false. + /** + * Check that the servant in info (which must not be null) is an instance of the expectedType. If not, set the thread + * local flag and return false. + * * @param so Servant to check * @param expectedType Type to check against * @return If the servant is an instance of the expected type - */ + */ @IsLocal - protected boolean checkForCompatibleServant( ServantObject so, Class expectedType ) { + protected boolean checkForCompatibleServant(ServantObject so, Class expectedType) { if (so == null) { return false; } - // Normally, this test will never fail. However, if the servant + // Normally, this test will never fail. However, if the servant // and the stub were loaded in different class loaders, this test // will fail. - if (!expectedType.isInstance( so.servant )) { - servantNotCompatible() ; - isNextCallValid.set( Boolean.FALSE ) ; + if (!expectedType.isInstance(so.servant)) { + servantNotCompatible(); + isNextCallValid.set(Boolean.FALSE); // When servant_preinvoke returns null, the stub will - // recursively re-invoke itself. Thus, the next call made from + // recursively re-invoke itself. Thus, the next call made from // the stub is another useLocalInvocation call. - return false ; + return false; } - return true ; + return true; } - // The actual servant_preinvoke implementation, which must be - // overridden. This method may throw exceptions + // The actual servant_preinvoke implementation, which must be + // overridden. This method may throw exceptions // which are handled by servant_preinvoke. - protected ServantObject internalPreinvoke( - org.omg.CORBA.Object self, String operation, - Class expectedType ) throws OADestroyed - { - return null ; + protected ServantObject internalPreinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) throws OADestroyed { + return null; } - // This method is called when OADestroyed is caught. This allows + // This method is called when OADestroyed is caught. This allows // subclasses to provide cleanup code if necessary. - protected void cleanupAfterOADestroyed() - { + protected void cleanupAfterOADestroyed() { // Default is NO-OP } @InfoMethod - private void display( String msg ) { } + private void display(String msg) { + } @InfoMethod - private void display( String msg, int value ) { } + private void display(String msg, int value) { + } @InfoMethod - private void display( String msg, Object value ) { } - + private void display(String msg, Object value) { + } // servant_preinvoke is here to contain the exception handling // logic that is common to all POA based servant_preinvoke implementations. @Subcontract - public ServantObject servant_preinvoke( org.omg.CORBA.Object self, - String operation, Class expectedType ) { + public ServantObject servant_preinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) { - long startTime = -1 ; - long backoff = INITIAL_BACKOFF ; - long maxWait = MAX_WAIT_TIME ; + long startTime = -1; + long backoff = INITIAL_BACKOFF; + long maxWait = MAX_WAIT_TIME; while (true) { try { - display( "Calling internalPreinvoke") ; - return internalPreinvoke( self, operation, expectedType ) ; + display("Calling internalPreinvoke"); + return internalPreinvoke(self, operation, expectedType); } catch (OADestroyed pdes) { - display( "Caught OADestroyed: will retry") ; - cleanupAfterOADestroyed() ; + display("Caught OADestroyed: will retry"); + cleanupAfterOADestroyed(); } catch (TRANSIENT exc) { - display( "Caught transient") ; + display("Caught transient"); // Local calls are very fast, so don't waste time setting // up to track the time UNLESS the first attempt fails // with a TRANSIENT exception. - long currentTime = System.currentTimeMillis() ; + long currentTime = System.currentTimeMillis(); // Delay if not too much time passed, otherwise re-throw // the TRANSIENT exception. if (startTime == -1) { - display( "backoff (first retry)", backoff ) ; - startTime = currentTime ; - } else if ((currentTime-startTime) > MAX_WAIT_TIME) { - display( "Total time exceeded", MAX_WAIT_TIME ) ; - throw exc ; + display("backoff (first retry)", backoff); + startTime = currentTime; + } else if ((currentTime - startTime) > MAX_WAIT_TIME) { + display("Total time exceeded", MAX_WAIT_TIME); + throw exc; } else { - backoff *= 2 ; + backoff *= 2; if (backoff > MAX_BACKOFF) { - backoff = MAX_BACKOFF ; + backoff = MAX_BACKOFF; } - display( "increasing backoff (will retry)", backoff ) ; + display("increasing backoff (will retry)", backoff); } try { - Thread.sleep( backoff ) ; + Thread.sleep(backoff); } catch (InterruptedException iexc) { // As usual, ignore the possible InterruptedException } - display( "retry" ) ; - } catch ( ForwardException ex ) { - /* REVISIT - ClientRequestDispatcher csub = (ClientRequestDispatcher) - StubAdapter.getDelegate( ex.forward_reference ) ; - IOR ior = csub.getIOR() ; - setLocatedIOR( ior ) ; - */ - display( "Unsupported ForwardException" ) ; - throw new RuntimeException("deal with this.", ex) ; - } catch ( ThreadDeath ex ) { + display("retry"); + } catch (ForwardException ex) { + /* + * REVISIT ClientRequestDispatcher csub = (ClientRequestDispatcher) StubAdapter.getDelegate( ex.forward_reference ) ; + * IOR ior = csub.getIOR() ; setLocatedIOR( ior ) ; + */ + display("Unsupported ForwardException"); + throw new RuntimeException("deal with this.", ex); + } catch (ThreadDeath ex) { // ThreadDeath on the server side should not cause a client - // side thread death in the local case. We want to preserve + // side thread death in the local case. We want to preserve // this behavior for location transparency, so that a ThreadDeath // has the same affect in either the local or remote case. // The non-colocated case is handled in iiop.ORB.process, which // throws the same exception. - display( "Caught ThreadDeath") ; - throw wrapper.runtimeexception( ex, ex.getClass().getName(), ex.getMessage() ) ; - } catch ( Throwable t ) { - display( "Caught Throwable") ; + display("Caught ThreadDeath"); + throw wrapper.runtimeexception(ex, ex.getClass().getName(), ex.getMessage()); + } catch (Throwable t) { + display("Caught Throwable"); if (t instanceof SystemException) - throw (SystemException)t ; + throw (SystemException) t; - throw poaWrapper.localServantLookup( t ) ; + throw poaWrapper.localServantLookup(t); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MessageMediatorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MessageMediatorImpl.java index 2c1615412..084f902ec 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MessageMediatorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MessageMediatorImpl.java @@ -90,17 +90,9 @@ */ @Subcontract @Transport -public class MessageMediatorImpl - implements - MessageMediator, - ProtocolHandler, - MessageHandler, - Work -{ - protected static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - protected static final InterceptorsSystemException interceptorWrapper = - InterceptorsSystemException.self ; +public class MessageMediatorImpl implements MessageMediator, ProtocolHandler, MessageHandler, Work { + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + protected static final InterceptorsSystemException interceptorWrapper = InterceptorsSystemException.self; protected ORB orb; protected ContactInfo contactInfo; @@ -127,9 +119,9 @@ public class MessageMediatorImpl protected boolean _executeRemoveThreadInfoInResponseConstructor = false; protected boolean _executePIInResponseConstructor = false; - // The localMaxVersion is used for caching the value of - //MaxStreamFormatVersion if the ORB has been created by the app server - private static byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion(); + // The localMaxVersion is used for caching the value of + // MaxStreamFormatVersion if the ORB has been created by the app server + private static byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion(); // time this CorbaMessageMediator (Work) was added to a WorkQueue. private long enqueueTime; @@ -137,51 +129,34 @@ public class MessageMediatorImpl // // Client-side constructor. // - public MessageMediatorImpl(ORB orb, - ContactInfo contactInfo, - Connection connection, - GIOPVersion giopVersion, - IOR ior, - int requestId, - short addrDisposition, - String operationName, - boolean isOneWay) - { - this( orb, connection ) ; - + public MessageMediatorImpl(ORB orb, ContactInfo contactInfo, Connection connection, GIOPVersion giopVersion, IOR ior, int requestId, + short addrDisposition, String operationName, boolean isOneWay) { + this(orb, connection); + this.contactInfo = contactInfo; this.addrDisposition = addrDisposition; - streamFormatVersion = getStreamFormatVersionForThisRequest( - this.contactInfo.getEffectiveTargetIOR(), giopVersion); + streamFormatVersion = getStreamFormatVersionForThisRequest(this.contactInfo.getEffectiveTargetIOR(), giopVersion); - /* Assuming streamFormatVersion can be set to 2 here - * here breaks interoperability - * with SAP, who has an ORB that does not support SFV 2 in - * GIOP 1.2. So we can't optimize this here. - if (orb.getORBData().isAppServerMode() == true) { - streamFormatVersion = localMaxVersion; - } - */ + /* + * Assuming streamFormatVersion can be set to 2 here here breaks interoperability with SAP, who has an ORB that does not + * support SFV 2 in GIOP 1.2. So we can't optimize this here. if (orb.getORBData().isAppServerMode() == true) { + * streamFormatVersion = localMaxVersion; } + */ streamFormatVersionSet = true; - byte encodingVersion = - ORBUtility.chooseEncodingVersion(orb, ior, giopVersion); + byte encodingVersion = ORBUtility.chooseEncodingVersion(orb, ior, giopVersion); ORBUtility.pushEncVersionToThreadLocalState(encodingVersion); - requestHeader = MessageBase.createRequest(this.orb, giopVersion, - encodingVersion, requestId, !isOneWay, - this.contactInfo.getEffectiveTargetIOR(), this.addrDisposition, - operationName, - ServiceContextDefaults.makeServiceContexts(orb), null); + requestHeader = MessageBase.createRequest(this.orb, giopVersion, encodingVersion, requestId, !isOneWay, + this.contactInfo.getEffectiveTargetIOR(), this.addrDisposition, operationName, + ServiceContextDefaults.makeServiceContexts(orb), null); } // // Acceptor constructor. // - private MessageMediatorImpl(ORB orb, - Connection connection) - { + private MessageMediatorImpl(ORB orb, Connection connection) { this.orb = orb; this.connection = connection; } @@ -190,15 +165,11 @@ private MessageMediatorImpl(ORB orb, // Dispatcher constructor. // - // Note: in some cases (e.g., a reply message) this message - // mediator will only be used for dispatch. Then the original - // request side mediator will take over. - public MessageMediatorImpl(ORB orb, - Connection connection, - Message dispatchHeader, - ByteBuffer byteBuffer) - { - this( orb, connection ) ; + // Note: in some cases (e.g., a reply message) this message + // mediator will only be used for dispatch. Then the original + // request side mediator will take over. + public MessageMediatorImpl(ORB orb, Connection connection, Message dispatchHeader, ByteBuffer byteBuffer) { + this(orb, connection); this.dispatchHeader = dispatchHeader; this.dispatchByteBuffer = byteBuffer; } @@ -261,13 +232,13 @@ public CDRInputObject getInputObject() { public void setReplyHeader(LocateReplyOrReplyMessage header) { this.replyHeader = header; - this.replyIOR = header.getIOR(); + this.replyIOR = header.getIOR(); } public LocateReplyMessage getLocateReplyHeader() { return (LocateReplyMessage) replyHeader; } - + public ReplyMessage getReplyHeader() { return (ReplyMessage) replyHeader; } @@ -275,18 +246,18 @@ public ReplyMessage getReplyHeader() { public void setReplyExceptionDetailMessage(String message) { replyExceptionDetailMessage = message; } - + public RequestMessage getRequestHeader() { return requestHeader; } - + public GIOPVersion getGIOPVersion() { if (messageHeader != null) { - return messageHeader.getGIOPVersion() ; + return messageHeader.getGIOPVersion(); } if (getRequestHeader() == null) { - return GIOPVersion.V1_2 ; + return GIOPVersion.V1_2; } return getRequestHeader().getGIOPVersion(); @@ -294,11 +265,11 @@ public GIOPVersion getGIOPVersion() { public byte getEncodingVersion() { if (messageHeader != null) { - return messageHeader.getEncodingVersion() ; + return messageHeader.getEncodingVersion(); } if (getRequestHeader() == null) { - return 0 ; + return 0; } return getRequestHeader().getEncodingVersion(); @@ -306,7 +277,7 @@ public byte getEncodingVersion() { public int getRequestId() { if (getRequestHeader() == null) { - return -1 ; + return -1; } return getRequestHeader().getRequestId(); @@ -314,15 +285,15 @@ public int getRequestId() { public boolean isOneWay() { if (getRequestHeader() == null) { - return false ; + return false; } - return ! getRequestHeader().isResponseExpected(); + return !getRequestHeader().isResponseExpected(); } public String getOperationName() { if (getRequestHeader() == null) { - return "UNKNOWN" ; + return "UNKNOWN"; } return getRequestHeader().getOperation(); @@ -330,7 +301,7 @@ public String getOperationName() { public ServiceContexts getRequestServiceContexts() { if (getRequestHeader() == null) { - return null ; + return null; } return getRequestHeader().getServiceContexts(); @@ -346,14 +317,12 @@ public ServiceContexts getReplyServiceContexts() { @Subcontract public void sendCancelRequestIfFinalFragmentNotSent() { - if ((!sentFullMessage()) && sentFragment() && - (!cancelRequestAlreadySent) && !connection.isClosed()) { + if ((!sentFullMessage()) && sentFragment() && (!cancelRequestAlreadySent) && !connection.isClosed()) { try { - connection.sendCancelRequestWithLock(getGIOPVersion(), - getRequestId()); - // Case: first a location forward, then a marshaling - // exception (e.g., non-serializable object). Only + connection.sendCancelRequestWithLock(getGIOPVersion(), getRequestId()); + // Case: first a location forward, then a marshaling + // exception (e.g., non-serializable object). Only // send cancel once. cancelRequestAlreadySent = true; } catch (SystemException se) { @@ -363,7 +332,7 @@ public void sendCancelRequestIfFinalFragmentNotSent() { throw se; } } catch (IOException e) { - throw interceptorWrapper.ioexceptionDuringCancelRequest( e ); + throw interceptorWrapper.ioexceptionDuringCancelRequest(e); } } } @@ -380,15 +349,14 @@ public boolean sentFullMessage() { @Subcontract public boolean sentFragment() { if (outputObject != null) { - BufferManagerWrite buffMan = - outputObject.getBufferManager() ; + BufferManagerWrite buffMan = outputObject.getBufferManager(); if (buffMan != null) { return outputObject.getBufferManager().sentFragment(); } } - return false ; + return false; } public void setDIIInfo(org.omg.CORBA.Request diiRequest) { @@ -401,7 +369,7 @@ public boolean isDIIRequest() { @Subcontract public Exception unmarshalDIIUserException(String repoId, InputStream is) { - if (! isDIIRequest()) { + if (!isDIIRequest()) { return null; } @@ -409,9 +377,9 @@ public Exception unmarshalDIIUserException(String repoId, InputStream is) { try { // Find the typecode for the exception - for (int i=0; i<_exceptions.count() ; i++) { + for (int i = 0; i < _exceptions.count(); i++) { TypeCode tc = _exceptions.item(i); - if ( tc.id().equals(repoId) ) { + if (tc.id().equals(repoId)) { // Since we dont have the actual user exception // class, the spec says we have to create an // UnknownUserException and put it in the @@ -427,7 +395,7 @@ public Exception unmarshalDIIUserException(String repoId, InputStream is) { } // must be a truly unknown exception - return wrapper.unknownCorbaExc() ; + return wrapper.unknownCorbaExc(); } public void setDIIException(Exception exception) { @@ -435,10 +403,10 @@ public void setDIIException(Exception exception) { } public void handleDIIReply(InputStream inputStream) { - if (! isDIIRequest()) { + if (!isDIIRequest()) { return; } - ((RequestImpl)diiRequest).unmarshalReply(inputStream); + ((RequestImpl) diiRequest).unmarshalReply(inputStream); } public Message getDispatchHeader() { @@ -457,20 +425,21 @@ public int getThreadPoolToUse() { } @InfoMethod - private void reportException( String msg, Throwable thr ) { } + private void reportException(String msg, Throwable thr) { + } @InfoMethod - private void reportConnection( Connection conn ) { } + private void reportConnection(Connection conn) { + } /** * NOTE: * - * This call is the transition from the transport block to the protocol - * block. - */ + * This call is the transition from the transport block to the protocol block. + */ @Transport public boolean dispatch() { - reportConnection( connection ) ; + reportConnection(connection); try { boolean result = getProtocolHandler().handleRequest(this); @@ -479,11 +448,11 @@ public boolean dispatch() { try { connection.purgeCalls(wrapper.connectionAbort(td), false, false); } catch (Throwable t) { - reportException( "ThreadDeatch exception in dispatch", t ); + reportException("ThreadDeatch exception in dispatch", t); } throw td; } catch (Throwable ex) { - reportException( "Exception in dispatch", ex ) ; + reportException("Exception in dispatch", ex); try { if (ex instanceof INTERNAL) { @@ -497,12 +466,11 @@ public boolean dispatch() { return true; } - public byte getStreamFormatVersion() - { + public byte getStreamFormatVersion() { // REVISIT: ContactInfo/Acceptor output object factories - // just use this. Maybe need to distinguish: - // createOutputObjectForRequest - // createOutputObjectForReply + // just use this. Maybe need to distinguish: + // createOutputObjectForRequest + // createOutputObjectForReply // then do getStreamFormatVersionForRequest/ForReply here. if (streamFormatVersionSet) { return streamFormatVersion; @@ -511,13 +479,11 @@ public byte getStreamFormatVersion() } /** - * If the RMI-IIOP maximum stream format version service context - * is present, it indicates the maximum stream format version we - * could use for the reply. If it isn't present, the default is - * 2 for GIOP 1.3 or greater, 1 for lower. + * If the RMI-IIOP maximum stream format version service context is present, it indicates the maximum stream format + * version we could use for the reply. If it isn't present, the default is 2 for GIOP 1.3 or greater, 1 for lower. * - * This is only sent on requests. Clients can find out the - * server's maximum by looking for a tagged component in the IOR. + * This is only sent on requests. Clients can find out the server's maximum by looking for a tagged component in the + * IOR. */ @Transport public byte getStreamFormatVersionForReply() { @@ -525,14 +491,13 @@ public byte getStreamFormatVersionForReply() { // NOTE: The request service contexts may indicate the max. ServiceContexts svc = getRequestServiceContexts(); - MaxStreamFormatVersionServiceContext msfvsc - = (MaxStreamFormatVersionServiceContext)svc.get( - MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID); - + MaxStreamFormatVersionServiceContext msfvsc = (MaxStreamFormatVersionServiceContext) svc + .get(MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID); + if (msfvsc != null) { byte remoteMaxVersion = msfvsc.getMaximumStreamFormatVersion(); - return (byte)Math.min(localMaxVersion, remoteMaxVersion); + return (byte) Math.min(localMaxVersion, remoteMaxVersion); } else { // Defaults to 1 for GIOP 1.2 or less, 2 for // GIOP 1.3 or higher. @@ -553,19 +518,19 @@ public boolean isUserExceptionReply() { } public boolean isLocationForwardReply() { - return ( (replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD) || - (replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD_PERM) ); - //return replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD; + return ((replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD) + || (replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD_PERM)); + // return replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD; } - + public boolean isDifferentAddrDispositionRequestedReply() { return replyHeader.getReplyStatus() == ReplyMessage.NEEDS_ADDRESSING_MODE; } - + public short getAddrDispositionReply() { return replyHeader.getAddrDisposition(); } - + public IOR getForwardedIOR() { return replyHeader.getIOR(); } @@ -577,10 +542,10 @@ public SystemException getSystemExceptionReply() { //////////////////////////////////////////////////// // // Used by server side. - // + // public ObjectKeyCacheEntry getObjectKeyCacheEntry() { - return getRequestHeader().getObjectKeyCacheEntry() ; + return getRequestHeader().getObjectKeyCacheEntry(); } public ProtocolHandler getProtocolHandler() { @@ -627,17 +592,15 @@ public boolean executePIInResponseConstructor() { return _executePIInResponseConstructor; } - public void setExecutePIInResponseConstructor( boolean b ) { + public void setExecutePIInResponseConstructor(boolean b) { _executePIInResponseConstructor = b; } @Transport private byte getStreamFormatVersionForThisRequest(IOR ior, GIOPVersion giopVersion) { - IOR effectiveTargetIOR = - this.contactInfo.getEffectiveTargetIOR(); - IIOPProfileTemplate temp = - (IIOPProfileTemplate)effectiveTargetIOR.getProfile().getTaggedProfileTemplate(); + IOR effectiveTargetIOR = this.contactInfo.getEffectiveTargetIOR(); + IIOPProfileTemplate temp = (IIOPProfileTemplate) effectiveTargetIOR.getProfile().getTaggedProfileTemplate(); Iterator iter = temp.iteratorById(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value); if (!iter.hasNext()) { // Didn't have the max stream format version tagged @@ -649,10 +612,9 @@ private byte getStreamFormatVersionForThisRequest(IOR ior, GIOPVersion giopVersi } } - byte remoteMaxVersion - = ((MaxStreamFormatVersionComponent)iter.next()).getMaxStreamFormatVersion(); + byte remoteMaxVersion = ((MaxStreamFormatVersionComponent) iter.next()).getMaxStreamFormatVersion(); - return (byte)Math.min(localMaxVersion, remoteMaxVersion); + return (byte) Math.min(localMaxVersion, remoteMaxVersion); } //////////////////////////////////////////////////////////////////////// @@ -660,10 +622,9 @@ private byte getStreamFormatVersionForThisRequest(IOR ior, GIOPVersion giopVersi //////////////////////////////////////////////////////////////////////// // REVISIT - This could be a separate implementation object looked - // up in a registry. However it needs some state in the message + // up in a registry. However it needs some state in the message // mediator so combine for now. - protected boolean isThreadDone = false; @Transport @@ -681,11 +642,12 @@ public boolean handleRequest(MessageMediator messageMediator) { } @InfoMethod - private void messageInfo( Message msg, RequestId rid ) { } + private void messageInfo(Message msg, RequestId rid) { + } @InfoMethod - private void connectionInfo( Connection conn ) { } - + private void connectionInfo(Connection conn) { + } //////////////////////////////////////////////////// // @@ -694,7 +656,7 @@ private void connectionInfo( Connection conn ) { } @Transport private void resumeOptimizedReadProcessing(Message message) { - messageInfo( message, message.getCorbaRequestId() ) ; + messageInfo(message, message.getCorbaRequestId()); connectionInfo(connection); if (message.moreFragmentsToFollow()) { @@ -702,14 +664,13 @@ private void resumeOptimizedReadProcessing(Message message) { MessageMediator messageMediator = null; RequestId requestId = message.getCorbaRequestId(); - Queue queue = - connection.getFragmentList(requestId); + Queue queue = connection.getFragmentList(requestId); // REVISIT - In the future, the synchronized(queue), // wait()/notify() construct should be replaced // with something like a LinkedBlockingQueue // from java.util.concurrent using its offer() - // and poll() methods. But, at the time of the + // and poll() methods. But, at the time of the // writing of this code, a LinkedBlockingQueue // implementation is not performing as well as // the synchronized(queue), wait(), notify() @@ -738,31 +699,29 @@ private void resumeOptimizedReadProcessing(Message message) { // put the on the WorkQueue here. addMessageMediatorToWorkQueue(messageMediator); } else { - if (message.getType() == Message.GIOPFragment || - message.getType() == Message.GIOPCancelRequest) { + if (message.getType() == Message.GIOPFragment || message.getType() == Message.GIOPCancelRequest) { // applies to FragmentMessage_1_[1|2] and CancelRequestMessage // when using non-blocking NIO SocketChannels RequestId requestId = message.getCorbaRequestId(); - generalMessage( - "done processing fragments (removing fragment list)" ); + generalMessage("done processing fragments (removing fragment list)"); connection.removeFragmentList(requestId); } } } @InfoMethod - private void poolToUseInfo( int id ) { } + private void poolToUseInfo(int id) { + } @Transport private void addMessageMediatorToWorkQueue(final MessageMediator messageMediator) { // Add messageMediator to work queue Throwable throwable = null; - int poolToUse = -1 ; + int poolToUse = -1; try { poolToUse = messageMediator.getThreadPoolToUse(); - poolToUseInfo( poolToUse ) ; - orb.getThreadPoolManager().getThreadPool(poolToUse).getWorkQueue(0). - addWork((MessageMediatorImpl)messageMediator); + poolToUseInfo(poolToUse); + orb.getThreadPoolManager().getThreadPool(poolToUse).getWorkQueue(0).addWork((MessageMediatorImpl) messageMediator); } catch (NoSuchThreadPoolException e) { throwable = e; } catch (NoSuchWorkQueueException e) { @@ -772,7 +731,7 @@ private void addMessageMediatorToWorkQueue(final MessageMediator messageMediator // REVISIT: need to close connection? if (throwable != null) { reportException("exception from thread pool", throwable); - throw wrapper.noSuchThreadpoolOrQueue(throwable, poolToUse ); + throw wrapper.noSuchThreadpoolOrQueue(throwable, poolToUse); } } @@ -783,15 +742,13 @@ private void setWorkThenPoolOrResumeOptimizedRead(Message header) { } else { // Leader/Follower when using reader thread. // When this thread is done working it will go back in pool. - + isThreadDone = true; // First unregister current registration. - orb.getTransportManager().getSelector(0) - .unregisterForEvent(getConnection().getEventHandler()); + orb.getTransportManager().getSelector(0).unregisterForEvent(getConnection().getEventHandler()); // Have another thread become the reader. - orb.getTransportManager().getSelector(0) - .registerForEvent(getConnection().getEventHandler()); + orb.getTransportManager().getSelector(0).registerForEvent(getConnection().getEventHandler()); } } @@ -800,7 +757,7 @@ private void setWorkThenReadOrResumeOptimizedRead(Message header) { if (getConnection().getEventHandler().shouldUseSelectThreadToWait()) { resumeOptimizedReadProcessing(header); } else { - // When using reader thread then wen this thread is + // When using reader thread then wen this thread is // done working it will continue reading. isThreadDone = false; } @@ -815,8 +772,7 @@ private void signalResponseReceived() { // This will end up using the MessageMediator associated with // the original request instead of the current mediator (which // need to be constructed to hold the dispatchBuffer and connection). - connection.getResponseWaitingRoom() - .responseReceived(inputObject); + connection.getResponseWaitingRoom().responseReceived(inputObject); } // This handles message types for which we don't create classes. @@ -825,25 +781,25 @@ public void handleInput(Message header) throws IOException { messageHeader = header; setWorkThenReadOrResumeOptimizedRead(header); - switch(header.getType()) { - case Message.GIOPCloseConnection: - generalMessage( "close connection" ) ; - connection.purgeCalls(wrapper.connectionRebind(), true, false); - break; - case Message.GIOPMessageError: - generalMessage( "message error" ) ; - connection.purgeCalls(wrapper.recvMsgError(), true, false); - break; - default: - generalMessage( "default" ) ; - throw wrapper.badGiopRequestType() ; + switch (header.getType()) { + case Message.GIOPCloseConnection: + generalMessage("close connection"); + connection.purgeCalls(wrapper.connectionRebind(), true, false); + break; + case Message.GIOPMessageError: + generalMessage("message error"); + connection.purgeCalls(wrapper.recvMsgError(), true, false); + break; + default: + generalMessage("default"); + throw wrapper.badGiopRequestType(); } releaseByteBufferToPool(); } @Transport public void handleInput(RequestMessage_1_0 header) throws IOException { - generalMessage( "GIOP Request 1.0") ; + generalMessage("GIOP Request 1.0"); try { try { messageHeader = requestHeader = (RequestMessage) header; @@ -853,14 +809,14 @@ public void handleInput(RequestMessage_1_0 header) throws IOException { } getProtocolHandler().handleRequest(header, this); } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } } - + @Transport public void handleInput(RequestMessage_1_1 header) throws IOException { - generalMessage( "GIOP Request 1.1") ; + generalMessage("GIOP Request 1.1"); try { try { messageHeader = requestHeader = (RequestMessage) header; @@ -871,18 +827,19 @@ public void handleInput(RequestMessage_1_1 header) throws IOException { } getProtocolHandler().handleRequest(header, this); } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } } @InfoMethod - private void requestIdInfo( int id ) { } + private void requestIdInfo(int id) { + } // REVISIT: this is identical to 1_0 except for fragment part. @Transport public void handleInput(RequestMessage_1_2 header) throws IOException { - generalMessage("GIOP Request 1.2") ; + generalMessage("GIOP Request 1.2"); try { try { messageHeader = requestHeader = header; @@ -906,10 +863,10 @@ public void handleInput(RequestMessage_1_2 header) throws IOException { // is set. setWorkThenPoolOrResumeOptimizedRead(header); } - //inputObject.unmarshalHeader(); // done in subcontract. + // inputObject.unmarshalHeader(); // done in subcontract. getProtocolHandler().handleRequest(header, this); } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } finally { connection.serverRequestMapRemove(header.getRequestId()); @@ -922,7 +879,7 @@ private void unmarshalRequestID(Message_1_2 message) { @Transport public void handleInput(ReplyMessage_1_0 header) throws IOException { - generalMessage( "GIOP ReplyMessage 1.0") ; + generalMessage("GIOP ReplyMessage 1.0"); try { try { messageHeader = replyHeader = (ReplyMessage) header; @@ -932,18 +889,18 @@ public void handleInput(ReplyMessage_1_0 header) throws IOException { inputObject.unmarshalHeader(); signalResponseReceived(); - } finally{ + } finally { setWorkThenReadOrResumeOptimizedRead(header); } } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } } - + @Transport public void handleInput(ReplyMessage_1_1 header) throws IOException { - generalMessage( "GIOP ReplyMessage 1.1" ) ; + generalMessage("GIOP ReplyMessage 1.1"); try { messageHeader = replyHeader = (ReplyMessage) header; setInputObject(); @@ -952,9 +909,9 @@ public void handleInput(ReplyMessage_1_1 header) throws IOException { // More fragments are coming to complete this reply, so keep // a reference to the InputStream so we can add the fragments connection.clientReply_1_1_Put(this); - + // In 1.1, we can't assume that we have the request ID in the - // first fragment. Thus, another thread is used + // first fragment. Thus, another thread is used // to be the reader while this thread unmarshals // the extended header and wakes up the client thread. setWorkThenPoolOrResumeOptimizedRead(header); @@ -966,7 +923,7 @@ public void handleInput(ReplyMessage_1_1 header) throws IOException { signalResponseReceived(); } else { // Not fragmented, therefore we know the request - // ID is here. Thus, we can unmarshal the extended header + // ID is here. Thus, we can unmarshal the extended header // and wake up the client thread without using a third // thread as above. @@ -979,24 +936,25 @@ public void handleInput(ReplyMessage_1_1 header) throws IOException { setWorkThenReadOrResumeOptimizedRead(header); } } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } } @InfoMethod - private void moreFragmentsInfo( boolean moreFragments ) { } + private void moreFragmentsInfo(boolean moreFragments) { + } @Transport public void handleInput(ReplyMessage_1_2 header) throws IOException { - generalMessage( "GIOP ReplyMessage 1.2" ) ; + generalMessage("GIOP ReplyMessage 1.2"); try { try { messageHeader = replyHeader = (ReplyMessage) header; // We know that the request ID is in the first fragment unmarshalRequestID(header); - requestIdInfo( header.getRequestId() ) ; + requestIdInfo(header.getRequestId()); moreFragmentsInfo(header.moreFragmentsToFollow()); setInputObject(); signalResponseReceived(); @@ -1004,14 +962,14 @@ public void handleInput(ReplyMessage_1_2 header) throws IOException { setWorkThenReadOrResumeOptimizedRead(header); } } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } } @Transport public void handleInput(LocateRequestMessage_1_0 header) throws IOException { - generalMessage( "GIOP LocateRequestMessage 1.0" ) ; + generalMessage("GIOP LocateRequestMessage 1.0"); try { try { messageHeader = header; @@ -1021,7 +979,7 @@ public void handleInput(LocateRequestMessage_1_0 header) throws IOException { } getProtocolHandler().handleRequest(header, this); } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } @@ -1029,7 +987,7 @@ public void handleInput(LocateRequestMessage_1_0 header) throws IOException { @Transport public void handleInput(LocateRequestMessage_1_1 header) throws IOException { - generalMessage( "GIOP LocateRequestMessage 1.1" ) ; + generalMessage("GIOP LocateRequestMessage 1.1"); try { try { messageHeader = header; @@ -1039,14 +997,14 @@ public void handleInput(LocateRequestMessage_1_1 header) throws IOException { } getProtocolHandler().handleRequest(header, this); } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } } @Transport public void handleInput(LocateRequestMessage_1_2 header) throws IOException { - generalMessage( "GIOP LocateRequestMessage 1.2" ) ; + generalMessage("GIOP LocateRequestMessage 1.2"); try { try { messageHeader = header; @@ -1058,14 +1016,14 @@ public void handleInput(LocateRequestMessage_1_2 header) throws IOException { moreFragmentsInfo(header.moreFragmentsToFollow()); if (header.moreFragmentsToFollow()) { - connection.serverRequestMapPut(header.getRequestId(),this); + connection.serverRequestMapPut(header.getRequestId(), this); } } finally { setWorkThenPoolOrResumeOptimizedRead(header); } getProtocolHandler().handleRequest(header, this); } catch (Throwable t) { - reportException( "", t ) ; + reportException("", t); // Mask the exception from thread.; } } @@ -1154,14 +1112,14 @@ public void handleInput(FragmentMessage_1_1 header) throws IOException { // If no input stream available, then discard the fragment. // This can happen: // 1. if a fragment message is received prior to receiving - // the original request/reply message. Very unlikely. + // the original request/reply message. Very unlikely. // 2. if a fragment message is received after the - // reply has been sent (early replies) + // reply has been sent (early replies) // Note: In the case of early replies, the fragments received // during the request processing (which are never unmarshaled), // will eventually be discarded by the GC. if (inObj == null) { - generalMessage( "No input stream: discarding fragment") ; + generalMessage("No input stream: discarding fragment"); // need to release dispatchByteBuffer to pool if we are discarding releaseByteBufferToPool(); return; @@ -1169,7 +1127,7 @@ public void handleInput(FragmentMessage_1_1 header) throws IOException { inObj.addFragment(header, dispatchByteBuffer); - if (! header.moreFragmentsToFollow()) { + if (!header.moreFragmentsToFollow()) { if (connection.isServer()) { connection.serverRequest_1_1_Remove(); } else { @@ -1194,7 +1152,7 @@ public void handleInput(FragmentMessage_1_2 header) throws IOException { try { messageHeader = header; - // Note: We know it's a 1.2 fragment, we have the data, but + // Note: We know it's a 1.2 fragment, we have the data, but // we need the IIOPInputStream instance to unmarshal the // request ID... but we need the request ID to get the // IIOPInputStream instance. So we peek at the raw bytes. @@ -1208,11 +1166,9 @@ public void handleInput(FragmentMessage_1_2 header) throws IOException { CDRInputObject inObj = null; if (connection.isServer()) { - mediator = - connection.serverRequestMapGet(header.getRequestId()); + mediator = connection.serverRequestMapGet(header.getRequestId()); } else { - mediator = - connection.clientRequestMapGet(header.getRequestId()); + mediator = connection.clientRequestMapGet(header.getRequestId()); } if (mediator != null) { @@ -1221,7 +1177,7 @@ public void handleInput(FragmentMessage_1_2 header) throws IOException { // See 1.1 comments. if (inObj == null) { - generalMessage( "No input stream: discarding fragment") ; + generalMessage("No input stream: discarding fragment"); // need to release dispatchByteBuffer to pool if // we are discarding @@ -1232,14 +1188,11 @@ public void handleInput(FragmentMessage_1_2 header) throws IOException { // REVISIT: but if it is a server don't you have to remove the // stream from the map? - if (! connection.isServer()) { - /* REVISIT - * No need to do anything. - * Should we mark that last was received? - if (! header.moreFragmentsToFollow()) { - // Last fragment. - } - */ + if (!connection.isServer()) { + /* + * REVISIT No need to do anything. Should we mark that last was received? if (! header.moreFragmentsToFollow()) { // + * Last fragment. } + */ } } finally { // NOTE: This *must* come after queing the fragment @@ -1253,7 +1206,8 @@ public void handleInput(FragmentMessage_1_2 header) throws IOException { } @InfoMethod - private void reportGIOPVersion( GIOPVersion vers ) { } + private void reportGIOPVersion(GIOPVersion vers) { + } @Transport public void handleInput(CancelRequestMessage header) throws IOException { @@ -1279,10 +1233,9 @@ public void handleInput(CancelRequestMessage header) throws IOException { // Mask the exception from thread.; } } - + private void throwNotImplemented(String msg) { - throw new RuntimeException( - "CorbaMessageMediatorImpl: not implemented " + msg); + throw new RuntimeException("CorbaMessageMediatorImpl: not implemented " + msg); } // REVISIT: move this to subcontract (but both client and server need it). @@ -1295,29 +1248,21 @@ private void processCancelRequest(int cancelReqId) { /* * CancelRequest processing logic : * - * - find the request with matching requestId + * - find the request with matching requestId * - * - call cancelProcessing() in BufferManagerRead [BMR] + * - call cancelProcessing() in BufferManagerRead [BMR] * - * - the hope is that worker thread would call BMR.underflow() - * to wait for more fragments to come in. When BMR.underflow() is - * called, if a CancelRequest had already arrived, - * the worker thread would throw ThreadDeath, - * else the thread would wait to be notified of the - * arrival of a new fragment or CancelRequest. Upon notification, - * the woken up thread would check to see if a CancelRequest had - * arrived and if so throw a ThreadDeath or it will continue to - * process the received fragment. + * - the hope is that worker thread would call BMR.underflow() to wait for more fragments to come in. When + * BMR.underflow() is called, if a CancelRequest had already arrived, the worker thread would throw ThreadDeath, else + * the thread would wait to be notified of the arrival of a new fragment or CancelRequest. Upon notification, the woken + * up thread would check to see if a CancelRequest had arrived and if so throw a ThreadDeath or it will continue to + * process the received fragment. * - * - if all the fragments had been received prior to CancelRequest - * then the worker thread would never block in BMR.underflow(). - * So, setting the abort flag in BMR has no effect. The request - * processing will complete normally. + * - if all the fragments had been received prior to CancelRequest then the worker thread would never block in + * BMR.underflow(). So, setting the abort flag in BMR has no effect. The request processing will complete normally. * - * - in the case where the server has received enough fragments to - * start processing the request and the server sends out - * an early reply. In such a case if the CancelRequest arrives - * after the reply has been sent, it has no effect. + * - in the case where the server has received enough fragments to start processing the request and the server sends out + * an early reply. In such a case if the CancelRequest arrives after the reply has been sent, it has no effect. */ if (!connection.isServer()) { @@ -1330,12 +1275,12 @@ private void processCancelRequest(int cancelReqId) { // was the request 1.2 ? MessageMediator mediator = connection.serverRequestMapGet(cancelReqId); - int requestId ; - if (mediator == null) { + int requestId; + if (mediator == null) { // was the request 1.1 ? mediator = connection.serverRequest_1_1_Get(); if (mediator == null) { - wrapper.badCancelRequest() ; + wrapper.badCancelRequest(); // either the request was 1.0 // or an early reply has already been sent // or request processing is over @@ -1347,16 +1292,16 @@ private void processCancelRequest(int cancelReqId) { if (requestId != cancelReqId) { // A spurious 1.1 CancelRequest has been received. - wrapper.bad1_1CancelRequestReceived() ; + wrapper.bad1_1CancelRequestReceived(); return; // do nothing } if (requestId == 0) { // special case - wrapper.cancelRequestWithId0() ; + wrapper.cancelRequestWithId0(); // this means that // 1. the 1.1 requests' requestId has not been received - // i.e., a CancelRequest was received even before the - // 1.1 request was received. The spec disallows this. + // i.e., a CancelRequest was received even before the + // 1.1 request was received. The spec disallows this. // 2. or the 1.1 request has a requestId 0. // // It is a little tricky to distinguish these two. So, be @@ -1372,7 +1317,7 @@ private void processCancelRequest(int cancelReqId) { if (msg.getType() != Message.GIOPRequest) { // Any mediator obtained here should only ever be for a GIOP // request. - wrapper.badMessageTypeForCancel() ; + wrapper.badMessageTypeForCancel(); } // At this point we have a valid message mediator that contains @@ -1397,8 +1342,7 @@ private void processCancelRequest(int cancelReqId) { // @Transport - public void handleRequest(RequestMessage msg, - MessageMediator messageMediator) { + public void handleRequest(RequestMessage msg, MessageMediator messageMediator) { try { beginRequest(messageMediator); try { @@ -1410,12 +1354,11 @@ public void handleRequest(RequestMessage msg, if (messageMediator.isOneWay()) { return; } - handleThrowableDuringServerDispatch( - messageMediator, t, CompletionStatus.COMPLETED_MAYBE); + handleThrowableDuringServerDispatch(messageMediator, t, CompletionStatus.COMPLETED_MAYBE); } sendResponse(messageMediator); } catch (Throwable t) { - wrapper.exceptionInHandleRequestForRequest( t ) ; + wrapper.exceptionInHandleRequestForRequest(t); dispatchError(messageMediator, "RequestMessage", t); } finally { endRequest(messageMediator); @@ -1423,19 +1366,17 @@ public void handleRequest(RequestMessage msg, } @Transport - public void handleRequest(LocateRequestMessage msg, - MessageMediator messageMediator) { + public void handleRequest(LocateRequestMessage msg, MessageMediator messageMediator) { try { beginRequest(messageMediator); try { handleLocateRequest(messageMediator); } catch (Throwable t) { - handleThrowableDuringServerDispatch( - messageMediator, t, CompletionStatus.COMPLETED_MAYBE); + handleThrowableDuringServerDispatch(messageMediator, t, CompletionStatus.COMPLETED_MAYBE); } sendResponse(messageMediator); } catch (Throwable t) { - wrapper.exceptionInHandleRequestForLocateRequest( t ) ; + wrapper.exceptionInHandleRequestForLocateRequest(t); dispatchError(messageMediator, "LocateRequestMessage", t); } finally { endRequest(messageMediator); @@ -1449,8 +1390,7 @@ private void beginRequest(MessageMediator messageMediator) { } @Subcontract - private void dispatchError(MessageMediator messageMediator, - String msg, Throwable t) { + private void dispatchError(MessageMediator messageMediator, String msg, Throwable t) { // REVISIT - this makes hcks sendTwoObjects fail // messageMediator.getConnection().close(); } @@ -1493,7 +1433,7 @@ private void endRequest(MessageMediator messageMediator) { // Given what close() does, this catch shouldn't ever happen. // See CDRInput/OutputObject.close() for more info. // It also won't result in a Corba error if an IOException happens. - reportException( "", ex ) ; + reportException("", ex); } finally { messageMediator.getConnection().serverRequestProcessingEnds(); } @@ -1514,7 +1454,7 @@ protected void handleRequestRequest(MessageMediator messageMediator) { ServerRequestDispatcher sc = okey.getServerRequestDispatcher(); if (sc == null) { - throw wrapper.noServerScInDispatch() ; + throw wrapper.noServerScInDispatch(); } // NOTE: @@ -1522,7 +1462,7 @@ protected void handleRequestRequest(MessageMediator messageMediator) { // and pass necessary info to response constructors located // in the subcontract. // REVISIT - same class right now. - //messageMediator.setProtocolHandler(this); + // messageMediator.setProtocolHandler(this); try { myOrb.startingDispatch(); @@ -1538,31 +1478,25 @@ protected void handleLocateRequest(MessageMediator messageMediator) { LocateRequestMessage msg = (LocateRequestMessage) messageMediator.getDispatchHeader(); IOR ior = null; LocateReplyMessage reply = null; - short addrDisp = -1; + short addrDisp = -1; try { messageMediator.getInputObject().unmarshalHeader(); - ObjectKey okey = msg.getObjectKeyCacheEntry().getObjectKey() ; - ServerRequestDispatcher sc = okey.getServerRequestDispatcher() ; + ObjectKey okey = msg.getObjectKeyCacheEntry().getObjectKey(); + ServerRequestDispatcher sc = okey.getServerRequestDispatcher(); if (sc == null) { return; } ior = sc.locate(okey); - if ( ior == null ) { - reply = MessageBase.createLocateReply( - myOrb, msg.getGIOPVersion(), - msg.getEncodingVersion(), - msg.getRequestId(), - LocateReplyMessage.OBJECT_HERE, null); + if (ior == null) { + reply = MessageBase.createLocateReply(myOrb, msg.getGIOPVersion(), msg.getEncodingVersion(), msg.getRequestId(), + LocateReplyMessage.OBJECT_HERE, null); } else { - reply = MessageBase.createLocateReply( - myOrb, msg.getGIOPVersion(), - msg.getEncodingVersion(), - msg.getRequestId(), - LocateReplyMessage.OBJECT_FORWARD, ior); + reply = MessageBase.createLocateReply(myOrb, msg.getGIOPVersion(), msg.getEncodingVersion(), msg.getRequestId(), + LocateReplyMessage.OBJECT_FORWARD, ior); } // REVISIT: Should we catch SystemExceptions? @@ -1570,12 +1504,9 @@ protected void handleLocateRequest(MessageMediator messageMediator) { // create a response containing the expected target // addressing disposition. - - reply = MessageBase.createLocateReply( - myOrb, msg.getGIOPVersion(), - msg.getEncodingVersion(), - msg.getRequestId(), - LocateReplyMessage.LOC_NEEDS_ADDRESSING_MODE, null); + + reply = MessageBase.createLocateReply(myOrb, msg.getGIOPVersion(), msg.getEncodingVersion(), msg.getRequestId(), + LocateReplyMessage.LOC_NEEDS_ADDRESSING_MODE, null); addrDisp = ex.expectedAddrDisp(); @@ -1583,7 +1514,7 @@ protected void handleLocateRequest(MessageMediator messageMediator) { return; // no need to send reply - } catch ( Exception ex ) { + } catch (Exception ex) { // REVISIT If exception is not OBJECT_NOT_EXIST, it should // have a different reply @@ -1591,11 +1522,8 @@ protected void handleLocateRequest(MessageMediator messageMediator) { // This handles OBJECT_NOT_EXIST exceptions thrown in // the subcontract or obj manager. Send back UNKNOWN_OBJECT. - reply = MessageBase.createLocateReply( - myOrb, msg.getGIOPVersion(), - msg.getEncodingVersion(), - msg.getRequestId(), - LocateReplyMessage.UNKNOWN_OBJECT, null); + reply = MessageBase.createLocateReply(myOrb, msg.getGIOPVersion(), msg.getEncodingVersion(), msg.getRequestId(), + LocateReplyMessage.UNKNOWN_OBJECT, null); } CDROutputObject outObj = createAppropriateOutputObject(messageMediator, msg, reply); @@ -1613,85 +1541,65 @@ protected void handleLocateRequest(MessageMediator messageMediator) { } @Subcontract - private CDROutputObject createAppropriateOutputObject( - MessageMediator messageMediator, - Message msg, LocateReplyMessage reply) { + private CDROutputObject createAppropriateOutputObject(MessageMediator messageMediator, Message msg, LocateReplyMessage reply) { CDROutputObject outObj; if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) { - // locate msgs 1.0 & 1.1 :=> grow, + // locate msgs 1.0 & 1.1 :=> grow, // REVISIT - build from factory - outObj = OutputStreamFactory.newCDROutputObject( messageMediator.getBroker(), this, - GIOPVersion.V1_0, - messageMediator.getConnection(), - reply, - ORBConstants.STREAM_FORMAT_VERSION_1); + outObj = OutputStreamFactory.newCDROutputObject(messageMediator.getBroker(), this, GIOPVersion.V1_0, + messageMediator.getConnection(), reply, ORBConstants.STREAM_FORMAT_VERSION_1); } else { // 1.2 :=> stream // REVISIT - build from factory - outObj = OutputStreamFactory.newCDROutputObject( messageMediator.getBroker(), messageMediator, - reply, - ORBConstants.STREAM_FORMAT_VERSION_1); + outObj = OutputStreamFactory.newCDROutputObject(messageMediator.getBroker(), messageMediator, reply, + ORBConstants.STREAM_FORMAT_VERSION_1); } return outObj; } @Subcontract - public void handleThrowableDuringServerDispatch( - MessageMediator messageMediator, - Throwable throwable, - CompletionStatus completionStatus) { + public void handleThrowableDuringServerDispatch(MessageMediator messageMediator, Throwable throwable, + CompletionStatus completionStatus) { // If we haven't unmarshaled the header, we probably don't // have enough information to even send back a reply. // REVISIT - // Cannot do this check. When target addressing disposition does + // Cannot do this check. When target addressing disposition does // not match (during header unmarshaling) it throws an exception // to be handled here. /* - if (! ((CDRInputObject)messageMediator.getInputObject()) - .unmarshaledHeader()) { - return; - } - */ - handleThrowableDuringServerDispatch(messageMediator, throwable, - completionStatus, 1); + * if (! ((CDRInputObject)messageMediator.getInputObject()) .unmarshaledHeader()) { return; } + */ + handleThrowableDuringServerDispatch(messageMediator, throwable, completionStatus, 1); } - // REVISIT - catch and ignore RequestCanceledException. @Subcontract - protected void handleThrowableDuringServerDispatch( - MessageMediator messageMediator, - Throwable throwable, - CompletionStatus completionStatus, - int iteration) { + protected void handleThrowableDuringServerDispatch(MessageMediator messageMediator, Throwable throwable, + CompletionStatus completionStatus, int iteration) { if (iteration > 10) { - throw new RuntimeException("handleThrowableDuringServerDispatch: " + - "cannot create response.", throwable); + throw new RuntimeException("handleThrowableDuringServerDispatch: " + "cannot create response.", throwable); } try { if (throwable instanceof ForwardException) { - ForwardException fex = (ForwardException)throwable ; - createLocationForward( messageMediator, fex.getIOR(), null ) ; + ForwardException fex = (ForwardException) throwable; + createLocationForward(messageMediator, fex.getIOR(), null); return; } if (throwable instanceof AddressingDispositionException) { - handleAddressingDisposition( - messageMediator, - (AddressingDispositionException)throwable); + handleAddressingDisposition(messageMediator, (AddressingDispositionException) throwable); return; - } + } // Else. - SystemException sex = - convertThrowableToSystemException(throwable, completionStatus); + SystemException sex = convertThrowableToSystemException(throwable, completionStatus); createSystemExceptionResponse(messageMediator, sex, null); return; @@ -1702,37 +1610,33 @@ protected void handleThrowableDuringServerDispatch( // the exception, so we end up back here. // Report the changed exception. - handleThrowableDuringServerDispatch(messageMediator, - throwable2, - completionStatus, - iteration + 1); + handleThrowableDuringServerDispatch(messageMediator, throwable2, completionStatus, iteration + 1); return; } } @Subcontract - protected SystemException convertThrowableToSystemException( - Throwable throwable, CompletionStatus completionStatus) { + protected SystemException convertThrowableToSystemException(Throwable throwable, CompletionStatus completionStatus) { if (throwable instanceof SystemException) { - return (SystemException)throwable; + return (SystemException) throwable; } if (throwable instanceof RequestCanceledException) { // Reporting an exception response causes the // poa current stack, the interceptor stacks, etc. - // to be balanced. It also notifies interceptors + // to be balanced. It also notifies interceptors // that the request was cancelled. - return wrapper.requestCanceled( throwable ) ; + return wrapper.requestCanceled(throwable); } // NOTE: We do not trap ThreadDeath above Throwable. - // There is no reason to stop the thread. It is - // just a worker thread. The ORB never throws - // ThreadDeath. Client code may (e.g., in ServanoutputObjecttManagers, + // There is no reason to stop the thread. It is + // just a worker thread. The ORB never throws + // ThreadDeath. Client code may (e.g., in ServanoutputObjecttManagers, // interceptors, or servants) but that should not - // effect the ORB threads. So it is just handled + // effect the ORB threads. So it is just handled // generically. // @@ -1740,63 +1644,45 @@ protected SystemException convertThrowableToSystemException( // If user code throws a non-SystemException report it generically. // - return wrapper.runtimeexception( throwable, - throwable.getClass().getName(), throwable.getMessage()); + return wrapper.runtimeexception(throwable, throwable.getClass().getName(), throwable.getMessage()); } @Subcontract - protected void handleAddressingDisposition( - MessageMediator messageMediator, - AddressingDispositionException ex) { + protected void handleAddressingDisposition(MessageMediator messageMediator, AddressingDispositionException ex) { short addrDisp = -1; // from iiop.RequestProcessor. // Respond with expected target addressing disposition. - + switch (messageMediator.getRequestHeader().getType()) { - case Message.GIOPRequest : - ORB myOrb = messageMediator.getBroker() ; - - ReplyMessage repHdr = MessageBase.createReply( myOrb, - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), - messageMediator.getRequestId(), - ReplyMessage.NEEDS_ADDRESSING_MODE, - ServiceContextDefaults.makeServiceContexts(myOrb), null); - + case Message.GIOPRequest: + ORB myOrb = messageMediator.getBroker(); + + ReplyMessage repHdr = MessageBase.createReply(myOrb, messageMediator.getGIOPVersion(), messageMediator.getEncodingVersion(), + messageMediator.getRequestId(), ReplyMessage.NEEDS_ADDRESSING_MODE, ServiceContextDefaults.makeServiceContexts(myOrb), + null); + // REVISIT: via acceptor factory. - CDROutputObject outObj = OutputStreamFactory.newCDROutputObject( - messageMediator.getBroker(), - this, - messageMediator.getGIOPVersion(), - messageMediator.getConnection(), - repHdr, - ORBConstants.STREAM_FORMAT_VERSION_1); + CDROutputObject outObj = OutputStreamFactory.newCDROutputObject(messageMediator.getBroker(), this, + messageMediator.getGIOPVersion(), messageMediator.getConnection(), repHdr, ORBConstants.STREAM_FORMAT_VERSION_1); messageMediator.setOutputObject(outObj); outObj.setMessageMediator(messageMediator); repHdr.write(outObj); - AddressingDispositionHelper.write(outObj, - ex.expectedAddrDisp()); + AddressingDispositionHelper.write(outObj, ex.expectedAddrDisp()); return; - case Message.GIOPLocateRequest : + case Message.GIOPLocateRequest: LocateReplyMessage locateReplyHeader = MessageBase.createLocateReply( - messageMediator.getBroker(), - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), messageMediator.getRequestId(), - LocateReplyMessage.LOC_NEEDS_ADDRESSING_MODE, - null); + messageMediator.getBroker(), messageMediator.getGIOPVersion(), messageMediator.getEncodingVersion(), + messageMediator.getRequestId(), LocateReplyMessage.LOC_NEEDS_ADDRESSING_MODE, null); addrDisp = ex.expectedAddrDisp(); // REVISIT: via acceptor factory. - outObj = - createAppropriateOutputObject(messageMediator, - messageMediator.getRequestHeader(), - locateReplyHeader); + outObj = createAppropriateOutputObject(messageMediator, messageMediator.getRequestHeader(), locateReplyHeader); messageMediator.setOutputObject(outObj); outObj.setMessageMediator(messageMediator); locateReplyHeader.write(outObj); @@ -1812,61 +1698,46 @@ protected void handleAddressingDisposition( } @Subcontract - public MessageMediator createResponse( - MessageMediator messageMediator, ServiceContexts svc) { + public MessageMediator createResponse(MessageMediator messageMediator, ServiceContexts svc) { // REVISIT: ignore service contexts during framework transition. // They are set in SubcontractResponseHandler to the wrong connection. // Then they would be set again here and a duplicate contexts // exception occurs. - return createResponseHelper( - messageMediator, - getServiceContextsForReply(messageMediator, null)); + return createResponseHelper(messageMediator, getServiceContextsForReply(messageMediator, null)); } @Subcontract - public MessageMediator createUserExceptionResponse( - MessageMediator messageMediator, ServiceContexts svc) { + public MessageMediator createUserExceptionResponse(MessageMediator messageMediator, ServiceContexts svc) { // REVISIT - same as above - return createResponseHelper( - messageMediator, - getServiceContextsForReply(messageMediator, null), - true); + return createResponseHelper(messageMediator, getServiceContextsForReply(messageMediator, null), true); } @Subcontract - public MessageMediator createUnknownExceptionResponse( - MessageMediator messageMediator, UnknownException ex) { + public MessageMediator createUnknownExceptionResponse(MessageMediator messageMediator, UnknownException ex) { // NOTE: This service context container gets augmented in // tail call. ServiceContexts contexts = null; - SystemException sys = new UNKNOWN( 0, - CompletionStatus.COMPLETED_MAYBE); - contexts = ServiceContextDefaults.makeServiceContexts( - messageMediator.getBroker()); - UEInfoServiceContext uei = - ServiceContextDefaults.makeUEInfoServiceContext(sys); - contexts.put( uei ) ; + SystemException sys = new UNKNOWN(0, CompletionStatus.COMPLETED_MAYBE); + contexts = ServiceContextDefaults.makeServiceContexts(messageMediator.getBroker()); + UEInfoServiceContext uei = ServiceContextDefaults.makeUEInfoServiceContext(sys); + contexts.put(uei); return createSystemExceptionResponse(messageMediator, sys, contexts); } @Subcontract - public MessageMediator createSystemExceptionResponse( - MessageMediator messageMediator, - SystemException ex, - ServiceContexts svc) { + public MessageMediator createSystemExceptionResponse(MessageMediator messageMediator, SystemException ex, ServiceContexts svc) { if (messageMediator.getConnection() != null) { // It is possible that fragments of response have already been - // sent. Then an error may occur (e.g. marshaling error like - // non serializable object). In that case it is too late - // to send the exception. We just return the existing fragmented - // stream here. This will cause an incomplete last fragment - // to be sent. Then the other side will get a marshaling error + // sent. Then an error may occur (e.g. marshaling error like + // non serializable object). In that case it is too late + // to send the exception. We just return the existing fragmented + // stream here. This will cause an incomplete last fragment + // to be sent. Then the other side will get a marshaling error // when attempting to unmarshal. - + // REVISIT: Impl - make interface method to do the following. - MessageMediatorImpl mediator = (MessageMediatorImpl) - messageMediator.getConnection() - .serverRequestMapGet(messageMediator.getRequestId()); + MessageMediatorImpl mediator = (MessageMediatorImpl) messageMediator.getConnection() + .serverRequestMapGet(messageMediator.getRequestId()); CDROutputObject existingOutputObject = null; if (mediator != null) { @@ -1875,33 +1746,29 @@ public MessageMediator createSystemExceptionResponse( // REVISIT: need to think about messageMediator containing correct // pointer to output object. - if (existingOutputObject != null && - mediator.sentFragment() && - ! mediator.sentFullMessage()) - { + if (existingOutputObject != null && mediator.sentFragment() && !mediator.sentFullMessage()) { return mediator; } } - + // Only do this if interceptors have been initialized on this request // and have not completed their lifecycle (otherwise the info stack // may be empty or have a different request's entry on top). if (messageMediator.executePIInResponseConstructor()) { // REVISIT: not necessary in framework now? - // Inform Portable Interceptors of the SystemException. This is + // Inform Portable Interceptors of the SystemException. This is // required to be done here because the ending interception point // is called in the when creating the response below - // but we do not currently write the SystemException into the + // but we do not currently write the SystemException into the // response until after the ending point is called. - messageMediator.getBroker().getPIHandler().setServerPIInfo( ex ); + messageMediator.getBroker().getPIHandler().setServerPIInfo(ex); } if (ex != null) { - reportException( "Creating system exception response for", ex ) ; + reportException("Creating system exception response for", ex); } - ServiceContexts serviceContexts = - getServiceContextsForReply(messageMediator, svc); + ServiceContexts serviceContexts = getServiceContextsForReply(messageMediator, svc); // NOTE: We MUST add the service context before creating // the response since service contexts are written to the @@ -1909,113 +1776,84 @@ public MessageMediator createSystemExceptionResponse( addExceptionDetailMessage(messageMediator, ex, serviceContexts); - MessageMediator response = - createResponseHelper(messageMediator, serviceContexts, false); + MessageMediator response = createResponseHelper(messageMediator, serviceContexts, false); // NOTE: From here on, it is too late to add more service contexts. // They have already been serialized to the stream (and maybe fragments // sent). - ORBUtility.writeSystemException( - ex, (OutputStream)response.getOutputObject()); + ORBUtility.writeSystemException(ex, (OutputStream) response.getOutputObject()); return response; } @Subcontract - private void addExceptionDetailMessage(MessageMediator mediator, - SystemException ex, ServiceContexts serviceContexts) { + private void addExceptionDetailMessage(MessageMediator mediator, SystemException ex, ServiceContexts serviceContexts) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(baos); ex.printStackTrace(pw); pw.flush(); // NOTE: you must flush or baos will be empty. - EncapsOutputStream encapsOutputStream = - OutputStreamFactory.newEncapsOutputStream(mediator.getBroker()); + EncapsOutputStream encapsOutputStream = OutputStreamFactory.newEncapsOutputStream(mediator.getBroker()); encapsOutputStream.putEndian(); encapsOutputStream.write_wstring(baos.toString()); - UnknownServiceContext serviceContext = - ServiceContextDefaults.makeUnknownServiceContext( - ExceptionDetailMessage.value, + UnknownServiceContext serviceContext = ServiceContextDefaults.makeUnknownServiceContext(ExceptionDetailMessage.value, encapsOutputStream.toByteArray()); serviceContexts.put(serviceContext); } @Subcontract - public MessageMediator createLocationForward( - MessageMediator messageMediator, IOR ior, ServiceContexts svc) { - - ReplyMessage reply - = MessageBase.createReply( - messageMediator.getBroker(), - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), messageMediator.getRequestId(), - ReplyMessage.LOCATION_FORWARD, - getServiceContextsForReply(messageMediator, svc), - ior); + public MessageMediator createLocationForward(MessageMediator messageMediator, IOR ior, ServiceContexts svc) { + + ReplyMessage reply = MessageBase.createReply(messageMediator.getBroker(), messageMediator.getGIOPVersion(), + messageMediator.getEncodingVersion(), messageMediator.getRequestId(), ReplyMessage.LOCATION_FORWARD, + getServiceContextsForReply(messageMediator, svc), ior); return createResponseHelper(messageMediator, reply, ior); } @Subcontract - protected MessageMediator createResponseHelper( - MessageMediator messageMediator, ServiceContexts svc) { - ReplyMessage message = - MessageBase.createReply( - messageMediator.getBroker(), - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), messageMediator.getRequestId(), ReplyMessage.NO_EXCEPTION, - svc, - null); + protected MessageMediator createResponseHelper(MessageMediator messageMediator, ServiceContexts svc) { + ReplyMessage message = MessageBase.createReply(messageMediator.getBroker(), messageMediator.getGIOPVersion(), + messageMediator.getEncodingVersion(), messageMediator.getRequestId(), ReplyMessage.NO_EXCEPTION, svc, null); return createResponseHelper(messageMediator, message, null); } @Subcontract - protected MessageMediator createResponseHelper( - MessageMediator messageMediator, ServiceContexts svc, - boolean user) { - - ReplyMessage message = - MessageBase.createReply( - messageMediator.getBroker(), - messageMediator.getGIOPVersion(), + protected MessageMediator createResponseHelper(MessageMediator messageMediator, ServiceContexts svc, boolean user) { + + ReplyMessage message = MessageBase.createReply(messageMediator.getBroker(), messageMediator.getGIOPVersion(), messageMediator.getEncodingVersion(), messageMediator.getRequestId(), - user ? ReplyMessage.USER_EXCEPTION : - ReplyMessage.SYSTEM_EXCEPTION, - svc, - null); + user ? ReplyMessage.USER_EXCEPTION : ReplyMessage.SYSTEM_EXCEPTION, svc, null); return createResponseHelper(messageMediator, message, null); } @InfoMethod - private void createResponseHelperInfo( ReplyMessage reply ) { } + private void createResponseHelperInfo(ReplyMessage reply) { + } // REVISIT - IOR arg is ignored. @Subcontract - protected MessageMediator createResponseHelper( - MessageMediator messageMediator, ReplyMessage reply, IOR ior) { + protected MessageMediator createResponseHelper(MessageMediator messageMediator, ReplyMessage reply, IOR ior) { // REVISIT - these should be invoked from subcontract. runServantPostInvoke(messageMediator); runInterceptors(messageMediator, reply); runRemoveThreadInfo(messageMediator); createResponseHelperInfo(reply); - + messageMediator.setReplyHeader(reply); CDROutputObject replyOutputObject; // REVISIT = do not use null. - // + // if (messageMediator.getConnection() == null) { // REVISIT - needs factory - replyOutputObject = - OutputStreamFactory.newCDROutputObject(orb, messageMediator, - messageMediator.getReplyHeader(), - messageMediator.getStreamFormatVersion(), - BufferManagerFactory.GROW); + replyOutputObject = OutputStreamFactory.newCDROutputObject(orb, messageMediator, messageMediator.getReplyHeader(), + messageMediator.getStreamFormatVersion(), BufferManagerFactory.GROW); } else { - replyOutputObject = messageMediator.getConnection().getAcceptor() - .createOutputObject(messageMediator.getBroker(), messageMediator); + replyOutputObject = messageMediator.getConnection().getAcceptor().createOutputObject(messageMediator.getBroker(), + messageMediator); } messageMediator.setOutputObject(replyOutputObject); messageMediator.getOutputObject().setMessageMediator(messageMediator); @@ -2025,7 +1863,7 @@ protected MessageMediator createResponseHelper( reply.getIOR().write((OutputStream) messageMediator.getOutputObject()); } // REVISIT - not necessary? - //messageMediator.this.replyIOR = reply.getIOR(); + // messageMediator.this.replyIOR = reply.getIOR(); // NOTE: The mediator holds onto output object so return value // not really necessary. @@ -2034,9 +1872,9 @@ protected MessageMediator createResponseHelper( @Subcontract protected void runServantPostInvoke(MessageMediator messageMediator) { - // Run ServantLocator::postinvoke. This may cause a SystemException + // Run ServantLocator::postinvoke. This may cause a SystemException // which will throw out of the constructor and return later - // to construct a reply for that exception. The internal logic + // to construct a reply for that exception. The internal logic // of returnServant makes sure that postinvoke is only called once. // REVISIT: instead of instanceof, put method on all orbs. ORB myOrb = null; @@ -2044,7 +1882,7 @@ protected void runServantPostInvoke(MessageMediator messageMediator) { // with ServerRequestDispatcher's use of reply streams, etc. if (messageMediator.executeReturnServantInResponseConstructor()) { // It is possible to get marshaling errors in the skeleton after - // postinvoke has completed. We must set this to false so that + // postinvoke has completed. We must set this to false so that // when the error exception reply is constructed we don't try // to incorrectly access poa current (which will be the wrong // one or an empty stack. @@ -2053,12 +1891,12 @@ protected void runServantPostInvoke(MessageMediator messageMediator) { try { myOrb = messageMediator.getBroker(); - OAInvocationInfo info = myOrb.peekInvocationInfo() ; + OAInvocationInfo info = myOrb.peekInvocationInfo(); ObjectAdapter oa = info.oa(); try { - oa.returnServant() ; + oa.returnServant(); } catch (Throwable thr) { - wrapper.unexpectedException( thr ) ; + wrapper.unexpectedException(thr); if (thr instanceof Error) { throw (Error) thr; @@ -2069,27 +1907,24 @@ protected void runServantPostInvoke(MessageMediator messageMediator) { oa.exit(); } } catch (EmptyStackException ese) { - throw wrapper.emptyStackRunServantPostInvoke( ese ) ; + throw wrapper.emptyStackRunServantPostInvoke(ese); } } } @Subcontract - protected void runInterceptors(MessageMediator messageMediator, - ReplyMessage reply) { + protected void runInterceptors(MessageMediator messageMediator, ReplyMessage reply) { - if( messageMediator.executePIInResponseConstructor() ) { + if (messageMediator.executePIInResponseConstructor()) { // Invoke server request ending interception points (send_*): // Note: this may end up with a SystemException or an internal // Runtime ForwardRequest - (messageMediator.getBroker()).getPIHandler(). - invokeServerPIEndingPoint( reply ); + (messageMediator.getBroker()).getPIHandler().invokeServerPIEndingPoint(reply); - // Note this will be executed even if a ForwardRequest or - // SystemException is thrown by a Portable Interceptors ending + // Note this will be executed even if a ForwardRequest or + // SystemException is thrown by a Portable Interceptors ending // point since we end up in this constructor again anyway. - (messageMediator.getBroker()).getPIHandler(). - cleanupServerPIRequest(); + (messageMediator.getBroker()).getPIHandler().cleanupServerPIRequest(); // See createSystemExceptionResponse for why this is necesary. messageMediator.setExecutePIInResponseConstructor(false); @@ -2102,68 +1937,58 @@ protected void runRemoveThreadInfo(MessageMediator messageMediator) { // postinvoke and interceptors have completed. if (messageMediator.executeRemoveThreadInfoInResponseConstructor()) { messageMediator.setExecuteRemoveThreadInfoInResponseConstructor(false); - messageMediator.getBroker().popInvocationInfo() ; + messageMediator.getBroker().popInvocationInfo(); } } @InfoMethod - private void generalMessage( String msg ) { } + private void generalMessage(String msg) { + } @Subcontract - protected ServiceContexts getServiceContextsForReply( - MessageMediator messageMediator, ServiceContexts contexts) { + protected ServiceContexts getServiceContextsForReply(MessageMediator messageMediator, ServiceContexts contexts) { Connection c = messageMediator.getConnection(); // NOTE : We only want to send the runtime context the first time, // only in the case where the encoding is set to CDR. if (contexts == null) { - if (getGIOPVersion().equals(GIOPVersion.V1_2) && - c != null && - c.getBroker().getORBData().alwaysSendCodeSetServiceContext() && - (getEncodingVersion() == ORBConstants.CDR_ENC_VERSION)) { + if (getGIOPVersion().equals(GIOPVersion.V1_2) && c != null && c.getBroker().getORBData().alwaysSendCodeSetServiceContext() + && (getEncodingVersion() == ORBConstants.CDR_ENC_VERSION)) { if (!c.isPostInitialContexts()) { c.setPostInitialContexts(); - contexts = messageMediator.getBroker(). - getServiceContextsCache().get( - ServiceContextsCache.CASE.SERVER_INITIAL); + contexts = messageMediator.getBroker().getServiceContextsCache().get(ServiceContextsCache.CASE.SERVER_INITIAL); } else { - contexts = messageMediator.getBroker(). - getServiceContextsCache().get( - ServiceContextsCache.CASE.SERVER_SUBSEQUENT); + contexts = messageMediator.getBroker().getServiceContextsCache().get(ServiceContextsCache.CASE.SERVER_SUBSEQUENT); } return contexts; } else { - contexts = ServiceContextDefaults.makeServiceContexts( - messageMediator.getBroker()); + contexts = ServiceContextDefaults.makeServiceContexts(messageMediator.getBroker()); } - } + } - if (c != null && !c.isPostInitialContexts() && - (getEncodingVersion() == ORBConstants.CDR_ENC_VERSION)) { + if (c != null && !c.isPostInitialContexts() && (getEncodingVersion() == ORBConstants.CDR_ENC_VERSION)) { c.setPostInitialContexts(); - SendingContextServiceContext scsc = - ServiceContextDefaults.makeSendingContextServiceContext( - messageMediator.getBroker().getFVDCodeBaseIOR()) ; + SendingContextServiceContext scsc = ServiceContextDefaults + .makeSendingContextServiceContext(messageMediator.getBroker().getFVDCodeBaseIOR()); - if (contexts.get( scsc.getId() ) != null) { + if (contexts.get(scsc.getId()) != null) { throw wrapper.duplicateSendingContextServiceContext(); } - contexts.put( scsc ) ; - generalMessage( "Added SendingContextServiceContext") ; + contexts.put(scsc); + generalMessage("Added SendingContextServiceContext"); } // send ORBVersion servicecontext as part of the Reply - ORBVersionServiceContext ovsc - = ServiceContextDefaults.makeORBVersionServiceContext(); + ORBVersionServiceContext ovsc = ServiceContextDefaults.makeORBVersionServiceContext(); - if (contexts.get( ovsc.getId() ) != null) { + if (contexts.get(ovsc.getId()) != null) { throw wrapper.duplicateOrbVersionServiceContext(); } - contexts.put( ovsc ) ; - generalMessage( "Added ORB version service context" ) ; + contexts.put(ovsc); + generalMessage("Added ORB version service context"); return contexts; } @@ -2183,18 +2008,17 @@ public void cancelRequest() { } } - // + // // Work implementation // - + @InfoMethod - private void ignoringThrowable( Throwable thr ) { } + private void ignoringThrowable(Throwable thr) { + } /** - * Execute dispatch in its own WorkerThread. Prior to this method being - * called this object must be initialized with a valid connection - * (CorbaConnection), orb (ORB), dispatchHeader (Message) and - * dispatchByteBuffer (ByteBuffer). + * Execute dispatch in its own WorkerThread. Prior to this method being called this object must be initialized with a + * valid connection (CorbaConnection), orb (ORB), dispatchHeader (Message) and dispatchByteBuffer (ByteBuffer). */ @Subcontract public void doWork() { @@ -2219,5 +2043,3 @@ public String getName() { } // End of file. - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MessageParserImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MessageParserImpl.java index bfcf25e5a..7786b1eec 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MessageParserImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MessageParserImpl.java @@ -37,11 +37,9 @@ import com.sun.corba.ee.spi.trace.Transport; import org.omg.CORBA.COMM_FAILURE; - /** * - * An implementation of a MessageParser that knows how to parse - * bytes into a GIOP protocol data unit. + * An implementation of a MessageParser that knows how to parse bytes into a GIOP protocol data unit. * * */ @@ -58,13 +56,10 @@ public class MessageParserImpl implements MessageParser { private int nextMsgStartPos; private int sizeNeeded; /** - * A list of request ids awaiting final fragments. When the size of - * this list is larger than 0, we have received a fragmented message - * and expecting to receive more message fragments for that given - * request id on this list. Hence, if there are entries in this list - * we are expecting more data to arrive. - * We are using a List here rather than a Set since the size of the - * List is expected to be rather small, (i.e. less than size 10). + * A list of request ids awaiting final fragments. When the size of this list is larger than 0, we have received a + * fragmented message and expecting to receive more message fragments for that given request id on this list. Hence, if + * there are entries in this list we are expecting more data to arrive. We are using a List here rather than a Set since + * the size of the List is expected to be rather small, (i.e. less than size 10). */ private List fragmentList; private ByteBuffer msgByteBuffer; @@ -77,7 +72,9 @@ public class MessageParserImpl implements MessageParser { private Connection connection; private boolean expectingFragments; - /** Creates a new instance of MessageParserImpl + /** + * Creates a new instance of MessageParserImpl + * * @param orb the ORB */ public MessageParserImpl(ORB orb) { @@ -100,17 +97,16 @@ public ByteBuffer getNewBufferAndCopyOld(ByteBuffer byteBuffer) { // Set byteBuffer position to the start position of data to be // copied into the re-allocated ByteBuffer. byteBuffer.position(getNextMessageStartPosition()); - newByteBuffer = orb.getByteBufferPool().reAllocate(byteBuffer, - getSizeNeeded()); + newByteBuffer = orb.getByteBufferPool().reAllocate(byteBuffer, getSizeNeeded()); setNextMessageStartPosition(0); return newByteBuffer; } /** * Is this MessageParser expecting more data ? - * @return - True if more bytes are needed to construct at least one - * GIOP protocol data unit. False, if no additional bytes are - * remain to be parsed into a GIOP protocol data unit. + * + * @return - True if more bytes are needed to construct at least one GIOP protocol data unit. False, if no additional + * bytes are remain to be parsed into a GIOP protocol data unit. */ public boolean isExpectingMoreData() { return expectingMoreData; @@ -130,7 +126,8 @@ public ByteBuffer getMsgByteBuffer() { public void offerBuffer(ByteBuffer buffer) { msgByteBuffer = null; messageMediator = null; - if (buffer == null) return; + if (buffer == null) + return; if (!containsFullHeader(buffer) || !containsFullMessage(buffer)) remainderBuffer = buffer; @@ -145,9 +142,8 @@ public void offerBuffer(ByteBuffer buffer) { } /** - * Splits the specified buffer at the specified position, returning the first part and - * setting {@link #remainderBuffer} to the second, or null if there is no data in the second. - * The split position must be no greater than the limit. + * Splits the specified buffer at the specified position, returning the first part and setting {@link #remainderBuffer} + * to the second, or null if there is no data in the second. The split position must be no greater than the limit. */ private ByteBuffer splitAndReturnRemainder(ByteBuffer buffer, int splitPosition) { assert splitPosition <= buffer.limit(); @@ -197,7 +193,8 @@ public MessageMediator getMessageMediator() { @Override public void checkTimeout(long timeSinceLastInput) { - if (isMidMessage() && timeLimitExceeded(timeSinceLastInput)) throw new COMM_FAILURE(); + if (isMidMessage() && timeLimitExceeded(timeSinceLastInput)) + throw new COMM_FAILURE(); } private boolean timeLimitExceeded(long timeSinceLastInput) { @@ -211,21 +208,20 @@ private boolean isMidMessage() { @Transport public Message parseBytes(ByteBuffer byteBuffer, Connection connection) { expectingMoreData = false; - remainderBuffer = byteBuffer; + remainderBuffer = byteBuffer; Message message = null; int bytesInBuffer = byteBuffer.limit() - nextMsgStartPos; // is there enough bytes available for a message header? if (bytesInBuffer >= Message.GIOPMessageHeaderLength) { // get message header message = MessageBase.parseGiopHeader(orb, connection, byteBuffer, nextMsgStartPos); - + // is there enough bytes for a message body? if (bytesInBuffer >= message.getSize()) { // slice the ByteBuffer into a GIOP PDU int savedLimit = byteBuffer.limit(); - byteBuffer.position(nextMsgStartPos). - limit(nextMsgStartPos + message.getSize()); + byteBuffer.position(nextMsgStartPos).limit(nextMsgStartPos + message.getSize()); msgByteBuffer = byteBuffer.slice(); // update nextMsgStartPos and byteBuffer state nextMsgStartPos = byteBuffer.limit(); @@ -241,7 +237,8 @@ public Message parseBytes(ByteBuffer byteBuffer, Connection connection) { } moreBytesToParse = byteBuffer.hasRemaining(); - if (!moreBytesToParse) byteBuffer.limit(byteBuffer.capacity()); + if (!moreBytesToParse) + byteBuffer.limit(byteBuffer.capacity()); sizeNeeded = orb.getORBData().getReadByteBufferSize(); } else { // set state for next parseBytes invocation @@ -269,15 +266,13 @@ private boolean stillLookingForFragments() { } private boolean isEndOfFragmentList(Message message) { - return message.getType() == MessageBase.GIOPFragment || - message.getType() == MessageBase.GIOPCancelRequest; + return message.getType() == MessageBase.GIOPFragment || message.getType() == MessageBase.GIOPCancelRequest; } private void removeRequestIdFromFragmentList(Message message, ByteBuffer byteBuffer) { // remove request id from fragmentList RequestId requestId = MessageBase.getRequestIdFromMessageBytes(message, byteBuffer); - if (fragmentList.size() > 0 && - fragmentList.remove(requestId)) { + if (fragmentList.size() > 0 && fragmentList.remove(requestId)) { } } @@ -290,36 +285,34 @@ private void addRequestIdToFragmentList(Message message, ByteBuffer byteBuffer) } /** - * Are there more bytes to be parsed in the ByteBuffer given - * to this MessageParser's parseBytes ? + * Are there more bytes to be parsed in the ByteBuffer given to this MessageParser's + * parseBytes ? * - * This method is typically called after a call to parseBytes() - * to determine if the ByteBuffer has more bytes which need to - * parsed into a Message. + * This method is typically called after a call to parseBytes() to determine if the ByteBuffer + * has more bytes which need to parsed into a Message. * - * @return true if there are more bytes to be parsed. - * Otherwise false. + * @return true if there are more bytes to be parsed. Otherwise false. */ public boolean hasMoreBytesToParse() { return moreBytesToParse; } - + /** - * Set the starting position where the next message in the - * ByteBuffer given to parseBytes() begins. + * Set the starting position where the next message in the ByteBuffer given to parseBytes() + * begins. */ public void setNextMessageStartPosition(int position) { this.nextMsgStartPos = position; } - + /** - * Get the starting position where the next message in the - * ByteBuffer given to parseBytes() begins. + * Get the starting position where the next message in the ByteBuffer given to parseBytes() + * begins. */ public int getNextMessageStartPosition() { return this.nextMsgStartPos; } - + /** Return a string representing this MessageParser's state */ @Override public String toString() { @@ -338,8 +331,7 @@ private String toStringPrefix() { } /** - * Return the suggested number of bytes needed to hold the next message - * to be parsed. + * Return the suggested number of bytes needed to hold the next message to be parsed. */ public int getSizeNeeded() { return sizeNeeded; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MinimalServantCacheLocalCRDImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MinimalServantCacheLocalCRDImpl.java index 126bef874..6b3709ab0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MinimalServantCacheLocalCRDImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/MinimalServantCacheLocalCRDImpl.java @@ -17,39 +17,33 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.protocol ; +package com.sun.corba.ee.impl.protocol; -import org.omg.CORBA.portable.ServantObject ; +import org.omg.CORBA.portable.ServantObject; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.oa.OAInvocationInfo ; +import com.sun.corba.ee.spi.oa.OAInvocationInfo; import com.sun.corba.ee.spi.oa.OADestroyed; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -public class MinimalServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase -{ - public MinimalServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior ) - { - super( (com.sun.corba.ee.spi.orb.ORB)orb, scid, ior ) ; +public class MinimalServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase { + public MinimalServantCacheLocalCRDImpl(ORB orb, int scid, IOR ior) { + super((com.sun.corba.ee.spi.orb.ORB) orb, scid, ior); } - public ServantObject internalPreinvoke( org.omg.CORBA.Object self, - String operation, Class expectedType ) throws OADestroyed - { - OAInvocationInfo cachedInfo = getCachedInfo() ; - if (checkForCompatibleServant( cachedInfo, expectedType )) - return cachedInfo ; + public ServantObject internalPreinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) throws OADestroyed { + OAInvocationInfo cachedInfo = getCachedInfo(); + if (checkForCompatibleServant(cachedInfo, expectedType)) + return cachedInfo; else - return null ; + return null; } - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servantobj) - { + public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servantobj) { } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/NotLocalLocalCRDImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/NotLocalLocalCRDImpl.java index e8b393ead..3231ae4b6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/NotLocalLocalCRDImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/NotLocalLocalCRDImpl.java @@ -22,39 +22,31 @@ import org.omg.CORBA.INTERNAL; import org.omg.CORBA.portable.ServantObject; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher; /** * @author Harold Carr */ -public class NotLocalLocalCRDImpl implements LocalClientRequestDispatcher -{ - public boolean useLocalInvocation(org.omg.CORBA.Object self) - { +public class NotLocalLocalCRDImpl implements LocalClientRequestDispatcher { + public boolean useLocalInvocation(org.omg.CORBA.Object self) { return false; } - public boolean is_local(org.omg.CORBA.Object self) - { + public boolean is_local(org.omg.CORBA.Object self) { return false; } - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType) - { + public ServantObject servant_preinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) { // REVISIT: Rewrite rmic.HelloTest and rmic.LocalStubTest // (which directly call servant_preinvoke) // then revert to exception again. return null; - //throw new INTERNAL(); + // throw new INTERNAL(); } - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servant) - { - //throw new INTERNAL(); + public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servant) { + // throw new INTERNAL(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/POALocalCRDImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/POALocalCRDImpl.java index 5e9747c1d..a43d62942 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/POALocalCRDImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/POALocalCRDImpl.java @@ -22,86 +22,83 @@ import org.omg.CORBA.portable.ServantObject; import com.sun.corba.ee.spi.oa.ObjectAdapter; -import com.sun.corba.ee.spi.oa.OAInvocationInfo ; +import com.sun.corba.ee.spi.oa.OAInvocationInfo; import com.sun.corba.ee.spi.oa.OADestroyed; import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.trace.Subcontract; @Subcontract public class POALocalCRDImpl extends LocalClientRequestDispatcherBase { - public POALocalCRDImpl( ORB orb, int scid, IOR ior) { - super( orb, scid, ior ); + public POALocalCRDImpl(ORB orb, int scid, IOR ior) { + super(orb, scid, ior); } @Subcontract - private OAInvocationInfo servantEnter( ObjectAdapter oa ) throws OADestroyed { - oa.enter() ; + private OAInvocationInfo servantEnter(ObjectAdapter oa) throws OADestroyed { + oa.enter(); - OAInvocationInfo info = oa.makeInvocationInfo( objectId ) ; - orb.pushInvocationInfo( info ) ; + OAInvocationInfo info = oa.makeInvocationInfo(objectId); + orb.pushInvocationInfo(info); - return info ; + return info; } @Subcontract - private void servantExit( ObjectAdapter oa ) { + private void servantExit(ObjectAdapter oa) { try { oa.returnServant(); } finally { - oa.exit() ; - orb.popInvocationInfo() ; + oa.exit(); + orb.popInvocationInfo(); } } - // Look up the servant for this request and return it in a - // ServantObject. Note that servant_postinvoke is always called - // by the stub UNLESS this method returns null. However, in all + // Look up the servant for this request and return it in a + // ServantObject. Note that servant_postinvoke is always called + // by the stub UNLESS this method returns null. However, in all // cases we must be sure that ObjectAdapter.getServant and // ObjectAdapter.returnServant calls are paired, as required for // Portable Interceptors and Servant Locators in the POA. // Thus, this method must call returnServant if it returns null. @Subcontract @Override - public ServantObject internalPreinvoke( org.omg.CORBA.Object self, - String operation, Class expectedType) throws OADestroyed { + public ServantObject internalPreinvoke(org.omg.CORBA.Object self, String operation, Class expectedType) throws OADestroyed { - ObjectAdapter oa = null ; + ObjectAdapter oa = null; - oa = oaf.find( oaid ) ; + oa = oaf.find(oaid); - OAInvocationInfo info = servantEnter( oa ) ; - info.setOperation( operation ) ; + OAInvocationInfo info = servantEnter(oa); + info.setOperation(operation); try { - oa.getInvocationServant( info ); - if (!checkForCompatibleServant( info, expectedType )) { - servantExit( oa ) ; - return null ; + oa.getInvocationServant(info); + if (!checkForCompatibleServant(info, expectedType)) { + servantExit(oa); + return null; } - return info ; + return info; } catch (Error err) { // Cleanup after this call, then throw to allow // outer try to handle the exception appropriately. - servantExit( oa ) ; - throw err ; + servantExit(oa); + throw err; } catch (RuntimeException re) { // Cleanup after this call, then throw to allow // outer try to handle the exception appropriately. - servantExit( oa ) ; - throw re ; + servantExit(oa); + throw re; } } - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servantobj) - { - ObjectAdapter oa = orb.peekInvocationInfo().oa() ; - servantExit( oa ) ; + public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servantobj) { + ObjectAdapter oa = orb.peekInvocationInfo().oa(); + servantExit(oa); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/RequestDispatcherRegistryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/RequestDispatcherRegistryImpl.java index 9848ca72b..e266f956d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/RequestDispatcherRegistryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/RequestDispatcherRegistryImpl.java @@ -25,73 +25,61 @@ import java.util.HashMap; import java.util.Collections; -import com.sun.corba.ee.spi.protocol.ClientRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.ClientRequestDispatcher; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; -import com.sun.corba.ee.spi.protocol.RequestDispatcherRegistry ; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; +import com.sun.corba.ee.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.ee.spi.oa.ObjectAdapterFactory ; +import com.sun.corba.ee.spi.oa.ObjectAdapterFactory; import org.glassfish.pfl.basic.contain.DenseIntMapImpl; /** - * This is a registry of all subcontract ID dependent objects. This includes: - * LocalClientRequestDispatcherFactory, ClientRequestDispatcher, ServerSubcontract, and - * ObjectAdapterFactory. + * This is a registry of all subcontract ID dependent objects. This includes: LocalClientRequestDispatcherFactory, + * ClientRequestDispatcher, ServerSubcontract, and ObjectAdapterFactory. */ public class RequestDispatcherRegistryImpl implements RequestDispatcherRegistry { - protected int defaultId; // The default subcontract ID to use if there is no more specific ID available. + protected int defaultId; // The default subcontract ID to use if there is no more specific ID available. // This happens when invoking a foreign IOR. - private DenseIntMapImpl SDRegistry ; - private DenseIntMapImpl CSRegistry ; - private DenseIntMapImpl OAFRegistry ; - private DenseIntMapImpl LCSFRegistry ; - private Set objectAdapterFactories ; - private Set objectAdapterFactoriesView ; // Read-only view of oaf instances - private Map stringToServerSubcontract ; + private DenseIntMapImpl SDRegistry; + private DenseIntMapImpl CSRegistry; + private DenseIntMapImpl OAFRegistry; + private DenseIntMapImpl LCSFRegistry; + private Set objectAdapterFactories; + private Set objectAdapterFactoriesView; // Read-only view of oaf instances + private Map stringToServerSubcontract; - public RequestDispatcherRegistryImpl(int defaultId ) - { + public RequestDispatcherRegistryImpl(int defaultId) { this.defaultId = defaultId; - SDRegistry = new DenseIntMapImpl() ; - CSRegistry = new DenseIntMapImpl() ; - OAFRegistry = new DenseIntMapImpl() ; - LCSFRegistry = new DenseIntMapImpl() ; - objectAdapterFactories = new HashSet() ; - objectAdapterFactoriesView = Collections.unmodifiableSet( objectAdapterFactories ) ; - stringToServerSubcontract = new HashMap() ; + SDRegistry = new DenseIntMapImpl(); + CSRegistry = new DenseIntMapImpl(); + OAFRegistry = new DenseIntMapImpl(); + LCSFRegistry = new DenseIntMapImpl(); + objectAdapterFactories = new HashSet(); + objectAdapterFactoriesView = Collections.unmodifiableSet(objectAdapterFactories); + stringToServerSubcontract = new HashMap(); } - public synchronized void registerClientRequestDispatcher( - ClientRequestDispatcher csc, int scid) - { - CSRegistry.set( scid, csc ) ; + public synchronized void registerClientRequestDispatcher(ClientRequestDispatcher csc, int scid) { + CSRegistry.set(scid, csc); } - public synchronized void registerLocalClientRequestDispatcherFactory( - LocalClientRequestDispatcherFactory csc, int scid) - { - LCSFRegistry.set( scid, csc ) ; + public synchronized void registerLocalClientRequestDispatcherFactory(LocalClientRequestDispatcherFactory csc, int scid) { + LCSFRegistry.set(scid, csc); } - public synchronized void registerServerRequestDispatcher( - ServerRequestDispatcher ssc, int scid) - { - SDRegistry.set( scid, ssc ) ; + public synchronized void registerServerRequestDispatcher(ServerRequestDispatcher ssc, int scid) { + SDRegistry.set(scid, ssc); } - public synchronized void registerServerRequestDispatcher( - ServerRequestDispatcher scc, String name ) - { - stringToServerSubcontract.put( name, scc ) ; + public synchronized void registerServerRequestDispatcher(ServerRequestDispatcher scc, String name) { + stringToServerSubcontract.put(name, scc); } - public synchronized void registerObjectAdapterFactory( - ObjectAdapterFactory oaf, int scid) - { - objectAdapterFactories.add( oaf ) ; - OAFRegistry.set( scid, oaf ) ; + public synchronized void registerObjectAdapterFactory(ObjectAdapterFactory oaf, int scid) { + objectAdapterFactories.add(oaf); + OAFRegistry.set(scid, oaf); } // ************************************************** @@ -100,63 +88,56 @@ public synchronized void registerObjectAdapterFactory( // Note that both forms of getServerRequestDispatcher need to return // the default server delegate if no other match is found. - // This is essential to proper handling of errors for - // malformed requests. In particular, a bad MAGIC will + // This is essential to proper handling of errors for + // malformed requests. In particular, a bad MAGIC will // result in a lookup in the named key table (stringToServerSubcontract), - // which must return a valid ServerRequestDispatcher. A bad subcontract ID + // which must return a valid ServerRequestDispatcher. A bad subcontract ID // will similarly need to return the default ServerRequestDispatcher. - - public ServerRequestDispatcher getServerRequestDispatcher(int scid) - { - ServerRequestDispatcher sdel = SDRegistry.get(scid) ; - if ( sdel == null ) - sdel = SDRegistry.get(defaultId) ; + + public ServerRequestDispatcher getServerRequestDispatcher(int scid) { + ServerRequestDispatcher sdel = SDRegistry.get(scid); + if (sdel == null) + sdel = SDRegistry.get(defaultId); return sdel; } - public ServerRequestDispatcher getServerRequestDispatcher( String name ) - { - ServerRequestDispatcher sdel = stringToServerSubcontract.get( name ) ; + public ServerRequestDispatcher getServerRequestDispatcher(String name) { + ServerRequestDispatcher sdel = stringToServerSubcontract.get(name); - if ( sdel == null ) - sdel = SDRegistry.get(defaultId) ; + if (sdel == null) + sdel = SDRegistry.get(defaultId); return sdel; } - public LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory( - int scid ) - { - LocalClientRequestDispatcherFactory factory = LCSFRegistry.get(scid) ; + public LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory(int scid) { + LocalClientRequestDispatcherFactory factory = LCSFRegistry.get(scid); if (factory == null) { - factory = LCSFRegistry.get(defaultId) ; + factory = LCSFRegistry.get(defaultId); } - return factory ; + return factory; } - public ClientRequestDispatcher getClientRequestDispatcher( int scid ) - { - ClientRequestDispatcher subcontract = CSRegistry.get(scid) ; + public ClientRequestDispatcher getClientRequestDispatcher(int scid) { + ClientRequestDispatcher subcontract = CSRegistry.get(scid); if (subcontract == null) { - subcontract = CSRegistry.get(defaultId) ; + subcontract = CSRegistry.get(defaultId); } - return subcontract ; + return subcontract; } - public ObjectAdapterFactory getObjectAdapterFactory( int scid ) - { - ObjectAdapterFactory oaf = OAFRegistry.get(scid) ; - if ( oaf == null ) - oaf = OAFRegistry.get(defaultId) ; + public ObjectAdapterFactory getObjectAdapterFactory(int scid) { + ObjectAdapterFactory oaf = OAFRegistry.get(scid); + if (oaf == null) + oaf = OAFRegistry.get(defaultId); return oaf; } - public Set getObjectAdapterFactories() - { - return objectAdapterFactoriesView ; + public Set getObjectAdapterFactories() { + return objectAdapterFactoriesView; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/RequestIdImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/RequestIdImpl.java index 93a92b50b..abc2927d5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/RequestIdImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/RequestIdImpl.java @@ -23,22 +23,21 @@ import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** - * Represents a protocol request id. Currently used to ensure proper - * sequencing of fragmented messages. + * Represents a protocol request id. Currently used to ensure proper sequencing of fragmented messages. * * @author Charlie Hunt */ public class RequestIdImpl implements RequestId { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; final private int value; final private boolean defined; final static private String UNDEFINED = "?"; - final static public - RequestId UNKNOWN_CORBA_REQUEST_ID = new RequestIdImpl(); + final static public RequestId UNKNOWN_CORBA_REQUEST_ID = new RequestIdImpl(); - /** Creates a new instance of CorbaRequestIdImpl + /** + * Creates a new instance of CorbaRequestIdImpl + * * @param requestId value of the request ID */ public RequestIdImpl(int requestId) { @@ -75,17 +74,17 @@ public boolean equals(Object requestId) { if (requestId == null || !(requestId instanceof RequestId)) { return false; } - + if (this.isDefined()) { - if (((RequestId)requestId).isDefined()) { - return this.value == ((RequestId)requestId).getValue(); + if (((RequestId) requestId).isDefined()) { + return this.value == ((RequestId) requestId).getValue(); } else { // requestId is not defined and "this" is defined return false; } } else { // "this" is not defined // simply return result of NOT requestId.isDefined() - return !((RequestId)requestId).isDefined(); + return !((RequestId) requestId).isDefined(); } } @@ -94,7 +93,7 @@ public boolean equals(Object requestId) { public int hashCode() { return this.value; } - + /** String representing this CorbaRequestId */ @Override public String toString() { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ServantCacheLocalCRDBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ServantCacheLocalCRDBase.java index 1de442fd8..952c69f2d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ServantCacheLocalCRDBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ServantCacheLocalCRDBase.java @@ -27,59 +27,57 @@ import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.trace.Subcontract; @Subcontract -public abstract class ServantCacheLocalCRDBase - extends LocalClientRequestDispatcherBase { +public abstract class ServantCacheLocalCRDBase extends LocalClientRequestDispatcherBase { - private OAInvocationInfo cachedInfo ; + private OAInvocationInfo cachedInfo; - protected ServantCacheLocalCRDBase( ORB orb, int scid, IOR ior ) - { - super( orb, scid, ior ) ; + protected ServantCacheLocalCRDBase(ORB orb, int scid, IOR ior) { + super(orb, scid, ior); } @Subcontract protected void cleanupAfterOADestroyed() { - cachedInfo = null ; + cachedInfo = null; } @Subcontract protected synchronized OAInvocationInfo getCachedInfo() throws OADestroyed { if (!servantIsLocal) { - throw poaWrapper.servantMustBeLocal() ; + throw poaWrapper.servantMustBeLocal(); } if (cachedInfo == null) { - updateCachedInfo() ; + updateCachedInfo(); } - return cachedInfo ; + return cachedInfo; } @Subcontract private void updateCachedInfo() throws OADestroyed { // If find throws an exception, just let it propagate out - ObjectAdapter oa = oaf.find( oaid ) ; - cachedInfo = oa.makeInvocationInfo( objectId ) ; - oa.enter( ); + ObjectAdapter oa = oaf.find(oaid); + cachedInfo = oa.makeInvocationInfo(objectId); + oa.enter(); // InvocationInfo must be pushed before calling getInvocationServant - orb.pushInvocationInfo( cachedInfo ) ; + orb.pushInvocationInfo(cachedInfo); try { - oa.getInvocationServant( cachedInfo ) ; + oa.getInvocationServant(cachedInfo); } catch (ForwardException freq) { - throw poaWrapper.illegalForwardRequest( freq ) ; + throw poaWrapper.illegalForwardRequest(freq); } finally { oa.returnServant(); oa.exit(); - orb.popInvocationInfo() ; + orb.popInvocationInfo(); } - return ; + return; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ServerRequestDispatcherImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ServerRequestDispatcherImpl.java index e0d90bf62..465ecdb97 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ServerRequestDispatcherImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/ServerRequestDispatcherImpl.java @@ -20,8 +20,6 @@ package com.sun.corba.ee.impl.protocol; - - import org.omg.CORBA.BAD_OPERATION; import org.omg.CORBA.SystemException; import org.omg.CORBA.CompletionStatus; @@ -36,7 +34,7 @@ import com.sun.corba.ee.spi.orb.ORBVersion; import com.sun.corba.ee.spi.orb.ORBVersionFactory; import com.sun.corba.ee.spi.orb.ObjectKeyCacheEntry; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.ior.ObjectKey; import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; import com.sun.corba.ee.spi.ior.ObjectAdapterId; @@ -47,7 +45,7 @@ import com.sun.corba.ee.spi.oa.NullServant; import com.sun.corba.ee.spi.protocol.MessageMediator; import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; -import com.sun.corba.ee.spi.protocol.ForwardException ; +import com.sun.corba.ee.spi.protocol.ForwardException; import com.sun.corba.ee.spi.protocol.RequestDispatcherRegistry; import com.sun.corba.ee.spi.transport.Connection; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; @@ -60,7 +58,7 @@ import com.sun.corba.ee.spi.servicecontext.SendingContextServiceContext; import com.sun.corba.ee.spi.servicecontext.ORBVersionServiceContext; -import com.sun.corba.ee.impl.corba.ServerRequestImpl ; +import com.sun.corba.ee.impl.corba.ServerRequestImpl; import com.sun.corba.ee.impl.encoding.CDROutputObject; import com.sun.corba.ee.impl.encoding.MarshalInputStream; import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; @@ -73,56 +71,52 @@ import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Subcontract -public class ServerRequestDispatcherImpl - implements ServerRequestDispatcher -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - private static final POASystemException poaWrapper = - POASystemException.self ; +public class ServerRequestDispatcherImpl implements ServerRequestDispatcher { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + private static final POASystemException poaWrapper = POASystemException.self; protected ORB orb; // my ORB instance - public ServerRequestDispatcherImpl(ORB orb) - { + public ServerRequestDispatcherImpl(ORB orb) { this.orb = orb; } - /** Called from ORB.locate when a LocateRequest arrives. - * Result is not always absolutely correct: may indicate OBJECT_HERE - * for non-existent objects, which is resolved on invocation. This - * "bug" is unavoidable, since in general the object may be destroyed - * between a locate and a request. Note that this only checks that - * the appropriate ObjectAdapter is available, not that the servant - * actually exists. - * Need to signal one of OBJECT_HERE, OBJECT_FORWARD, OBJECT_NOT_EXIST. - * @return Result is null if object is (possibly) implemented here, otherwise - * an IOR indicating objref to forward the request to. - * @exception org.omg.CORBA.OBJECT_NOT_EXIST is thrown if we know the object does not - * exist here, and we are not forwarding. + /** + * Called from ORB.locate when a LocateRequest arrives. Result is not always absolutely correct: may indicate + * OBJECT_HERE for non-existent objects, which is resolved on invocation. This "bug" is unavoidable, since in general + * the object may be destroyed between a locate and a request. Note that this only checks that the appropriate + * ObjectAdapter is available, not that the servant actually exists. Need to signal one of OBJECT_HERE, OBJECT_FORWARD, + * OBJECT_NOT_EXIST. + * + * @return Result is null if object is (possibly) implemented here, otherwise an IOR indicating objref to forward the + * request to. + * @exception org.omg.CORBA.OBJECT_NOT_EXIST is thrown if we know the object does not exist here, and we are not + * forwarding. */ @Subcontract @Override public IOR locate(ObjectKey okey) { - ObjectKeyTemplate oktemp = okey.getTemplate() ; + ObjectKeyTemplate oktemp = okey.getTemplate(); try { checkServerId(okey); } catch (ForwardException fex) { - return fex.getIOR() ; + return fex.getIOR(); } // Called only for its side-effect of throwing appropriate exceptions findObjectAdapter(oktemp); - return null ; - } + return null; + } @InfoMethod - private void generalMessage( String msg ) { } + private void generalMessage(String msg) { + } @InfoMethod - private void exceptionMessage( String msg, Throwable thr ) { } + private void exceptionMessage(String msg, Throwable thr) { + } @Subcontract @Override @@ -134,54 +128,49 @@ public void dispatch(MessageMediator request) { // Now that we have the service contexts processed and the // correct ORBVersion set, we must finish initializing the // stream. - ((MarshalInputStream)request.getInputObject()) - .performORBVersionSpecificInit(); + ((MarshalInputStream) request.getInputObject()).performORBVersionSpecificInit(); - ObjectKeyCacheEntry entry = request.getObjectKeyCacheEntry() ; + ObjectKeyCacheEntry entry = request.getObjectKeyCacheEntry(); ObjectKey okey = entry.getObjectKey(); // Check that this server is the right server try { checkServerId(okey); } catch (ForwardException fex) { - operationAndId(request.getOperationName(), - request.getRequestId()); + operationAndId(request.getOperationName(), request.getRequestId()); - request.getProtocolHandler() - .createLocationForward(request, fex.getIOR(), null); + request.getProtocolHandler().createLocationForward(request, fex.getIOR(), null); return; } String operation = request.getOperationName(); - ObjectAdapter objectAdapter = entry.getObjectAdapter() ; + ObjectAdapter objectAdapter = entry.getObjectAdapter(); try { - byte[] objectId = okey.getId().getId() ; - ObjectKeyTemplate oktemp = okey.getTemplate() ; + byte[] objectId = okey.getId().getId(); + ObjectKeyTemplate oktemp = okey.getTemplate(); if (objectAdapter == null) { // This call is expensive enough to cache, hence the creation // of the ObjectKeyCacheEntry mechanism. objectAdapter = findObjectAdapter(oktemp); - entry.setObjectAdapter( objectAdapter ) ; + entry.setObjectAdapter(objectAdapter); } - java.lang.Object servant = getServantWithPI(request, objectAdapter, - objectId, oktemp, operation); + java.lang.Object servant = getServantWithPI(request, objectAdapter, objectId, oktemp, operation); dispatchToServant(servant, request, objectId, objectAdapter); } catch (ForwardException ex) { - generalMessage( "Caught ForwardException") ; + generalMessage("Caught ForwardException"); // Thrown by Portable Interceptors from InterceptorInvoker, // through Response constructor. - request.getProtocolHandler() - .createLocationForward(request, ex.getIOR(), null); + request.getProtocolHandler().createLocationForward(request, ex.getIOR(), null); } catch (OADestroyed ex) { - generalMessage( "Caught OADestroyed" ) ; + generalMessage("Caught OADestroyed"); // Clear any cached ObjectAdapter in the ObjectKeyCacheEntry, because // it is no longer valid. - entry.clearObjectAdapter() ; + entry.clearObjectAdapter(); // DO NOT CALL releaseServant here! // The problem is that OADestroyed is only thrown by oa.enter, in @@ -192,7 +181,7 @@ public void dispatch(MessageMediator request) { // So just restart the dispatch. dispatch(request); } catch (RequestCanceledException ex) { - generalMessage( "Caught RequestCanceledException") ; + generalMessage("Caught RequestCanceledException"); // IDLJ generated non-tie based skeletons do not catch the // RequestCanceledException. Rethrow the exception, which will @@ -200,7 +189,7 @@ public void dispatch(MessageMediator request) { // other requests. throw ex; } catch (UnknownException ex) { - generalMessage( "Caught UnknownException" ) ; + generalMessage("Caught UnknownException"); // RMIC generated tie skeletons convert all Throwable exception // types (including RequestCanceledException, ThreadDeath) @@ -212,65 +201,56 @@ public void dispatch(MessageMediator request) { throw (RequestCanceledException) ex.originalEx; } - ServiceContexts contexts = - ServiceContextDefaults.makeServiceContexts(orb); - UEInfoServiceContext usc = - ServiceContextDefaults.makeUEInfoServiceContext(ex.originalEx); + ServiceContexts contexts = ServiceContextDefaults.makeServiceContexts(orb); + UEInfoServiceContext usc = ServiceContextDefaults.makeUEInfoServiceContext(ex.originalEx); - contexts.put( usc ) ; + contexts.put(usc); - SystemException sysex = wrapper.unknownExceptionInDispatch( ex ) ; - request.getProtocolHandler() - .createSystemExceptionResponse(request, sysex, - contexts); + SystemException sysex = wrapper.unknownExceptionInDispatch(ex); + request.getProtocolHandler().createSystemExceptionResponse(request, sysex, contexts); } catch (Throwable ex) { - generalMessage( "Caught other exception" ) ; - request.getProtocolHandler() - .handleThrowableDuringServerDispatch( - request, ex, CompletionStatus.COMPLETED_MAYBE); + generalMessage("Caught other exception"); + request.getProtocolHandler().handleThrowableDuringServerDispatch(request, ex, CompletionStatus.COMPLETED_MAYBE); } } @Subcontract private void releaseServant(ObjectAdapter objectAdapter) { if (objectAdapter == null) { - generalMessage( "Null object adapter" ) ; - return ; + generalMessage("Null object adapter"); + return; } try { objectAdapter.returnServant(); } finally { objectAdapter.exit(); - orb.popInvocationInfo() ; + orb.popInvocationInfo(); } } // Note that objectAdapter.enter() must be called before getServant. @Subcontract - private java.lang.Object getServant(ObjectAdapter objectAdapter, - byte[] objectId, String operation) throws OADestroyed { + private java.lang.Object getServant(ObjectAdapter objectAdapter, byte[] objectId, String operation) throws OADestroyed { OAInvocationInfo info = objectAdapter.makeInvocationInfo(objectId); info.setOperation(operation); orb.pushInvocationInfo(info); objectAdapter.getInvocationServant(info); - return info.getServantContainer() ; + return info.getServantContainer(); } @Subcontract - protected java.lang.Object getServantWithPI(MessageMediator request, - ObjectAdapter objectAdapter, byte[] objectId, ObjectKeyTemplate oktemp, - String operation) throws OADestroyed { + protected java.lang.Object getServantWithPI(MessageMediator request, ObjectAdapter objectAdapter, byte[] objectId, + ObjectKeyTemplate oktemp, String operation) throws OADestroyed { // Prepare Portable Interceptors for a new server request - // and invoke receive_request_service_contexts. The starting + // and invoke receive_request_service_contexts. The starting // point may throw a SystemException or ForwardException. - orb.getPIHandler().initializeServerPIInfo(request, objectAdapter, - objectId, oktemp); + orb.getPIHandler().initializeServerPIInfo(request, objectAdapter, objectId, oktemp); orb.getPIHandler().invokeServerPIStartingPoint(); - objectAdapter.enter() ; + objectAdapter.enter(); // This must be set just after the enter so that exceptions thrown by // enter do not cause @@ -279,39 +259,36 @@ protected java.lang.Object getServantWithPI(MessageMediator request, request.setExecuteReturnServantInResponseConstructor(true); } - java.lang.Object servant = getServant(objectAdapter, objectId, - operation); + java.lang.Object servant = getServant(objectAdapter, objectId, operation); // Note: we do not know the MDI on a null servant. // We only end up in that situation if _non_existent called, // so that the following handleNullServant call does not throw an // exception. - String mdi = "unknown" ; + String mdi = "unknown"; if (servant instanceof NullServant) { - handleNullServant(operation, - (NullServant) servant); + handleNullServant(operation, (NullServant) servant); } else { mdi = objectAdapter.getInterfaces(servant, objectId)[0]; } orb.getPIHandler().setServerPIInfo(servant, mdi); - if (((servant != null) && - !(servant instanceof org.omg.CORBA.DynamicImplementation) && - !(servant instanceof org.omg.PortableServer.DynamicImplementation)) || - (SpecialMethod.getSpecialMethod(operation) != null)) { + if (((servant != null) && !(servant instanceof org.omg.CORBA.DynamicImplementation) + && !(servant instanceof org.omg.PortableServer.DynamicImplementation)) + || (SpecialMethod.getSpecialMethod(operation) != null)) { orb.getPIHandler().invokeServerPIIntermediatePoint(); } - return servant ; + return servant; } @Subcontract protected void checkServerId(ObjectKey okey) { - ObjectKeyTemplate oktemp = okey.getTemplate() ; - int sId = oktemp.getServerId() ; - int scid = oktemp.getSubcontractId() ; + ObjectKeyTemplate oktemp = okey.getTemplate(); + int sId = oktemp.getServerId(); + int scid = oktemp.getSubcontractId(); if (!orb.isLocalServerId(scid, sId)) { generalMessage("bad server ID"); @@ -321,223 +298,212 @@ protected void checkServerId(ObjectKey okey) { @Subcontract private ObjectAdapter findObjectAdapter(ObjectKeyTemplate oktemp) { - RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ; - int scid = oktemp.getSubcontractId() ; + RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry(); + int scid = oktemp.getSubcontractId(); ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(scid); if (oaf == null) { - throw wrapper.noObjectAdapterFactory() ; + throw wrapper.noObjectAdapterFactory(); } - ObjectAdapterId oaid = oktemp.getObjectAdapterId() ; + ObjectAdapterId oaid = oktemp.getObjectAdapterId(); ObjectAdapter oa = oaf.find(oaid); if (oa == null) { - throw wrapper.badAdapterId() ; + throw wrapper.badAdapterId(); } - return oa ; + return oa; } - /** Always throws OBJECT_NOT_EXIST if operation is not a special method. - * If operation is _non_existent or _not_existent, this will just - * return without performing any action, so that _non_existent can return - * false. Always throws OBJECT_NOT_EXIST for any other special method. - * Update for issue 4385. + /** + * Always throws OBJECT_NOT_EXIST if operation is not a special method. If operation is _non_existent or _not_existent, + * this will just return without performing any action, so that _non_existent can return false. Always throws + * OBJECT_NOT_EXIST for any other special method. Update for issue 4385. + * * @param operation Name of method to get * @param nserv Servant throw associated {@link Exception} if not such method exists. - */ + */ @Subcontract - protected void handleNullServant(String operation, NullServant nserv ) { + protected void handleNullServant(String operation, NullServant nserv) { SpecialMethod specialMethod = SpecialMethod.getSpecialMethod(operation); - if ((specialMethod == null) || - !specialMethod.isNonExistentMethod()) { - throw nserv.getException() ; + if ((specialMethod == null) || !specialMethod.isNonExistentMethod()) { + throw nserv.getException(); } } @InfoMethod - private void objectInfo( String msg, Object obj ) { } + private void objectInfo(String msg, Object obj) { + } @Subcontract protected void consumeServiceContexts(MessageMediator request) { operationAndId(request.getOperationName(), request.getRequestId()); - ServiceContexts ctxts = request.getRequestServiceContexts(); - ServiceContext sc ; - GIOPVersion giopVersion = request.getGIOPVersion(); - - // we cannot depend on this since for our local case, we do not send - // in this service context. Can we rely on just the CodeSetServiceContext? - // boolean rtSC = false; // Runtime ServiceContext + ServiceContexts ctxts = request.getRequestServiceContexts(); + ServiceContext sc; + GIOPVersion giopVersion = request.getGIOPVersion(); - boolean hasCodeSetContext = processCodeSetContext(request, ctxts); + // we cannot depend on this since for our local case, we do not send + // in this service context. Can we rely on just the CodeSetServiceContext? + // boolean rtSC = false; // Runtime ServiceContext - objectInfo( "GIOP version", giopVersion ) ; - objectInfo( "Has code set context?" , hasCodeSetContext ) ; + boolean hasCodeSetContext = processCodeSetContext(request, ctxts); - sc = ctxts.get( - SendingContextServiceContext.SERVICE_CONTEXT_ID ) ; + objectInfo("GIOP version", giopVersion); + objectInfo("Has code set context?", hasCodeSetContext); - if (sc != null) { - SendingContextServiceContext scsc = - (SendingContextServiceContext)sc ; - IOR ior = scsc.getIOR() ; + sc = ctxts.get(SendingContextServiceContext.SERVICE_CONTEXT_ID); - try { - request.getConnection().setCodeBaseIOR(ior); - } catch (ThreadDeath td) { - throw td ; - } catch (Throwable t) { - throw wrapper.badStringifiedIor( t ) ; - } + if (sc != null) { + SendingContextServiceContext scsc = (SendingContextServiceContext) sc; + IOR ior = scsc.getIOR(); + + try { + request.getConnection().setCodeBaseIOR(ior); + } catch (ThreadDeath td) { + throw td; + } catch (Throwable t) { + throw wrapper.badStringifiedIor(t); } + } - // the RTSC is sent only once during session establishment. We - // need to find out if the CodeBaseRef is already set. If yes, - // then also the rtSC flag needs to be set to true - // this is not possible for the LocalCase since there is no - // IIOPConnection for the LocalCase - - // used for a case where we have JDK 1.3 supporting 1.0 protocol, - // but sending 2 service contexts, that is not normal as per - // GIOP rules, based on above information, we figure out that we - // are talking to the legacy ORB and set the ORB Version Accordingly. - - // this special case tell us that it is legacy SUN orb - // and not a foreign one - // rtSC is not available for localcase due to which this generic - // path would fail if relying on rtSC - //if (giopVersion.equals(GIOPVersion.V1_0) && hasCodeSetContext && rtSC) - boolean isForeignORB = false; - - if (giopVersion.equals(GIOPVersion.V1_0) && hasCodeSetContext) { - generalMessage("Old Sun ORB"); - orb.setORBVersion(ORBVersionFactory.getOLD()) ; - // System.out.println("setting legacy ORB version"); - } else { - // If it didn't include our ORB version service context (below), - // then it must be a foreign ORB. - isForeignORB = true; - } + // the RTSC is sent only once during session establishment. We + // need to find out if the CodeBaseRef is already set. If yes, + // then also the rtSC flag needs to be set to true + // this is not possible for the LocalCase since there is no + // IIOPConnection for the LocalCase + + // used for a case where we have JDK 1.3 supporting 1.0 protocol, + // but sending 2 service contexts, that is not normal as per + // GIOP rules, based on above information, we figure out that we + // are talking to the legacy ORB and set the ORB Version Accordingly. + + // this special case tell us that it is legacy SUN orb + // and not a foreign one + // rtSC is not available for localcase due to which this generic + // path would fail if relying on rtSC + // if (giopVersion.equals(GIOPVersion.V1_0) && hasCodeSetContext && rtSC) + boolean isForeignORB = false; + + if (giopVersion.equals(GIOPVersion.V1_0) && hasCodeSetContext) { + generalMessage("Old Sun ORB"); + orb.setORBVersion(ORBVersionFactory.getOLD()); + // System.out.println("setting legacy ORB version"); + } else { + // If it didn't include our ORB version service context (below), + // then it must be a foreign ORB. + isForeignORB = true; + } - // try to get the ORBVersion sent as part of the ServiceContext - // if any - sc = ctxts.get( ORBVersionServiceContext.SERVICE_CONTEXT_ID ) ; - if (sc != null) { - ORBVersionServiceContext ovsc = - (ORBVersionServiceContext) sc; + // try to get the ORBVersion sent as part of the ServiceContext + // if any + sc = ctxts.get(ORBVersionServiceContext.SERVICE_CONTEXT_ID); + if (sc != null) { + ORBVersionServiceContext ovsc = (ORBVersionServiceContext) sc; - ORBVersion version = ovsc.getVersion(); - orb.setORBVersion(version); + ORBVersion version = ovsc.getVersion(); + orb.setORBVersion(version); - isForeignORB = false; - } + isForeignORB = false; + } - if (isForeignORB) { - generalMessage("Foreign ORB" ) ; - orb.setORBVersion(ORBVersionFactory.getFOREIGN()); - } + if (isForeignORB) { + generalMessage("Foreign ORB"); + orb.setORBVersion(ORBVersionFactory.getFOREIGN()); + } } - + @Subcontract - protected MessageMediator dispatchToServant( - java.lang.Object servant, - MessageMediator req, - byte[] objectId, ObjectAdapter objectAdapter) - { + protected MessageMediator dispatchToServant(java.lang.Object servant, MessageMediator req, byte[] objectId, + ObjectAdapter objectAdapter) { try { if (orb.operationTraceDebugFlag) { - OperationTracer.enable() ; + OperationTracer.enable(); } - OperationTracer.begin( "Dispatch to servant" ) ; + OperationTracer.begin("Dispatch to servant"); - operationAndId( req.getOperationName(), req.getRequestId()); - objectInfo( "Servant info", servant ) ; + operationAndId(req.getOperationName(), req.getRequestId()); + objectInfo("Servant info", servant); - MessageMediator response = null ; + MessageMediator response = null; - String operation = req.getOperationName() ; + String operation = req.getOperationName(); - SpecialMethod method = SpecialMethod.getSpecialMethod(operation) ; + SpecialMethod method = SpecialMethod.getSpecialMethod(operation); if (method != null) { - objectInfo( "Handling special method", method.getName() ) ; + objectInfo("Handling special method", method.getName()); response = method.invoke(servant, req, objectId, objectAdapter); - return response ; - } - + return response; + } + // Invoke on the servant using the portable DSI skeleton if (servant instanceof org.omg.CORBA.DynamicImplementation) { - generalMessage( "Handling old style DSI type servant") ; + generalMessage("Handling old style DSI type servant"); - org.omg.CORBA.DynamicImplementation dynimpl = - (org.omg.CORBA.DynamicImplementation)servant; + org.omg.CORBA.DynamicImplementation dynimpl = (org.omg.CORBA.DynamicImplementation) servant; ServerRequestImpl sreq = new ServerRequestImpl(req, orb); // Note: When/if dynimpl.invoke calls arguments() or // set_exception() then intermediate points are run. dynimpl.invoke(sreq); - + response = handleDynamicResult(sreq, req); } else if (servant instanceof org.omg.PortableServer.DynamicImplementation) { - generalMessage( "Handling POA DSI type servant" ) ; - org.omg.PortableServer.DynamicImplementation dynimpl = - (org.omg.PortableServer.DynamicImplementation)servant; + generalMessage("Handling POA DSI type servant"); + org.omg.PortableServer.DynamicImplementation dynimpl = (org.omg.PortableServer.DynamicImplementation) servant; ServerRequestImpl sreq = new ServerRequestImpl(req, orb); // Note: When/if dynimpl.invoke calls arguments() or // set_exception() then intermediate points are run. dynimpl.invoke(sreq); - + response = handleDynamicResult(sreq, req); } else { - generalMessage( "Handling invoke handler type servant" ) ; - InvokeHandler invhandle = (InvokeHandler)servant ; + generalMessage("Handling invoke handler type servant"); + InvokeHandler invhandle = (InvokeHandler) servant; OutputStream stream = null; try { - stream = invhandle._invoke(operation, - (org.omg.CORBA.portable.InputStream) req.getInputObject(), - req); + stream = invhandle._invoke(operation, (org.omg.CORBA.portable.InputStream) req.getInputObject(), req); } catch (BAD_OPERATION e) { wrapper.badOperationFromInvoke(e, operation); throw e; } - response = ((CDROutputObject)stream).getMessageMediator(); + response = ((CDROutputObject) stream).getMessageMediator(); } - return response ; + return response; } finally { - OperationTracer.disable() ; - OperationTracer.finish( ) ; + OperationTracer.disable(); + OperationTracer.finish(); } } @Subcontract - protected MessageMediator handleDynamicResult( ServerRequestImpl sreq, - MessageMediator req) { + protected MessageMediator handleDynamicResult(ServerRequestImpl sreq, MessageMediator req) { - MessageMediator response = null ; + MessageMediator response = null; // Check if ServerRequestImpl.result() has been called Any excany = sreq.checkResultCalled(); if (excany == null) { // normal return - generalMessage( "Handling normal result" ) ; + generalMessage("Handling normal result"); // Marshal out/inout/return parameters into the ReplyMessage response = sendingReply(req); OutputStream os = (OutputStream) response.getOutputObject(); sreq.marshalReplyParams(os); - } else { - generalMessage( "Handling error" ) ; + } else { + generalMessage("Handling error"); response = sendingReply(req, excany); } - return response ; + return response; } @Subcontract @@ -546,9 +512,10 @@ protected MessageMediator sendingReply(MessageMediator req) { return req.getProtocolHandler().createResponse(req, scs); } - /** Must always be called, just after the servant's method returns. - * Creates the ReplyMessage header and puts in the transaction context - * if necessary. + /** + * Must always be called, just after the servant's method returns. Creates the ReplyMessage header and puts in the + * transaction context if necessary. + * * @param req original request * @param excany {@link Any} that contains an exception * @return Response that contains the exception @@ -557,33 +524,31 @@ protected MessageMediator sendingReply(MessageMediator req) { protected MessageMediator sendingReply(MessageMediator req, Any excany) { ServiceContexts scs = ServiceContextDefaults.makeServiceContexts(orb); - operationAndId( req.getOperationName(), req.getRequestId() ) ; + operationAndId(req.getOperationName(), req.getRequestId()); // Check if the servant set a SystemException or // UserException MessageMediator resp; - String repId=null; + String repId = null; try { repId = excany.type().id(); } catch (org.omg.CORBA.TypeCodePackage.BadKind e) { - throw wrapper.problemWithExceptionTypecode( e ) ; + throw wrapper.problemWithExceptionTypecode(e); } if (ORBUtility.isSystemException(repId)) { - generalMessage( "Handling system exception" ) ; + generalMessage("Handling system exception"); // Get the exception object from the Any InputStream in = excany.create_input_stream(); SystemException ex = ORBUtility.readSystemException(in); // Marshal the exception back - resp = req.getProtocolHandler() - .createSystemExceptionResponse(req, ex, scs); + resp = req.getProtocolHandler().createSystemExceptionResponse(req, ex, scs); } else { - generalMessage( "Handling user exception" ) ; + generalMessage("Handling user exception"); - resp = req.getProtocolHandler() - .createUserExceptionResponse(req, scs); - OutputStream os = (OutputStream)resp.getOutputObject(); + resp = req.getProtocolHandler().createUserExceptionResponse(req, scs); + OutputStream os = (OutputStream) resp.getOutputObject(); excany.write_value(os); } @@ -591,12 +556,13 @@ protected MessageMediator sendingReply(MessageMediator req, Any excany) { } @InfoMethod - private void codeSetServiceContextInfo( CodeSetServiceContext csctx ) { } + private void codeSetServiceContextInfo(CodeSetServiceContext csctx) { + } /** - * Handles setting the connection's code sets if required. - * Returns true if the CodeSetContext was in the request, false + * Handles setting the connection's code sets if required. Returns true if the CodeSetContext was in the request, false * otherwise. + * * @param request request to process * @param contexts context to check * @return if the CodeSetContext was in the request @@ -604,8 +570,7 @@ private void codeSetServiceContextInfo( CodeSetServiceContext csctx ) { } @Subcontract protected boolean processCodeSetContext(MessageMediator request, ServiceContexts contexts) { - ServiceContext sc = contexts.get( - CodeSetServiceContext.SERVICE_CONTEXT_ID); + ServiceContext sc = contexts.get(CodeSetServiceContext.SERVICE_CONTEXT_ID); if (sc != null) { // Somehow a code set service context showed up in the local case. @@ -613,24 +578,23 @@ protected boolean processCodeSetContext(MessageMediator request, ServiceContexts return true; } - // If it's GIOP 1.0, it shouldn't have this context at all. Our legacy + // If it's GIOP 1.0, it shouldn't have this context at all. Our legacy // ORBs sent it and we need to know if it's here to make ORB versioning // decisions, but we don't use the contents. if (request.getGIOPVersion().equals(GIOPVersion.V1_0)) { return true; } - CodeSetServiceContext cssc = (CodeSetServiceContext)sc ; + CodeSetServiceContext cssc = (CodeSetServiceContext) sc; CodeSetComponentInfo.CodeSetContext csctx = cssc.getCodeSetContext(); // The connection's codeSetContext is null until we've received a // request with a code set context with the negotiated code sets. - Connection connection = request.getConnection() ; + Connection connection = request.getConnection(); synchronized (connection) { if (connection.getCodeSetContext() == null) { - operationAndId(request.getOperationName(), - request.getRequestId() ); + operationAndId(request.getOperationName(), request.getRequestId()); codeSetServiceContextInfo(cssc); connection.setCodeSetContext(csctx); @@ -638,7 +602,7 @@ protected boolean processCodeSetContext(MessageMediator request, ServiceContexts // We had to read the method name using ISO 8859-1 // (which is the default in the CDRInputStream for // char data), but now we may have a new char - // code set. If it isn't ISO8859-1, we must tell + // code set. If it isn't ISO8859-1, we must tell // the CDR stream to null any converter references // it has created so that it will reacquire // the code sets again using the new info. @@ -647,10 +611,8 @@ protected boolean processCodeSetContext(MessageMediator request, ServiceContexts // char code set rather than assuming it's ISO8859-1. // (However, the operation name is almost certainly // ISO8859-1 or ASCII.) - if (csctx.getCharCodeSet() != - OSFCodeSetRegistry.ISO_8859_1.getNumber()) { - ((MarshalInputStream)request.getInputObject()) - .resetCodeSetConverters(); + if (csctx.getCharCodeSet() != OSFCodeSetRegistry.ISO_8859_1.getNumber()) { + ((MarshalInputStream) request.getInputObject()).resetCodeSetConverters(); } } } @@ -661,14 +623,14 @@ protected boolean processCodeSetContext(MessageMediator request, ServiceContexts // exception for any wchar transmissions. // // In the local case, we use ORB provided streams for - // marshaling and unmarshaling. Currently, they use + // marshaling and unmarshaling. Currently, they use // ISO8859-1 for char/string and UTF16 for wchar/wstring. - return sc != null ; + return sc != null; } @InfoMethod - private void operationAndId( String operation, int rid ) { } + private void operationAndId(String operation, int rid) { + } } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/SharedCDRClientRequestDispatcherImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/SharedCDRClientRequestDispatcherImpl.java index 3b3e9cdb1..009d08b4b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/SharedCDRClientRequestDispatcherImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/SharedCDRClientRequestDispatcherImpl.java @@ -35,43 +35,33 @@ import org.glassfish.pfl.tf.spi.annotation.InfoMethod; /** - * ClientDelegate is the RMI client-side subcontract or representation - * It implements RMI delegate as well as our internal ClientRequestDispatcher - * interface. + * ClientDelegate is the RMI client-side subcontract or representation It implements RMI delegate as well as our + * internal ClientRequestDispatcher interface. */ @Subcontract -public class SharedCDRClientRequestDispatcherImpl - extends - ClientRequestDispatcherImpl -{ +public class SharedCDRClientRequestDispatcherImpl extends ClientRequestDispatcherImpl { @InfoMethod - private void operationAndId( String msg, int rid ) { } + private void operationAndId(String msg, int rid) { + } // REVISIT: // Rather than have separate CDR subcontract, // use same CorbaClientRequestDispatcherImpl but have // different MessageMediator finishSendingRequest and waitForResponse - // handle what is done below. + // handle what is done below. // Benefit: then in ContactInfo no need to do a direct new // of subcontract - does not complicate subcontract registry. @Override @Subcontract - public CDRInputObject marshalingComplete(java.lang.Object self, - CDROutputObject outputObject) - throws - ApplicationException, - org.omg.CORBA.portable.RemarshalException - { + public CDRInputObject marshalingComplete(java.lang.Object self, CDROutputObject outputObject) + throws ApplicationException, org.omg.CORBA.portable.RemarshalException { MessageMediator messageMediator = null; - messageMediator = (MessageMediator) - outputObject.getMessageMediator(); - operationAndId( messageMediator.getOperationName(), - messageMediator.getRequestId() ) ; + messageMediator = (MessageMediator) outputObject.getMessageMediator(); + operationAndId(messageMediator.getOperationName(), messageMediator.getRequestId()); final ORB orb = (ORB) messageMediator.getBroker(); - operationAndId(messageMediator.getOperationName(), - messageMediator.getRequestId()); + operationAndId(messageMediator.getOperationName(), messageMediator.getRequestId()); CDROutputObject cdrOutputObject = outputObject; final CDROutputObject fCDROutputObject = cdrOutputObject; @@ -80,14 +70,13 @@ public CDRInputObject marshalingComplete(java.lang.Object self, // Create server-side input object. // - CDRInputObject cdrInputObject = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public CDRInputObject run() { - return fCDROutputObject.createInputObject(orb); - } - }); - + CDRInputObject cdrInputObject = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public CDRInputObject run() { + return fCDROutputObject.createInputObject(orb); + } + }); + messageMediator.setInputObject(cdrInputObject); cdrInputObject.setMessageMediator(messageMediator); @@ -96,8 +85,7 @@ public CDRInputObject run() { // // REVISIT: Impl cast. - ((MessageMediatorImpl)messageMediator).handleRequestRequest( - messageMediator); + ((MessageMediatorImpl) messageMediator).handleRequestRequest(messageMediator); // InputStream must be closed on the InputObject so that its // ByteBuffer can be released to the ByteBufferPool. We must do @@ -117,16 +105,15 @@ public CDRInputObject run() { cdrOutputObject = messageMediator.getOutputObject(); final CDROutputObject fCDROutputObject2 = cdrOutputObject; - cdrInputObject = AccessController.doPrivileged( - new PrivilegedAction() { - - @Override - public CDRInputObject run() { - // TODO Auto-generated method stub - return fCDROutputObject2.createInputObject(orb); - } - - }); + cdrInputObject = AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public CDRInputObject run() { + // TODO Auto-generated method stub + return fCDROutputObject2.createInputObject(orb); + } + + }); messageMediator.setInputObject(cdrInputObject); cdrInputObject.setMessageMediator(messageMediator); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/SpecialMethod.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/SpecialMethod.java index d19936e2c..a8f214b8d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/SpecialMethod.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/SpecialMethod.java @@ -17,8 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.protocol ; - +package com.sun.corba.ee.impl.protocol; import org.omg.CORBA.portable.InputStream; import org.omg.CORBA.portable.OutputStream; @@ -29,21 +28,19 @@ import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -import com.sun.corba.ee.spi.oa.NullServant ; +import com.sun.corba.ee.spi.oa.NullServant; public abstract class SpecialMethod { - static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + + public abstract boolean isNonExistentMethod(); - public abstract boolean isNonExistentMethod() ; public abstract String getName(); - public abstract MessageMediator invoke(java.lang.Object servant, - MessageMediator request, - byte[] objectId, - ObjectAdapter objectAdapter); + + public abstract MessageMediator invoke(java.lang.Object servant, MessageMediator request, byte[] objectId, ObjectAdapter objectAdapter); public static final SpecialMethod getSpecialMethod(String operation) { - for(int i = 0; i < methods.length; i++) { + for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(operation)) { return methods[i]; } @@ -51,104 +48,79 @@ public static final SpecialMethod getSpecialMethod(String operation) { return null; } - static SpecialMethod[] methods = { - new IsA(), - new GetInterface(), - new NonExistent(), - new NotExistent() - }; + static SpecialMethod[] methods = { new IsA(), new GetInterface(), new NonExistent(), new NotExistent() }; } class NonExistent extends SpecialMethod { - public boolean isNonExistentMethod() - { - return true ; + public boolean isNonExistentMethod() { + return true; } - public String getName() { // _non_existent + public String getName() { // _non_existent return "_non_existent"; } - public MessageMediator invoke(java.lang.Object servant, - MessageMediator request, - byte[] objectId, - ObjectAdapter objectAdapter) - { - boolean result = (servant == null) || (servant instanceof NullServant) ; - MessageMediator response = - request.getProtocolHandler().createResponse(request, null); - ((OutputStream)response.getOutputObject()).write_boolean(result); + public MessageMediator invoke(java.lang.Object servant, MessageMediator request, byte[] objectId, ObjectAdapter objectAdapter) { + boolean result = (servant == null) || (servant instanceof NullServant); + MessageMediator response = request.getProtocolHandler().createResponse(request, null); + ((OutputStream) response.getOutputObject()).write_boolean(result); return response; } } class NotExistent extends NonExistent { @Override - public String getName() { // _not_existent + public String getName() { // _not_existent return "_not_existent"; } } -class IsA extends SpecialMethod { // _is_a - public boolean isNonExistentMethod() - { - return false ; +class IsA extends SpecialMethod { // _is_a + public boolean isNonExistentMethod() { + return false; } public String getName() { return "_is_a"; } - public MessageMediator invoke(java.lang.Object servant, - MessageMediator request, - byte[] objectId, - ObjectAdapter objectAdapter) - { + + public MessageMediator invoke(java.lang.Object servant, MessageMediator request, byte[] objectId, ObjectAdapter objectAdapter) { if ((servant == null) || (servant instanceof NullServant)) { - return request.getProtocolHandler().createSystemExceptionResponse( - request, wrapper.badSkeleton(), null); + return request.getProtocolHandler().createSystemExceptionResponse(request, wrapper.badSkeleton(), null); } - - String[] ids = objectAdapter.getInterfaces( servant, objectId ); - String clientId = - ((InputStream)request.getInputObject()).read_string(); + + String[] ids = objectAdapter.getInterfaces(servant, objectId); + String clientId = ((InputStream) request.getInputObject()).read_string(); boolean answer = false; - for(int i = 0; i < ids.length; i++) { + for (int i = 0; i < ids.length; i++) { if (ids[i].equals(clientId)) { answer = true; break; } } - - MessageMediator response = - request.getProtocolHandler().createResponse(request, null); - ((OutputStream)response.getOutputObject()).write_boolean(answer); + + MessageMediator response = request.getProtocolHandler().createResponse(request, null); + ((OutputStream) response.getOutputObject()).write_boolean(answer); return response; } } -class GetInterface extends SpecialMethod { // _get_interface - public boolean isNonExistentMethod() - { - return false ; +class GetInterface extends SpecialMethod { // _get_interface + public boolean isNonExistentMethod() { + return false; } public String getName() { return "_interface"; } - public MessageMediator invoke(java.lang.Object servant, - MessageMediator request, - byte[] objectId, - ObjectAdapter objectAdapter) - { + + public MessageMediator invoke(java.lang.Object servant, MessageMediator request, byte[] objectId, ObjectAdapter objectAdapter) { if ((servant == null) || (servant instanceof NullServant)) { - return request.getProtocolHandler().createSystemExceptionResponse( - request, wrapper.badSkeleton(), null); + return request.getProtocolHandler().createSystemExceptionResponse(request, wrapper.badSkeleton(), null); } else { - return request.getProtocolHandler().createSystemExceptionResponse( - request, wrapper.getinterfaceNotImplemented(), null); + return request.getProtocolHandler().createSystemExceptionResponse(request, wrapper.getinterfaceNotImplemented(), null); } } } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java index 0965aa21a..7608d25ea 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java @@ -19,57 +19,49 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - /** -* com/sun/corba/ee/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ + * com/sun/corba/ee/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java Generated by the IDL-to-Java compiler + * (portable), version "3.0" from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl Sunday, June 4, + * 2000 5:18:54 PM PDT + */ -abstract public class AddressingDispositionHelper -{ - private static String _id = "IDL:messages/AddressingDisposition:1.0"; +abstract public class AddressingDispositionHelper { + private static String _id = "IDL:messages/AddressingDisposition:1.0"; + + public static void insert(org.omg.CORBA.Any a, short that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } - public static void insert (org.omg.CORBA.Any a, short that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } + public static short extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); + } - public static short extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } + private static org.omg.CORBA.TypeCode __typeCode = null; - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.corba.ee.impl.protocol.giopmsgheaders.AddressingDispositionHelper.id (), "AddressingDisposition", __typeCode); + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_short); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc( + com.sun.corba.ee.impl.protocol.giopmsgheaders.AddressingDispositionHelper.id(), "AddressingDisposition", __typeCode); + } + return __typeCode; } - return __typeCode; - } - public static String id () - { - return _id; - } + public static String id() { + return _id; + } - public static short read (org.omg.CORBA.portable.InputStream istream) - { - short value = (short)0; - value = istream.read_short (); - return value; - } + public static short read(org.omg.CORBA.portable.InputStream istream) { + short value = (short) 0; + value = istream.read_short(); + return value; + } - public static void write (org.omg.CORBA.portable.OutputStream ostream, short value) - { - ostream.write_short (value); - } + public static void write(org.omg.CORBA.portable.OutputStream ostream, short value) { + ostream.write_short(value); + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage.java index c030ea8eb..a6ee9a211 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage.java @@ -28,5 +28,6 @@ public interface CancelRequestMessage extends Message { int CANCEL_REQ_MSG_SIZE = 4; + int getRequestId(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java index 06f13bf3e..a2f725e91 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java @@ -28,8 +28,7 @@ * @version 1.0 */ -public final class CancelRequestMessage_1_0 extends Message_1_0 - implements CancelRequestMessage { +public final class CancelRequestMessage_1_0 extends Message_1_0 implements CancelRequestMessage { // Instance variables @@ -37,11 +36,11 @@ public final class CancelRequestMessage_1_0 extends Message_1_0 // Constructors - CancelRequestMessage_1_0() {} + CancelRequestMessage_1_0() { + } CancelRequestMessage_1_0(int _request_id) { - super(Message.GIOPBigMagic, false, Message.GIOPCancelRequest, - CANCEL_REQ_MSG_SIZE); + super(Message.GIOPBigMagic, false, Message.GIOPCancelRequest, CANCEL_REQ_MSG_SIZE); request_id = _request_id; } @@ -63,9 +62,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { ostream.write_ulong(this.request_id); } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } } // class CancelRequestMessage_1_0 diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java index d5b772e62..ccb99266f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java @@ -28,8 +28,7 @@ * @version 1.0 */ -public final class CancelRequestMessage_1_1 extends Message_1_1 - implements CancelRequestMessage { +public final class CancelRequestMessage_1_1 extends Message_1_1 implements CancelRequestMessage { // Instance variables @@ -37,11 +36,11 @@ public final class CancelRequestMessage_1_1 extends Message_1_1 // Constructors - CancelRequestMessage_1_1() {} + CancelRequestMessage_1_1() { + } CancelRequestMessage_1_1(int _request_id) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCancelRequest, CANCEL_REQ_MSG_SIZE); + super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPCancelRequest, CANCEL_REQ_MSG_SIZE); request_id = _request_id; } @@ -54,7 +53,7 @@ public int getRequestId() { // IO methods public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); + super.read(istream); this.request_id = istream.read_ulong(); } @@ -63,9 +62,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { ostream.write_ulong(this.request_id); } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } } // class CancelRequestMessage_1_1 diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java index b222dcac8..99384229b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java @@ -30,8 +30,7 @@ * @version 1.0 */ -public final class CancelRequestMessage_1_2 extends Message_1_1 - implements CancelRequestMessage { +public final class CancelRequestMessage_1_2 extends Message_1_1 implements CancelRequestMessage { // Instance variables @@ -39,11 +38,11 @@ public final class CancelRequestMessage_1_2 extends Message_1_1 // Constructors - CancelRequestMessage_1_2() {} + CancelRequestMessage_1_2() { + } CancelRequestMessage_1_2(int _request_id) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCancelRequest, CANCEL_REQ_MSG_SIZE); + super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPCancelRequest, CANCEL_REQ_MSG_SIZE); request_id = _request_id; } @@ -69,9 +68,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { ostream.write_ulong(this.request_id); } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } } // class CancelRequestMessage_1_2 diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage.java index 756820e95..7ec1aea26 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage.java @@ -28,5 +28,6 @@ public interface FragmentMessage extends Message { int getRequestId(); + int getHeaderLength(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java index c334b5bfa..0a5439a68 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java @@ -26,8 +26,7 @@ * @version 1.0 */ -public final class FragmentMessage_1_1 extends Message_1_1 - implements FragmentMessage { +public final class FragmentMessage_1_1 extends Message_1_1 implements FragmentMessage { // Constructors @@ -54,8 +53,8 @@ public int getHeaderLength() { // IO methods - /* This will never be called, since we do not currently read the - * request_id from an CDRInputStream. Instead we use the + /* + * This will never be called, since we do not currently read the request_id from an CDRInputStream. Instead we use the * readGIOP_1_1_requestId to read the requestId from a byte buffer. */ public void read(org.omg.CORBA.portable.InputStream istream) { @@ -67,8 +66,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { super.write(ostream); } - public void callback(MessageHandler handler) - throws java.io.IOException { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java index 8ffba9ae1..3739e8eaa 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java @@ -28,8 +28,7 @@ * @version 1.0 */ -public final class FragmentMessage_1_2 extends Message_1_2 - implements FragmentMessage { +public final class FragmentMessage_1_2 extends Message_1_2 implements FragmentMessage { // Constructors @@ -38,8 +37,7 @@ public final class FragmentMessage_1_2 extends Message_1_2 // This is currently never called. FragmentMessage_1_2(int _request_id) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPFragment, 0); + super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0); this.message_type = GIOPFragment; request_id = _request_id; } @@ -52,21 +50,21 @@ public final class FragmentMessage_1_2 extends Message_1_2 this.message_size = 0; switch (msg12.message_type) { - case GIOPRequest: - this.request_id = ((RequestMessage) msg12).getRequestId(); - break; - case GIOPReply: - this.request_id = ((ReplyMessage) msg12).getRequestId(); - break; - case GIOPLocateRequest: - this.request_id = ((LocateRequestMessage) msg12).getRequestId(); - break; - case GIOPLocateReply: - this.request_id = ((LocateReplyMessage) msg12).getRequestId(); - break; - case GIOPFragment: - this.request_id = ((FragmentMessage) msg12).getRequestId(); - break; + case GIOPRequest: + this.request_id = ((RequestMessage) msg12).getRequestId(); + break; + case GIOPReply: + this.request_id = ((ReplyMessage) msg12).getRequestId(); + break; + case GIOPLocateRequest: + this.request_id = ((LocateRequestMessage) msg12).getRequestId(); + break; + case GIOPLocateReply: + this.request_id = ((LocateReplyMessage) msg12).getRequestId(); + break; + case GIOPFragment: + this.request_id = ((FragmentMessage) msg12).getRequestId(); + break; } } @@ -82,8 +80,8 @@ public int getHeaderLength() { // IO methods - /* This will never be called, since we do not currently read the - * request_id from an CDRInputStream. Instead we use the + /* + * This will never be called, since we do not currently read the request_id from an CDRInputStream. Instead we use the * readGIOP_1_2_requestId to read the requestId from a byte buffer. */ public void read(org.omg.CORBA.portable.InputStream istream) { @@ -96,8 +94,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { ostream.write_ulong(this.request_id); } - public void callback(MessageHandler handler) - throws java.io.IOException { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfo.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfo.java index d1327e848..d74a757f0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfo.java @@ -19,27 +19,22 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - /** -* com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfo.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ + * com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfo.java Generated by the IDL-to-Java compiler + * (portable), version "3.0" from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl Sunday, June 4, + * 2000 5:18:54 PM PDT + */ -public final class IORAddressingInfo implements org.omg.CORBA.portable.IDLEntity -{ - public int selected_profile_index = (int)0; - public org.omg.IOP.IOR ior = null; +public final class IORAddressingInfo implements org.omg.CORBA.portable.IDLEntity { + public int selected_profile_index = (int) 0; + public org.omg.IOP.IOR ior = null; - public IORAddressingInfo () - { - } // ctor + public IORAddressingInfo() { + } // ctor - public IORAddressingInfo (int _selected_profile_index, org.omg.IOP.IOR _ior) - { - selected_profile_index = _selected_profile_index; - ior = _ior; - } // ctor + public IORAddressingInfo(int _selected_profile_index, org.omg.IOP.IOR _ior) { + selected_profile_index = _selected_profile_index; + ior = _ior; + } // ctor } // class IORAddressingInfo diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java index 92fc88e21..d798aa800 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java @@ -19,83 +19,67 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - /** -* com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ + * com/sun/corba/ee/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java Generated by the IDL-to-Java compiler + * (portable), version "3.0" from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl Sunday, June 4, + * 2000 5:18:54 PM PDT + */ -abstract public class IORAddressingInfoHelper -{ - private static String _id = "IDL:messages/IORAddressingInfo:1.0"; +abstract public class IORAddressingInfoHelper { + private static String _id = "IDL:messages/IORAddressingInfo:1.0"; + + public static void insert(org.omg.CORBA.Any a, com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } - public static void insert (org.omg.CORBA.Any a, com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } + public static com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); + } - public static com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } + private static org.omg.CORBA.TypeCode __typeCode = null; + private static boolean __active = false; - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong); - _members0[0] = new org.omg.CORBA.StructMember ( - "selected_profile_index", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.IOP.IORHelper.type (); - _members0[1] = new org.omg.CORBA.StructMember ( - "ior", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init().create_struct_tc (com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.id (), "IORAddressingInfo", _members0); - __active = false; + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); + } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[2]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong); + _members0[0] = new org.omg.CORBA.StructMember("selected_profile_index", _tcOf_members0, null); + _tcOf_members0 = org.omg.IOP.IORHelper.type(); + _members0[1] = new org.omg.CORBA.StructMember("ior", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc( + com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.id(), "IORAddressingInfo", _members0); + __active = false; + } + } } - } + return __typeCode; } - return __typeCode; - } - public static String id () - { - return _id; - } + public static String id() { + return _id; + } - public static com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo value = new com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo (); - value.selected_profile_index = istream.read_ulong (); - value.ior = org.omg.IOP.IORHelper.read (istream); - return value; - } + public static com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo read(org.omg.CORBA.portable.InputStream istream) { + com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo value = new com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo(); + value.selected_profile_index = istream.read_ulong(); + value.ior = org.omg.IOP.IORHelper.read(istream); + return value; + } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo value) - { - ostream.write_ulong (value.selected_profile_index); - org.omg.IOP.IORHelper.write (ostream, value.ior); - } + public static void write(org.omg.CORBA.portable.OutputStream ostream, + com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo value) { + ostream.write_ulong(value.selected_profile_index); + org.omg.IOP.IORHelper.write(ostream, value.ior); + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/KeyAddr.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/KeyAddr.java index 104fe066b..9438306a0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/KeyAddr.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/KeyAddr.java @@ -19,15 +19,11 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - /** -* com/sun/corba/ee/impl/protocol/giopmsgheaders/KeyAddr.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ + * com/sun/corba/ee/impl/protocol/giopmsgheaders/KeyAddr.java Generated by the IDL-to-Java compiler (portable), version + * "3.0" from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl Sunday, June 4, 2000 5:18:54 PM PDT + */ -public interface KeyAddr -{ - public static final short value = (short)(0); +public interface KeyAddr { + public static final short value = (short) (0); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java index 250d6d033..334988b7c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java @@ -30,7 +30,7 @@ import com.sun.corba.ee.impl.encoding.CDRInputObject; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** * This implements the GIOP 1.0 LocateReply header. @@ -39,11 +39,9 @@ * @version 1.0 */ -public final class LocateReplyMessage_1_0 extends Message_1_0 - implements LocateReplyMessage { +public final class LocateReplyMessage_1_0 extends Message_1_0 implements LocateReplyMessage { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables @@ -58,8 +56,7 @@ public final class LocateReplyMessage_1_0 extends Message_1_0 this.orb = orb; } - LocateReplyMessage_1_0(ORB orb, int _request_id, - int _locate_status, IOR _ior) { + LocateReplyMessage_1_0(ORB orb, int _request_id, int _locate_status, IOR _ior) { super(Message.GIOPBigMagic, false, Message.GIOPLocateReply, 0); this.orb = orb; request_id = _request_id; @@ -80,9 +77,9 @@ public int getReplyStatus() { public short getAddrDisposition() { return KeyAddr.value; } - + public SystemException getSystemException(String message) { - return null; // 1.0 LocateReply body does not contain SystemException + return null; // 1.0 LocateReply body does not contain SystemException } public IOR getIOR() { @@ -100,7 +97,7 @@ public void read(org.omg.CORBA.portable.InputStream istream) { // The code below reads the reply body if status is OBJECT_FORWARD if (this.locate_status == OBJECT_FORWARD) { CDRInputObject cdr = (CDRInputObject) istream; - this.ior = IORFactories.makeIOR( orb, (InputStream)cdr ) ; + this.ior = IORFactories.makeIOR(orb, (InputStream) cdr); } } @@ -116,18 +113,16 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { public static void isValidReplyStatus(int replyStatus) { switch (replyStatus) { - case UNKNOWN_OBJECT : - case OBJECT_HERE : - case OBJECT_FORWARD : + case UNKNOWN_OBJECT: + case OBJECT_HERE: + case OBJECT_FORWARD: break; - default : - throw wrapper.illegalReplyStatus() ; + default: + throw wrapper.illegalReplyStatus(); } } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } } // class LocateReplyMessage_1_0 diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java index 1cd85042b..5bd188d46 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java @@ -31,7 +31,7 @@ import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; import com.sun.corba.ee.impl.encoding.CDRInputObject; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** * This implements the GIOP 1.1 LocateReply header. @@ -40,11 +40,9 @@ * @version 1.0 */ -public final class LocateReplyMessage_1_1 extends Message_1_1 - implements LocateReplyMessage { +public final class LocateReplyMessage_1_1 extends Message_1_1 implements LocateReplyMessage { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables @@ -59,10 +57,8 @@ public final class LocateReplyMessage_1_1 extends Message_1_1 this.orb = orb; } - LocateReplyMessage_1_1(ORB orb, int _request_id, - int _reply_status, IOR _ior) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPLocateReply, 0); + LocateReplyMessage_1_1(ORB orb, int _request_id, int _reply_status, IOR _ior) { + super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPLocateReply, 0); this.orb = orb; request_id = _request_id; reply_status = _reply_status; @@ -82,7 +78,7 @@ public int getReplyStatus() { public short getAddrDisposition() { return KeyAddr.value; } - + public SystemException getSystemException(String message) { return null; // 1.0 LocateReply body does not contain SystemException } @@ -103,7 +99,7 @@ public void read(org.omg.CORBA.portable.InputStream istream) { // The code below reads the reply body if status is OBJECT_FORWARD if (this.reply_status == OBJECT_FORWARD) { CDRInputObject cdr = (CDRInputObject) istream; - this.ior = IORFactories.makeIOR( orb, (InputStream)cdr ) ; + this.ior = IORFactories.makeIOR(orb, (InputStream) cdr); } } @@ -120,18 +116,16 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { public static void isValidReplyStatus(int replyStatus) { switch (replyStatus) { - case UNKNOWN_OBJECT : - case OBJECT_HERE : - case OBJECT_FORWARD : + case UNKNOWN_OBJECT: + case OBJECT_HERE: + case OBJECT_FORWARD: break; - default : + default: throw wrapper.illegalReplyStatus(); } } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } } // class LocateReplyMessage_1_1 diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java index 5b960df3d..49e3f70f7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java @@ -42,11 +42,9 @@ * @version 1.0 */ -public final class LocateReplyMessage_1_2 extends Message_1_2 - implements LocateReplyMessage { +public final class LocateReplyMessage_1_2 extends Message_1_2 implements LocateReplyMessage { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables @@ -64,10 +62,8 @@ public final class LocateReplyMessage_1_2 extends Message_1_2 this.orb = orb; } - LocateReplyMessage_1_2(ORB orb, int _request_id, - int _reply_status, IOR _ior) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPLocateReply, 0); + LocateReplyMessage_1_2(ORB orb, int _request_id, int _reply_status, IOR _ior) { + super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPLocateReply, 0); this.orb = orb; request_id = _request_id; reply_status = _reply_status; @@ -89,8 +85,7 @@ public short getAddrDisposition() { } public SystemException getSystemException(String message) { - return MessageBase.getSystemException( - exClassName, minorCode, completionStatus, message, wrapper); + return MessageBase.getSystemException(exClassName, minorCode, completionStatus, message, wrapper); } public IOR getIOR() { @@ -119,20 +114,19 @@ public void read(org.omg.CORBA.portable.InputStream istream) { int status = istream.read_long(); switch (status) { - case CompletionStatus._COMPLETED_YES: - this.completionStatus = CompletionStatus.COMPLETED_YES; - break; - case CompletionStatus._COMPLETED_NO: - this.completionStatus = CompletionStatus.COMPLETED_NO; - break; - case CompletionStatus._COMPLETED_MAYBE: - this.completionStatus = CompletionStatus.COMPLETED_MAYBE; - break; - default: - throw wrapper.badCompletionStatusInLocateReply(status); + case CompletionStatus._COMPLETED_YES: + this.completionStatus = CompletionStatus.COMPLETED_YES; + break; + case CompletionStatus._COMPLETED_NO: + this.completionStatus = CompletionStatus.COMPLETED_NO; + break; + case CompletionStatus._COMPLETED_MAYBE: + this.completionStatus = CompletionStatus.COMPLETED_MAYBE; + break; + default: + throw wrapper.badCompletionStatusInLocateReply(status); } - } else if ((this.reply_status == OBJECT_FORWARD) || - (this.reply_status == OBJECT_FORWARD_PERM)) { + } else if ((this.reply_status == OBJECT_FORWARD) || (this.reply_status == OBJECT_FORWARD_PERM)) { CDRInputObject cdr = (CDRInputObject) istream; this.ior = IORFactories.makeIOR(orb, (InputStream) cdr); } else if (this.reply_status == LOC_NEEDS_ADDRESSING_MODE) { @@ -152,7 +146,6 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { ostream.write_ulong(this.request_id); ostream.write_long(this.reply_status); - // GIOP 1.2 LocateReply message bodies are not aligned on // 8 byte boundaries. } @@ -161,21 +154,20 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { public static void isValidReplyStatus(int replyStatus) { switch (replyStatus) { - case UNKNOWN_OBJECT: - case OBJECT_HERE: - case OBJECT_FORWARD: - case OBJECT_FORWARD_PERM: - case LOC_SYSTEM_EXCEPTION: - case LOC_NEEDS_ADDRESSING_MODE: - break; - default: - throw wrapper.illegalReplyStatus(); + case UNKNOWN_OBJECT: + case OBJECT_HERE: + case OBJECT_FORWARD: + case OBJECT_FORWARD_PERM: + case LOC_SYSTEM_EXCEPTION: + case LOC_NEEDS_ADDRESSING_MODE: + break; + default: + throw wrapper.illegalReplyStatus(); } } @Override - public void callback(MessageHandler handler) - throws java.io.IOException { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java index ab37ce5f3..fbcb9548e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java @@ -25,11 +25,14 @@ public interface LocateReplyOrReplyMessage extends Message { int getRequestId(); + int getReplyStatus(); + SystemException getSystemException(String message); + IOR getIOR(); + short getAddrDisposition(); } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage.java index f2d090224..a595557da 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage.java @@ -30,5 +30,6 @@ public interface LocateRequestMessage extends Message { int getRequestId(); + ObjectKeyCacheEntry getObjectKeyCacheEntry(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java index fe2199988..5d3525935 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java @@ -31,8 +31,7 @@ * @version 1.0 */ -public final class LocateRequestMessage_1_0 extends Message_1_0 - implements LocateRequestMessage { +public final class LocateRequestMessage_1_0 extends Message_1_0 implements LocateRequestMessage { // Instance variables @@ -72,11 +71,12 @@ public ObjectKeyCacheEntry getObjectKeyCacheEntry() { // IO methods public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream);; + super.read(istream); + ; this.request_id = istream.read_ulong(); int _len0 = istream.read_long(); this.object_key = new byte[_len0]; - istream.read_octet_array (this.object_key, 0, _len0); + istream.read_octet_array(this.object_key, 0, _len0); } public void write(org.omg.CORBA.portable.OutputStream ostream) { @@ -87,9 +87,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { ostream.write_octet_array(this.object_key, 0, this.object_key.length); } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } } // class LocateRequestMessage_1_0 diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java index e27bd43d1..682f5566e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java @@ -32,8 +32,7 @@ * @version 1.0 */ -public final class LocateRequestMessage_1_1 extends Message_1_1 - implements LocateRequestMessage { +public final class LocateRequestMessage_1_1 extends Message_1_1 implements LocateRequestMessage { // Instance variables @@ -49,8 +48,7 @@ public final class LocateRequestMessage_1_1 extends Message_1_1 } LocateRequestMessage_1_1(ORB orb, int _request_id, byte[] _object_key) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPLocateRequest, 0); + super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPLocateRequest, 0); this.orb = orb; request_id = _request_id; object_key = _object_key; @@ -89,9 +87,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { ostream.write_octet_array(this.object_key, 0, this.object_key.length); } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } } // class LocateRequestMessage_1_1 diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java index 6ae1e1ae1..f04b56cd2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java @@ -30,8 +30,7 @@ * @version 1.0 */ -public final class LocateRequestMessage_1_2 extends Message_1_2 - implements LocateRequestMessage { +public final class LocateRequestMessage_1_2 extends Message_1_2 implements LocateRequestMessage { // Instance variables @@ -46,8 +45,7 @@ public final class LocateRequestMessage_1_2 extends Message_1_2 } LocateRequestMessage_1_2(ORB orb, int _request_id, TargetAddress _target) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPLocateRequest, 0); + super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPLocateRequest, 0); this.orb = orb; request_id = _request_id; target = _target; @@ -74,7 +72,7 @@ public void read(org.omg.CORBA.portable.InputStream istream) { super.read(istream); this.request_id = istream.read_ulong(); this.target = TargetAddressHelper.read(istream); - getObjectKeyCacheEntry(); // this does AddressingDisposition check + getObjectKeyCacheEntry(); // this does AddressingDisposition check } public void write(org.omg.CORBA.portable.OutputStream ostream) { @@ -84,8 +82,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { TargetAddressHelper.write(ostream, this.target); } - public void callback(MessageHandler handler) - throws java.io.IOException { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message.java index 2e6373cd3..012924ae5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message.java @@ -37,7 +37,7 @@ public interface Message { // Generic constants static final int defaultBufferSize = 1024; - static final int GIOPBigMagic = 0x47494F50; + static final int GIOPBigMagic = 0x47494F50; static final int GIOPMessageHeaderLength = 12; // Other useful constants @@ -62,19 +62,23 @@ public interface Message { /** * Returns whether the Message supports message fragmenting. * - * @return true if Message supports fragmenting or is - * a message fragment. Otherwise false it does - * not support message fragments. + * @return true if Message supports fragmenting or is a message fragment. Otherwise false it + * does not support message fragments. */ boolean supportsFragments(); // Accessor methods GIOPVersion getGIOPVersion(); + byte getEncodingVersion(); + boolean isLittleEndian(); + boolean moreFragmentsToFollow(); + int getType(); + int getSize(); int getThreadPoolToUse(); @@ -82,6 +86,7 @@ public interface Message { // Mutator methods void read(org.omg.CORBA.portable.InputStream istream); + void write(org.omg.CORBA.portable.OutputStream ostream); void setSize(ByteBuffer byteBuffer, int size); @@ -89,12 +94,13 @@ public interface Message { FragmentMessage createFragmentMessage(); void callback(MessageHandler handler) throws IOException; + void setEncodingVersion(byte version); - + /** - * Return a Message's CorbaRequestId. Messages which do not support - * a request id in the 4 bytes following the 12 byte GIOP message - * header shall return an undefined CorbaRequestId. + * Return a Message's CorbaRequestId. Messages which do not support a request id in the 4 bytes following the 12 byte + * GIOP message header shall return an undefined CorbaRequestId. + * * @return a Message's CorbaRequestId. */ RequestId getCorbaRequestId(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/MessageBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/MessageBase.java index ab23de993..2c35a306f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/MessageBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/MessageBase.java @@ -53,9 +53,8 @@ import com.sun.corba.ee.spi.trace.Giop; /** - * This class acts as the base class for the various GIOP message types. This - * also serves as a factory to create various message types. We currently - * support GIOP 1.0, 1.1 and 1.2 message types. + * This class acts as the base class for the various GIOP message types. This also serves as a factory to create various + * message types. We currently support GIOP 1.0, 1.1 and 1.2 message types. * * @author Ram Jeyaraman 05/14/2000 * @version 1.0 @@ -66,57 +65,52 @@ public abstract class MessageBase implements Message { private int threadPoolToUse; - // (encodingVersion == 0x00) implies CDR encoding, - // (encodingVersion > 0x00) implies Java serialization encoding version. + // (encodingVersion == 0x00) implies CDR encoding, + // (encodingVersion > 0x00) implies Java serialization encoding version. private byte encodingVersion = ORBConstants.CDR_ENC_VERSION; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Static methods public static String typeToString(byte type) { String result = type + "/"; switch (type) { - case GIOPRequest: - result += "GIOPRequest"; - break; - case GIOPReply: - result += "GIOPReply"; - break; - case GIOPCancelRequest: - result += "GIOPCancelRequest"; - break; - case GIOPLocateRequest: - result += "GIOPLocateRequest"; - break; - case GIOPLocateReply: - result += "GIOPLocateReply"; - break; - case GIOPCloseConnection: - result += "GIOPCloseConnection"; - break; - case GIOPMessageError: - result += "GIOPMessageError"; - break; - case GIOPFragment: - result += "GIOPFragment"; - break; - default: - result += "Unknown"; - break; + case GIOPRequest: + result += "GIOPRequest"; + break; + case GIOPReply: + result += "GIOPReply"; + break; + case GIOPCancelRequest: + result += "GIOPCancelRequest"; + break; + case GIOPLocateRequest: + result += "GIOPLocateRequest"; + break; + case GIOPLocateReply: + result += "GIOPLocateReply"; + break; + case GIOPCloseConnection: + result += "GIOPCloseConnection"; + break; + case GIOPMessageError: + result += "GIOPMessageError"; + break; + case GIOPFragment: + result += "GIOPFragment"; + break; + default: + result += "Unknown"; + break; } return result; } - public static MessageBase parseGiopHeader(ORB orb, - Connection connection, - ByteBuffer buf, - int startPosition) { + public static MessageBase parseGiopHeader(ORB orb, Connection connection, ByteBuffer buf, int startPosition) { TransportManager ctm = orb.getTransportManager(); - MessageTraceManagerImpl mtm = - (MessageTraceManagerImpl) ctm.getMessageTraceManager(); + MessageTraceManagerImpl mtm = (MessageTraceManagerImpl) ctm.getMessageTraceManager(); if (mtm.isEnabled()) { mtm.recordHeaderReceived(buf); } @@ -124,14 +118,10 @@ public static MessageBase parseGiopHeader(ORB orb, // Sanity checks /* - * check for magic corruption - * check for version incompatibility - * check if fragmentation is allowed based on mesg type. - . 1.0 fragmentation disallowed; FragmentMessage is non-existent. - . 1.1 only {Request, Reply} msgs maybe fragmented. - . 1.2 only {Request, Reply, LocateRequest, LocateReply} msgs - maybe fragmented. - */ + * check for magic corruption check for version incompatibility check if fragmentation is allowed based on mesg type. . + * 1.0 fragmentation disallowed; FragmentMessage is non-existent. . 1.1 only {Request, Reply} msgs maybe fragmented. . + * 1.2 only {Request, Reply, LocateRequest, LocateReply} msgs maybe fragmented. + */ byte[] it = new byte[12]; buf.position(startPosition); @@ -155,30 +145,25 @@ public static MessageBase parseGiopHeader(ORB orb, // if it contains an encoding, and set GIOP version appropriately. // For Java serialization, we use GIOP Version 1.2 message format. byte requestEncodingVersion = ORBConstants.CDR_ENC_VERSION; - if ((it[4] == GIOPVersion.V13_XX.getMajor()) && - (it[5] <= ORBConstants.JAVA_ENC_VERSION) && - (it[5] > ORBConstants.CDR_ENC_VERSION)) { + if ((it[4] == GIOPVersion.V13_XX.getMajor()) && (it[5] <= ORBConstants.JAVA_ENC_VERSION) + && (it[5] > ORBConstants.CDR_ENC_VERSION)) { // Entering this block means the request is using Java encoding, // and the encoding version is <= this ORB's Java encoding version. requestEncodingVersion = it[5]; buf.put(startPosition + 4, GIOPVersion.V1_2.getMajor()); buf.put(startPosition + 5, GIOPVersion.V1_2.getMinor()); - it[4] = GIOPVersion.V1_2.getMajor();//buf.get(4); - it[5] = GIOPVersion.V1_2.getMinor();//buf.get(5); + it[4] = GIOPVersion.V1_2.getMajor();// buf.get(4); + it[5] = GIOPVersion.V1_2.getMinor();// buf.get(5); } GIOPVersion orbVersion = orb.getORBData().getGIOPVersion(); if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: Message GIOP version: " - + it[4] + '.' + it[5]); - dprint(".parseGIOPHeader: ORB Max GIOP Version: " - + orbVersion); + dprint(".parseGIOPHeader: Message GIOP version: " + it[4] + '.' + it[5]); + dprint(".parseGIOPHeader: ORB Max GIOP Version: " + orbVersion); } - if ((it[4] > orbVersion.getMajor()) || - ((it[4] == orbVersion.getMajor()) && (it[5] > orbVersion.getMinor())) - ) { + if ((it[4] > orbVersion.getMajor()) || ((it[4] == orbVersion.getMajor()) && (it[5] > orbVersion.getMinor()))) { // For requests, sending ORB should use the version info // published in the IOR or may choose to use a <= version // for requests. If the version is greater than published version, @@ -202,147 +187,147 @@ public static MessageBase parseGiopHeader(ORB orb, switch (it[7]) { - case GIOPRequest: - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: creating RequestMessage"); - } - //msg = new RequestMessage(orb.giopDebugFlag); - if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 - msg = new RequestMessage_1_0(orb); - } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 - msg = new RequestMessage_1_1(orb); - } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 - msg = new RequestMessage_1_2(orb); - } else { - throw wrapper.giopVersionError(); - } - break; - - case GIOPLocateRequest: - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: creating LocateRequestMessage"); - } - //msg = new LocateRequestMessage(orb.giopDebugFlag); - if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 - msg = new LocateRequestMessage_1_0(orb); - } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 - msg = new LocateRequestMessage_1_1(orb); - } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 - msg = new LocateRequestMessage_1_2(orb); - } else { - throw wrapper.giopVersionError(); - } - break; - - case GIOPCancelRequest: - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: creating CancelRequestMessage"); - } - //msg = new CancelRequestMessage(orb.giopDebugFlag); - if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 - msg = new CancelRequestMessage_1_0(); - } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 - msg = new CancelRequestMessage_1_1(); - } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 - msg = new CancelRequestMessage_1_2(); - } else { - throw wrapper.giopVersionError(); - } - break; + case GIOPRequest: + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: creating RequestMessage"); + } + // msg = new RequestMessage(orb.giopDebugFlag); + if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 + msg = new RequestMessage_1_0(orb); + } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 + msg = new RequestMessage_1_1(orb); + } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 + msg = new RequestMessage_1_2(orb); + } else { + throw wrapper.giopVersionError(); + } + break; - case GIOPReply: - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: creating ReplyMessage"); - } - //msg = new ReplyMessage(orb.giopDebugFlag); - if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 - msg = new ReplyMessage_1_0(orb); - } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 - msg = new ReplyMessage_1_1(orb); - } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 - msg = new ReplyMessage_1_2(orb); - } else { - throw wrapper.giopVersionError(); - } - break; + case GIOPLocateRequest: + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: creating LocateRequestMessage"); + } + // msg = new LocateRequestMessage(orb.giopDebugFlag); + if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 + msg = new LocateRequestMessage_1_0(orb); + } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 + msg = new LocateRequestMessage_1_1(orb); + } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 + msg = new LocateRequestMessage_1_2(orb); + } else { + throw wrapper.giopVersionError(); + } + break; - case GIOPLocateReply: - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: creating LocateReplyMessage"); - } - //msg = new LocateReplyMessage(orb.giopDebugFlag); - if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 - msg = new LocateReplyMessage_1_0(orb); - } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 - msg = new LocateReplyMessage_1_1(orb); - } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 - msg = new LocateReplyMessage_1_2(orb); - } else { - throw wrapper.giopVersionError(); - } - break; + case GIOPCancelRequest: + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: creating CancelRequestMessage"); + } + // msg = new CancelRequestMessage(orb.giopDebugFlag); + if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 + msg = new CancelRequestMessage_1_0(); + } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 + msg = new CancelRequestMessage_1_1(); + } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 + msg = new CancelRequestMessage_1_2(); + } else { + throw wrapper.giopVersionError(); + } + break; - case GIOPCloseConnection: - // IMPORTANT: Must process the CloseConnection message as soon as - // its received to avoid a potential race condition on - // the connection, (i.e. another thread could try to send - // a new request on the same connection while this - // CloseConnection message would be getting dispatched - // if the CloseConnection message were not processed - // here). - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: received CloseConnection message"); - } - COMM_FAILURE comm_failure = wrapper.connectionRebind(); - connection.purgeCalls(comm_failure, false, true); - throw comm_failure; + case GIOPReply: + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: creating ReplyMessage"); + } + // msg = new ReplyMessage(orb.giopDebugFlag); + if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 + msg = new ReplyMessage_1_0(orb); + } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 + msg = new ReplyMessage_1_1(orb); + } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 + msg = new ReplyMessage_1_2(orb); + } else { + throw wrapper.giopVersionError(); + } + break; - case GIOPMessageError: - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: creating Message for CloseConnection or MessageError"); - } - // REVISIT a MessageError may contain the highest version server - // can support. In such a case, a new request may be made with the - // correct version or the connection be simply closed. Note the - // connection may have been closed by the server. - //msg = new Message(orb.giopDebugFlag); - if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 - msg = new Message_1_0(); - } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 - msg = new Message_1_1(); - } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 - msg = new Message_1_1(); - } else { - throw wrapper.giopVersionError(); - } - break; + case GIOPLocateReply: + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: creating LocateReplyMessage"); + } + // msg = new LocateReplyMessage(orb.giopDebugFlag); + if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 + msg = new LocateReplyMessage_1_0(orb); + } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 + msg = new LocateReplyMessage_1_1(orb); + } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 + msg = new LocateReplyMessage_1_2(orb); + } else { + throw wrapper.giopVersionError(); + } + break; + + case GIOPCloseConnection: + // IMPORTANT: Must process the CloseConnection message as soon as + // its received to avoid a potential race condition on + // the connection, (i.e. another thread could try to send + // a new request on the same connection while this + // CloseConnection message would be getting dispatched + // if the CloseConnection message were not processed + // here). + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: received CloseConnection message"); + } + COMM_FAILURE comm_failure = wrapper.connectionRebind(); + connection.purgeCalls(comm_failure, false, true); + throw comm_failure; - case GIOPFragment: - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: creating FragmentMessage"); - } - //msg = new FragmentMessage(orb.giopDebugFlag); - if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 - // not possible (error checking done already) - // Throw exception just for completeness, and - // for proper dataflow analysis in FindBugs - throw wrapper.giopVersionError(); - } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 - msg = new FragmentMessage_1_1(); - } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 - msg = new FragmentMessage_1_2(); - } else { - throw wrapper.giopVersionError(); - } - break; + case GIOPMessageError: + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: creating Message for CloseConnection or MessageError"); + } + // REVISIT a MessageError may contain the highest version server + // can support. In such a case, a new request may be made with the + // correct version or the connection be simply closed. Note the + // connection may have been closed by the server. + // msg = new Message(orb.giopDebugFlag); + if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 + msg = new Message_1_0(); + } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 + msg = new Message_1_1(); + } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 + msg = new Message_1_1(); + } else { + throw wrapper.giopVersionError(); + } + break; - default: - if (orb.giopDebugFlag) { - dprint(".parseGIOPHeader: UNKNOWN MESSAGE TYPE: " + it[7]); - } - // unknown message type ? - // ACTION : send MessageError and close the connection + case GIOPFragment: + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: creating FragmentMessage"); + } + // msg = new FragmentMessage(orb.giopDebugFlag); + if ((it[4] == 0x01) && (it[5] == 0x00)) { // 1.0 + // not possible (error checking done already) + // Throw exception just for completeness, and + // for proper dataflow analysis in FindBugs throw wrapper.giopVersionError(); + } else if ((it[4] == 0x01) && (it[5] == 0x01)) { // 1.1 + msg = new FragmentMessage_1_1(); + } else if ((it[4] == 0x01) && (it[5] == 0x02)) { // 1.2 + msg = new FragmentMessage_1_2(); + } else { + throw wrapper.giopVersionError(); + } + break; + + default: + if (orb.giopDebugFlag) { + dprint(".parseGIOPHeader: UNKNOWN MESSAGE TYPE: " + it[7]); + } + // unknown message type ? + // ACTION : send MessageError and close the connection + throw wrapper.giopVersionError(); } // @@ -358,28 +343,24 @@ public static MessageBase parseGiopHeader(ORB orb, // so just use the default thread pool, 0. msg.threadPoolToUse = 0; msg10.message_type = it[7]; - msg10.message_size = readSize(it[8], it[9], it[10], it[11], - msg10.isLittleEndian()) + - GIOPMessageHeaderLength; + msg10.message_size = readSize(it[8], it[9], it[10], it[11], msg10.isLittleEndian()) + GIOPMessageHeaderLength; } else { // 1.1 & 1.2 Message_1_1 msg11 = (Message_1_1) msg; msg11.magic = magic; msg11.GIOP_version = new GIOPVersion(it[4], it[5]); msg11.flags = (byte) (it[6] & TRAILING_TWO_BIT_BYTE_MASK); // IMPORTANT: For 'request partitioning', the thread pool to use - // information is stored in the leading 6 bits of byte 6. + // information is stored in the leading 6 bits of byte 6. // // IMPORTANT: Request partitioning is a PROPRIETARY EXTENSION !!! // - // NOTE: Bitwise operators will promote a byte to an int before - // performing a bitwise operation and bytes, ints, longs, etc - // are signed types in Java. Thus, the need for the - // THREAD_POOL_TO_USE_MASK operation. + // NOTE: Bitwise operators will promote a byte to an int before + // performing a bitwise operation and bytes, ints, longs, etc + // are signed types in Java. Thus, the need for the + // THREAD_POOL_TO_USE_MASK operation. msg.threadPoolToUse = (it[6] >>> 2) & THREAD_POOL_TO_USE_MASK; msg11.message_type = it[7]; - msg11.message_size = - readSize(it[8], it[9], it[10], it[11], - msg11.isLittleEndian()) + GIOPMessageHeaderLength; + msg11.message_size = readSize(it[8], it[9], it[10], it[11], msg11.isLittleEndian()) + GIOPMessageHeaderLength; if (orb.giopSizeDebugFlag) { StringBuilder sb = new StringBuilder(); @@ -397,20 +378,15 @@ public static MessageBase parseGiopHeader(ORB orb, } @SuppressWarnings("deprecation") - private static RequestMessage createRequest( - ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, - boolean response_expected, byte[] object_key, String operation, - ServiceContexts service_contexts, - org.omg.CORBA.Principal requesting_principal) { + private static RequestMessage createRequest(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, boolean response_expected, + byte[] object_key, String operation, ServiceContexts service_contexts, org.omg.CORBA.Principal requesting_principal) { if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new RequestMessage_1_0(orb, service_contexts, request_id, - response_expected, object_key, - operation, requesting_principal); + return new RequestMessage_1_0(orb, service_contexts, request_id, response_expected, object_key, operation, + requesting_principal); } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new RequestMessage_1_1(orb, service_contexts, request_id, - response_expected, new byte[]{0x00, 0x00, 0x00}, - object_key, operation, requesting_principal); + return new RequestMessage_1_1(orb, service_contexts, request_id, response_expected, new byte[] { 0x00, 0x00, 0x00 }, object_key, + operation, requesting_principal); } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 // Note: Currently we use response_expected flag to decide if the // call is oneway or not. Ideally, it is possible to expect a @@ -422,27 +398,17 @@ private static RequestMessage createRequest( response_flags = 0x00; } /* - // REVISIT The following is the correct way to do it. This gives - // more flexibility. - if ((DII::INV_NO_RESPONSE == false) && response_expected) { - response_flags = 0x03; // regular two-way - } else if ((DII::INV_NO_RESPONSE == false) && !response_expected) { - // this condition is not possible - } else if ((DII::INV_NO_RESPONSE == true) && response_expected) { - // oneway, but we need response for LocationForwards or - // SystemExceptions. - response_flags = 0x01; - } else if ((DII::INV_NO_RESPONSE == true) && !response_expected) { - // oneway, no response required - response_flags = 0x00; - } - */ + * // REVISIT The following is the correct way to do it. This gives // more flexibility. if ((DII::INV_NO_RESPONSE == + * false) && response_expected) { response_flags = 0x03; // regular two-way } else if ((DII::INV_NO_RESPONSE == false) + * && !response_expected) { // this condition is not possible } else if ((DII::INV_NO_RESPONSE == true) && + * response_expected) { // oneway, but we need response for LocationForwards or // SystemExceptions. response_flags = + * 0x01; } else if ((DII::INV_NO_RESPONSE == true) && !response_expected) { // oneway, no response required + * response_flags = 0x00; } + */ TargetAddress target = new TargetAddress(); target.object_key(object_key); - RequestMessage msg = - new RequestMessage_1_2(orb, request_id, response_flags, - new byte[]{0x00, 0x00, 0x00}, - target, operation, service_contexts); + RequestMessage msg = new RequestMessage_1_2(orb, request_id, response_flags, new byte[] { 0x00, 0x00, 0x00 }, target, operation, + service_contexts); msg.setEncodingVersion(encodingVersion); return msg; } else { @@ -450,13 +416,9 @@ private static RequestMessage createRequest( } } - @SuppressWarnings({"deprecation"}) - public static RequestMessage createRequest( - ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, - boolean response_expected, IOR ior, - short addrDisp, String operation, - ServiceContexts service_contexts, - org.omg.CORBA.Principal requesting_principal) { + @SuppressWarnings({ "deprecation" }) + public static RequestMessage createRequest(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, boolean response_expected, + IOR ior, short addrDisp, String operation, ServiceContexts service_contexts, org.omg.CORBA.Principal requesting_principal) { RequestMessage requestMessage = null; IIOPProfile profile = ior.getProfile(); @@ -466,15 +428,12 @@ public static RequestMessage createRequest( profile = ior.getProfile(); ObjectKey objKey = profile.getObjectKey(); byte[] object_key = objKey.getBytes(orb); - requestMessage = - createRequest(orb, gv, encodingVersion, request_id, - response_expected, object_key, - operation, service_contexts, - requesting_principal); + requestMessage = createRequest(orb, gv, encodingVersion, request_id, response_expected, object_key, operation, service_contexts, + requesting_principal); } else { if (!(gv.equals(GIOPVersion.V1_2))) { - // only object_key based target addressing is allowed for + // only object_key based target addressing is allowed for // GIOP 1.0 & 1.1 throw wrapper.giopVersionError(); } @@ -493,39 +452,32 @@ public static RequestMessage createRequest( if (addrDisp == ProfileAddr.value) { // iop profile will be used profile = ior.getProfile(); target.profile(profile.getIOPProfile()); - } else if (addrDisp == ReferenceAddr.value) { // ior will be used - IORAddressingInfo iorInfo = - new IORAddressingInfo(0, // profile index - ior.getIOPIOR()); + } else if (addrDisp == ReferenceAddr.value) { // ior will be used + IORAddressingInfo iorInfo = new IORAddressingInfo(0, // profile index + ior.getIOPIOR()); target.ior(iorInfo); } else { // invalid target addressing disposition value throw wrapper.illegalTargetAddressDisposition(); } - requestMessage = - new RequestMessage_1_2(orb, request_id, response_flags, - new byte[]{0x00, 0x00, 0x00}, target, - operation, service_contexts); + requestMessage = new RequestMessage_1_2(orb, request_id, response_flags, new byte[] { 0x00, 0x00, 0x00 }, target, operation, + service_contexts); requestMessage.setEncodingVersion(encodingVersion); } if (gv.supportsIORIIOPProfileComponents()) { // add request partitioning thread pool to use info int poolToUse = 0; // default pool - IIOPProfileTemplate temp = - (IIOPProfileTemplate) profile.getTaggedProfileTemplate(); - Iterator iter = - temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID); + IIOPProfileTemplate temp = (IIOPProfileTemplate) profile.getTaggedProfileTemplate(); + Iterator iter = temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID); if (iter.hasNext()) { - poolToUse = - ((RequestPartitioningComponent) iter.next()).getRequestPartitioningId(); + poolToUse = ((RequestPartitioningComponent) iter.next()).getRequestPartitioningId(); } - if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID || - poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { - throw wrapper.invalidRequestPartitioningId(poolToUse, - ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID, + if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID + || poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { + throw wrapper.invalidRequestPartitioningId(poolToUse, ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID, ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID); } requestMessage.setThreadPoolToUse(poolToUse); @@ -534,20 +486,15 @@ public static RequestMessage createRequest( return requestMessage; } - public static ReplyMessage createReply( - ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, - int reply_status, ServiceContexts service_contexts, IOR ior) { + public static ReplyMessage createReply(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, int reply_status, + ServiceContexts service_contexts, IOR ior) { if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new ReplyMessage_1_0(orb, service_contexts, request_id, - reply_status, ior); + return new ReplyMessage_1_0(orb, service_contexts, request_id, reply_status, ior); } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new ReplyMessage_1_1(orb, service_contexts, request_id, - reply_status, ior); + return new ReplyMessage_1_1(orb, service_contexts, request_id, reply_status, ior); } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - ReplyMessage msg = - new ReplyMessage_1_2(orb, request_id, reply_status, - service_contexts, ior); + ReplyMessage msg = new ReplyMessage_1_2(orb, request_id, reply_status, service_contexts, ior); msg.setEncodingVersion(encodingVersion); return msg; } else { @@ -555,9 +502,8 @@ public static ReplyMessage createReply( } } - public static LocateRequestMessage createLocateRequest( - ORB orb, GIOPVersion gv, byte encodingVersion, - int request_id, byte[] object_key) { + public static LocateRequestMessage createLocateRequest(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, + byte[] object_key) { if (gv.equals(GIOPVersion.V1_0)) { // 1.0 return new LocateRequestMessage_1_0(orb, request_id, object_key); @@ -566,8 +512,7 @@ public static LocateRequestMessage createLocateRequest( } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 TargetAddress target = new TargetAddress(); target.object_key(object_key); - LocateRequestMessage msg = - new LocateRequestMessage_1_2(orb, request_id, target); + LocateRequestMessage msg = new LocateRequestMessage_1_2(orb, request_id, target); msg.setEncodingVersion(encodingVersion); return msg; } else { @@ -575,20 +520,15 @@ public static LocateRequestMessage createLocateRequest( } } - public static LocateReplyMessage createLocateReply( - ORB orb, GIOPVersion gv, byte encodingVersion, - int request_id, int locate_status, IOR ior) { + public static LocateReplyMessage createLocateReply(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, int locate_status, + IOR ior) { if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new LocateReplyMessage_1_0(orb, request_id, - locate_status, ior); + return new LocateReplyMessage_1_0(orb, request_id, locate_status, ior); } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new LocateReplyMessage_1_1(orb, request_id, - locate_status, ior); + return new LocateReplyMessage_1_1(orb, request_id, locate_status, ior); } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - LocateReplyMessage msg = - new LocateReplyMessage_1_2(orb, request_id, - locate_status, ior); + LocateReplyMessage msg = new LocateReplyMessage_1_2(orb, request_id, locate_status, ior); msg.setEncodingVersion(encodingVersion); return msg; } else { @@ -596,8 +536,7 @@ public static LocateReplyMessage createLocateReply( } } - public static CancelRequestMessage createCancelRequest( - GIOPVersion gv, int request_id) { + public static CancelRequestMessage createCancelRequest(GIOPVersion gv, int request_id) { if (gv.equals(GIOPVersion.V1_0)) { // 1.0 return new CancelRequestMessage_1_0(request_id); @@ -612,16 +551,11 @@ public static CancelRequestMessage createCancelRequest( public static Message createCloseConnection(GIOPVersion gv) { if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new Message_1_0(Message.GIOPBigMagic, false, - Message.GIOPCloseConnection, 0); + return new Message_1_0(Message.GIOPBigMagic, false, Message.GIOPCloseConnection, 0); } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1, - FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCloseConnection, 0); + return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPCloseConnection, 0); } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2, - FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCloseConnection, 0); + return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPCloseConnection, 0); } else { throw wrapper.giopVersionError(); } @@ -629,16 +563,11 @@ public static Message createCloseConnection(GIOPVersion gv) { public static Message createMessageError(GIOPVersion gv) { if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new Message_1_0(Message.GIOPBigMagic, false, - Message.GIOPMessageError, 0); + return new Message_1_0(Message.GIOPBigMagic, false, Message.GIOPMessageError, 0); } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1, - FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPMessageError, 0); + return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPMessageError, 0); } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2, - FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPMessageError, 0); + return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPMessageError, 0); } else { throw wrapper.giopVersionError(); } @@ -646,6 +575,7 @@ public static Message createMessageError(GIOPVersion gv) { /** * Set a flag in the given buffer (fragment bit, byte order bit, etc) + * * @param byteBuffer buffer to set flag in * @param flag flag to set */ @@ -655,8 +585,7 @@ public static void setFlag(ByteBuffer byteBuffer, int flag) { byteBuffer.put(6, b); } - private static void AreFragmentsAllowed(byte major, byte minor, byte flag, - byte msgType) { + private static void AreFragmentsAllowed(byte major, byte minor, byte flag, byte msgType) { if ((major == 0x01) && (minor == 0x00)) { // 1.0 if (msgType == GIOPFragment) { @@ -666,16 +595,16 @@ private static void AreFragmentsAllowed(byte major, byte minor, byte flag, if ((flag & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT) { switch (msgType) { - case GIOPCancelRequest: - case GIOPCloseConnection: - case GIOPMessageError: + case GIOPCancelRequest: + case GIOPCloseConnection: + case GIOPMessageError: + throw wrapper.fragmentationDisallowed(); + case GIOPLocateRequest: + case GIOPLocateReply: + if ((major == 0x01) && (minor == 0x01)) { // 1.1 throw wrapper.fragmentationDisallowed(); - case GIOPLocateRequest: - case GIOPLocateReply: - if ((major == 0x01) && (minor == 0x01)) { // 1.1 - throw wrapper.fragmentationDisallowed(); - } - break; + } + break; } } } @@ -691,58 +620,58 @@ static ObjectKeyCacheEntry extractObjectKeyCacheEntry(TargetAddress target, ORB short reqAddrDisp = target.discriminator(); switch (orbTargetAddrPref) { - case ORBConstants.ADDR_DISP_OBJKEY: - if (reqAddrDisp != KeyAddr.value) { - throw new AddressingDispositionException(KeyAddr.value); + case ORBConstants.ADDR_DISP_OBJKEY: + if (reqAddrDisp != KeyAddr.value) { + throw new AddressingDispositionException(KeyAddr.value); + } + break; + case ORBConstants.ADDR_DISP_PROFILE: + if (reqAddrDisp != ProfileAddr.value) { + throw new AddressingDispositionException(ProfileAddr.value); + } + break; + case ORBConstants.ADDR_DISP_IOR: + if (reqAddrDisp != ReferenceAddr.value) { + throw new AddressingDispositionException(ReferenceAddr.value); + } + break; + case ORBConstants.ADDR_DISP_HANDLE_ALL: + break; + default: + throw wrapper.orbTargetAddrPreferenceInExtractObjectkeyInvalid(); + } + + try { + switch (reqAddrDisp) { + case KeyAddr.value: + byte[] objKey = target.object_key(); + if (objKey != null) { // AddressingDisposition::KeyAddr + return orb.extractObjectKeyCacheEntry(objKey); } break; - case ORBConstants.ADDR_DISP_PROFILE: - if (reqAddrDisp != ProfileAddr.value) { - throw new AddressingDispositionException(ProfileAddr.value); + case ProfileAddr.value: + TaggedProfile profile = target.profile(); + if (profile != null) { // AddressingDisposition::ProfileAddr + IIOPProfile iiopProfile = IIOPFactories.makeIIOPProfile(orb, profile); + ObjectKey objectKey = iiopProfile.getObjectKey(); + return new ObjectKeyCacheEntryNoObjectAdapterImpl(objectKey); } break; - case ORBConstants.ADDR_DISP_IOR: - if (reqAddrDisp != ReferenceAddr.value) { - throw new AddressingDispositionException(ReferenceAddr.value); + case ReferenceAddr.value: + IORAddressingInfo iorInfo = target.ior(); + if (iorInfo != null) { // AddressingDisposition::IORAddr + profile = iorInfo.ior.profiles[iorInfo.selected_profile_index]; + IIOPProfile iiopProfile = IIOPFactories.makeIIOPProfile(orb, profile); + ObjectKey objectKey = iiopProfile.getObjectKey(); + return new ObjectKeyCacheEntryNoObjectAdapterImpl(objectKey); } break; - case ORBConstants.ADDR_DISP_HANDLE_ALL: - break; default: - throw wrapper.orbTargetAddrPreferenceInExtractObjectkeyInvalid(); - } - - try { - switch (reqAddrDisp) { - case KeyAddr.value: - byte[] objKey = target.object_key(); - if (objKey != null) { // AddressingDisposition::KeyAddr - return orb.extractObjectKeyCacheEntry(objKey); - } - break; - case ProfileAddr.value: - TaggedProfile profile = target.profile(); - if (profile != null) { // AddressingDisposition::ProfileAddr - IIOPProfile iiopProfile = IIOPFactories.makeIIOPProfile(orb, profile); - ObjectKey objectKey = iiopProfile.getObjectKey(); - return new ObjectKeyCacheEntryNoObjectAdapterImpl(objectKey); - } - break; - case ReferenceAddr.value: - IORAddressingInfo iorInfo = target.ior(); - if (iorInfo != null) { // AddressingDisposition::IORAddr - profile = iorInfo.ior.profiles[iorInfo.selected_profile_index]; - IIOPProfile iiopProfile = IIOPFactories.makeIIOPProfile(orb, profile); - ObjectKey objectKey = iiopProfile.getObjectKey(); - return new ObjectKeyCacheEntryNoObjectAdapterImpl(objectKey); - } - break; - default: - // this cannot happen - // There is no need for a explicit exception, since the - // TargetAddressHelper.read() would have raised a BAD_OPERATION - // exception by now. - break; + // this cannot happen + // There is no need for a explicit exception, since the + // TargetAddressHelper.read() would have raised a BAD_OPERATION + // exception by now. + break; } } catch (Exception e) { throw wrapper.invalidObjectKey(e); @@ -752,8 +681,7 @@ static ObjectKeyCacheEntry extractObjectKeyCacheEntry(TargetAddress target, ORB throw wrapper.invalidObjectKey(); } - private static int readSize(byte b1, byte b2, byte b3, byte b4, - boolean littleEndian) { + private static int readSize(byte b1, byte b2, byte b3, byte b4, boolean littleEndian) { int a1, a2, a3, a4; @@ -778,9 +706,8 @@ static void nullCheck(Object obj) { } } - static SystemException getSystemException( - String exClassName, int minorCode, CompletionStatus completionStatus, - String message, ORBUtilSystemException wrapper) { + static SystemException getSystemException(String exClassName, int minorCode, CompletionStatus completionStatus, String message, + ORBUtilSystemException wrapper) { SystemException sysEx; try { @@ -788,9 +715,9 @@ static SystemException getSystemException( if (message == null) { sysEx = (SystemException) clazz.newInstance(); } else { - Class[] types = {String.class}; + Class[] types = { String.class }; Constructor constructor = clazz.getConstructor(types); - Object[] args = {message}; + Object[] args = { message }; sysEx = (SystemException) constructor.newInstance(args); } } catch (Exception someEx) { @@ -803,8 +730,7 @@ static SystemException getSystemException( return sysEx; } - public void callback(MessageHandler handler) - throws java.io.IOException { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } @@ -821,9 +747,8 @@ public void setEncodingVersion(byte version) { } /** - * Return a Message's CorbaRequestId. - * NOTE: This method should be overridden for messages that support - * a 4 byte request id following the 12 byte GIOP message header. + * Return a Message's CorbaRequestId. NOTE: This method should be overridden for messages that support a 4 byte request + * id following the 12 byte GIOP message header. */ public RequestId getCorbaRequestId() { return RequestIdImpl.UNKNOWN_CORBA_REQUEST_ID; @@ -837,17 +762,16 @@ public boolean supportsFragments() { } /** - * Get the request id from the 4 bytes following the 12 byte GIOP - * request header if the request header exists. Otherwise, return 0. + * Get the request id from the 4 bytes following the 12 byte GIOP request header if the request header exists. + * Otherwise, return 0. *

    - * NOTE: Assumes Message already been filtered by - * MessageBase.messageSupportsFragments(Message) + * NOTE: Assumes Message already been filtered by MessageBase.messageSupportsFragments(Message) *

    + * * @param message message to set ID of * @param byteBuffer buffer containing the request ID - * @return CorbaRequestIdif Message supports a 12 - * + 4 byte GIOP header. Otherwise returns a CorbaRequestId with an - * undefined request id. + * @return CorbaRequestIdif Message supports a 12 + 4 byte GIOP header. Otherwise returns a + * CorbaRequestId with an undefined request id. */ public static RequestId getRequestIdFromMessageBytes(Message message, ByteBuffer byteBuffer) { if (!(message instanceof Message_1_2)) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/MessageHandler.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/MessageHandler.java index 2f2bf40b8..10e9ea58e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/MessageHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/MessageHandler.java @@ -22,19 +22,18 @@ import java.io.IOException; /** - * Interface which allows an implementation to use - * double dispatch when processing the various - * concrete message types found in this package. + * Interface which allows an implementation to use double dispatch when processing the various concrete message types + * found in this package. */ -public interface MessageHandler -{ +public interface MessageHandler { // // REVISIT - These should not throw IOException. - // Should be handled internally. + // Should be handled internally. /** - * Used for message types for which we don't have concrete classes, yet, - * such as CloseConnection and MessageError, as well as unknown types. + * Used for message types for which we don't have concrete classes, yet, such as CloseConnection and MessageError, as + * well as unknown types. + * * @param header Message to handle * @throws IOException If an IO error occurs */ @@ -42,29 +41,37 @@ public interface MessageHandler // Request void handleInput(RequestMessage_1_0 header) throws IOException; + void handleInput(RequestMessage_1_1 header) throws IOException; + void handleInput(RequestMessage_1_2 header) throws IOException; // Reply - void handleInput(ReplyMessage_1_0 header) throws IOException; + void handleInput(ReplyMessage_1_0 header) throws IOException; + void handleInput(ReplyMessage_1_1 header) throws IOException; - void handleInput(ReplyMessage_1_2 header) throws IOException; + + void handleInput(ReplyMessage_1_2 header) throws IOException; // LocateRequest void handleInput(LocateRequestMessage_1_0 header) throws IOException; + void handleInput(LocateRequestMessage_1_1 header) throws IOException; + void handleInput(LocateRequestMessage_1_2 header) throws IOException; // LocateReply void handleInput(LocateReplyMessage_1_0 header) throws IOException; + void handleInput(LocateReplyMessage_1_1 header) throws IOException; + void handleInput(LocateReplyMessage_1_2 header) throws IOException; // Fragment void handleInput(FragmentMessage_1_1 header) throws IOException; + void handleInput(FragmentMessage_1_2 header) throws IOException; // CancelRequest void handleInput(CancelRequestMessage header) throws IOException; } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_0.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_0.java index db14a389a..d73537a1e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_0.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_0.java @@ -22,7 +22,7 @@ import java.nio.ByteBuffer; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /* * This implements the GIOP 1.0 Message header. @@ -31,11 +31,9 @@ * @version 1.0 */ -public class Message_1_0 - extends com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase { +public class Message_1_0 extends com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase { - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables int magic = 0; @@ -48,9 +46,8 @@ public class Message_1_0 Message_1_0() { } - - Message_1_0(int _magic, boolean _byte_order, byte _message_type, - int _message_size) { + + Message_1_0(int _magic, boolean _byte_order, byte _message_type, int _message_size) { magic = _magic; GIOP_version = GIOPVersion.V1_0; byte_order = _byte_order; @@ -69,7 +66,7 @@ public int getType() { } public int getSize() { - return this.message_size; + return this.message_size; } public boolean isLittleEndian() { @@ -83,29 +80,29 @@ public boolean moreFragmentsToFollow() { // Mutator methods public void setSize(ByteBuffer byteBuffer, int size) { - this.message_size = size; + this.message_size = size; // // Patch the size field in the header. // - int patch = size - GIOPMessageHeaderLength; + int patch = size - GIOPMessageHeaderLength; if (!isLittleEndian()) { - byteBuffer.put(8, (byte)((patch >>> 24) & 0xFF)); - byteBuffer.put(9, (byte)((patch >>> 16) & 0xFF)); - byteBuffer.put(10, (byte)((patch >>> 8) & 0xFF)); - byteBuffer.put(11, (byte)((patch) & 0xFF)); + byteBuffer.put(8, (byte) ((patch >>> 24) & 0xFF)); + byteBuffer.put(9, (byte) ((patch >>> 16) & 0xFF)); + byteBuffer.put(10, (byte) ((patch >>> 8) & 0xFF)); + byteBuffer.put(11, (byte) ((patch) & 0xFF)); } else { - byteBuffer.put(8, (byte)((patch) & 0xFF)); - byteBuffer.put(9, (byte)((patch >>> 8) & 0xFF)); - byteBuffer.put(10, (byte)((patch >>> 16) & 0xFF)); - byteBuffer.put(11, (byte)((patch >>> 24) & 0xFF)); + byteBuffer.put(8, (byte) ((patch) & 0xFF)); + byteBuffer.put(9, (byte) ((patch >>> 8) & 0xFF)); + byteBuffer.put(10, (byte) ((patch >>> 16) & 0xFF)); + byteBuffer.put(11, (byte) ((patch >>> 24) & 0xFF)); } } public FragmentMessage createFragmentMessage() { - throw wrapper.fragmentationDisallowed() ; + throw wrapper.fragmentationDisallowed(); } - + // IO methods // This should do nothing even if it is called. The Message Header already @@ -114,12 +111,9 @@ public FragmentMessage createFragmentMessage() { // So, we would never need to read the Message Header off a CDRInputStream. public void read(org.omg.CORBA.portable.InputStream istream) { /* - this.magic = istream.read_long(); - this.GIOP_version = (new GIOPVersion()).read(istream); - this.byte_order = istream.read_boolean(); - this.message_type = istream.read_octet(); - this.message_size = istream.read_ulong(); - */ + * this.magic = istream.read_long(); this.GIOP_version = (new GIOPVersion()).read(istream); this.byte_order = + * istream.read_boolean(); this.message_type = istream.read_octet(); this.message_size = istream.read_ulong(); + */ } public void write(org.omg.CORBA.portable.OutputStream ostream) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_1.java index ed1165da4..23aaf65b2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_1.java @@ -23,7 +23,7 @@ import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /* * This implements the GIOP 1.1 & 1.2 Message header. @@ -32,14 +32,12 @@ * @version 1.0 */ -public class Message_1_1 - extends com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase { +public class Message_1_1 extends com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase { // Constants final static int UPPER_THREE_BYTES_OF_INT_MASK = 0xFF; - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables int magic = 0; @@ -52,9 +50,8 @@ public class Message_1_1 Message_1_1() { } - - Message_1_1(int _magic, GIOPVersion _GIOP_version, byte _flags, - byte _message_type, int _message_size) { + + Message_1_1(int _magic, GIOPVersion _GIOP_version, byte _flags, byte _message_type, int _message_size) { magic = _magic; GIOP_version = _GIOP_version; flags = _flags; @@ -73,7 +70,7 @@ public int getType() { } public int getSize() { - return this.message_size; + return this.message_size; } public boolean isLittleEndian() { @@ -81,7 +78,7 @@ public boolean isLittleEndian() { } public boolean moreFragmentsToFollow() { - return ( (this.flags & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT ); + return ((this.flags & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT); } // Mutator methods @@ -91,13 +88,13 @@ public boolean moreFragmentsToFollow() { // this.flags represents byte 6 here. public void setThreadPoolToUse(int poolToUse) { // IMPORTANT: Bitwise operations will promote - // byte types to int before performing - // bitwise operations. And, Java - // types are signed. + // byte types to int before performing + // bitwise operations. And, Java + // types are signed. int tmpFlags = poolToUse << 2; tmpFlags &= UPPER_THREE_BYTES_OF_INT_MASK; tmpFlags |= flags; - flags = (byte)tmpFlags; + flags = (byte) tmpFlags; } public void setSize(ByteBuffer byteBuffer, int size) { @@ -110,15 +107,15 @@ public void setSize(ByteBuffer byteBuffer, int size) { int patch = size - GIOPMessageHeaderLength; if (!isLittleEndian()) { - byteBuffer.put(8, (byte)((patch >>> 24) & 0xFF)); - byteBuffer.put(9, (byte)((patch >>> 16) & 0xFF)); - byteBuffer.put(10, (byte)((patch >>> 8) & 0xFF)); - byteBuffer.put(11, (byte)((patch >>> 0) & 0xFF)); + byteBuffer.put(8, (byte) ((patch >>> 24) & 0xFF)); + byteBuffer.put(9, (byte) ((patch >>> 16) & 0xFF)); + byteBuffer.put(10, (byte) ((patch >>> 8) & 0xFF)); + byteBuffer.put(11, (byte) ((patch >>> 0) & 0xFF)); } else { - byteBuffer.put(8, (byte)((patch >>> 0) & 0xFF)); - byteBuffer.put(9, (byte)((patch >>> 8) & 0xFF)); - byteBuffer.put(10, (byte)((patch >>> 16) & 0xFF)); - byteBuffer.put(11, (byte)((patch >>> 24) & 0xFF)); + byteBuffer.put(8, (byte) ((patch >>> 0) & 0xFF)); + byteBuffer.put(9, (byte) ((patch >>> 8) & 0xFF)); + byteBuffer.put(10, (byte) ((patch >>> 16) & 0xFF)); + byteBuffer.put(11, (byte) ((patch >>> 24) & 0xFF)); } } @@ -130,33 +127,30 @@ public FragmentMessage createFragmentMessage() { // check for message type validity switch (this.message_type) { - case GIOPCancelRequest : - case GIOPCloseConnection : - case GIOPMessageError : - throw wrapper.fragmentationDisallowed() ; - case GIOPLocateRequest : - case GIOPLocateReply : + case GIOPCancelRequest: + case GIOPCloseConnection: + case GIOPMessageError: + throw wrapper.fragmentationDisallowed(); + case GIOPLocateRequest: + case GIOPLocateReply: if (this.GIOP_version.equals(GIOPVersion.V1_1)) { - throw wrapper.fragmentationDisallowed() ; + throw wrapper.fragmentationDisallowed(); } break; } /* - // A fragmented mesg can be created only if the current mesg' fragment - // bit is set. Otherwise, raise error - // too stringent check - if ( (this.flags & MORE_FRAGMENTS_BIT) != MORE_FRAGMENTS_BIT ) { - throw wrapper.fragmentationDisallowed( CompletionStatus.COMPLETED_MAYBE); - } - */ + * // A fragmented mesg can be created only if the current mesg' fragment // bit is set. Otherwise, raise error // too + * stringent check if ( (this.flags & MORE_FRAGMENTS_BIT) != MORE_FRAGMENTS_BIT ) { throw + * wrapper.fragmentationDisallowed( CompletionStatus.COMPLETED_MAYBE); } + */ if (this.GIOP_version.equals(GIOPVersion.V1_1)) { return new FragmentMessage_1_1(this); } else if (this.GIOP_version.equals(GIOPVersion.V1_2)) { return new FragmentMessage_1_2(this); } - throw wrapper.giopVersionError() ; + throw wrapper.giopVersionError(); } // IO methods @@ -167,12 +161,9 @@ public FragmentMessage createFragmentMessage() { // So, we would never need to read the Message Header off a CDRInputStream. public void read(org.omg.CORBA.portable.InputStream istream) { /* - this.magic = istream.read_long(); - this.GIOP_version = (new GIOPVersion()).read(istream); - this.flags = istream.read_octet(); - this.message_type = istream.read_octet(); - this.message_size = istream.read_ulong(); - */ + * this.magic = istream.read_long(); this.GIOP_version = (new GIOPVersion()).read(istream); this.flags = + * istream.read_octet(); this.message_type = istream.read_octet(); this.message_size = istream.read_ulong(); + */ } public void write(org.omg.CORBA.portable.OutputStream ostream) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_2.java index 316817c18..4474403b9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/Message_1_2.java @@ -20,7 +20,6 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -30,26 +29,21 @@ import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.impl.protocol.RequestIdImpl; -public class Message_1_2 extends Message_1_1 -{ +public class Message_1_2 extends Message_1_1 { protected int request_id = (int) 0; - Message_1_2() {} - - Message_1_2(int _magic, GIOPVersion _GIOP_version, byte _flags, - byte _message_type, int _message_size) { + Message_1_2() { + } - super(_magic, - _GIOP_version, - _flags, - _message_type, - _message_size); - } + Message_1_2(int _magic, GIOPVersion _GIOP_version, byte _flags, byte _message_type, int _message_size) { + + super(_magic, _GIOP_version, _flags, _message_type, _message_size); + } /** - * The byteBuffer is presumed to have contents of the message already - * read in. It must have 12 bytes of space at the beginning for the GIOP header, - * but the header doesn't have to be copied in. + * The byteBuffer is presumed to have contents of the message already read in. It must have 12 bytes of space at the + * beginning for the GIOP header, but the header doesn't have to be copied in. + * * @param byteBuffer buffer to get request ID of */ public void unmarshalRequestID(ByteBuffer byteBuffer) { @@ -64,8 +58,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { return; } GIOPVersion gv = GIOP_version; // save - GIOP_version = GIOPVersion.getInstance(GIOPVersion.V13_XX.getMajor(), - getEncodingVersion()); + GIOP_version = GIOPVersion.getInstance(GIOPVersion.V13_XX.getMajor(), getEncodingVersion()); super.write(ostream); GIOP_version = gv; // restore } @@ -75,4 +68,3 @@ public RequestId getCorbaRequestId() { return new RequestIdImpl(this.request_id); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ProfileAddr.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ProfileAddr.java index 2a1bd4c63..35668c1e5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ProfileAddr.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ProfileAddr.java @@ -19,15 +19,12 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - /** -* com/sun/corba/ee/impl/protocol/giopmsgheaders/ProfileAddr.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ + * com/sun/corba/ee/impl/protocol/giopmsgheaders/ProfileAddr.java Generated by the IDL-to-Java compiler (portable), + * version "3.0" from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl Sunday, June 4, 2000 5:18:54 + * PM PDT + */ -public interface ProfileAddr -{ - public static final short value = (short)(1); +public interface ProfileAddr { + public static final short value = (short) (1); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReferenceAddr.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReferenceAddr.java index 0215e6dba..5e8db1478 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReferenceAddr.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReferenceAddr.java @@ -19,15 +19,12 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - /** -* com/sun/corba/ee/impl/protocol/giopmsgheaders/ReferenceAddr.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ + * com/sun/corba/ee/impl/protocol/giopmsgheaders/ReferenceAddr.java Generated by the IDL-to-Java compiler (portable), + * version "3.0" from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl Sunday, June 4, 2000 5:18:54 + * PM PDT + */ -public interface ReferenceAddr -{ - public static final short value = (short)(2); +public interface ReferenceAddr { + public static final short value = (short) (2); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage.java index ab4728527..0db1c45b0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage.java @@ -38,9 +38,10 @@ public interface ReplyMessage extends Message, LocateReplyOrReplyMessage { int USER_EXCEPTION = 1; int SYSTEM_EXCEPTION = 2; int LOCATION_FORWARD = 3; - int LOCATION_FORWARD_PERM = 4; // 1.2 - int NEEDS_ADDRESSING_MODE = 5; // 1.2 + int LOCATION_FORWARD_PERM = 4; // 1.2 + int NEEDS_ADDRESSING_MODE = 5; // 1.2 ServiceContexts getServiceContexts(); - void setIOR( IOR newIOR ); + + void setIOR(IOR newIOR); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java index 40cf612ab..84e7cb2db 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java @@ -34,7 +34,7 @@ import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.impl.encoding.CDRInputObject; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** * This implements the GIOP 1.0 Reply header. @@ -43,11 +43,9 @@ * @version 1.0 */ -public final class ReplyMessage_1_0 extends Message_1_0 - implements ReplyMessage { +public final class ReplyMessage_1_0 extends Message_1_0 implements ReplyMessage { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables @@ -63,12 +61,11 @@ public final class ReplyMessage_1_0 extends Message_1_0 // Constructors ReplyMessage_1_0(ORB orb) { - this.service_contexts = ServiceContextDefaults.makeServiceContexts( orb ) ; + this.service_contexts = ServiceContextDefaults.makeServiceContexts(orb); this.orb = orb; } - ReplyMessage_1_0(ORB orb, ServiceContexts _service_contexts, - int _request_id, int _reply_status, IOR _ior) { + ReplyMessage_1_0(ORB orb, ServiceContexts _service_contexts, int _request_id, int _reply_status, IOR _ior) { super(Message.GIOPBigMagic, false, Message.GIOPReply, 0); this.orb = orb; service_contexts = _service_contexts; @@ -86,7 +83,7 @@ public int getRequestId() { public int getReplyStatus() { return this.reply_status; } - + public short getAddrDisposition() { return KeyAddr.value; } @@ -96,15 +93,14 @@ public ServiceContexts getServiceContexts() { } public SystemException getSystemException(String message) { - return MessageBase.getSystemException( - exClassName, minorCode, completionStatus, message, wrapper); + return MessageBase.getSystemException(exClassName, minorCode, completionStatus, message, wrapper); } public IOR getIOR() { return this.ior; } - public void setIOR( IOR ior ) { + public void setIOR(IOR ior) { this.ior = ior; } @@ -112,8 +108,7 @@ public void setIOR( IOR ior ) { public void read(org.omg.CORBA.portable.InputStream istream) { super.read(istream); - this.service_contexts = ServiceContextDefaults.makeServiceContexts( - (org.omg.CORBA_2_3.portable.InputStream) istream); + this.service_contexts = ServiceContextDefaults.makeServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); this.request_id = istream.read_ulong(); this.reply_status = istream.read_long(); isValidReplyStatus(this.reply_status); // raises exception on error @@ -138,14 +133,14 @@ public void read(org.omg.CORBA.portable.InputStream istream) { this.completionStatus = CompletionStatus.COMPLETED_MAYBE; break; default: - throw wrapper.badCompletionStatusInReply( status ); + throw wrapper.badCompletionStatusInReply(status); } } else if (this.reply_status == USER_EXCEPTION) { // do nothing. The client stub will read the exception from body. } else if (this.reply_status == LOCATION_FORWARD) { CDRInputObject cdr = (CDRInputObject) istream; - this.ior = IORFactories.makeIOR( orb, (InputStream)cdr ) ; + this.ior = IORFactories.makeIOR(orb, (InputStream) cdr); } } @@ -153,9 +148,7 @@ public void read(org.omg.CORBA.portable.InputStream istream) { // IOR may be written afterwards into the reply mesg body. public void write(org.omg.CORBA.portable.OutputStream ostream) { super.write(ostream); - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_0); + service_contexts.write((org.omg.CORBA_2_3.portable.OutputStream) ostream, GIOPVersion.V1_0); ostream.write_ulong(this.request_id); ostream.write_long(this.reply_status); } @@ -164,19 +157,17 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { public static void isValidReplyStatus(int replyStatus) { switch (replyStatus) { - case NO_EXCEPTION : - case USER_EXCEPTION : - case SYSTEM_EXCEPTION : - case LOCATION_FORWARD : + case NO_EXCEPTION: + case USER_EXCEPTION: + case SYSTEM_EXCEPTION: + case LOCATION_FORWARD: break; - default : + default: throw wrapper.illegalReplyStatus(); } } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } -} // +} // diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java index 1d60c4ad0..eb0b398d4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java @@ -44,8 +44,7 @@ * @version 1.0 */ -public final class ReplyMessage_1_1 extends Message_1_1 - implements ReplyMessage { +public final class ReplyMessage_1_1 extends Message_1_1 implements ReplyMessage { private static final ORBUtilSystemException wrapper = null; // Instance variables @@ -66,10 +65,8 @@ public final class ReplyMessage_1_1 extends Message_1_1 this.service_contexts = ServiceContextDefaults.makeServiceContexts(orb); } - ReplyMessage_1_1(ORB orb, ServiceContexts _service_contexts, - int _request_id, int _reply_status, IOR _ior) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPReply, 0); + ReplyMessage_1_1(ORB orb, ServiceContexts _service_contexts, int _request_id, int _reply_status, IOR _ior) { + super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0); this.orb = orb; service_contexts = _service_contexts; request_id = _request_id; @@ -96,8 +93,7 @@ public ServiceContexts getServiceContexts() { } public SystemException getSystemException(String message) { - return MessageBase.getSystemException( - exClassName, minorCode, completionStatus, message, wrapper); + return MessageBase.getSystemException(exClassName, minorCode, completionStatus, message, wrapper); } public IOR getIOR() { @@ -112,8 +108,7 @@ public void setIOR(IOR ior) { public void read(org.omg.CORBA.portable.InputStream istream) { super.read(istream); - this.service_contexts = ServiceContextDefaults.makeServiceContexts( - (org.omg.CORBA_2_3.portable.InputStream) istream); + this.service_contexts = ServiceContextDefaults.makeServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); this.request_id = istream.read_ulong(); this.reply_status = istream.read_long(); isValidReplyStatus(this.reply_status); // raises exception on error @@ -128,17 +123,17 @@ public void read(org.omg.CORBA.portable.InputStream istream) { int status = istream.read_long(); switch (status) { - case CompletionStatus._COMPLETED_YES: - this.completionStatus = CompletionStatus.COMPLETED_YES; - break; - case CompletionStatus._COMPLETED_NO: - this.completionStatus = CompletionStatus.COMPLETED_NO; - break; - case CompletionStatus._COMPLETED_MAYBE: - this.completionStatus = CompletionStatus.COMPLETED_MAYBE; - break; - default: - throw wrapper.badCompletionStatusInReply(status); + case CompletionStatus._COMPLETED_YES: + this.completionStatus = CompletionStatus.COMPLETED_YES; + break; + case CompletionStatus._COMPLETED_NO: + this.completionStatus = CompletionStatus.COMPLETED_NO; + break; + case CompletionStatus._COMPLETED_MAYBE: + this.completionStatus = CompletionStatus.COMPLETED_MAYBE; + break; + default: + throw wrapper.badCompletionStatusInReply(status); } } else if (this.reply_status == USER_EXCEPTION) { // do nothing. The client stub will read the exception from body. @@ -149,12 +144,10 @@ public void read(org.omg.CORBA.portable.InputStream istream) { } // Note, this writes only the header information. SystemException or - // IOR may be written afterwards into the reply mesg body. + // IOR may be written afterwards into the reply mesg body. public void write(org.omg.CORBA.portable.OutputStream ostream) { super.write(ostream); - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_1); + service_contexts.write((org.omg.CORBA_2_3.portable.OutputStream) ostream, GIOPVersion.V1_1); ostream.write_ulong(this.request_id); ostream.write_long(this.reply_status); } @@ -163,18 +156,17 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { public static void isValidReplyStatus(int replyStatus) { switch (replyStatus) { - case NO_EXCEPTION: - case USER_EXCEPTION: - case SYSTEM_EXCEPTION: - case LOCATION_FORWARD: - break; - default: - throw wrapper.illegalReplyStatus(); + case NO_EXCEPTION: + case USER_EXCEPTION: + case SYSTEM_EXCEPTION: + case LOCATION_FORWARD: + break; + default: + throw wrapper.illegalReplyStatus(); } } - public void callback(MessageHandler handler) - throws java.io.IOException { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java index cac1a3937..612b619f9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java @@ -24,7 +24,7 @@ import org.omg.CORBA_2_3.portable.InputStream; import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.ior.IORFactories ; +import com.sun.corba.ee.spi.ior.IORFactories; import com.sun.corba.ee.spi.orb.ORB; @@ -37,9 +37,9 @@ import com.sun.corba.ee.impl.misc.ORBUtility; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -import com.sun.corba.ee.spi.trace.Transport ; +import com.sun.corba.ee.spi.trace.Transport; /** * This implements the GIOP 1.2 Reply header. @@ -49,41 +49,36 @@ */ @Transport -public final class ReplyMessage_1_2 extends Message_1_2 - implements ReplyMessage { +public final class ReplyMessage_1_2 extends Message_1_2 implements ReplyMessage { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables private ORB orb = null; private int reply_status = 0; - private ServiceContexts service_contexts = null ; + private ServiceContexts service_contexts = null; private IOR ior = null; private String exClassName = null; private int minorCode = 0; private CompletionStatus completionStatus = null; private short addrDisposition = KeyAddr.value; // default; - + // Constructors ReplyMessage_1_2(ORB orb) { - this.service_contexts = ServiceContextDefaults.makeServiceContexts( orb ) ; + this.service_contexts = ServiceContextDefaults.makeServiceContexts(orb); this.orb = orb; } - ReplyMessage_1_2(ORB orb, int _request_id, int _reply_status, - ServiceContexts _service_contexts, IOR _ior) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPReply, 0); + ReplyMessage_1_2(ORB orb, int _request_id, int _reply_status, ServiceContexts _service_contexts, IOR _ior) { + super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0); this.orb = orb; request_id = _request_id; reply_status = _reply_status; service_contexts = _service_contexts; if (service_contexts == null) { - service_contexts = - ServiceContextDefaults.makeServiceContexts(orb); + service_contexts = ServiceContextDefaults.makeServiceContexts(orb); } ior = _ior; } @@ -101,21 +96,20 @@ public int getReplyStatus() { public short getAddrDisposition() { return this.addrDisposition; } - + public ServiceContexts getServiceContexts() { return this.service_contexts; } public SystemException getSystemException(String message) { - return MessageBase.getSystemException( - exClassName, minorCode, completionStatus, message, wrapper); + return MessageBase.getSystemException(exClassName, minorCode, completionStatus, message, wrapper); } public IOR getIOR() { return this.ior; } - public void setIOR( IOR ior ) { + public void setIOR(IOR ior) { this.ior = ior; } @@ -126,15 +120,14 @@ public void read(org.omg.CORBA.portable.InputStream istream) { this.request_id = istream.read_ulong(); this.reply_status = istream.read_long(); isValidReplyStatus(this.reply_status); // raises exception on error - this.service_contexts = ServiceContextDefaults.makeServiceContexts( - (org.omg.CORBA_2_3.portable.InputStream)istream ) ; + this.service_contexts = ServiceContextDefaults.makeServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be // aligned on an 8 octet boundary. // Ensures that the first read operation called from the stub code, // during body deconstruction, would skip the header padding, that was // inserted to ensure that the body was aligned on an 8-octet boundary. - ((CDRInputObject)istream).setHeaderPadding(true); + ((CDRInputObject) istream).setHeaderPadding(true); // The code below reads the reply body in some cases // SYSTEM_EXCEPTION & LOCATION_FORWARD & LOCATION_FORWARD_PERM & @@ -157,20 +150,19 @@ public void read(org.omg.CORBA.portable.InputStream istream) { this.completionStatus = CompletionStatus.COMPLETED_MAYBE; break; default: - throw wrapper.badCompletionStatusInReply( status ) ; + throw wrapper.badCompletionStatusInReply(status); } } else if (this.reply_status == USER_EXCEPTION) { // do nothing. The client stub will read the exception from body. - } else if ( (this.reply_status == LOCATION_FORWARD) || - (this.reply_status == LOCATION_FORWARD_PERM) ){ + } else if ((this.reply_status == LOCATION_FORWARD) || (this.reply_status == LOCATION_FORWARD_PERM)) { CDRInputObject cdr = (CDRInputObject) istream; - this.ior = IORFactories.makeIOR( orb, (InputStream)cdr ) ; - } else if (this.reply_status == NEEDS_ADDRESSING_MODE) { + this.ior = IORFactories.makeIOR(orb, (InputStream) cdr); + } else if (this.reply_status == NEEDS_ADDRESSING_MODE) { // read GIOP::AddressingDisposition from body and resend the // original request using the requested addressing mode. The // resending is transparent to the client program. - this.addrDisposition = AddressingDispositionHelper.read(istream); + this.addrDisposition = AddressingDispositionHelper.read(istream); } } @@ -182,36 +174,32 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { super.write(ostream); ostream.write_ulong(this.request_id); ostream.write_long(this.reply_status); - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_2); + service_contexts.write((org.omg.CORBA_2_3.portable.OutputStream) ostream, GIOPVersion.V1_2); // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be // aligned on an 8 octet boundary. // Ensures that the first write operation called from the stub code, // during body construction, would insert a header padding, such that // the body is aligned on an 8-octet boundary. - ((CDROutputObject)ostream).setHeaderPadding(true); + ((CDROutputObject) ostream).setHeaderPadding(true); } // Static methods public static void isValidReplyStatus(int replyStatus) { switch (replyStatus) { - case NO_EXCEPTION : - case USER_EXCEPTION : - case SYSTEM_EXCEPTION : - case LOCATION_FORWARD : - case LOCATION_FORWARD_PERM : - case NEEDS_ADDRESSING_MODE : + case NO_EXCEPTION: + case USER_EXCEPTION: + case SYSTEM_EXCEPTION: + case LOCATION_FORWARD: + case LOCATION_FORWARD_PERM: + case NEEDS_ADDRESSING_MODE: break; - default : - throw wrapper.illegalReplyStatus() ; + default: + throw wrapper.illegalReplyStatus(); } } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage.java index 1d904699a..37be41796 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage.java @@ -34,17 +34,23 @@ public interface RequestMessage extends Message { byte RESPONSE_EXPECTED_BIT = 0x01; ServiceContexts getServiceContexts(); + void setServiceContexts(ServiceContexts sc); + int getRequestId(); + boolean isResponseExpected(); + byte[] getReserved(); + ObjectKeyCacheEntry getObjectKeyCacheEntry(); + String getOperation(); - @SuppressWarnings({"deprecation"}) + + @SuppressWarnings({ "deprecation" }) org.omg.CORBA.Principal getPrincipal(); // NOTE: This is a SUN PROPRIETARY EXTENSION void setThreadPoolToUse(int poolToUse); - } // interface RequestMessage diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_0.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_0.java index 9c6ab55cf..3f8d400ae 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_0.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_0.java @@ -19,7 +19,6 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - import com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults; import com.sun.corba.ee.spi.servicecontext.ServiceContexts; @@ -36,8 +35,7 @@ * @version 1.0 */ -public final class RequestMessage_1_0 extends Message_1_0 - implements RequestMessage { +public final class RequestMessage_1_0 extends Message_1_0 implements RequestMessage { // Instance variables @@ -47,7 +45,7 @@ public final class RequestMessage_1_0 extends Message_1_0 private boolean response_expected = false; private byte[] object_key = null; private String operation = null; - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) private org.omg.CORBA.Principal requesting_principal = null; private ObjectKeyCacheEntry entry = null; @@ -55,12 +53,11 @@ public final class RequestMessage_1_0 extends Message_1_0 RequestMessage_1_0(ORB orb) { this.orb = orb; - service_contexts = ServiceContextDefaults.makeServiceContexts( orb ) ; + service_contexts = ServiceContextDefaults.makeServiceContexts(orb); } - @SuppressWarnings({"deprecation"}) - RequestMessage_1_0(ORB orb, ServiceContexts _service_contexts, - int _request_id, boolean _response_expected, byte[] _object_key, + @SuppressWarnings({ "deprecation" }) + RequestMessage_1_0(ORB orb, ServiceContexts _service_contexts, int _request_id, boolean _response_expected, byte[] _object_key, String _operation, org.omg.CORBA.Principal _requesting_principal) { super(Message.GIOPBigMagic, false, Message.GIOPRequest, 0); this.orb = orb; @@ -79,7 +76,7 @@ public ServiceContexts getServiceContexts() { } public void setServiceContexts(ServiceContexts sc) { - this.service_contexts = sc; + this.service_contexts = sc; } public int getRequestId() { @@ -108,14 +105,13 @@ public String getOperation() { return this.operation; } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) public org.omg.CORBA.Principal getPrincipal() { return this.requesting_principal; } - // Mutators - + public void setThreadPoolToUse(int poolToUse) { // No-op, must be GIOP Version 1.1 or greater // to support this SUN PROPRIETARY EXTENSION. @@ -125,8 +121,7 @@ public void setThreadPoolToUse(int poolToUse) { public void read(org.omg.CORBA.portable.InputStream istream) { super.read(istream); - this.service_contexts = ServiceContextDefaults.makeServiceContexts( - (org.omg.CORBA_2_3.portable.InputStream) istream); + this.service_contexts = ServiceContextDefaults.makeServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); this.request_id = istream.read_ulong(); this.response_expected = istream.read_boolean(); int _len0 = istream.read_long(); @@ -138,9 +133,7 @@ public void read(org.omg.CORBA.portable.InputStream istream) { public void write(org.omg.CORBA.portable.OutputStream ostream) { super.write(ostream); - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_0); + service_contexts.write((org.omg.CORBA_2_3.portable.OutputStream) ostream, GIOPVersion.V1_0); ostream.write_ulong(this.request_id); ostream.write_boolean(this.response_expected); nullCheck(this.object_key); @@ -154,9 +147,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { } } - public void callback(MessageHandler handler) - throws java.io.IOException - { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } } // class RequestMessage_1_0 diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_1.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_1.java index 73eac5921..ae8136f09 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_1.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_1.java @@ -34,11 +34,9 @@ * @version 1.0 */ -public final class RequestMessage_1_1 extends Message_1_1 - implements RequestMessage { +public final class RequestMessage_1_1 extends Message_1_1 implements RequestMessage { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables @@ -49,7 +47,7 @@ public final class RequestMessage_1_1 extends Message_1_1 private byte[] reserved = null; // Added in GIOP 1.1 private byte[] object_key = null; private String operation = null; - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) private org.omg.CORBA.Principal requesting_principal = null; private ObjectKeyCacheEntry entry = null; @@ -60,13 +58,10 @@ public final class RequestMessage_1_1 extends Message_1_1 this.service_contexts = ServiceContextDefaults.makeServiceContexts(orb); } - @SuppressWarnings({"deprecation"}) - RequestMessage_1_1(ORB orb, ServiceContexts _service_contexts, - int _request_id, boolean _response_expected, byte[] _reserved, - byte[] _object_key, String _operation, - org.omg.CORBA.Principal _requesting_principal) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPRequest, 0); + @SuppressWarnings({ "deprecation" }) + RequestMessage_1_1(ORB orb, ServiceContexts _service_contexts, int _request_id, boolean _response_expected, byte[] _reserved, + byte[] _object_key, String _operation, org.omg.CORBA.Principal _requesting_principal) { + super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0); this.orb = orb; service_contexts = _service_contexts; request_id = _request_id; @@ -112,7 +107,7 @@ public String getOperation() { return this.operation; } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) public org.omg.CORBA.Principal getPrincipal() { return this.requesting_principal; } @@ -121,9 +116,7 @@ public org.omg.CORBA.Principal getPrincipal() { public void read(org.omg.CORBA.portable.InputStream istream) { super.read(istream); - this.service_contexts - = ServiceContextDefaults.makeServiceContexts( - (org.omg.CORBA_2_3.portable.InputStream) istream); + this.service_contexts = ServiceContextDefaults.makeServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); this.request_id = istream.read_ulong(); this.response_expected = istream.read_boolean(); this.reserved = new byte[3]; @@ -139,9 +132,7 @@ public void read(org.omg.CORBA.portable.InputStream istream) { public void write(org.omg.CORBA.portable.OutputStream ostream) { super.write(ostream); - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_1); + service_contexts.write((org.omg.CORBA_2_3.portable.OutputStream) ostream, GIOPVersion.V1_1); ostream.write_ulong(this.request_id); ostream.write_boolean(this.response_expected); nullCheck(this.reserved); @@ -162,8 +153,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { } } - public void callback(MessageHandler handler) - throws java.io.IOException { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_2.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_2.java index 8d9f485fa..7be1bc921 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_2.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/RequestMessage_1_2.java @@ -40,11 +40,9 @@ */ @Transport -public final class RequestMessage_1_2 extends Message_1_2 - implements RequestMessage { +public final class RequestMessage_1_2 extends Message_1_2 implements RequestMessage { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; // Instance variables @@ -63,11 +61,9 @@ public final class RequestMessage_1_2 extends Message_1_2 this.service_contexts = ServiceContextDefaults.makeServiceContexts(orb); } - RequestMessage_1_2(ORB orb, int _request_id, byte _response_flags, - byte[] _reserved, TargetAddress _target, - String _operation, ServiceContexts _service_contexts) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPRequest, 0); + RequestMessage_1_2(ORB orb, int _request_id, byte _response_flags, byte[] _reserved, TargetAddress _target, String _operation, + ServiceContexts _service_contexts) { + super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0); this.orb = orb; request_id = _request_id; response_flags = _response_flags; @@ -85,16 +81,10 @@ public int getRequestId() { public boolean isResponseExpected() { /* - case 1: LSBit[1] == 1 - not a oneway call (DII flag INV_NO_RESPONSE is false) // Ox03 - LSBit[0] must be 1. - case 2: LSBit[1] == 0 - if (LSB[0] == 0) // Ox00 - oneway call - else if (LSB[0] == 1) // 0x01 - oneway call; but server may provide - a location forward response or system exception response. - */ + * case 1: LSBit[1] == 1 not a oneway call (DII flag INV_NO_RESPONSE is false) // Ox03 LSBit[0] must be 1. case 2: + * LSBit[1] == 0 if (LSB[0] == 0) // Ox00 oneway call else if (LSB[0] == 1) // 0x01 oneway call; but server may provide + * a location forward response or system exception response. + */ if ((this.response_flags & RESPONSE_EXPECTED_BIT) == RESPONSE_EXPECTED_BIT) { return true; @@ -120,7 +110,7 @@ public String getOperation() { return this.operation; } - @SuppressWarnings({"deprecation"}) + @SuppressWarnings({ "deprecation" }) public org.omg.CORBA.Principal getPrincipal() { // REVISIT Should we throw an exception or return null ? return null; @@ -148,8 +138,7 @@ public void read(org.omg.CORBA.portable.InputStream istream) { this.target = TargetAddressHelper.read(istream); getObjectKeyCacheEntry(); // this does AddressingDisposition check this.operation = istream.read_string(); - this.service_contexts = ServiceContextDefaults.makeServiceContexts( - (org.omg.CORBA_2_3.portable.InputStream) istream); + this.service_contexts = ServiceContextDefaults.makeServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be // aligned on an 8 octet boundary. @@ -175,9 +164,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { nullCheck(this.target); TargetAddressHelper.write(ostream, this.target); ostream.write_string(this.operation); - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_2); + service_contexts.write((org.omg.CORBA_2_3.portable.OutputStream) ostream, GIOPVersion.V1_2); // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be // aligned on an 8 octet boundary. @@ -187,8 +174,7 @@ public void write(org.omg.CORBA.portable.OutputStream ostream) { ((CDROutputObject) ostream).setHeaderPadding(true); } - public void callback(MessageHandler handler) - throws java.io.IOException { + public void callback(MessageHandler handler) throws java.io.IOException { handler.handleInput(this); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddress.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddress.java index a3676d8e1..f57753c42 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddress.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddress.java @@ -19,100 +19,85 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - /** -* com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddress.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -public final class TargetAddress implements org.omg.CORBA.portable.IDLEntity -{ - private byte[] ___object_key; - private org.omg.IOP.TaggedProfile ___profile; - private com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo ___ior; - private short __discriminator; - private boolean __uninitialized = true; - - public TargetAddress () - { - } - - public short discriminator () - { - if (__uninitialized) - throw new org.omg.CORBA.BAD_OPERATION (); - return __discriminator; - } - - public byte[] object_key () - { - if (__uninitialized) - throw new org.omg.CORBA.BAD_OPERATION (); - verifyobject_key (__discriminator); - return ___object_key; - } - - public void object_key (byte[] value) - { - __discriminator = com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value; - ___object_key = value; - __uninitialized = false; - } - - private void verifyobject_key (short discriminator) - { - if (discriminator != com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value) - throw new org.omg.CORBA.BAD_OPERATION (); - } - - public org.omg.IOP.TaggedProfile profile () - { - if (__uninitialized) - throw new org.omg.CORBA.BAD_OPERATION (); - verifyprofile (__discriminator); - return ___profile; - } - - public void profile (org.omg.IOP.TaggedProfile value) - { - __discriminator = com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value; - ___profile = value; - __uninitialized = false; - } - - private void verifyprofile (short discriminator) - { - if (discriminator != com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value) - throw new org.omg.CORBA.BAD_OPERATION (); - } - - public com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo ior () - { - if (__uninitialized) - throw new org.omg.CORBA.BAD_OPERATION (); - verifyior (__discriminator); - return ___ior; - } - - public void ior (com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo value) - { - __discriminator = com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value; - ___ior = value; - __uninitialized = false; - } - - private void verifyior (short discriminator) - { - if (discriminator != com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value) - throw new org.omg.CORBA.BAD_OPERATION (); - } - - public void _default () - { - __discriminator = -32768; - __uninitialized = false; - } + * com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddress.java Generated by the IDL-to-Java compiler (portable), + * version "3.0" from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl Sunday, June 4, 2000 5:18:54 + * PM PDT + */ + +public final class TargetAddress implements org.omg.CORBA.portable.IDLEntity { + private byte[] ___object_key; + private org.omg.IOP.TaggedProfile ___profile; + private com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo ___ior; + private short __discriminator; + private boolean __uninitialized = true; + + public TargetAddress() { + } + + public short discriminator() { + if (__uninitialized) + throw new org.omg.CORBA.BAD_OPERATION(); + return __discriminator; + } + + public byte[] object_key() { + if (__uninitialized) + throw new org.omg.CORBA.BAD_OPERATION(); + verifyobject_key(__discriminator); + return ___object_key; + } + + public void object_key(byte[] value) { + __discriminator = com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value; + ___object_key = value; + __uninitialized = false; + } + + private void verifyobject_key(short discriminator) { + if (discriminator != com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value) + throw new org.omg.CORBA.BAD_OPERATION(); + } + + public org.omg.IOP.TaggedProfile profile() { + if (__uninitialized) + throw new org.omg.CORBA.BAD_OPERATION(); + verifyprofile(__discriminator); + return ___profile; + } + + public void profile(org.omg.IOP.TaggedProfile value) { + __discriminator = com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value; + ___profile = value; + __uninitialized = false; + } + + private void verifyprofile(short discriminator) { + if (discriminator != com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value) + throw new org.omg.CORBA.BAD_OPERATION(); + } + + public com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo ior() { + if (__uninitialized) + throw new org.omg.CORBA.BAD_OPERATION(); + verifyior(__discriminator); + return ___ior; + } + + public void ior(com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo value) { + __discriminator = com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value; + ___ior = value; + __uninitialized = false; + } + + private void verifyior(short discriminator) { + if (discriminator != com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value) + throw new org.omg.CORBA.BAD_OPERATION(); + } + + public void _default() { + __discriminator = -32768; + __uninitialized = false; + } } // class TargetAddress diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddressHelper.java b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddressHelper.java index 158945f39..d5499437d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddressHelper.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddressHelper.java @@ -19,131 +19,111 @@ package com.sun.corba.ee.impl.protocol.giopmsgheaders; - /** -* com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddressHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ + * com/sun/corba/ee/impl/protocol/giopmsgheaders/TargetAddressHelper.java Generated by the IDL-to-Java compiler + * (portable), version "3.0" from ../../../../../../../src/share/classes/com/sun/corba/ee/GiopIDL/g.idl Sunday, June 4, + * 2000 5:18:54 PM PDT + */ + +abstract public class TargetAddressHelper { + private static String _id = "IDL:messages/TargetAddress:1.0"; -abstract public class TargetAddressHelper -{ - private static String _id = "IDL:messages/TargetAddress:1.0"; + public static void insert(org.omg.CORBA.Any a, com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } - public static void insert (org.omg.CORBA.Any a, com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } + public static com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); + } - public static com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } + private static org.omg.CORBA.TypeCode __typeCode = null; - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - org.omg.CORBA.TypeCode _disTypeCode0; - _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - _disTypeCode0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.corba.ee.impl.protocol.giopmsgheaders.AddressingDispositionHelper.id (), "AddressingDisposition", _disTypeCode0); - org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [3]; - org.omg.CORBA.TypeCode _tcOf_members0; - org.omg.CORBA.Any _anyOf_members0; + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + org.omg.CORBA.TypeCode _disTypeCode0; + _disTypeCode0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_short); + _disTypeCode0 = org.omg.CORBA.ORB.init().create_alias_tc( + com.sun.corba.ee.impl.protocol.giopmsgheaders.AddressingDispositionHelper.id(), "AddressingDisposition", _disTypeCode0); + org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember[3]; + org.omg.CORBA.TypeCode _tcOf_members0; + org.omg.CORBA.Any _anyOf_members0; - // Branch for object_key - _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any (); - _anyOf_members0.insert_short ((short)com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_octet); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _members0[0] = new org.omg.CORBA.UnionMember ( - "object_key", - _anyOf_members0, - _tcOf_members0, - null); + // Branch for object_key + _anyOf_members0 = org.omg.CORBA.ORB.init().create_any(); + _anyOf_members0.insert_short((short) com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_octet); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _members0[0] = new org.omg.CORBA.UnionMember("object_key", _anyOf_members0, _tcOf_members0, null); - // Branch for profile - _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any (); - _anyOf_members0.insert_short ((short)com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value); - _tcOf_members0 = org.omg.IOP.TaggedProfileHelper.type (); - _members0[1] = new org.omg.CORBA.UnionMember ( - "profile", - _anyOf_members0, - _tcOf_members0, - null); + // Branch for profile + _anyOf_members0 = org.omg.CORBA.ORB.init().create_any(); + _anyOf_members0.insert_short((short) com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value); + _tcOf_members0 = org.omg.IOP.TaggedProfileHelper.type(); + _members0[1] = new org.omg.CORBA.UnionMember("profile", _anyOf_members0, _tcOf_members0, null); - // Branch for ior - _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any (); - _anyOf_members0.insert_short ((short)com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value); - _tcOf_members0 = com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.type (); - _members0[2] = new org.omg.CORBA.UnionMember ( - "ior", - _anyOf_members0, - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddressHelper.id (), "TargetAddress", _disTypeCode0, _members0); + // Branch for ior + _anyOf_members0 = org.omg.CORBA.ORB.init().create_any(); + _anyOf_members0.insert_short((short) com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value); + _tcOf_members0 = com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.type(); + _members0[2] = new org.omg.CORBA.UnionMember("ior", _anyOf_members0, _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_union_tc(com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddressHelper.id(), + "TargetAddress", _disTypeCode0, _members0); + } + return __typeCode; } - return __typeCode; - } - public static String id () - { - return _id; - } + public static String id() { + return _id; + } - public static com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress value = new com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress (); - short _dis0 = (short)0; - _dis0 = istream.read_short (); - switch (_dis0) - { - case com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value: - byte _object_key[] = null; - int _len1 = istream.read_long (); - _object_key = new byte[_len1]; - istream.read_octet_array (_object_key, 0, _len1); - value.object_key (_object_key); - break; - case com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value: - org.omg.IOP.TaggedProfile _profile = null; - _profile = org.omg.IOP.TaggedProfileHelper.read (istream); - value.profile (_profile); - break; - case com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value: - com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo _ior = null; - _ior = com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.read (istream); - value.ior (_ior); - break; - default: - throw new org.omg.CORBA.BAD_OPERATION (); + public static com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress read(org.omg.CORBA.portable.InputStream istream) { + com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress value = new com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress(); + short _dis0 = (short) 0; + _dis0 = istream.read_short(); + switch (_dis0) { + case com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value: + byte _object_key[] = null; + int _len1 = istream.read_long(); + _object_key = new byte[_len1]; + istream.read_octet_array(_object_key, 0, _len1); + value.object_key(_object_key); + break; + case com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value: + org.omg.IOP.TaggedProfile _profile = null; + _profile = org.omg.IOP.TaggedProfileHelper.read(istream); + value.profile(_profile); + break; + case com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value: + com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfo _ior = null; + _ior = com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.read(istream); + value.ior(_ior); + break; + default: + throw new org.omg.CORBA.BAD_OPERATION(); + } + return value; } - return value; - } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress value) - { - ostream.write_short (value.discriminator ()); - switch (value.discriminator ()) - { - case com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value: - ostream.write_long (value.object_key ().length); - ostream.write_octet_array (value.object_key (), 0, value.object_key ().length); - break; - case com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value: - org.omg.IOP.TaggedProfileHelper.write (ostream, value.profile ()); - break; - case com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value: - com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.write (ostream, value.ior ()); - break; - default: - throw new org.omg.CORBA.BAD_OPERATION (); + public static void write(org.omg.CORBA.portable.OutputStream ostream, + com.sun.corba.ee.impl.protocol.giopmsgheaders.TargetAddress value) { + ostream.write_short(value.discriminator()); + switch (value.discriminator()) { + case com.sun.corba.ee.impl.protocol.giopmsgheaders.KeyAddr.value: + ostream.write_long(value.object_key().length); + ostream.write_octet_array(value.object_key(), 0, value.object_key().length); + break; + case com.sun.corba.ee.impl.protocol.giopmsgheaders.ProfileAddr.value: + org.omg.IOP.TaggedProfileHelper.write(ostream, value.profile()); + break; + case com.sun.corba.ee.impl.protocol.giopmsgheaders.ReferenceAddr.value: + com.sun.corba.ee.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.write(ostream, value.ior()); + break; + default: + throw new org.omg.CORBA.BAD_OPERATION(); + } } - } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/BootstrapResolverImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/BootstrapResolverImpl.java index 5159313fe..d31c4e14c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/BootstrapResolverImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/BootstrapResolverImpl.java @@ -17,63 +17,57 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.resolver ; - -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; -import org.omg.CORBA.portable.ApplicationException ; -import org.omg.CORBA.portable.RemarshalException ; - -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.IORFactories ; -import com.sun.corba.ee.spi.ior.IORTemplate ; -import com.sun.corba.ee.spi.ior.ObjectKey ; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.ee.spi.ior.iiop.IIOPFactories ; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.resolver.Resolver ; +package com.sun.corba.ee.impl.resolver; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.RemarshalException; + +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.IORFactories; +import com.sun.corba.ee.spi.ior.IORTemplate; +import com.sun.corba.ee.spi.ior.ObjectKey; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; +import com.sun.corba.ee.spi.ior.iiop.IIOPFactories; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.resolver.Resolver; import com.sun.corba.ee.impl.ior.ObjectIdImpl; import com.sun.corba.ee.impl.ior.ObjectKeyImpl; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; -import com.sun.corba.ee.impl.misc.ORBUtility ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; +import com.sun.corba.ee.impl.misc.ORBUtility; import java.util.Set; public class BootstrapResolverImpl implements Resolver { - private org.omg.CORBA.portable.Delegate bootstrapDelegate ; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private org.omg.CORBA.portable.Delegate bootstrapDelegate; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; public BootstrapResolverImpl(ORB orb, String host, int port) { // Create a new IOR with the magic of INIT byte[] initialKey = "INIT".getBytes(); - ObjectKey okey = new ObjectKeyImpl(orb.getWireObjectKeyTemplate(), - new ObjectIdImpl(initialKey)); + ObjectKey okey = new ObjectKeyImpl(orb.getWireObjectKeyTemplate(), new ObjectIdImpl(initialKey)); - IIOPAddress addr = IIOPFactories.makeIIOPAddress( host, port ) ; - IIOPProfileTemplate ptemp = IIOPFactories.makeIIOPProfileTemplate( - orb, GIOPVersion.V1_0, addr); - - IORTemplate iortemp = IORFactories.makeIORTemplate( okey.getTemplate() ) ; - iortemp.add( ptemp ) ; + IIOPAddress addr = IIOPFactories.makeIIOPAddress(host, port); + IIOPProfileTemplate ptemp = IIOPFactories.makeIIOPProfileTemplate(orb, GIOPVersion.V1_0, addr); - IOR initialIOR = iortemp.makeIOR( orb, "", okey.getId() ) ; + IORTemplate iortemp = IORFactories.makeIORTemplate(okey.getTemplate()); + iortemp.add(ptemp); - bootstrapDelegate = ORBUtility.makeClientDelegate( initialIOR ) ; + IOR initialIOR = iortemp.makeIOR(orb, "", okey.getId()); + + bootstrapDelegate = ORBUtility.makeClientDelegate(initialIOR); } /** - * For the BootStrap operation we do not expect to have more than one - * parameter. We do not want to extend BootStrap protocol any further, - * as INS handles most of what BootStrap can handle in a portable way. + * For the BootStrap operation we do not expect to have more than one parameter. We do not want to extend BootStrap + * protocol any further, as INS handles most of what BootStrap can handle in a portable way. * - * @return InputStream which contains the response from the - * BootStrapOperation. + * @return InputStream which contains the response from the BootStrapOperation. */ - private InputStream invoke( String operationName, String parameter ) - { + private InputStream invoke(String operationName, String parameter) { boolean remarshal = true; // Invoke. @@ -86,29 +80,28 @@ private InputStream invoke( String operationName, String parameter ) // does not take the location forward info into account. while (remarshal) { - org.omg.CORBA.Object objref = null ; + org.omg.CORBA.Object objref = null; remarshal = false; - OutputStream os = bootstrapDelegate.request(objref, operationName, - true); + OutputStream os = bootstrapDelegate.request(objref, operationName, true); - if ( parameter != null ) { - os.write_string( parameter ); + if (parameter != null) { + os.write_string(parameter); } try { // The only reason a null objref is passed is to get the version of - // invoke used by streams. Otherwise the PortableInterceptor + // invoke used by streams. Otherwise the PortableInterceptor // call stack will become unbalanced since the version of - // invoke which only takes the stream does not call + // invoke which only takes the stream does not call // PortableInterceptor ending points. // Note that the first parameter is ignored inside invoke. - inStream = bootstrapDelegate.invoke( objref, os); + inStream = bootstrapDelegate.invoke(objref, os); } catch (ApplicationException e) { - throw wrapper.bootstrapApplicationException( e ) ; + throw wrapper.bootstrapApplicationException(e); } catch (RemarshalException e) { - wrapper.bootstrapRemarshalException( e ) ; + wrapper.bootstrapRemarshalException(e); remarshal = true; } } @@ -116,44 +109,42 @@ private InputStream invoke( String operationName, String parameter ) return inStream; } - public org.omg.CORBA.Object resolve( String identifier ) - { - InputStream inStream = null ; - org.omg.CORBA.Object result = null ; + public org.omg.CORBA.Object resolve(String identifier) { + InputStream inStream = null; + org.omg.CORBA.Object result = null; - try { - inStream = invoke( "get", identifier ) ; + try { + inStream = invoke("get", identifier); result = inStream.read_Object(); // NOTE: do note trap and ignore errors. // Let them flow out. } finally { - bootstrapDelegate.releaseReply( null, inStream ) ; + bootstrapDelegate.releaseReply(null, inStream); } - return result ; + return result; } - public Set list() - { - InputStream inStream = null ; - java.util.Set result = new java.util.HashSet() ; + public Set list() { + InputStream inStream = null; + java.util.Set result = new java.util.HashSet(); try { - inStream = invoke( "list", null ) ; + inStream = invoke("list", null); int count = inStream.read_long(); - for (int i=0; i < count; i++) { + for (int i = 0; i < count; i++) { result.add(inStream.read_string()); } // NOTE: do note trap and ignore errors. // Let them flow out. } finally { - bootstrapDelegate.releaseReply( null, inStream ) ; + bootstrapDelegate.releaseReply(null, inStream); } - return result ; + return result; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/CompositeResolverImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/CompositeResolverImpl.java index d4fec6982..9b7ced80a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/CompositeResolverImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/CompositeResolverImpl.java @@ -17,36 +17,33 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.resolver ; +package com.sun.corba.ee.impl.resolver; -import java.util.Set ; -import java.util.HashSet ; +import java.util.Set; +import java.util.HashSet; -import com.sun.corba.ee.spi.resolver.Resolver ; +import com.sun.corba.ee.spi.resolver.Resolver; public class CompositeResolverImpl implements Resolver { - private Resolver first ; - private Resolver second ; + private Resolver first; + private Resolver second; - public CompositeResolverImpl( Resolver first, Resolver second ) - { - this.first = first ; - this.second = second ; + public CompositeResolverImpl(Resolver first, Resolver second) { + this.first = first; + this.second = second; } - public org.omg.CORBA.Object resolve( String name ) - { - org.omg.CORBA.Object result = first.resolve( name ) ; - if (result == null) - result = second.resolve( name ) ; - return result ; + public org.omg.CORBA.Object resolve(String name) { + org.omg.CORBA.Object result = first.resolve(name); + if (result == null) + result = second.resolve(name); + return result; } - public Set list() - { - Set result = new HashSet() ; - result.addAll( first.list() ) ; - result.addAll( second.list() ) ; - return result ; + public Set list() { + Set result = new HashSet(); + result.addAll(first.list()); + result.addAll(second.list()); + return result; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/FileResolverImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/FileResolverImpl.java index 41adc5942..5c3bbdc05 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/FileResolverImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/FileResolverImpl.java @@ -17,9 +17,9 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.resolver ; +package com.sun.corba.ee.impl.resolver; -import com.sun.corba.ee.spi.resolver.Resolver ; +import com.sun.corba.ee.spi.resolver.Resolver; import java.util.Enumeration; import java.util.Properties; @@ -29,55 +29,49 @@ import java.io.File; import java.io.FileInputStream; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.impl.misc.CorbaResourceUtil ; +import com.sun.corba.ee.impl.misc.CorbaResourceUtil; -public class FileResolverImpl implements Resolver -{ - private ORB orb ; - private File file ; - private Properties savedProps ; - private long fileModified = 0 ; +public class FileResolverImpl implements Resolver { + private ORB orb; + private File file; + private Properties savedProps; + private long fileModified = 0; - public FileResolverImpl( ORB orb, File file ) - { - this.orb = orb ; - this.file = file ; - savedProps = new Properties() ; + public FileResolverImpl(ORB orb, File file) { + this.orb = orb; + this.file = file; + savedProps = new Properties(); } - public org.omg.CORBA.Object resolve( String name ) - { - check() ; - String stringifiedObject = savedProps.getProperty( name ) ; + public org.omg.CORBA.Object resolve(String name) { + check(); + String stringifiedObject = savedProps.getProperty(name); if (stringifiedObject == null) { return null; } - return orb.string_to_object( stringifiedObject ) ; + return orb.string_to_object(stringifiedObject); } - public Set list() - { - check() ; + public Set list() { + check(); - Set result = new HashSet() ; + Set result = new HashSet(); // Obtain all the keys from the property object Enumeration theKeys = savedProps.propertyNames(); while (theKeys.hasMoreElements()) { - result.add( theKeys.nextElement() ) ; + result.add(theKeys.nextElement()); } - return result ; + return result; } /** - * Checks the lastModified() timestamp of the file and optionally - * re-reads the Properties object from the file if newer. - */ - private void check() - { + * Checks the lastModified() timestamp of the file and optionally re-reads the Properties object from the file if newer. + */ + private void check() { if (file == null) { return; } @@ -91,12 +85,9 @@ private void check() fileIS.close(); fileModified = lastMod; } catch (java.io.FileNotFoundException e) { - System.err.println( CorbaResourceUtil.getText( - "bootstrap.filenotfound", file.getAbsolutePath())); + System.err.println(CorbaResourceUtil.getText("bootstrap.filenotfound", file.getAbsolutePath())); } catch (java.io.IOException e) { - System.err.println( CorbaResourceUtil.getText( - "bootstrap.exception", - file.getAbsolutePath(), e.toString())); + System.err.println(CorbaResourceUtil.getText("bootstrap.exception", file.getAbsolutePath(), e.toString())); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/INSURLOperationImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/INSURLOperationImpl.java index 13409186f..be64fecdb 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/INSURLOperationImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/INSURLOperationImpl.java @@ -19,25 +19,25 @@ package com.sun.corba.ee.impl.resolver; -import java.util.List ; -import java.util.Map ; -import java.util.Comparator ; -import java.util.Iterator ; -import java.util.HashMap ; -import java.util.ArrayList ; -import java.util.Collections ; - -import org.omg.CosNaming.NamingContextExt ; -import org.omg.CosNaming.NamingContextExtHelper ; -import org.omg.CORBA.ORBPackage.InvalidName ; +import java.util.List; +import java.util.Map; +import java.util.Comparator; +import java.util.Iterator; +import java.util.HashMap; +import java.util.ArrayList; +import java.util.Collections; + +import org.omg.CosNaming.NamingContextExt; +import org.omg.CosNaming.NamingContextExtHelper; +import org.omg.CORBA.ORBPackage.InvalidName; import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.ior.IORTemplate; import com.sun.corba.ee.spi.ior.ObjectKey; import com.sun.corba.ee.spi.ior.IORFactories; import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.ee.spi.ior.iiop.IIOPFactories ; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; +import com.sun.corba.ee.spi.ior.iiop.IIOPFactories; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; import com.sun.corba.ee.spi.ior.iiop.AlternateIIOPAddressComponent; import com.sun.corba.ee.spi.orb.Operation; @@ -45,8 +45,8 @@ import com.sun.corba.ee.impl.encoding.EncapsInputStream; import com.sun.corba.ee.impl.encoding.EncapsInputStreamFactory; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; -import com.sun.corba.ee.spi.logging.OMGSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; +import com.sun.corba.ee.spi.logging.OMGSystemException; import com.sun.corba.ee.impl.naming.namingutil.INSURLHandler; import com.sun.corba.ee.impl.naming.namingutil.IIOPEndpointInfo; import com.sun.corba.ee.impl.naming.namingutil.INSURL; @@ -55,211 +55,191 @@ import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.impl.misc.ORBUtility; -/** - * This class provides an Operation that converts from CORBA INS URL strings into - * CORBA object references. It will eventually become extensible, but for now it - * simply encapsulates the existing implementation. Once the full extensibility - * is in place, we want this operation to convert string to INSURL, which has mainly - * a public resolver method that returns an object reference. +/** + * This class provides an Operation that converts from CORBA INS URL strings into CORBA object references. It will + * eventually become extensible, but for now it simply encapsulates the existing implementation. Once the full + * extensibility is in place, we want this operation to convert string to INSURL, which has mainly a public resolver + * method that returns an object reference. * - * @author Hemanth - * @author Ken + * @author Hemanth + * @author Ken */ -public class INSURLOperationImpl implements Operation -{ +public class INSURLOperationImpl implements Operation { private ORB orb; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - private static final OMGSystemException omgWrapper = - OMGSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + private static final OMGSystemException omgWrapper = OMGSystemException.self; // Root Naming Context for default resolution of names. private NamingContextExt rootNamingContextExt; - private Object rootContextCacheLock = new Object() ; + private Object rootContextCacheLock = new Object(); // The URLHandler to parse INS URL's - private INSURLHandler insURLHandler = INSURLHandler.getINSURLHandler() ; + private INSURLHandler insURLHandler = INSURLHandler.getINSURLHandler(); - public INSURLOperationImpl( ORB orb ) - { - this.orb = orb ; + public INSURLOperationImpl(ORB orb) { + this.orb = orb; } - private static final int NIBBLES_PER_BYTE = 2 ; - private static final int UN_SHIFT = 4 ; // "UPPER NIBBLE" shift factor for << - - /** This static method takes a Stringified IOR and converts it into IOR object. - * It is the caller's responsibility to only pass strings that start with "IOR:". - */ - private org.omg.CORBA.Object getIORFromString( String str ) - { + private static final int NIBBLES_PER_BYTE = 2; + private static final int UN_SHIFT = 4; // "UPPER NIBBLE" shift factor for << + + /** + * This static method takes a Stringified IOR and converts it into IOR object. It is the caller's responsibility to only + * pass strings that start with "IOR:". + */ + private org.omg.CORBA.Object getIORFromString(String str) { // Length must be even for str to be valid - if ( (str.length() & 1) == 1 ) { + if ((str.length() & 1) == 1) { throw wrapper.badStringifiedIorLen(); } byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE]; - for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) { - buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0); - buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F); + for (int i = ORBConstants.STRINGIFY_PREFIX.length(), j = 0; i < str.length(); i += NIBBLES_PER_BYTE, j++) { + buf[j] = (byte) ((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0); + buf[j] |= (byte) (ORBUtility.hexOf(str.charAt(i + 1)) & 0x0F); } - EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length, - orb.getORBData().getGIOPVersion()); + EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length, orb.getORBData().getGIOPVersion()); s.consumeEndian(); - return s.read_Object() ; + return s.read_Object(); } - public Object operate( Object arg ) - { + public Object operate(Object arg) { if (arg instanceof String) { - String str = (String)arg ; + String str = (String) arg; - if (str.startsWith( ORBConstants.STRINGIFY_PREFIX )) { + if (str.startsWith(ORBConstants.STRINGIFY_PREFIX)) { return getIORFromString(str); } else { - INSURL insURL = insURLHandler.parseURL( str ) ; + INSURL insURL = insURLHandler.parseURL(str); if (insURL == null) { throw omgWrapper.soBadSchemeName(str); } - return resolveINSURL( insURL ) ; + return resolveINSURL(insURL); } } - throw wrapper.stringExpected() ; + throw wrapper.stringExpected(); } - private org.omg.CORBA.Object resolveINSURL( INSURL theURLObject ) { - if( theURLObject.isCorbanameURL() ) { - return resolveCorbaname( (CorbanameURL)theURLObject ); + private org.omg.CORBA.Object resolveINSURL(INSURL theURLObject) { + if (theURLObject.isCorbanameURL()) { + return resolveCorbaname((CorbanameURL) theURLObject); } else { - return resolveCorbaloc( (CorbalocURL)theURLObject ); + return resolveCorbaloc((CorbalocURL) theURLObject); } } - + /** - * resolves a corbaloc: url that is encapsulated in a CorbalocURL object. + * resolves a corbaloc: url that is encapsulated in a CorbalocURL object. * - * @return the CORBA.Object if resolution is successful + * @return the CORBA.Object if resolution is successful */ - private org.omg.CORBA.Object resolveCorbaloc( - CorbalocURL theCorbaLocObject ) - { + private org.omg.CORBA.Object resolveCorbaloc(CorbalocURL theCorbaLocObject) { org.omg.CORBA.Object result = null; // If RIR flag is true use the Bootstrap protocol - // Bug 6678177 noticed that this is incorrect: rir means use + // Bug 6678177 noticed that this is incorrect: rir means use // resolve_initial_references on the local ORB! - if( theCorbaLocObject.getRIRFlag( ) ) { - String keyString = theCorbaLocObject.getKeyString() ; - if (keyString.equals( "" )) { + if (theCorbaLocObject.getRIRFlag()) { + String keyString = theCorbaLocObject.getKeyString(); + if (keyString.equals("")) { keyString = "NameService"; } try { - result = orb.resolve_initial_references( keyString ) ; + result = orb.resolve_initial_references(keyString); } catch (InvalidName exc) { - throw omgWrapper.soBadSchemaSpecific( exc, keyString ) ; + throw omgWrapper.soBadSchemaSpecific(exc, keyString); } } else { - result = getIORUsingCorbaloc( theCorbaLocObject ); + result = getIORUsingCorbaloc(theCorbaLocObject); } return result; } /** - * resolves a corbaname: url that is encapsulated in a CorbanameURL object. + * resolves a corbaname: url that is encapsulated in a CorbanameURL object. * - * @return the CORBA.Object if resolution is successful + * @return the CORBA.Object if resolution is successful */ - private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) { + private org.omg.CORBA.Object resolveCorbaname(CorbanameURL theCorbaName) { org.omg.CORBA.Object result = null; try { NamingContextExt theNamingContext = null; - if( theCorbaName.getRIRFlag( ) ) { + if (theCorbaName.getRIRFlag()) { // Case 1 of corbaname: rir# - theNamingContext = getDefaultRootNamingContext( ); + theNamingContext = getDefaultRootNamingContext(); } else { // Case 2 of corbaname: ::hostname# - org.omg.CORBA.Object corbalocResult = - getIORUsingCorbaloc( theCorbaName ); - if( corbalocResult == null ) { + org.omg.CORBA.Object corbalocResult = getIORUsingCorbaloc(theCorbaName); + if (corbalocResult == null) { return null; } - theNamingContext = - NamingContextExtHelper.narrow( corbalocResult ); + theNamingContext = NamingContextExtHelper.narrow(corbalocResult); } - String StringifiedName = theCorbaName.getStringifiedName( ); + String StringifiedName = theCorbaName.getStringifiedName(); - if( StringifiedName == null ) { + if (StringifiedName == null) { // This means return the Root Naming context return theNamingContext; } else { - return theNamingContext.resolve_str( StringifiedName ); + return theNamingContext.resolve_str(StringifiedName); } - } catch( Exception e ) { - clearRootNamingContextCache( ); + } catch (Exception e) { + clearRootNamingContextCache(); // Bug 6475580 - throw omgWrapper.soBadSchemaSpecific( e, - theCorbaName.getStringifiedName() ) ; + throw omgWrapper.soBadSchemaSpecific(e, theCorbaName.getStringifiedName()); } - } + } /** - * This is an internal method to get the IOR from the CorbalocURL object. + * This is an internal method to get the IOR from the CorbalocURL object. * - * @return the CORBA.Object if resolution is successful + * @return the CORBA.Object if resolution is successful */ - private org.omg.CORBA.Object getIORUsingCorbaloc( INSURL corbalocObject ) - { - Map profileMap = new HashMap(); - List profileList1_0 = new ArrayList(); + private org.omg.CORBA.Object getIORUsingCorbaloc(INSURL corbalocObject) { + Map profileMap = new HashMap(); + List profileList1_0 = new ArrayList(); // corbalocObject cannot be null, because it's validated during // parsing. So no null check is required. java.util.List theEndpointInfo = corbalocObject.getEndpointInfo(); String theKeyString = corbalocObject.getKeyString(); // If there is no KeyString then it's invalid - if( theKeyString == null ) { + if (theKeyString == null) { return null; } - ObjectKey key = orb.getObjectKeyFactory().create( - theKeyString.getBytes() ); - IORTemplate iortemp = IORFactories.makeIORTemplate( key.getTemplate() ); - - java.util.Iterator iterator = theEndpointInfo.iterator( ); - while( iterator.hasNext( ) ) { - IIOPEndpointInfo element = - (IIOPEndpointInfo) iterator.next( ); - IIOPAddress addr = IIOPFactories.makeIIOPAddress( element.getHost(), - element.getPort() ); - GIOPVersion giopVersion = GIOPVersion.getInstance( (byte)element.getMajor(), - (byte)element.getMinor()); + ObjectKey key = orb.getObjectKeyFactory().create(theKeyString.getBytes()); + IORTemplate iortemp = IORFactories.makeIORTemplate(key.getTemplate()); + + java.util.Iterator iterator = theEndpointInfo.iterator(); + while (iterator.hasNext()) { + IIOPEndpointInfo element = (IIOPEndpointInfo) iterator.next(); + IIOPAddress addr = IIOPFactories.makeIIOPAddress(element.getHost(), element.getPort()); + GIOPVersion giopVersion = GIOPVersion.getInstance((byte) element.getMajor(), (byte) element.getMinor()); IIOPProfileTemplate profileTemplate = null; if (giopVersion.equals(GIOPVersion.V1_0)) { - profileTemplate = IIOPFactories.makeIIOPProfileTemplate( - orb, giopVersion, addr); + profileTemplate = IIOPFactories.makeIIOPProfileTemplate(orb, giopVersion, addr); profileList1_0.add(profileTemplate); } else { if (profileMap.get(giopVersion) == null) { - profileTemplate = IIOPFactories.makeIIOPProfileTemplate( - orb, giopVersion, addr); + profileTemplate = IIOPFactories.makeIIOPProfileTemplate(orb, giopVersion, addr); profileMap.put(giopVersion, profileTemplate); } else { - profileTemplate = (IIOPProfileTemplate)profileMap.get(giopVersion); - AlternateIIOPAddressComponent iiopAddressComponent = - IIOPFactories.makeAlternateIIOPAddressComponent(addr); + profileTemplate = (IIOPProfileTemplate) profileMap.get(giopVersion); + AlternateIIOPAddressComponent iiopAddressComponent = IIOPFactories.makeAlternateIIOPAddressComponent(addr); profileTemplate.add(iiopAddressComponent); } } } GIOPVersion giopVersion = orb.getORBData().getGIOPVersion(); - IIOPProfileTemplate pTemplate = (IIOPProfileTemplate)profileMap.get(giopVersion); + IIOPProfileTemplate pTemplate = (IIOPProfileTemplate) profileMap.get(giopVersion); if (pTemplate != null) { iortemp.add(pTemplate); // Add profile for GIOP version used by this ORB profileMap.remove(giopVersion); // Now remove this value from the map @@ -268,8 +248,8 @@ private org.omg.CORBA.Object getIORUsingCorbaloc( INSURL corbalocObject ) // Create a comparator that can sort in decending order (1.2, 1.1, ...) Comparator comp = new Comparator() { public int compare(Object o1, Object o2) { - GIOPVersion gv1 = (GIOPVersion)o1; - GIOPVersion gv2 = (GIOPVersion)o2; + GIOPVersion gv1 = (GIOPVersion) o1; + GIOPVersion gv2 = (GIOPVersion) o2; return (gv1.lessThan(gv2) ? 1 : (gv1.equals(gv2) ? 0 : -1)); }; }; @@ -281,35 +261,31 @@ public int compare(Object o1, Object o2) { // Add the profiles in the sorted order Iterator iter = list.iterator(); while (iter.hasNext()) { - IIOPProfileTemplate pt = (IIOPProfileTemplate)profileMap.get(iter.next()); + IIOPProfileTemplate pt = (IIOPProfileTemplate) profileMap.get(iter.next()); iortemp.add(pt); } // Finally add the 1.0 profiles iortemp.addAll(profileList1_0); - IOR ior = iortemp.makeIOR( orb, "", key.getId() ) ; - return ORBUtility.makeObjectReference( ior ) ; + IOR ior = iortemp.makeIOR(orb, "", key.getId()); + return ORBUtility.makeObjectReference(ior); } /** - * This is required for corbaname: resolution. Currently we - * are not caching RootNamingContext as the reference to rootNamingContext - * may not be Persistent in all the implementations. - * _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE. + * This is required for corbaname: resolution. Currently we are not caching RootNamingContext as the reference to + * rootNamingContext may not be Persistent in all the implementations. _REVISIT_ to clear the rootNamingContext in case + * of COMM_FAILURE. + * + * @return the org.omg.COSNaming.NamingContextExt if resolution is successful * - * @return the org.omg.COSNaming.NamingContextExt if resolution is - * successful - * */ - private NamingContextExt getDefaultRootNamingContext( ) { - synchronized( rootContextCacheLock ) { - if( rootNamingContextExt == null ) { + private NamingContextExt getDefaultRootNamingContext() { + synchronized (rootContextCacheLock) { + if (rootNamingContextExt == null) { try { - rootNamingContextExt = - NamingContextExtHelper.narrow( - orb.getLocalResolver().resolve( "NameService" ) ); - } catch( Exception e ) { + rootNamingContextExt = NamingContextExtHelper.narrow(orb.getLocalResolver().resolve("NameService")); + } catch (Exception e) { rootNamingContextExt = null; } } @@ -318,11 +294,11 @@ private NamingContextExt getDefaultRootNamingContext( ) { } /** - * A utility method to clear the RootNamingContext, if there is an - * exception in resolving CosNaming:Name from the RootNamingContext, + * A utility method to clear the RootNamingContext, if there is an exception in resolving CosNaming:Name from the + * RootNamingContext, */ - private void clearRootNamingContextCache( ) { - synchronized( rootContextCacheLock ) { + private void clearRootNamingContextCache() { + synchronized (rootContextCacheLock) { rootNamingContextExt = null; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/LocalResolverImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/LocalResolverImpl.java index ee89a33fe..78ddc510c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/LocalResolverImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/LocalResolverImpl.java @@ -17,9 +17,9 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.resolver ; +package com.sun.corba.ee.impl.resolver; -import com.sun.corba.ee.spi.resolver.LocalResolver ; +import com.sun.corba.ee.spi.resolver.LocalResolver; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -27,8 +27,7 @@ import org.glassfish.pfl.basic.func.NullaryFunction; public class LocalResolverImpl implements LocalResolver { - ConcurrentHashMap> nameToClosure = - new ConcurrentHashMap>() ; + ConcurrentHashMap> nameToClosure = new ConcurrentHashMap>(); final Lock lock = new ReentrantLock(); public org.omg.CORBA.Object resolve(String name) { @@ -54,11 +53,10 @@ public org.omg.CORBA.Object resolve(String name) { } public java.util.Set list() { - return nameToClosure.keySet() ; + return nameToClosure.keySet(); } - public void register( String name, - NullaryFunction closure ) { - nameToClosure.put( name, closure ) ; + public void register(String name, NullaryFunction closure) { + nameToClosure.put(name, closure); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/ORBDefaultInitRefResolverImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/ORBDefaultInitRefResolverImpl.java index 8cc832452..015fdda2d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/ORBDefaultInitRefResolverImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/ORBDefaultInitRefResolverImpl.java @@ -17,47 +17,44 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.resolver ; +package com.sun.corba.ee.impl.resolver; -import com.sun.corba.ee.spi.resolver.Resolver ; +import com.sun.corba.ee.spi.resolver.Resolver; -import com.sun.corba.ee.spi.orb.Operation ; +import com.sun.corba.ee.spi.orb.Operation; import java.util.Set; public class ORBDefaultInitRefResolverImpl implements Resolver { - Operation urlHandler ; - String orbDefaultInitRef ; + Operation urlHandler; + String orbDefaultInitRef; - public ORBDefaultInitRefResolverImpl( Operation urlHandler, String orbDefaultInitRef ) - { - this.urlHandler = urlHandler ; + public ORBDefaultInitRefResolverImpl(Operation urlHandler, String orbDefaultInitRef) { + this.urlHandler = urlHandler; - this.orbDefaultInitRef = orbDefaultInitRef ; + this.orbDefaultInitRef = orbDefaultInitRef; } - public org.omg.CORBA.Object resolve( String ident ) - { + public org.omg.CORBA.Object resolve(String ident) { // If the ORBDefaultInitRef is not defined simply return null - if( orbDefaultInitRef == null ) { + if (orbDefaultInitRef == null) { return null; } String urlString; - // If the ORBDefaultInitDef is defined as corbaloc: then create the + // If the ORBDefaultInitDef is defined as corbaloc: then create the // corbaloc String in the format // / // and resolve it using resolveCorbaloc method - if( orbDefaultInitRef.startsWith( "corbaloc:" ) ) { + if (orbDefaultInitRef.startsWith("corbaloc:")) { urlString = orbDefaultInitRef + "/" + ident; } else { urlString = orbDefaultInitRef + "#" + ident; } - return (org.omg.CORBA.Object)urlHandler.operate( urlString ) ; + return (org.omg.CORBA.Object) urlHandler.operate(urlString); } - public Set list() - { - return new java.util.HashSet() ; + public Set list() { + return new java.util.HashSet(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/ORBInitRefResolverImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/ORBInitRefResolverImpl.java index 7b36f2e57..54fe32f5b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/ORBInitRefResolverImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/ORBInitRefResolverImpl.java @@ -17,49 +17,46 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.resolver ; +package com.sun.corba.ee.impl.resolver; -import com.sun.corba.ee.spi.resolver.Resolver ; +import com.sun.corba.ee.spi.resolver.Resolver; -import com.sun.corba.ee.spi.orb.Operation ; +import com.sun.corba.ee.spi.orb.Operation; import java.util.Set; import org.glassfish.pfl.basic.contain.Pair; public class ORBInitRefResolverImpl implements Resolver { - Operation urlHandler ; - java.util.Map orbInitRefTable ; + Operation urlHandler; + java.util.Map orbInitRefTable; /** * Creates a new Resolver + * * @param urlHandler operation to get reference from URL * @param initRefs an array of Pairs of <name of CORBA object, URL to get reference with> */ - public ORBInitRefResolverImpl( Operation urlHandler, Pair[] initRefs ) - { - this.urlHandler = urlHandler ; - orbInitRefTable = new java.util.HashMap() ; + public ORBInitRefResolverImpl(Operation urlHandler, Pair[] initRefs) { + this.urlHandler = urlHandler; + orbInitRefTable = new java.util.HashMap(); - for( int i = 0; i < initRefs.length ; i++ ) { - Pair sp = initRefs[i] ; - orbInitRefTable.put( sp.first(), sp.second() ) ; + for (int i = 0; i < initRefs.length; i++) { + Pair sp = initRefs[i]; + orbInitRefTable.put(sp.first(), sp.second()); } } @Override - public org.omg.CORBA.Object resolve( String ident ) - { - String url = (String)orbInitRefTable.get( ident ) ; + public org.omg.CORBA.Object resolve(String ident) { + String url = (String) orbInitRefTable.get(ident); if (url == null) - return null ; + return null; - org.omg.CORBA.Object result = - (org.omg.CORBA.Object)urlHandler.operate( url ) ; - return result ; + org.omg.CORBA.Object result = (org.omg.CORBA.Object) urlHandler.operate(url); + return result; } @Override - public Set list() - { - return orbInitRefTable.keySet() ; + public Set list() { + return orbInitRefTable.keySet(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/SplitLocalResolverImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/SplitLocalResolverImpl.java index aaeb8cac0..f149ee928 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/SplitLocalResolverImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/resolver/SplitLocalResolverImpl.java @@ -17,35 +17,31 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.resolver ; +package com.sun.corba.ee.impl.resolver; -import com.sun.corba.ee.spi.resolver.Resolver ; -import com.sun.corba.ee.spi.resolver.LocalResolver ; +import com.sun.corba.ee.spi.resolver.Resolver; +import com.sun.corba.ee.spi.resolver.LocalResolver; import java.util.Set; import org.glassfish.pfl.basic.func.NullaryFunction; -public class SplitLocalResolverImpl implements LocalResolver -{ - private Resolver resolver ; - private LocalResolver localResolver ; +public class SplitLocalResolverImpl implements LocalResolver { + private Resolver resolver; + private LocalResolver localResolver; - public SplitLocalResolverImpl( Resolver resolver, - LocalResolver localResolver ) { - this.resolver = resolver ; - this.localResolver = localResolver ; + public SplitLocalResolverImpl(Resolver resolver, LocalResolver localResolver) { + this.resolver = resolver; + this.localResolver = localResolver; } - public void register( String name, - NullaryFunction closure ) { - localResolver.register( name, closure ) ; + public void register(String name, NullaryFunction closure) { + localResolver.register(name, closure); } - public org.omg.CORBA.Object resolve( String name ) { - return resolver.resolve( name ) ; + public org.omg.CORBA.Object resolve(String name) { + return resolver.resolve(name); } public Set list() { - return resolver.list() ; + return resolver.list(); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/CodeSetServiceContextImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/CodeSetServiceContextImpl.java index f6f6c8559..72b76548f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/CodeSetServiceContextImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/CodeSetServiceContextImpl.java @@ -27,44 +27,36 @@ import com.sun.corba.ee.spi.servicecontext.ServiceContextBase; import com.sun.corba.ee.spi.servicecontext.CodeSetServiceContext; -import com.sun.corba.ee.impl.encoding.MarshalInputStream ; -import com.sun.corba.ee.impl.encoding.MarshalOutputStream ; -import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo ; +import com.sun.corba.ee.impl.encoding.MarshalInputStream; +import com.sun.corba.ee.impl.encoding.MarshalOutputStream; +import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; -public class CodeSetServiceContextImpl extends ServiceContextBase - implements CodeSetServiceContext -{ - private CodeSetComponentInfo.CodeSetContext csc ; +public class CodeSetServiceContextImpl extends ServiceContextBase implements CodeSetServiceContext { + private CodeSetComponentInfo.CodeSetContext csc; - public CodeSetServiceContextImpl( CodeSetComponentInfo.CodeSetContext csc ) - { - this.csc = csc ; + public CodeSetServiceContextImpl(CodeSetComponentInfo.CodeSetContext csc) { + this.csc = csc; } - public CodeSetServiceContextImpl(InputStream is, GIOPVersion gv) - { - super(is) ; - csc = new CodeSetComponentInfo.CodeSetContext() ; - csc.read( (MarshalInputStream)in ) ; + public CodeSetServiceContextImpl(InputStream is, GIOPVersion gv) { + super(is); + csc = new CodeSetComponentInfo.CodeSetContext(); + csc.read((MarshalInputStream) in); } - public int getId() - { - return SERVICE_CONTEXT_ID ; + public int getId() { + return SERVICE_CONTEXT_ID; } - public void writeData( OutputStream os ) - { - csc.write( (MarshalOutputStream)os ) ; + public void writeData(OutputStream os) { + csc.write((MarshalOutputStream) os); } - - public CodeSetComponentInfo.CodeSetContext getCodeSetContext() - { - return csc ; + + public CodeSetComponentInfo.CodeSetContext getCodeSetContext() { + return csc; } - public String toString() - { - return "CodeSetServiceContextImpl[ csc=" + csc + " ]" ; + public String toString() { + return "CodeSetServiceContextImpl[ csc=" + csc + " ]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/MaxStreamFormatVersionServiceContextImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/MaxStreamFormatVersionServiceContextImpl.java index 7235e9664..448680f50 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/MaxStreamFormatVersionServiceContextImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/MaxStreamFormatVersionServiceContextImpl.java @@ -23,60 +23,45 @@ import org.omg.CORBA_2_3.portable.OutputStream; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.servicecontext.ServiceContextBase ; -import com.sun.corba.ee.spi.servicecontext.MaxStreamFormatVersionServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContextBase; +import com.sun.corba.ee.spi.servicecontext.MaxStreamFormatVersionServiceContext; import com.sun.corba.ee.impl.misc.ORBUtility; -public class MaxStreamFormatVersionServiceContextImpl extends ServiceContextBase - implements MaxStreamFormatVersionServiceContext -{ +public class MaxStreamFormatVersionServiceContextImpl extends ServiceContextBase implements MaxStreamFormatVersionServiceContext { private byte maxStreamFormatVersion; // The singleton uses the maximum version indicated by our // ValueHandler. - public static final MaxStreamFormatVersionServiceContext singleton - = new MaxStreamFormatVersionServiceContextImpl(); + public static final MaxStreamFormatVersionServiceContext singleton = new MaxStreamFormatVersionServiceContextImpl(); - private MaxStreamFormatVersionServiceContextImpl() - { + private MaxStreamFormatVersionServiceContextImpl() { maxStreamFormatVersion = ORBUtility.getMaxStreamFormatVersion(); } - public MaxStreamFormatVersionServiceContextImpl(byte maxStreamFormatVersion) - { + public MaxStreamFormatVersionServiceContextImpl(byte maxStreamFormatVersion) { this.maxStreamFormatVersion = maxStreamFormatVersion; } - public MaxStreamFormatVersionServiceContextImpl(InputStream is, GIOPVersion gv) - { - super(is) ; + public MaxStreamFormatVersionServiceContextImpl(InputStream is, GIOPVersion gv) { + super(is); maxStreamFormatVersion = is.read_octet(); } - public int getId() - { - return SERVICE_CONTEXT_ID; + public int getId() { + return SERVICE_CONTEXT_ID; } - public void writeData(OutputStream os) - { + public void writeData(OutputStream os) { os.write_octet(maxStreamFormatVersion); } - - public byte getMaximumStreamFormatVersion() - { + + public byte getMaximumStreamFormatVersion() { return maxStreamFormatVersion; } - public String toString() - { - return "MaxStreamFormatVersionServiceContextImpl[" - + maxStreamFormatVersion + "]"; + public String toString() { + return "MaxStreamFormatVersionServiceContextImpl[" + maxStreamFormatVersion + "]"; } } - - - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ORBVersionServiceContextImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ORBVersionServiceContextImpl.java index 3fcef3cdc..9bae0c04a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ORBVersionServiceContextImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ORBVersionServiceContextImpl.java @@ -20,65 +20,55 @@ package com.sun.corba.ee.impl.servicecontext; import org.omg.CORBA.SystemException; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.orb.ORBVersion ; -import com.sun.corba.ee.spi.orb.ORBVersionFactory ; +import com.sun.corba.ee.spi.orb.ORBVersion; +import com.sun.corba.ee.spi.orb.ORBVersionFactory; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.servicecontext.ServiceContextBase ; -import com.sun.corba.ee.spi.servicecontext.ORBVersionServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContextBase; +import com.sun.corba.ee.spi.servicecontext.ORBVersionServiceContext; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.misc.ORBConstants; -public class ORBVersionServiceContextImpl extends ServiceContextBase - implements ORBVersionServiceContext -{ +public class ORBVersionServiceContextImpl extends ServiceContextBase implements ORBVersionServiceContext { // current ORB Version - private ORBVersion version = ORBVersionFactory.getORBVersion() ; + private ORBVersion version = ORBVersionFactory.getORBVersion(); - public static final ORBVersionServiceContext singleton = - new ORBVersionServiceContextImpl() ; + public static final ORBVersionServiceContext singleton = new ORBVersionServiceContextImpl(); - public ORBVersionServiceContextImpl( ) - { - version = ORBVersionFactory.getORBVersion() ; + public ORBVersionServiceContextImpl() { + version = ORBVersionFactory.getORBVersion(); } - public ORBVersionServiceContextImpl( ORBVersion ver ) - { - this.version = ver ; + public ORBVersionServiceContextImpl(ORBVersion ver) { + this.version = ver; } - public ORBVersionServiceContextImpl(InputStream is, GIOPVersion gv) - { - super(is) ; + public ORBVersionServiceContextImpl(InputStream is, GIOPVersion gv) { + super(is); // pay particular attention to where the version is being read from! // is contains an encapsulation, ServiceContext reads off the // encapsulation and leaves the pointer in the variable "in", // which points to the long value. - version = ORBVersionFactory.create( in ) ; + version = ORBVersionFactory.create(in); } - public int getId() - { - return SERVICE_CONTEXT_ID ; + public int getId() { + return SERVICE_CONTEXT_ID; } - public void writeData( OutputStream os ) throws SystemException - { - version.write( os ) ; + public void writeData(OutputStream os) throws SystemException { + version.write(os); } - public ORBVersion getVersion() - { - return version ; + public ORBVersion getVersion() { + return version; } - public String toString() - { - return "ORBVersionServiceContextImpl[ version=" + version + " ]" ; + public String toString() { + return "ORBVersionServiceContextImpl[ version=" + version + " ]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/SendingContextServiceContextImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/SendingContextServiceContextImpl.java index c3aff1c04..bc00d02e7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/SendingContextServiceContextImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/SendingContextServiceContextImpl.java @@ -19,52 +19,44 @@ package com.sun.corba.ee.impl.servicecontext; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.IORFactories ; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.IORFactories; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.servicecontext.ServiceContextBase ; -import com.sun.corba.ee.spi.servicecontext.SendingContextServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContextBase; +import com.sun.corba.ee.spi.servicecontext.SendingContextServiceContext; -public class SendingContextServiceContextImpl extends ServiceContextBase - implements SendingContextServiceContext -{ - private IOR ior = null ; +public class SendingContextServiceContextImpl extends ServiceContextBase implements SendingContextServiceContext { + private IOR ior = null; - public SendingContextServiceContextImpl( IOR ior ) - { - this.ior = ior ; + public SendingContextServiceContextImpl(IOR ior) { + this.ior = ior; } - public SendingContextServiceContextImpl(InputStream is, GIOPVersion gv) - { - super(is) ; - ior = IORFactories.makeIOR( (ORB)is.orb(), is ) ; + public SendingContextServiceContextImpl(InputStream is, GIOPVersion gv) { + super(is); + ior = IORFactories.makeIOR((ORB) is.orb(), is); } - public int getId() - { - return SERVICE_CONTEXT_ID ; + public int getId() { + return SERVICE_CONTEXT_ID; } - public void writeData( OutputStream os ) - { - ior.write( os ) ; + public void writeData(OutputStream os) { + ior.write(os); } - public IOR getIOR() - { - return ior ; + public IOR getIOR() { + return ior; } - public String toString() - { - return "SendingContexServiceContextImpl[ ior=" + ior + " ]" ; + public String toString() { + return "SendingContexServiceContextImpl[ ior=" + ior + " ]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ServiceContextFactoryRegistryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ServiceContextFactoryRegistryImpl.java index 499726a5b..7501c2d9a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ServiceContextFactoryRegistryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ServiceContextFactoryRegistryImpl.java @@ -19,30 +19,25 @@ package com.sun.corba.ee.impl.servicecontext; -import java.util.Map ; -import java.util.HashMap ; -import com.sun.corba.ee.spi.servicecontext.ServiceContext ; -import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import java.util.Map; +import java.util.HashMap; +import com.sun.corba.ee.spi.servicecontext.ServiceContext; +import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -public class ServiceContextFactoryRegistryImpl - implements ServiceContextFactoryRegistry -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class ServiceContextFactoryRegistryImpl implements ServiceContextFactoryRegistry { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - final private ORB orb ; - private Map scMap ; + final private ORB orb; + private Map scMap; - public ServiceContextFactoryRegistryImpl( ORB orb ) - { - scMap = new HashMap() ; - this.orb = orb ; - } + public ServiceContextFactoryRegistryImpl(ORB orb) { + scMap = new HashMap(); + this.orb = orb; + } - public void register( ServiceContext.Factory factory ) - { + public void register(ServiceContext.Factory factory) { if (scMap.get(factory.getId()) == null) { scMap.put(factory.getId(), factory); } else { @@ -50,9 +45,8 @@ public void register( ServiceContext.Factory factory ) } // BAD_PARAM } - public ServiceContext.Factory find( int scId ) - { - ServiceContext.Factory result = scMap.get( scId ) ; - return result ; + public ServiceContext.Factory find(int scId) { + ServiceContext.Factory result = scMap.get(scId); + return result; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ServiceContextsImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ServiceContextsImpl.java index 7a736e190..0424c7cb5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ServiceContextsImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/ServiceContextsImpl.java @@ -19,66 +19,60 @@ package com.sun.corba.ee.impl.servicecontext; -import java.util.Map ; -import java.util.HashMap ; -import java.util.concurrent.atomic.AtomicInteger ; +import java.util.Map; +import java.util.HashMap; +import java.util.concurrent.atomic.AtomicInteger; import org.omg.CORBA.OctetSeqHelper; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; +import org.omg.CORBA_2_3.portable.InputStream; import com.sun.org.omg.SendingContext.CodeBase; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults ; -import com.sun.corba.ee.spi.servicecontext.ServiceContext ; -import com.sun.corba.ee.spi.servicecontext.ServiceContexts ; -import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry ; -import com.sun.corba.ee.spi.servicecontext.UEInfoServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults; +import com.sun.corba.ee.spi.servicecontext.ServiceContext; +import com.sun.corba.ee.spi.servicecontext.ServiceContexts; +import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry; +import com.sun.corba.ee.spi.servicecontext.UEInfoServiceContext; import com.sun.corba.ee.impl.encoding.CDRInputObject; -import com.sun.corba.ee.impl.encoding.EncapsInputStream ; +import com.sun.corba.ee.impl.encoding.EncapsInputStream; import com.sun.corba.ee.impl.encoding.EncapsInputStreamFactory; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.spi.trace.TraceServiceContext; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @TraceServiceContext -public class ServiceContextsImpl implements ServiceContexts -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class ServiceContextsImpl implements ServiceContexts { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private static final AtomicInteger creationCount = new AtomicInteger(0) ; + private static final AtomicInteger creationCount = new AtomicInteger(0); - private final ORB orb ; + private final ORB orb; - /** + /** * Map of all ServiceContext objects in this container. * - * Keys are java.lang.Integers for service context IDs. - * Values are either instances of ServiceContext or the - * unmarshaled byte arrays (unmarshaled on first use). + * Keys are java.lang.Integers for service context IDs. Values are either instances of ServiceContext or the unmarshaled + * byte arrays (unmarshaled on first use). * - * This provides a mild optimization if we don't happen to - * use a given service context, but it's main advantage is - * that it allows us to change the order in which we - * unmarshal them. We need to do the UnknownExceptionInfo service - * context after the SendingContextRunTime service context so that we can - * get the CodeBase if necessary. + * This provides a mild optimization if we don't happen to use a given service context, but it's main advantage is that + * it allows us to change the order in which we unmarshal them. We need to do the UnknownExceptionInfo service context + * after the SendingContextRunTime service context so that we can get the CodeBase if necessary. */ - private final Map scMap; + private final Map scMap; private CodeBase codeBase; private GIOPVersion giopVersion; private String getValidSCIds() { - StringBuilder sb = new StringBuilder() ; - sb.append( "(" ) ; - boolean first = true ; + StringBuilder sb = new StringBuilder(); + sb.append("("); + boolean first = true; for (int id : scMap.keySet()) { if (first) { first = false; @@ -86,35 +80,35 @@ private String getValidSCIds() { sb.append(","); } - sb.append( id ) ; + sb.append(id); } - sb.append( ")" ) ; - return sb.toString() ; + sb.append(")"); + return sb.toString(); } @InfoMethod - private void numberValid( int num ) { } + private void numberValid(int num) { + } @InfoMethod - private void readingServiceContextId( int id ) { } + private void readingServiceContextId(int id) { + } @InfoMethod - private void serviceContextLength( int len ) { } + private void serviceContextLength(int len) { + } /** - * Given the input stream, this fills our service - * context map. See the definition of scMap for - * details. Creates a HashMap. + * Given the input stream, this fills our service context map. See the definition of scMap for details. Creates a + * HashMap. * - * Note that we don't actually unmarshal the - * bytes of the service contexts here. That is - * done when they are actually requested via - * get(int). + * Note that we don't actually unmarshal the bytes of the service contexts here. That is done when they are actually + * requested via get(int). */ @TraceServiceContext private void createMapFromInputStream(InputStream is) { - int numValid = is.read_long() ; - numberValid( numValid ) ; + int numValid = is.read_long(); + numberValid(numValid); for (int ctr = 0; ctr < numValid; ctr++) { int scId = is.read_long(); @@ -127,52 +121,52 @@ private void createMapFromInputStream(InputStream is) { } } - public ServiceContextsImpl( ORB orb ) { - this.orb = orb ; + public ServiceContextsImpl(ORB orb) { + this.orb = orb; - scMap = new HashMap(); + scMap = new HashMap(); - // Use the GIOP version of the ORB. Should - // be specified in ServiceContext. + // Use the GIOP version of the ORB. Should + // be specified in ServiceContext. // See REVISIT below concerning giopVersion. giopVersion = orb.getORBData().getGIOPVersion(); - codeBase = null ; + codeBase = null; } - /** + /** * Read the Service contexts from the input stream. + * * @param s Stream to get context from */ public ServiceContextsImpl(InputStream s) { - this( (ORB)(s.orb()) ) ; + this((ORB) (s.orb())); // We need to store this so that we can have access // to the CodeBase for unmarshaling possible // RMI-IIOP valuetype data within an encapsulation. // (Known case: UnknownExceptionInfo) - codeBase = ((CDRInputObject)s).getCodeBase(); - + codeBase = ((CDRInputObject) s).getCodeBase(); createMapFromInputStream(s); // Fix for bug 4904723 - giopVersion = ((CDRInputObject)s).getGIOPVersion(); + giopVersion = ((CDRInputObject) s).getGIOPVersion(); } @InfoMethod - private void couldNotFindServiceContextFactory( int scid ) { } + private void couldNotFindServiceContextFactory(int scid) { + } @InfoMethod - private void foundServiceContextFactory( int scid ) { } + private void foundServiceContextFactory(int scid) { + } /** - * Find the ServiceContextData for a given scId and unmarshal - * the bytes. + * Find the ServiceContextData for a given scId and unmarshal the bytes. */ @TraceServiceContext private ServiceContext unmarshal(int scId, byte[] data) { - ServiceContextFactoryRegistry scr = - orb.getServiceContextFactoryRegistry(); + ServiceContextFactoryRegistry scr = orb.getServiceContextFactoryRegistry(); ServiceContext.Factory factory = scr.find(scId); ServiceContext sc = null; @@ -183,7 +177,7 @@ private ServiceContext unmarshal(int scId, byte[] data) { } else { foundServiceContextFactory(scId); - // REVISIT. GIOP version should be specified as + // REVISIT. GIOP version should be specified as // part of a service context's definition, so should // be accessible from ServiceContextData via // its ServiceContext implementation class. @@ -193,10 +187,9 @@ private ServiceContext unmarshal(int scId, byte[] data) { // can't send a service context of a later GIOP // version than its stream version. // - // Note: As of Jan 2001, no standard OMG or Sun service contexts + // Note: As of Jan 2001, no standard OMG or Sun service contexts // ship wchar data or are defined as using anything but GIOP 1.0 CDR. - EncapsInputStream eis = EncapsInputStreamFactory.newEncapsInputStream(orb, data, data.length, - giopVersion, codeBase); + EncapsInputStream eis = EncapsInputStreamFactory.newEncapsInputStream(orb, data, data.length, giopVersion, codeBase); try { eis.consumeEndian(); @@ -205,7 +198,7 @@ private ServiceContext unmarshal(int scId, byte[] data) { // stream with the endianness read off, so the // service context should just unmarshal its own // data. - sc =factory.create(eis, giopVersion); + sc = factory.create(eis, giopVersion); } finally { try { eis.close(); @@ -222,129 +215,128 @@ private ServiceContext unmarshal(int scId, byte[] data) { return sc; } - /** + /** * Write the service contexts to the output stream. * - * If they haven't been unmarshaled, we don't have to - * unmarshal them. + * If they haven't been unmarshaled, we don't have to unmarshal them. */ @TraceServiceContext public void write(OutputStream os, GIOPVersion gv) { int numsc = scMap.size(); - os.write_long( numsc ) ; + os.write_long(numsc); writeServiceContextsInOrder(os, gv); } /** - * Write the service contexts in scMap in a desired order. - * Right now, the only special case we have is UnknownExceptionInfo, - * so I'm merely writing it last if present. + * Write the service contexts in scMap in a desired order. Right now, the only special case we have is + * UnknownExceptionInfo, so I'm merely writing it last if present. */ @TraceServiceContext private void writeServiceContextsInOrder(OutputStream os, GIOPVersion gv) { - int ueid = UEInfoServiceContext.SERVICE_CONTEXT_ID ; + int ueid = UEInfoServiceContext.SERVICE_CONTEXT_ID; - for (int i : scMap.keySet() ) { + for (int i : scMap.keySet()) { if (i != ueid) { writeMapEntry(os, i, scMap.get(i), gv); } } // Write the UnknownExceptionInfo service context last - // (so it will be after the CodeBase) - Object uesc = scMap.get(ueid) ; + // (so it will be after the CodeBase) + Object uesc = scMap.get(ueid); if (uesc != null) { writeMapEntry(os, ueid, uesc, gv); } } @InfoMethod - private void writingServiceContextBytesFor( int id ) { } + private void writingServiceContextBytesFor(int id) { + } @InfoMethod - private void writingServiceContext( ServiceContext sc ) { } + private void writingServiceContext(ServiceContext sc) { + } /** - * Write the given entry from the scMap to the OutputStream. - * See note on giopVersion. The service context should - * know the GIOP version it is meant for. + * Write the given entry from the scMap to the OutputStream. See note on giopVersion. The service context should know + * the GIOP version it is meant for. */ @TraceServiceContext - private void writeMapEntry(OutputStream os, int id, Object scObj, - GIOPVersion gv) { + private void writeMapEntry(OutputStream os, int id, Object scObj, GIOPVersion gv) { if (scObj instanceof byte[]) { // If it's still in byte[] form, we don't need to // unmarshal it here, just copy the bytes into // the new stream. - byte[] sc = (byte[])scObj ; + byte[] sc = (byte[]) scObj; writingServiceContextBytesFor(id); OctetSeqHelper.write(os, sc); } else if (scObj instanceof ServiceContext) { // We actually unmarshaled it into a ServiceContext // at some point. - ServiceContext sc = (ServiceContext)scObj; + ServiceContext sc = (ServiceContext) scObj; writingServiceContext(sc); sc.write(os, gv); } else { - wrapper.errorInServiceContextMap() ; + wrapper.errorInServiceContextMap(); } } @TraceServiceContext - public void put( ServiceContext sc ) - { + public void put(ServiceContext sc) { scMap.put(sc.getId(), sc); } @TraceServiceContext - public void delete( int scId ) - { + public void delete(int scId) { scMap.remove(scId); } @InfoMethod - private void serviceContextIdFound( int id ) { } + private void serviceContextIdFound(int id) { + } @InfoMethod - private void serviceContextIdNotFound( int id ) { } + private void serviceContextIdNotFound(int id) { + } @InfoMethod - private void unmarshallingServiceContext( int id ) { } + private void unmarshallingServiceContext(int id) { + } @TraceServiceContext public ServiceContext get(int id) { Object result = scMap.get(id); if (result == null) { serviceContextIdNotFound(id); - return null ; + return null; } serviceContextIdFound(id); - + // Lazy unmarshaling on first use. if (result instanceof byte[]) { - unmarshallingServiceContext(id) ; + unmarshallingServiceContext(id); - ServiceContext sc = unmarshal(id, (byte[])result); + ServiceContext sc = unmarshal(id, (byte[]) result); scMap.put(id, sc); return sc; } else { - return (ServiceContext)result; + return (ServiceContext) result; } } - private ServiceContextsImpl( ServiceContextsImpl scimpl ) { - this( scimpl.orb ) ; + private ServiceContextsImpl(ServiceContextsImpl scimpl) { + this(scimpl.orb); - this.codeBase = scimpl.codeBase ; - this.giopVersion = scimpl.giopVersion ; - for (Map.Entry entry : scimpl.scMap.entrySet() ) { - this.scMap.put( entry.getKey(), entry.getValue() ) ; + this.codeBase = scimpl.codeBase; + this.giopVersion = scimpl.giopVersion; + for (Map.Entry entry : scimpl.scMap.entrySet()) { + this.scMap.put(entry.getKey(), entry.getValue()); } } @@ -353,7 +345,7 @@ private ServiceContextsImpl( ServiceContextsImpl scimpl ) { */ @TraceServiceContext public ServiceContexts copy() { - ServiceContexts result = new ServiceContextsImpl( this ) ; + ServiceContexts result = new ServiceContextsImpl(this); return result; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/UEInfoServiceContextImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/UEInfoServiceContextImpl.java index 5ef8a5be8..23cd63005 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/UEInfoServiceContextImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/UEInfoServiceContextImpl.java @@ -19,55 +19,47 @@ package com.sun.corba.ee.impl.servicecontext; -import java.io.Serializable ; +import java.io.Serializable; import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.servicecontext.ServiceContextBase ; -import com.sun.corba.ee.spi.servicecontext.UEInfoServiceContext ; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.servicecontext.ServiceContextBase; +import com.sun.corba.ee.spi.servicecontext.UEInfoServiceContext; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -public class UEInfoServiceContextImpl extends ServiceContextBase - implements UEInfoServiceContext -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class UEInfoServiceContextImpl extends ServiceContextBase implements UEInfoServiceContext { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private Throwable unknown = null ; + private Throwable unknown = null; - public UEInfoServiceContextImpl( Throwable ex ) - { - unknown = ex ; + public UEInfoServiceContextImpl(Throwable ex) { + unknown = ex; } - public UEInfoServiceContextImpl(InputStream is, GIOPVersion gv) - { - super(is) ; + public UEInfoServiceContextImpl(InputStream is, GIOPVersion gv) { + super(is); - try { - unknown = (Throwable) in.read_value() ; + try { + unknown = (Throwable) in.read_value(); } catch (Exception e) { - unknown = wrapper.couldNotReadInfo( e ) ; + unknown = wrapper.couldNotReadInfo(e); } } - public int getId() - { - return SERVICE_CONTEXT_ID ; + public int getId() { + return SERVICE_CONTEXT_ID; } - public void writeData( OutputStream os ) - { - os.write_value( (Serializable)unknown ) ; + public void writeData(OutputStream os) { + os.write_value((Serializable) unknown); } - public Throwable getUE() { return unknown ; } + public Throwable getUE() { + return unknown; + } @Override - public String toString() - { - return "UEInfoServiceContextImpl[ unknown=" + unknown.toString() + " ]" ; + public String toString() { + return "UEInfoServiceContextImpl[ unknown=" + unknown.toString() + " ]"; } } - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/UnknownServiceContextImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/UnknownServiceContextImpl.java index 8b1e34096..23f9a1b1a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/UnknownServiceContextImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/servicecontext/UnknownServiceContextImpl.java @@ -22,48 +22,42 @@ import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.servicecontext.ServiceContextBase ; -import com.sun.corba.ee.spi.servicecontext.UnknownServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContextBase; +import com.sun.corba.ee.spi.servicecontext.UnknownServiceContext; -public class UnknownServiceContextImpl extends ServiceContextBase - implements UnknownServiceContext -{ - private int id = -1 ; - private byte[] data = null ; +public class UnknownServiceContextImpl extends ServiceContextBase implements UnknownServiceContext { + private int id = -1; + private byte[] data = null; - public UnknownServiceContextImpl( int id, byte[] data ) - { - this.id = id ; - this.data = data.clone() ; + public UnknownServiceContextImpl(int id, byte[] data) { + this.id = id; + this.data = data.clone(); } - public UnknownServiceContextImpl( int id, InputStream is ) - { - this.id = id ; + public UnknownServiceContextImpl(int id, InputStream is) { + this.id = id; int len = is.read_long(); data = new byte[len]; - is.read_octet_array(data,0,len); + is.read_octet_array(data, 0, len); } - public int getId() { return id ; } + public int getId() { + return id; + } - public void writeData( OutputStream os ) - { + public void writeData(OutputStream os) { // Abstract method in the base class not used // here because write overrides ServiceContextBase.write } - public void write( OutputStream os, GIOPVersion gv) - { - os.write_long( id ) ; - os.write_long( data.length ) ; - os.write_octet_array( data, 0, data.length ) ; + public void write(OutputStream os, GIOPVersion gv) { + os.write_long(id); + os.write_long(data.length); + os.write_octet_array(data, 0, data.length); } - public byte[] getData() - { - return data.clone() ; + public byte[] getData() { + return data.clone(); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorAcceptOnlyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorAcceptOnlyImpl.java index bd4fe15bc..74e761e99 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorAcceptOnlyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorAcceptOnlyImpl.java @@ -29,29 +29,27 @@ import java.net.Socket; import com.sun.corba.ee.spi.orb.ORB; -import org.glassfish.pfl.basic.func.UnaryVoidFunction ; - -/** This version of an acceptor is the other half of CorbaAcceptorLazyImpl. - * The idea is that AcceptOnly will NOT contribute to an IORTemplate, and will - * actually accept from a ServerSocket (and so it must initialize the - * server socket and close it). The LazyImpl will contribute to an IORTemplate, - * and will not actually accept, but does the actual processing of sockets - * from the server socket. +import org.glassfish.pfl.basic.func.UnaryVoidFunction; + +/** + * This version of an acceptor is the other half of CorbaAcceptorLazyImpl. The idea is that AcceptOnly will NOT + * contribute to an IORTemplate, and will actually accept from a ServerSocket (and so it must initialize the server + * socket and close it). The LazyImpl will contribute to an IORTemplate, and will not actually accept, but does the + * actual processing of sockets from the server socket. * * @author ken */ public class AcceptorAcceptOnlyImpl extends AcceptorImpl { - private UnaryVoidFunction operation ; + private UnaryVoidFunction operation; - public AcceptorAcceptOnlyImpl( ORB orb, int port, - String name, String type, UnaryVoidFunction operation ) { - super( orb, port, name, type ) ; - this.operation = operation ; + public AcceptorAcceptOnlyImpl(ORB orb, int port, String name, String type, UnaryVoidFunction operation) { + super(orb, port, name, type); + this.operation = operation; } @Override public void accept() { - operation.evaluate( getAcceptedSocket() ) ; + operation.evaluate(getAcceptedSocket()); } @Override diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorBase.java index e1946ee94..4ab907e90 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorBase.java @@ -47,7 +47,7 @@ import com.sun.corba.ee.spi.trace.Transport; import java.nio.channels.SelectionKey; import java.util.Iterator; -import java.net.Socket ; +import java.net.Socket; import org.omg.IOP.TAG_INTERNET_IOP; /** @@ -55,35 +55,28 @@ * @author ken */ @Transport -public abstract class AcceptorBase - extends - EventHandlerBase - implements - Acceptor, - Work, +public abstract class AcceptorBase extends EventHandlerBase implements Acceptor, Work, // BEGIN Legacy - SocketInfo, - LegacyServerSocketEndPointInfo - // END Legacy + SocketInfo, LegacyServerSocketEndPointInfo +// END Legacy { - protected ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + protected ORBUtilSystemException wrapper = ORBUtilSystemException.self; - protected int port ; + protected int port; protected long enqueueTime; - protected boolean initialized = false ; + protected boolean initialized = false; // BEGIN legacy protected String type = ""; protected String name = ""; - protected String hostname ; + protected String hostname; protected int locatorPort; // END legacy protected InboundConnectionCache connectionCache; public int getPort() { - return port ; + return port; } public String getInterfaceName() { @@ -93,20 +86,18 @@ public String getInterfaceName() { // Need this for the work interface. public String getName() { - return getInterfaceName() ; + return getInterfaceName(); } - + public String getType() { - return type ; + return type; } public boolean isLazy() { - return false ; + return false; } - public AcceptorBase(ORB orb, int port, - String name, String type) - { + public AcceptorBase(ORB orb, int port, String name, String type) { this.orb = orb; setWork(this); @@ -123,12 +114,11 @@ public AcceptorBase(ORB orb, int port, } @Transport - public void processSocket( Socket socket ) { - Connection connection = - new ConnectionImpl(orb, this, socket); + public void processSocket(Socket socket) { + Connection connection = new ConnectionImpl(orb, this, socket); // NOTE: The connection MUST be put in the cache BEFORE being - // registered with the selector. Otherwise if the bytes + // registered with the selector. Otherwise if the bytes // are read on the connection it will attempt a time stamp // but the cache will be null, resulting in NPE. getConnectionCache().put(this, connection); @@ -147,13 +137,11 @@ public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, String String hname = orb.getORBData().getORBServerHost(); if (iterator.hasNext()) { // NEVER create an AlternateIIOPAddress for an SSL acceptor! - if (!type.startsWith( SocketInfo.SSL_PREFIX )) { + if (!type.startsWith(SocketInfo.SSL_PREFIX)) { IIOPAddress iiopAddress = IIOPFactories.makeIIOPAddress(hname, port); - AlternateIIOPAddressComponent iiopAddressComponent = - IIOPFactories.makeAlternateIIOPAddressComponent(iiopAddress); + AlternateIIOPAddressComponent iiopAddressComponent = IIOPFactories.makeAlternateIIOPAddressComponent(iiopAddress); while (iterator.hasNext()) { - TaggedProfileTemplate taggedProfileTemplate = - (TaggedProfileTemplate)iterator.next(); + TaggedProfileTemplate taggedProfileTemplate = (TaggedProfileTemplate) iterator.next(); taggedProfileTemplate.add(iiopAddressComponent); } } @@ -172,42 +160,31 @@ protected final IIOPProfileTemplate makeIIOPProfileTemplate(Policies policies, S } else if (policies.isTransient()) { templatePort = port; } else { - templatePort = orb.getLegacyServerSocketManager() - .legacyGetPersistentServerPort(SocketInfo.IIOP_CLEAR_TEXT); + templatePort = orb.getLegacyServerSocketManager().legacyGetPersistentServerPort(SocketInfo.IIOP_CLEAR_TEXT); } - IIOPAddress addr = IIOPFactories.makeIIOPAddress(hostname, - templatePort); - IIOPProfileTemplate iiopProfile = IIOPFactories.makeIIOPProfileTemplate(orb, - version, addr); + IIOPAddress addr = IIOPFactories.makeIIOPAddress(hostname, templatePort); + IIOPProfileTemplate iiopProfile = IIOPFactories.makeIIOPProfileTemplate(orb, version, addr); if (version.supportsIORIIOPProfileComponents()) { iiopProfile.add(IIOPFactories.makeCodeSetsComponent(orb)); iiopProfile.add(IIOPFactories.makeMaxStreamFormatVersionComponent()); - RequestPartitioningPolicy rpPolicy = - (RequestPartitioningPolicy) policies.get_effective_policy( - ORBConstants.REQUEST_PARTITIONING_POLICY); + RequestPartitioningPolicy rpPolicy = (RequestPartitioningPolicy) policies + .get_effective_policy(ORBConstants.REQUEST_PARTITIONING_POLICY); if (rpPolicy != null) { - iiopProfile.add( - IIOPFactories.makeRequestPartitioningComponent(rpPolicy.getValue())); + iiopProfile.add(IIOPFactories.makeRequestPartitioningComponent(rpPolicy.getValue())); } - LoadBalancingPolicy lbPolicy = (LoadBalancingPolicy) - policies.get_effective_policy( - ORBConstants.LOAD_BALANCING_POLICY); + LoadBalancingPolicy lbPolicy = (LoadBalancingPolicy) policies.get_effective_policy(ORBConstants.LOAD_BALANCING_POLICY); if (lbPolicy != null) { - iiopProfile.add( - IIOPFactories.makeLoadBalancingComponent( - lbPolicy.getValue())); + iiopProfile.add(IIOPFactories.makeLoadBalancingComponent(lbPolicy.getValue())); } if (codebase != null && !codebase.equals("")) { - iiopProfile.add( - IIOPFactories.makeJavaCodebaseComponent(codebase)); + iiopProfile.add(IIOPFactories.makeJavaCodebaseComponent(codebase)); } if (orb.getORBData().isJavaSerializationEnabled()) { - iiopProfile.add( - IIOPFactories.makeJavaSerializationComponent()); + iiopProfile.add(IIOPFactories.makeJavaSerializationComponent()); } } return iiopProfile; @@ -279,8 +256,8 @@ public Connection getConnection() { } public CDROutputObject createOutputObject(ORB broker, MessageMediator messageMediator) { - return OutputStreamFactory.newCDROutputObject(broker, messageMediator, - messageMediator.getReplyHeader(), messageMediator.getStreamFormatVersion()); + return OutputStreamFactory.newCDROutputObject(broker, messageMediator, messageMediator.getReplyHeader(), + messageMediator.getStreamFormatVersion()); } public boolean shouldRegisterAcceptEvent() { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorImpl.java index a4bc40f8e..a8c0cf936 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorImpl.java @@ -29,7 +29,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; - import com.sun.corba.ee.spi.transport.Selector; import com.sun.corba.ee.spi.orb.ORB; @@ -41,16 +40,15 @@ /** * @author Harold Carr */ -@Transport public class AcceptorImpl extends AcceptorBase { +@Transport +public class AcceptorImpl extends AcceptorBase { protected ServerSocketChannel serverSocketChannel; protected ServerSocket serverSocket; - - private Class lastExceptionClassSeen = null ; - public AcceptorImpl(ORB orb, int port, - String name, String type) - { - super( orb, port, name, type ) ; + private Class lastExceptionClassSeen = null; + + public AcceptorImpl(ORB orb, int port, String name, String type) { + super(orb, port, name, type); } @Transport @@ -67,8 +65,7 @@ public synchronized boolean initialize() { host = orb.getORBData().getORBServerHost(); inetSocketAddress = new InetSocketAddress(host, port); } - serverSocket = orb.getORBData().getSocketFactory() - .createServerSocket(type, inetSocketAddress); + serverSocket = orb.getORBData().getSocketFactory().createServerSocket(type, inetSocketAddress); internalInitialize(); if (orb.getORBData().showInfoMessages()) { wrapper.infoCreateListenerSucceeded(host, Integer.toString(port)); @@ -80,9 +77,7 @@ public synchronized boolean initialize() { return true; } - protected void internalInitialize() - throws Exception - { + protected void internalInitialize() throws Exception { // Determine the listening port (for the IOR). // This is important when using emphemeral ports (i.e., // when the port value to the constructor is 0). @@ -98,24 +93,23 @@ protected void internalInitialize() serverSocketChannel = serverSocket.getChannel(); if (serverSocketChannel != null) { - setUseSelectThreadToWait( - orb.getORBData().acceptorSocketUseSelectThreadToWait()); - serverSocketChannel.configureBlocking( - ! orb.getORBData().acceptorSocketUseSelectThreadToWait()); + setUseSelectThreadToWait(orb.getORBData().acceptorSocketUseSelectThreadToWait()); + serverSocketChannel.configureBlocking(!orb.getORBData().acceptorSocketUseSelectThreadToWait()); } else { // Configure to use listener and reader threads. setUseSelectThreadToWait(false); } - setUseWorkerThreadForEvent( - orb.getORBData().acceptorSocketUseWorkerThreadForEvent()); + setUseWorkerThreadForEvent(orb.getORBData().acceptorSocketUseWorkerThreadForEvent()); } @InfoMethod - private void usingServerSocket( ServerSocket ss ) { } + private void usingServerSocket(ServerSocket ss) { + } @InfoMethod - private void usingServerSocketChannel( ServerSocketChannel ssc ) { } + private void usingServerSocketChannel(ServerSocketChannel ssc) { + } @Transport public Socket getAcceptedSocket() { @@ -125,31 +119,30 @@ public Socket getAcceptedSocket() { try { if (serverSocketChannel == null) { socket = serverSocket.accept(); - usingServerSocket( serverSocket ) ; + usingServerSocket(serverSocket); } else { socketChannel = serverSocketChannel.accept(); socket = socketChannel.socket(); usingServerSocketChannel(serverSocketChannel); } - orb.getORBData().getSocketFactory() - .setAcceptedSocketOptions(this, serverSocket, socket); + orb.getORBData().getSocketFactory().setAcceptedSocketOptions(this, serverSocket, socket); // Clear the last exception after a successful accept, in case // we get sporadic bursts of related failures. - lastExceptionClassSeen = null ; + lastExceptionClassSeen = null; } catch (IOException e) { // Log the exception at WARNING level, unless the same exception - // occurs repeatedly. In that case, only log the first exception - // as a warning. Log all exceptions with the same class after the - // first of that class at FINE level. We want to avoid flooding the + // occurs repeatedly. In that case, only log the first exception + // as a warning. Log all exceptions with the same class after the + // first of that class at FINE level. We want to avoid flooding the // log when the same error occurs repeatedly (e.g. we are using an // SSLSocketChannel and there is a certificate problem that causes // ALL accepts to fail). if (e.getClass() == lastExceptionClassSeen) { wrapper.ioexceptionInAcceptFine(e); } else { - lastExceptionClassSeen = e.getClass() ; + lastExceptionClassSeen = e.getClass(); wrapper.ioexceptionInAccept(e); } @@ -157,18 +150,19 @@ public Socket getAcceptedSocket() { // REVISIT - need to close - recreate - then register new one. orb.getTransportManager().getSelector(0).registerForEvent(this); // NOTE: if register cycling we do not want to shut down ORB - // since local beans will still work. Instead one will see + // since local beans will still work. Instead one will see // a growing log file to alert admin of problem. } - return socket ; + return socket; } @InfoMethod - private void closeException( IOException exc ) { } + private void closeException(IOException exc) { + } @Transport - public void close () { + public void close() { try { Selector selector = orb.getTransportManager().getSelector(0); selector.unregisterForEvent(this); @@ -197,33 +191,31 @@ public SelectableChannel getChannel() { // protected void accept() { - processSocket( getAcceptedSocket() ) ; + processSocket(getAcceptedSocket()); } @Transport public void doWork() { try { if (selectionKey.isAcceptable()) { - AccessController.doPrivileged( - new PrivilegedAction() { - public java.lang.Object run() { - accept() ; - return null; - } + AccessController.doPrivileged(new PrivilegedAction() { + public java.lang.Object run() { + accept(); + return null; } - ); + }); } else { - selectionKeyNotAcceptable() ; + selectionKeyNotAcceptable(); } } catch (SecurityException se) { - securityException( se ) ; + securityException(se); String permissionStr = ORBUtility.getClassSecurityInfo(getClass()); wrapper.securityExceptionInAccept(se, permissionStr); } catch (Exception ex) { - otherException( ex ) ; - wrapper.exceptionInAccept(ex, ex.toString() ); + otherException(ex); + wrapper.exceptionInAccept(ex, ex.toString()); } catch (Throwable t) { - otherException( t ) ; + otherException(t); } finally { // IMPORTANT: To avoid bug (4953599), we force the @@ -233,8 +225,8 @@ public java.lang.Object run() { // indefinitely. // NOTE: If "acceptorSocketUseWorkerThreadForEvent" is // set to to false in ParserTable.java, then this method, - // doWork(), will get executed by the same thread - // (SelectorThread) that does the NIO select. + // doWork(), will get executed by the same thread + // (SelectorThread) that does the NIO select. // If "acceptorSocketUseWorkerThreadForEvent" is set // to true, a WorkerThread will execute this method, // doWork(). Hence, the registering of the enabling of @@ -251,19 +243,21 @@ public java.lang.Object run() { // SocketOrChannelAcceptor // - public ServerSocket getServerSocket() - { + public ServerSocket getServerSocket() { return serverSocket; } @InfoMethod - private void selectionKeyNotAcceptable() { } + private void selectionKeyNotAcceptable() { + } @InfoMethod - private void securityException(SecurityException se) { } + private void securityException(SecurityException se) { + } @InfoMethod - private void otherException(Throwable t) { } + private void otherException(Throwable t) { + } // END Legacy support } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorLazyImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorLazyImpl.java index 2f366b409..e705951b0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorLazyImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/AcceptorLazyImpl.java @@ -25,30 +25,30 @@ import java.net.Socket; import java.nio.channels.SelectableChannel; -/** A version of an Acceptor that does not own the ServerSocket. - * Instead, SelectableChannels obtained from the ServerSocket are - * given to the processSocket method +/** + * A version of an Acceptor that does not own the ServerSocket. Instead, SelectableChannels obtained from the + * ServerSocket are given to the processSocket method * * @author ken */ @Transport public class AcceptorLazyImpl extends AcceptorBase { - public AcceptorLazyImpl( ORB orb, int port, String name, String type ) { - super( orb, port, name, type ) ; + public AcceptorLazyImpl(ORB orb, int port, String name, String type) { + super(orb, port, name, type); } @Override public boolean isLazy() { - return true ; + return true; } public Socket getAcceptedSocket() { - throw wrapper.notSupportedOnLazyAcceptor() ; + throw wrapper.notSupportedOnLazyAcceptor(); } public SelectableChannel getChannel() { - throw wrapper.notSupportedOnLazyAcceptor() ; + throw wrapper.notSupportedOnLazyAcceptor(); } @Transport @@ -59,9 +59,9 @@ public synchronized boolean initialize() { orb.getCorbaTransportManager().getInboundConnectionCache(this); - initialized = true ; + initialized = true; - return true ; + return true; } public void close() { @@ -69,11 +69,11 @@ public void close() { } public ServerSocket getServerSocket() { - throw wrapper.notSupportedOnLazyAcceptor() ; + throw wrapper.notSupportedOnLazyAcceptor(); } public void doWork() { - throw wrapper.notSupportedOnLazyAcceptor() ; + throw wrapper.notSupportedOnLazyAcceptor(); } @Override diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ByteBufferPoolImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ByteBufferPoolImpl.java index a5c4654f5..8daedb467 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ByteBufferPoolImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ByteBufferPoolImpl.java @@ -29,8 +29,7 @@ * @author Charlie Hunt */ public class ByteBufferPoolImpl implements ByteBufferPool { - final private static ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + final private static ORBUtilSystemException wrapper = ORBUtilSystemException.self; private ByteBuffer byteBufferSlab; final private boolean useDirectBuffers; @@ -62,15 +61,14 @@ public ByteBuffer getByteBuffer(int size) { return ByteBuffer.allocate(size); } synchronized (this) { - if (byteBufferSlab == null || - (byteBufferSlab.capacity() - byteBufferSlab.limit() < size)) { + if (byteBufferSlab == null || (byteBufferSlab.capacity() - byteBufferSlab.limit() < size)) { byteBufferSlab = allocateDirectByteBufferSlab(); } - + byteBufferSlab.limit(byteBufferSlab.position() + size); ByteBuffer view = byteBufferSlab.slice(); byteBufferSlab.position(byteBufferSlab.limit()); - + return view; } } else { @@ -78,7 +76,6 @@ public ByteBuffer getByteBuffer(int size) { } } - public void releaseByteBuffer(ByteBuffer buffer) { // nothing to do here other than help the garbage collector // Remove this, as it is not useful, and gets flagged by findbugs. @@ -86,20 +83,17 @@ public void releaseByteBuffer(ByteBuffer buffer) { // buffer = null; } - // REVISIT - Active ByteBuffers are currently not tracked. /** - * Get a count of the outstanding allocated DirectByteBuffers. - * (Those allocated and have not been returned to the pool). + * Get a count of the outstanding allocated DirectByteBuffers. (Those allocated and have not been returned to the pool). */ public int activeCount() { - return 0; + return 0; } /** - * Return a new ByteBuffer of at least minimumSize - * and copy any bytes in the oldByteBuffer starting at - * oldByteBuffer.position() up to oldByteBuffer.limit() + * Return a new ByteBuffer of at least minimumSize and copy any bytes in the + * oldByteBuffer starting at oldByteBuffer.position() up to oldByteBuffer.limit() * into the returned ByteBuffer. */ public ByteBuffer reAllocate(ByteBuffer oldByteBuffer, int minimumSize) { @@ -110,26 +104,25 @@ public ByteBuffer reAllocate(ByteBuffer oldByteBuffer, int minimumSize) { if (size > orb.getORBData().getMaxReadByteBufferSizeThreshold()) { if (minimumSize > orb.getORBData().getMaxReadByteBufferSizeThreshold()) { - throw wrapper.maximumReadByteBufferSizeExceeded( - orb.getORBData().getMaxReadByteBufferSizeThreshold(), size, - ORBConstants.MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD_PROPERTY); + throw wrapper.maximumReadByteBufferSizeExceeded(orb.getORBData().getMaxReadByteBufferSizeThreshold(), size, + ORBConstants.MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD_PROPERTY); } else { - // minimumSize is greater than 1/2 of size, and less than or - // equal to max read byte buffer size threshold. So, just + // minimumSize is greater than 1/2 of size, and less than or + // equal to max read byte buffer size threshold. So, just // re-allocate a ByteBuffer of minimumSize. size = minimumSize; } } - + ByteBuffer newByteBuffer = getByteBuffer(size); - + // copy oldByteBuffer into newByteBuffer newByteBuffer.put(oldByteBuffer); - + return newByteBuffer; } - /** + /** * Allocate a DirectByteBuffer slab. */ private ByteBuffer allocateDirectByteBufferSlab() { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ConnectionCacheBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ConnectionCacheBase.java index 9eb6f04f6..09ed3871c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ConnectionCacheBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ConnectionCacheBase.java @@ -29,178 +29,147 @@ import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import com.sun.corba.ee.spi.trace.Transport; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.NameValue ; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.NameValue; -import org.glassfish.external.statistics.CountStatistic ; -import org.glassfish.external.statistics.impl.CountStatisticImpl ; +import org.glassfish.external.statistics.CountStatistic; +import org.glassfish.external.statistics.impl.CountStatisticImpl; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; - - //////////////////////////////////////////////////// - // - // spi.transport.ConnectionCache - // +//////////////////////////////////////////////////// +// +// spi.transport.ConnectionCache +// /** * @author Harold Carr */ @Transport -public abstract class ConnectionCacheBase - implements - ConnectionCache -{ - protected static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - private static final String STAT_UNIT = "count" ; - - private static final String TOTAL_ID_STD = "TotalConnections" ; - private static final String TOTAL_ID = "totalconnections" ; - private static final String IDLE_ID_STD = "ConnectionsIdle" ; - private static final String IDLE_ID = "connectionsidle" ; - private static final String BUSY_ID_STD = "ConnectionsBusy" ; - private static final String BUSY_ID = "connectionsbusy" ; - - private static final String TOTAL_DESC = - "Total number of connections in the connection cache" ; - private static final String IDLE_DESC = - "Number of connections in the connection cache that are idle" ; - private static final String BUSY_DESC = - "Number of connections in the connection cache that are in use" ; +public abstract class ConnectionCacheBase implements ConnectionCache { + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + private static final String STAT_UNIT = "count"; + + private static final String TOTAL_ID_STD = "TotalConnections"; + private static final String TOTAL_ID = "totalconnections"; + private static final String IDLE_ID_STD = "ConnectionsIdle"; + private static final String IDLE_ID = "connectionsidle"; + private static final String BUSY_ID_STD = "ConnectionsBusy"; + private static final String BUSY_ID = "connectionsbusy"; + + private static final String TOTAL_DESC = "Total number of connections in the connection cache"; + private static final String IDLE_DESC = "Number of connections in the connection cache that are idle"; + private static final String BUSY_DESC = "Number of connections in the connection cache that are in use"; protected ORB orb; protected long timestamp = 0; protected String cacheType; protected String monitoringName; - protected ConnectionCacheBase(ORB orb, String cacheType, - String monitoringName) - { + protected ConnectionCacheBase(ORB orb, String cacheType, String monitoringName) { this.orb = orb; this.cacheType = cacheType; this.monitoringName = monitoringName; dprintCreation(); } - + @NameValue - public String getCacheType() - { + public String getCacheType() { return cacheType; } - public synchronized void stampTime(Connection c) - { + public synchronized void stampTime(Connection c) { // _REVISIT_ Need to worry about wrap around some day c.setTimeStamp(timestamp++); } - private CountStatistic makeCountStat( String name, String desc, - long value ) { + private CountStatistic makeCountStat(String name, String desc, long value) { - CountStatisticImpl result = new CountStatisticImpl( name, - STAT_UNIT, desc ) ; - result.setCount( value ) ; - return result ; + CountStatisticImpl result = new CountStatisticImpl(name, STAT_UNIT, desc); + result.setCount(value); + return result; } public void close() { synchronized (backingStore()) { for (Object obj : values()) { - ((Connection)obj).closeConnectionResources() ; + ((Connection) obj).closeConnectionResources(); } } } - @ManagedAttribute( id=TOTAL_ID ) - @Description( TOTAL_DESC ) - private CountStatistic numberOfConnectionsAttr() - { - return makeCountStat( TOTAL_ID_STD, TOTAL_DESC, - numberOfConnections() ) ; + @ManagedAttribute(id = TOTAL_ID) + @Description(TOTAL_DESC) + private CountStatistic numberOfConnectionsAttr() { + return makeCountStat(TOTAL_ID_STD, TOTAL_DESC, numberOfConnections()); } - public long numberOfConnections() - { - long count = 0 ; + public long numberOfConnections() { + long count = 0; synchronized (backingStore()) { count = values().size(); } - return count ; + return count; } - @ManagedAttribute( id=IDLE_ID ) - @Description( IDLE_DESC ) - private CountStatistic numberOfIdleConnectionsAttr() - { - return makeCountStat( IDLE_ID_STD, IDLE_DESC, - numberOfIdleConnections() ) ; + @ManagedAttribute(id = IDLE_ID) + @Description(IDLE_DESC) + private CountStatistic numberOfIdleConnectionsAttr() { + return makeCountStat(IDLE_ID_STD, IDLE_DESC, numberOfIdleConnections()); } - public long numberOfIdleConnections() - { + public long numberOfIdleConnections() { long count = 0; synchronized (backingStore()) { Iterator connections = values().iterator(); while (connections.hasNext()) { - if (! ((Connection)connections.next()).isBusy()) { + if (!((Connection) connections.next()).isBusy()) { count++; } } } - return count ; + return count; } - @ManagedAttribute( id=BUSY_ID ) - @Description( BUSY_DESC ) - private CountStatistic numberOfBusyConnectionsAttr() - { - return makeCountStat( BUSY_ID_STD, BUSY_DESC, - numberOfBusyConnections() ) ; + @ManagedAttribute(id = BUSY_ID) + @Description(BUSY_DESC) + private CountStatistic numberOfBusyConnectionsAttr() { + return makeCountStat(BUSY_ID_STD, BUSY_DESC, numberOfBusyConnections()); } - public long numberOfBusyConnections() - { + public long numberOfBusyConnections() { long count = 0; synchronized (backingStore()) { Iterator connections = values().iterator(); while (connections.hasNext()) { - if (((Connection)connections.next()).isBusy()) { + if (((Connection) connections.next()).isBusy()) { count++; } } } - - return count ; - } + return count; + } /** * Discarding least recently used Connections that are not busy * - * This method must be synchronized since one WorkerThread could - * be reclaming connections inside the synchronized backingStore - * block and a second WorkerThread (or a SelectorThread) could have - * already executed the if (numberOfConnections <= .... ). As a - * result the second thread would also attempt to reclaim connections. + * This method must be synchronized since one WorkerThread could be reclaming connections inside the synchronized + * backingStore block and a second WorkerThread (or a SelectorThread) could have already executed the if + * (numberOfConnections <= .... ). As a result the second thread would also attempt to reclaim connections. * - * If connection reclamation becomes a performance issue, the connection - * reclamation could make its own task and consequently executed in - * a separate thread. - * Currently, the accept and reclaim are done in the same thread, WorkerThread - * by default. It could be changed such that the SelectorThread would do - * it for SocketChannels and WorkerThreads for Sockets by updating the - * ParserTable. + * If connection reclamation becomes a performance issue, the connection reclamation could make its own task and + * consequently executed in a separate thread. Currently, the accept and reclaim are done in the same thread, + * WorkerThread by default. It could be changed such that the SelectorThread would do it for SocketChannels and + * WorkerThreads for Sockets by updating the ParserTable. */ @Transport @Override synchronized public boolean reclaim() { - long numberOfConnections = numberOfConnections() ; + long numberOfConnections = numberOfConnections(); - reclaimInfo( numberOfConnections, - orb.getORBData().getHighWaterMark(), - orb.getORBData().getNumberToReclaim() ) ; + reclaimInfo(numberOfConnections, orb.getORBData().getHighWaterMark(), orb.getORBData().getNumberToReclaim()); if (numberOfConnections <= orb.getORBData().getHighWaterMark()) { return false; @@ -209,44 +178,42 @@ synchronized public boolean reclaim() { Object backingStore = backingStore(); synchronized (backingStore) { - // REVISIT - A less expensive alternative connection reclaiming - // algorithm could be investigated. + // REVISIT - A less expensive alternative connection reclaiming + // algorithm could be investigated. - for (int i=0; i < orb.getORBData().getNumberToReclaim(); i++) { + for (int i = 0; i < orb.getORBData().getNumberToReclaim(); i++) { Connection toClose = null; long lru = java.lang.Long.MAX_VALUE; Iterator iterator = values().iterator(); // Find least recently used and not busy connection in cache - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { Connection c = (Connection) iterator.next(); - if ( !c.isBusy() && c.getTimeStamp() < lru ) { + if (!c.isBusy() && c.getTimeStamp() < lru) { toClose = c; lru = c.getTimeStamp(); } } - if ( toClose == null ) { + if (toClose == null) { return false; } try { - closingInfo( toClose ) ; + closingInfo(toClose); toClose.close(); } catch (Exception ex) { // REVISIT - log } } - connectionsReclaimedInfo( - numberOfConnections - numberOfConnections() ); + connectionsReclaimedInfo(numberOfConnections - numberOfConnections()); } return true; } - public String getMonitoringName() - { + public String getMonitoringName() { return monitoringName; } @@ -261,34 +228,36 @@ public String getMonitoringName() protected abstract Object backingStore(); @InfoMethod - private void creationInfo(String cacheType, String monitoringName) { } + private void creationInfo(String cacheType, String monitoringName) { + } @Transport protected void dprintCreation() { - creationInfo( getCacheType(), getMonitoringName() ) ; + creationInfo(getCacheType(), getMonitoringName()); } @InfoMethod - private void cacheStatsInfo( long numberOfConnections, - long numberOfBusyConnections, long numberOfIdleConnections, - int highWaterMark, int numberToReclaim) { } + private void cacheStatsInfo(long numberOfConnections, long numberOfBusyConnections, long numberOfIdleConnections, int highWaterMark, + int numberToReclaim) { + } @Transport protected void cacheStatisticsInfo() { - cacheStatsInfo( numberOfConnections(), numberOfBusyConnections(), - numberOfIdleConnections(), orb.getORBData().getHighWaterMark(), - orb.getORBData().getNumberToReclaim() ) ; + cacheStatsInfo(numberOfConnections(), numberOfBusyConnections(), numberOfIdleConnections(), orb.getORBData().getHighWaterMark(), + orb.getORBData().getNumberToReclaim()); } @InfoMethod - private void reclaimInfo(long numberOfConnections, int highWaterMark, - int numberToReclaim) { } + private void reclaimInfo(long numberOfConnections, int highWaterMark, int numberToReclaim) { + } @InfoMethod - private void closingInfo(Connection toClose) { } + private void closingInfo(Connection toClose) { + } @InfoMethod - private void connectionsReclaimedInfo(long l) { } + private void connectionsReclaimedInfo(long l) { + } } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ConnectionImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ConnectionImpl.java index 8789623b2..37db37c4c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ConnectionImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ConnectionImpl.java @@ -19,7 +19,6 @@ package com.sun.corba.ee.impl.transport; - import com.sun.corba.ee.impl.encoding.CDRInputObject; import com.sun.corba.ee.impl.encoding.CDROutputObject; import com.sun.corba.ee.impl.encoding.CachedCodeBase; @@ -65,16 +64,14 @@ /** * @author Harold Carr - * - * Note: this is the version WITHOUT the purgeCalls changes. - * The changes are in the 1.106 version, which is saved as - * SocketOrChannelConnectionImpl.1.106.sjava. + * + * Note: this is the version WITHOUT the purgeCalls changes. The changes are in the 1.106 version, which is saved as + * SocketOrChannelConnectionImpl.1.106.sjava. */ @Transport public class ConnectionImpl extends EventHandlerBase implements Connection, Work { - protected static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self; + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; /// // New transport. @@ -102,7 +99,7 @@ public SocketChannel getSocketChannel() { // From iiop.Connection.java // - protected Socket socket; // The socket used for this connection. + protected Socket socket; // The socket used for this connection. protected long timeStamp = 0; protected boolean isServer = false; @@ -129,12 +126,11 @@ public SocketChannel getSocketChannel() { // FullValueDescription, among other things) protected IOR codeBaseServerIOR; - // CodeBase cache for this connection. This will cache remote operations, + // CodeBase cache for this connection. This will cache remote operations, // handle connecting, and ensure we don't do any remote operations until // necessary. protected CachedCodeBase cachedCodeBase = new CachedCodeBase(this); - // transport read / write timeout values protected TcpTimeouts tcpTimeouts; @@ -148,16 +144,16 @@ public SocketChannel getSocketChannel() { protected Dispatcher dispatcher = DISPATCHER; /** - * Returns the throwable, if any, that occurred during the latest {@link #doWork} call. - * Currently used only by unit tests. + * Returns the throwable, if any, that occurred during the latest {@link #doWork} call. Currently used only by unit + * tests. */ Throwable getDiscardedThrowable() { return discardedThrowable; } /** - * Clears the throwable, if any, that occurred during the latest {@link #doWork} call. - * Currently used only by unit tests. + * Clears the throwable, if any, that occurred during the latest {@link #doWork} call. Currently used only by unit + * tests. */ void clearDiscardedThrowable() { discardedThrowable = null; @@ -174,7 +170,6 @@ public boolean dispatch(MessageMediator messageMediator) { } }; - // Mapping of a fragmented messages by request id and its corresponding // fragmented messages stored in a queue. This mapping is used in the // optimized read strategy when message fragments arrive for a given @@ -199,9 +194,7 @@ public ConnectionImpl(ORB orb) { } // Both client and servers. - protected ConnectionImpl(ORB orb, - boolean useSelectThreadToWait, - boolean useWorkerThread) { + protected ConnectionImpl(ORB orb, boolean useSelectThreadToWait, boolean useWorkerThread) { this(orb); setUseSelectThreadToWait(useSelectThreadToWait); setUseWorkerThreadForEvent(useWorkerThread); @@ -213,13 +206,8 @@ protected ConnectionImpl(ORB orb, } // Client constructor. - private ConnectionImpl(ORB orb, - ContactInfo contactInfo, - boolean useSelectThreadToWait, - boolean useWorkerThread, - String socketType, - String hostname, - int port) { + private ConnectionImpl(ORB orb, ContactInfo contactInfo, boolean useSelectThreadToWait, boolean useWorkerThread, String socketType, + String hostname, int port) { this(orb, useSelectThreadToWait, useWorkerThread); this.contactInfo = contactInfo; @@ -228,8 +216,7 @@ private ConnectionImpl(ORB orb, defineSocket(useSelectThreadToWait, orb.getORBData().getSocketFactory().createSocket(socketType, new InetSocketAddress(hostname, port))); } catch (Throwable t) { - throw wrapper.connectFailure(t, socketType, hostname, - Integer.toString(port)); + throw wrapper.connectFailure(t, socketType, hostname, Integer.toString(port)); } state = OPENING; } @@ -239,27 +226,20 @@ protected final void defineSocket(boolean useSelectThreadToWait, Socket socket) socketChannel = socket.getChannel(); if (socketChannel == null) { - setUseSelectThreadToWait(false); // IMPORTANT: non-channel-backed sockets must use dedicated reader threads. + setUseSelectThreadToWait(false); // IMPORTANT: non-channel-backed sockets must use dedicated reader threads. } else { socketChannel.configureBlocking(!useSelectThreadToWait); } } // Client-side convenience. - public ConnectionImpl(ORB orb, - ContactInfo contactInfo, - String socketType, - String hostname, - int port) { - this(orb, contactInfo, - orb.getORBData().connectionSocketUseSelectThreadToWait(), - orb.getORBData().connectionSocketUseWorkerThreadForEvent(), - socketType, hostname, port); + public ConnectionImpl(ORB orb, ContactInfo contactInfo, String socketType, String hostname, int port) { + this(orb, contactInfo, orb.getORBData().connectionSocketUseSelectThreadToWait(), + orb.getORBData().connectionSocketUseWorkerThreadForEvent(), socketType, hostname, port); } // Server-side constructor. - private ConnectionImpl(ORB orb, Acceptor acceptor, Socket socket, - boolean useSelectThreadToWait, boolean useWorkerThread) { + private ConnectionImpl(ORB orb, Acceptor acceptor, Socket socket, boolean useSelectThreadToWait, boolean useWorkerThread) { this(orb, useSelectThreadToWait, useWorkerThread); try { @@ -278,11 +258,8 @@ private ConnectionImpl(ORB orb, Acceptor acceptor, Socket socket, } // Server-side convenience - public ConnectionImpl(ORB orb, - Acceptor acceptor, - Socket socket) { - this(orb, acceptor, socket, - (socket.getChannel() != null && orb.getORBData().connectionSocketUseSelectThreadToWait()), + public ConnectionImpl(ORB orb, Acceptor acceptor, Socket socket) { + this(orb, acceptor, socket, (socket.getChannel() != null && orb.getORBData().connectionSocketUseSelectThreadToWait()), (socket.getChannel() != null && orb.getORBData().connectionSocketUseWorkerThreadForEvent())); } @@ -337,12 +314,12 @@ private MessageMediator readBits() { unregisterForEventAndPurgeCalls(wrapper.connectionAbort(ex)); // REVISIT - //keepRunning = false; + // keepRunning = false; // REVISIT - if this is called after purgeCalls then // the state of the socket is ABORT so the writeLock - // in close throws an exception. It is ignored but + // in close throws an exception. It is ignored but // causes IBM (screen scraping) tests to fail. - //close(); + // close(); throw wrapper.throwableInReadBits(ex); } } @@ -355,7 +332,7 @@ private void unregisterForEventAndPurgeCalls(SystemException ex) { } // NOTE: This method is used only when the ORB is configured with - // "useNIOSelectToWait=false", aka use blocking Sockets/SocketChannels + // "useNIOSelectToWait=false", aka use blocking Sockets/SocketChannels private MessageMediator createMessageMediator() { try { ByteBuffer headerBuffer = read(0, Message.GIOPMessageHeaderLength); @@ -373,7 +350,6 @@ private MessageMediator createMessageMediator() { } } - private void traceMessageBodyReceived(ORB orb, ByteBuffer buf) { TransportManager ctm = orb.getTransportManager(); MessageTraceManagerImpl mtm = (MessageTraceManagerImpl) ctm.getMessageTraceManager(); @@ -387,7 +363,7 @@ public boolean hasSocketChannel() { } // NOTE: This method is used only when the ORB is configured with - // "useNIOSelectToWait=false", aka use blocking Sockets/SocketChannels. + // "useNIOSelectToWait=false", aka use blocking Sockets/SocketChannels. // NOTE: This method can throw a connection rebind SystemException. private ByteBuffer read(int offset, int length) throws IOException { try { @@ -409,30 +385,27 @@ private ByteBuffer read(int offset, int length) throws IOException { } // NOTE: This method is used only when the ORB is configured with - // "useNIOSelectToWait=false", aka use blocking java.net.Socket + // "useNIOSelectToWait=false", aka use blocking java.net.Socket // To support non-channel connections. - - // case 1: asked for full header and received it: - // -> ask for full body + // -> ask for full body // case 2: asked for full header and did not receive it: - // -> read more later + // -> read more later // case 3: asked for full body and received it: - // -> enqueue + // -> enqueue // case 4: asked for full body and did not receive it: - // -> read more later + // -> read more later /** - * Reads data from the input stream, adding it the end of the existing buffer. - * At least one byte will always be read. + * Reads data from the input stream, adding it the end of the existing buffer. At least one byte will always be read. + * * @param is the input stream from which to read * @param buf the buffer into which to read * @param offset the first position in the buffer into which to read * @param length * @throws IOException */ - private void readFully(java.io.InputStream is, byte[] buf, int offset, int length) - throws IOException { + private void readFully(java.io.InputStream is, byte[] buf, int offset, int length) throws IOException { int n = 0; int bytecount; @@ -518,8 +491,8 @@ public synchronized void close() { } // stop the reader without causing it to do purgeCalls - //Exception ex = new Exception(); - //reader.stop(ex); // REVISIT + // Exception ex = new Exception(); + // reader.stop(ex); // REVISIT // NOTE: !!!!!! // This does writeUnlock(). @@ -583,7 +556,7 @@ public EventHandler getEventHandler() { // This is used by the GIOPOutputObject in order to // throw the correct error when handling code sets. // Can we determine if we are on the server side by - // other means? XREVISIT + // other means? XREVISIT public boolean isServer() { return isServer; } @@ -599,8 +572,7 @@ public boolean isClosed() { } public boolean isBusy() { - if (serverRequestCount > 0 || - getResponseWaitingRoom().numberRegistered() > 0) { + if (serverRequestCount > 0 || getResponseWaitingRoom().numberRegistered() > 0) { return true; } else { return false; @@ -635,11 +607,9 @@ public void setState(String stateString) { } /** - * Sets the writeLock for this connection. - * If the writeLock is already set by someone else, block till the - * writeLock is released and can set by us. - * IMPORTANT: this connection's lock must be acquired before - * setting the writeLock and must be unlocked after setting the writeLock. + * Sets the writeLock for this connection. If the writeLock is already set by someone else, block till the writeLock is + * released and can set by us. IMPORTANT: this connection's lock must be acquired before setting the writeLock and must + * be unlocked after setting the writeLock. */ @Transport public void writeLock() { @@ -654,62 +624,62 @@ public void writeLock() { switch (localState) { - case OPENING: - synchronized (stateEvent) { - if (getState() != OPENING) { - // somebody has changed 'state' so be careful - break; - } - try { - stateEvent.wait(); - } catch (InterruptedException ie) { - wrapper.openingWaitInterrupted(ie); - } + case OPENING: + synchronized (stateEvent) { + if (getState() != OPENING) { + // somebody has changed 'state' so be careful + break; + } + try { + stateEvent.wait(); + } catch (InterruptedException ie) { + wrapper.openingWaitInterrupted(ie); + } + } + // Loop back + break; + + case ESTABLISHED: + synchronized (writeEvent) { + if (!writeLocked) { + writeLocked = true; + return; } - // Loop back - break; - - case ESTABLISHED: - synchronized (writeEvent) { - if (!writeLocked) { - writeLocked = true; - return; - } - try { - // do not stay here too long if state != ESTABLISHED - // Bug 4752117 - while (getState() == ESTABLISHED && writeLocked) { - writeEvent.wait(100); - } - } catch (InterruptedException ie) { - wrapper.establishedWaitInterrupted(ie); + try { + // do not stay here too long if state != ESTABLISHED + // Bug 4752117 + while (getState() == ESTABLISHED && writeLocked) { + writeEvent.wait(100); } + } catch (InterruptedException ie) { + wrapper.establishedWaitInterrupted(ie); } - // Loop back - break; + } + // Loop back + break; - case ABORT: - synchronized (stateEvent) { - if (getState() != ABORT) { - break; - } - throw wrapper.writeErrorSend(); + case ABORT: + synchronized (stateEvent) { + if (getState() != ABORT) { + break; } + throw wrapper.writeErrorSend(); + } - case CLOSE_RECVD: - // the connection has been closed or closing - // ==> throw rebind exception - synchronized (stateEvent) { - if (getState() != CLOSE_RECVD) { - break; - } - throw wrapper.connectionRebind(); + case CLOSE_RECVD: + // the connection has been closed or closing + // ==> throw rebind exception + synchronized (stateEvent) { + if (getState() != CLOSE_RECVD) { + break; } + throw wrapper.connectionRebind(); + } - default: - // REVISIT - throw new RuntimeException(".writeLock: bad state"); + default: + // REVISIT + throw new RuntimeException(".writeLock: bad state"); } } } @@ -726,9 +696,9 @@ public void writeUnlock() { // NOTE: This method can throw a connection rebind SystemException. public void sendWithoutLock(CDROutputObject outputObject) { // Don't we need to check for CloseConnection - // here? REVISIT + // here? REVISIT - // XREVISIT - Shouldn't the MessageMediator + // XREVISIT - Shouldn't the MessageMediator // be the one to handle writing the data here? try { @@ -737,20 +707,18 @@ public void sendWithoutLock(CDROutputObject outputObject) { cdrOutputObject.writeTo(this); // REVISIT - no flush? - //socket.getOutputStream().flush(); + // socket.getOutputStream().flush(); } catch (IOException exc) { // Since IIOPOutputStream's msgheader is set only once, and not - // altered during sending multiple fragments, the original + // altered during sending multiple fragments, the original // msgheader will always have the requestId. // REVISIT This could be optimized to send a CancelRequest only // if any fragments had been sent already. // IIOPOutputStream will cleanup the connection info when it // sees this exception. - final SystemException sysexc = (getState() == CLOSE_RECVD) ? - wrapper.connectionRebindMaybe(exc) : - wrapper.writeErrorSend(exc); + final SystemException sysexc = (getState() == CLOSE_RECVD) ? wrapper.connectionRebindMaybe(exc) : wrapper.writeErrorSend(exc); purgeCalls(sysexc, false, true); @@ -796,7 +764,7 @@ public int getInterestOps() { return SelectionKey.OP_READ; } - // public Acceptor getAcceptor() - already defined above. + // public Acceptor getAcceptor() - already defined above. public Connection getConnection() { return this; @@ -816,8 +784,8 @@ public void doWork() { discardedThrowable = null; try { // IMPORTANT: Sanity checks on SelectionKeys such as - // SelectorKey.isValid() should not be done - // here. + // SelectorKey.isValid() should not be done + // here. // if (hasSocketChannel()) { @@ -848,7 +816,7 @@ public ResponseWaitingRoom getResponseWaitingRoom() { return responseWaitingRoom; } - // REVISIT - inteface defines isServer but already defined in + // REVISIT - inteface defines isServer but already defined in // higher interface. public void serverRequestMapPut(int reqId, MessageMediator messageMediator) { @@ -878,13 +846,10 @@ public java.net.Socket getSocket() { } /** - * It is possible for a Close Connection to have been - * * sent here, but we will not check for this. A "lazy" - * * Exception will be thrown in the Worker thread after the - * * incoming request has been processed even though the connection - * * is closed before the request is processed. This is o.k because - * * it is a boundary condition. To prevent it we would have to add - * * more locks which would reduce performance in the normal case. + * It is possible for a Close Connection to have been * sent here, but we will not check for this. A "lazy" * Exception + * will be thrown in the Worker thread after the * incoming request has been processed even though the connection * is + * closed before the request is processed. This is o.k because * it is a boundary condition. To prevent it we would have + * to add * more locks which would reduce performance in the normal case. */ public synchronized void serverRequestProcessingBegins() { serverRequestCount++; @@ -916,8 +881,8 @@ public synchronized CodeSetComponentInfo.CodeSetContext getCodeSetContext() { public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) { if (codeSetContext == null) { - if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null || - OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) { + if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null + || OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) { // If the client says it's negotiated a code set that // isn't a fallback and we never said we support, then // it has a bug. @@ -936,7 +901,7 @@ public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext c // This is so the client thread can start unmarshaling // the reply and remove it from the out_calls map while the // ReaderThread can still obtain the input stream to give - // new fragments. Only the ReaderThread touches the clientReplyMap, + // new fragments. Only the ReaderThread touches the clientReplyMap, // so it doesn't incur synchronization overhead. public MessageMediator clientRequestMapGet(int requestId) { @@ -974,18 +939,18 @@ public void serverRequest_1_1_Remove() { protected String getStateString(int state) { synchronized (stateEvent) { switch (state) { - case OPENING: - return "OPENING"; - case ESTABLISHED: - return "ESTABLISHED"; - case CLOSE_SENT: - return "CLOSE_SENT"; - case CLOSE_RECVD: - return "CLOSE_RECVD"; - case ABORT: - return "ABORT"; - default: - return "???"; + case OPENING: + return "OPENING"; + case ESTABLISHED: + return "ESTABLISHED"; + case CLOSE_SENT: + return "CLOSE_SENT"; + case CLOSE_RECVD: + return "CLOSE_RECVD"; + case ABORT: + return "ABORT"; + default: + return "???"; } } } @@ -1000,21 +965,17 @@ public synchronized void setPostInitialContexts() { } /** - * Wake up the outstanding requests on the connection, and hand them - * COMM_FAILURE exception with a given minor code. + * Wake up the outstanding requests on the connection, and hand them COMM_FAILURE exception with a given minor code. *

    - * Also, delete connection from connection table and - * stop the reader thread. + * Also, delete connection from connection table and stop the reader thread. *

    - * Note that this should only ever be called by the Reader thread for - * this connection. + * Note that this should only ever be called by the Reader thread for this connection. * - * @param die Kill the reader thread (this thread) before exiting. + * @param die Kill the reader thread (this thread) before exiting. * @param lockHeld true if the calling thread holds the lock on the connection */ @Transport - public void purgeCalls(SystemException systemException, boolean die, - boolean lockHeld) { + public void purgeCalls(SystemException systemException, boolean die, boolean lockHeld) { int minor_code = systemException.minor; // If this invocation is a result of ThreadDeath caused @@ -1089,52 +1050,43 @@ public void purgeCalls(SystemException systemException, boolean die, } /** - * ********************************************************************** - * The following methods are for dealing with Connection cleaning for - * better scalability of servers in high network load conditions. + * ********************************************************************** The following methods are for dealing with + * Connection cleaning for better scalability of servers in high network load conditions. * ************************************************************************ */ - public void sendCloseConnection(GIOPVersion giopVersion) - throws IOException { + public void sendCloseConnection(GIOPVersion giopVersion) throws IOException { Message msg = MessageBase.createCloseConnection(giopVersion); sendHelper(giopVersion, msg); } - public void sendMessageError(GIOPVersion giopVersion) - throws IOException { + public void sendMessageError(GIOPVersion giopVersion) throws IOException { Message msg = MessageBase.createMessageError(giopVersion); sendHelper(giopVersion, msg); } /** - * Send a CancelRequest message. This does not lock the connection, so the - * caller needs to ensure this method is called appropriately. + * Send a CancelRequest message. This does not lock the connection, so the caller needs to ensure this method is called + * appropriately. * * @throws IOException - could be due to abortive connection closure. */ - public void sendCancelRequest(GIOPVersion giopVersion, int requestId) - throws IOException { + public void sendCancelRequest(GIOPVersion giopVersion, int requestId) throws IOException { Message msg = MessageBase.createCancelRequest(giopVersion, requestId); sendHelper(giopVersion, msg); } - protected void sendHelper(GIOPVersion giopVersion, Message msg) - throws IOException { + protected void sendHelper(GIOPVersion giopVersion, Message msg) throws IOException { // REVISIT: See comments in CDROutputObject constructor. - CDROutputObject outputObject = - new CDROutputObject(orb, null, giopVersion, this, msg, - ORBConstants.STREAM_FORMAT_VERSION_1); + CDROutputObject outputObject = new CDROutputObject(orb, null, giopVersion, this, msg, ORBConstants.STREAM_FORMAT_VERSION_1); msg.write(outputObject); outputObject.writeTo(this); } // NOTE: This method can throw a connection rebind SystemException. - public void sendCancelRequestWithLock(GIOPVersion giopVersion, - int requestId) - throws IOException { + public void sendCancelRequestWithLock(GIOPVersion giopVersion, int requestId) throws IOException { writeLock(); try { sendCancelRequest(giopVersion, requestId); @@ -1151,15 +1103,15 @@ public void sendCancelRequestWithLock(GIOPVersion giopVersion, // Begin Code Base methods --------------------------------------- // - // Set this connection's code base IOR. The IOR comes from the - // SendingContext. This is an optional service context, but all + // Set this connection's code base IOR. The IOR comes from the + // SendingContext. This is an optional service context, but all // JavaSoft ORBs send it. // // The set and get methods don't need to be synchronized since the // first possible get would occur during reading a valuetype, and // that would be after the set. - // Sets this connection's code base IOR. This is done after + // Sets this connection's code base IOR. This is done after // getting the IOR out of the SendingContext service context. // Our ORBs always send this, but it's optional in CORBA. @@ -1171,7 +1123,7 @@ public final IOR getCodeBaseIOR() { return codeBaseServerIOR; } - // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase + // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase // won't connect to the remote codebase unless it's necessary. public final CodeBase getCodeBase() { return cachedCodeBase; @@ -1187,23 +1139,15 @@ protected void setTcpTimeouts(TcpTimeouts tcpTimeouts) { @Transport protected void doOptimizedReadStrategy() { try { - /*/ - int minimumToRead = 0; - ByteBuffer byteBuffer; - do { - byteBuffer = socketChannelReader.read(getSocketChannel(), messageParser.getRemainderBuffer(), minimumToRead); - if (byteBuffer != null) { - byteBuffer.flip(); - byteBuffer = extractAndProcessMessages(byteBuffer); - minimumToRead = messageParser.getSizeNeeded(); - } - } while (byteBuffer != null); - /*/ + /* + * / int minimumToRead = 0; ByteBuffer byteBuffer; do { byteBuffer = socketChannelReader.read(getSocketChannel(), + * messageParser.getRemainderBuffer(), minimumToRead); if (byteBuffer != null) { byteBuffer.flip(); byteBuffer = + * extractAndProcessMessages(byteBuffer); minimumToRead = messageParser.getSizeNeeded(); } } while (byteBuffer != null); + * / + */ // get a new ByteBuffer from ByteBufferPool ? if (byteBuffer == null || !byteBuffer.hasRemaining()) { - byteBuffer = - orb.getByteBufferPool().getByteBuffer( - orb.getORBData().getReadByteBufferSize()); + byteBuffer = orb.getByteBufferPool().getByteBuffer(orb.getORBData().getReadByteBufferSize()); } // start of a message must begin at byteBuffer's current position @@ -1212,7 +1156,7 @@ protected void doOptimizedReadStrategy() { int bytesRead = 0; // When orb.getORBData().nonBlockingReadCheckMessageParser() is // true, we check both conditions, messageParser.isExpectingMoreData() and - // bytesRead > 0. If bytesRead > 0 is the only condition checked, + // bytesRead > 0. If bytesRead > 0 is the only condition checked, // i.e. orb.getORBData().nonBlockingReadCheckMessageParser() is false, // then an additional read() would be done before exiting the while // loop. The default is to check both conditions. @@ -1266,12 +1210,12 @@ protected void doOptimizedReadStrategy() { unregisterForEventAndPurgeCalls(wrapper.connectionAbort(ex)); // REVISIT - //keepRunning = false; + // keepRunning = false; // REVISIT - if this is called after purgeCalls then // the state of the socket is ABORT so the writeLock - // in close throws an exception. It is ignored but + // in close throws an exception. It is ignored but // causes IBM (screen scraping) tests to fail. - //close(); + // close(); throw wrapper.throwableInDoOptimizedReadStrategy(ex); } } @@ -1289,8 +1233,7 @@ public ByteBuffer extractAndProcessMessages(ByteBuffer byteBuffer) { } private void parseBytesAndDispatchMessages() { - byteBuffer.limit(byteBuffer.position()) - .position(messageParser.getNextMessageStartPosition()); + byteBuffer.limit(byteBuffer.position()).position(messageParser.getNextMessageStartPosition()); do { MessageMediator messageMediator = null; Message message = messageParser.parseBytes(byteBuffer, this); @@ -1313,9 +1256,9 @@ private void parseBytesAndDispatchMessages() { @Transport protected void blockingRead() { - // Precondition: byteBuffer's position must be pointing to where next - // bit of data should be read and MessageParser's next - // message start position must be set. + // Precondition: byteBuffer's position must be pointing to where next + // bit of data should be read and MessageParser's next + // message start position must be set. TcpTimeouts.Waiter waiter = tcpTimeouts.waiter(); TemporarySelector tmpSelector = null; @@ -1335,8 +1278,7 @@ protected void blockingRead() { waiter = tcpTimeouts.waiter(); } else if (bytesRead < 0) { Exception exc = new IOException("End-of-stream"); - throw wrapper.blockingReadEndOfStream( - exc, exc.toString(), this.toString()); + throw wrapper.blockingReadEndOfStream(exc, exc.toString(), this.toString()); } else { // bytesRead == 0, unlikely but possible waiter.advance(); } @@ -1351,8 +1293,7 @@ protected void blockingRead() { if (messageParser.isExpectingMoreData()) { // failed to read data when we were expecting more // and exceeded time willing to wait for additional data - throw wrapper.blockingReadTimeout( - tcpTimeouts.get_max_time_to_wait(), waiter.timeWaiting()); + throw wrapper.blockingReadTimeout(tcpTimeouts.get_max_time_to_wait(), waiter.timeWaiting()); } } catch (IOException ioe) { throw wrapper.exceptionBlockingReadWithTemporarySelector(ioe, this); @@ -1394,7 +1335,7 @@ private void queueUpWork(MessageMediator messageMediator) { // wait()/notify() construct should be replaced // with something like a LinkedBlockingQueue // from java.util.concurrent using its offer() - // and poll() methods. But, at the time of the + // and poll() methods. But, at the time of the // writing of this code, a LinkedBlockingQueue // implementation is not performing as well as // the synchronized(queue), wait(), notify() @@ -1455,7 +1396,7 @@ private void addMessageMediatorToWorkQueue(final MessageMediator messageMediator int poolToUse = -1; try { poolToUse = messageMediator.getThreadPoolToUse(); - orb.getThreadPoolManager().getThreadPool(poolToUse).getWorkQueue(0).addWork((Work)messageMediator); + orb.getThreadPoolManager().getThreadPool(poolToUse).getWorkQueue(0).addWork((Work) messageMediator); } catch (NoSuchThreadPoolException e) { throwable = e; } catch (NoSuchWorkQueueException e) { @@ -1470,15 +1411,15 @@ private void addMessageMediatorToWorkQueue(final MessageMediator messageMediator @Transport private void resumeSelectOnMainSelector() { // NOTE: VERY IMPORTANT: - // Re-enable read event handling on main Selector after getting to + // Re-enable read event handling on main Selector after getting to // the point that proper serialization of fragments is ensured. // parseBytesAndDispatchMessages() and MessageParserImpl.parseBytes() // ensures this by tracking fragment messages for a given request id // for GIOP 1.2 and tracking GIOP 1.1 fragment messages. - // IMPORTANT: To avoid bug (4953599), we force the Thread that does the - // NIO select to also do the enable/disable of interest ops using - // SelectionKey.interestOps(Ops of Interest). Otherwise, the + // IMPORTANT: To avoid bug (4953599), we force the Thread that does the + // NIO select to also do the enable/disable of interest ops using + // SelectionKey.interestOps(Ops of Interest). Otherwise, the // SelectionKey.interestOps(Ops of Interest) may block indefinitely in // this thread. orb.getTransportManager().getSelector(0).registerInterestOps(this); @@ -1528,12 +1469,8 @@ public String toString() { str = ""; } - return "SocketOrChannelConnectionImpl[ " - + str + " " - + getStateString(getState()) + " " - + shouldUseSelectThreadToWait() + " " - + shouldUseWorkerThreadForEvent() - + "]"; + return "SocketOrChannelConnectionImpl[ " + str + " " + getStateString(getState()) + " " + shouldUseSelectThreadToWait() + " " + + shouldUseWorkerThreadForEvent() + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoBase.java index 253369053..cd69a1ae4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoBase.java @@ -41,10 +41,7 @@ * @author Harold Carr */ @Transport -public abstract class ContactInfoBase - implements - ContactInfo -{ +public abstract class ContactInfoBase implements ContactInfo { protected ORB orb; protected ContactInfoList contactInfoList; // NOTE: This may be different from same named one in CorbaContactInfoList. @@ -52,61 +49,42 @@ public abstract class ContactInfoBase protected short addressingDisposition; protected OutboundConnectionCache connectionCache; - public ORB getBroker() - { + public ORB getBroker() { return orb; } - public ContactInfoList getContactInfoList() - { + public ContactInfoList getContactInfoList() { return contactInfoList; } - public ClientRequestDispatcher getClientRequestDispatcher() - { - int scid = - getEffectiveProfile().getObjectKeyTemplate().getSubcontractId() ; - RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ; - return scr.getClientRequestDispatcher( scid ) ; + public ClientRequestDispatcher getClientRequestDispatcher() { + int scid = getEffectiveProfile().getObjectKeyTemplate().getSubcontractId(); + RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry(); + return scr.getClientRequestDispatcher(scid); } // Note: not all derived classes will use a connection cache. // These are convenience methods that may not be used. - public void setConnectionCache(OutboundConnectionCache connectionCache) - { + public void setConnectionCache(OutboundConnectionCache connectionCache) { this.connectionCache = connectionCache; } - public OutboundConnectionCache getConnectionCache() - { + public OutboundConnectionCache getConnectionCache() { return connectionCache; } - // Called when client making an invocation. + // Called when client making an invocation. @Transport - public MessageMediator createMessageMediator(ORB broker, - ContactInfo contactInfo, - Connection connection, - String methodName, - boolean isOneWay) - { + public MessageMediator createMessageMediator(ORB broker, ContactInfo contactInfo, Connection connection, String methodName, + boolean isOneWay) { // REVISIT: Would like version, ior, requestid, etc., decisions - // to be in client subcontract. Cannot pass these to this + // to be in client subcontract. Cannot pass these to this // factory method because it breaks generic abstraction. // Maybe set methods on mediator called from subcontract // after creation? - MessageMediator messageMediator = - new MessageMediatorImpl( - (ORB) broker, - (ContactInfo)contactInfo, - connection, - GIOPVersion.chooseRequestVersion( (ORB)broker, - effectiveTargetIOR), - effectiveTargetIOR, - ((Connection)connection).getNextRequestId(), - getAddressingDisposition(), - methodName, - isOneWay); + MessageMediator messageMediator = new MessageMediatorImpl((ORB) broker, (ContactInfo) contactInfo, connection, + GIOPVersion.chooseRequestVersion((ORB) broker, effectiveTargetIOR), effectiveTargetIOR, + ((Connection) connection).getNextRequestId(), getAddressingDisposition(), methodName, isOneWay); return messageMediator; } @@ -114,10 +92,8 @@ public MessageMediator createMessageMediator(ORB broker, @Transport public CDROutputObject createOutputObject(MessageMediator messageMediator) { - CDROutputObject outputObject = - OutputStreamFactory.newCDROutputObject(orb, messageMediator, - messageMediator.getRequestHeader(), - messageMediator.getStreamFormatVersion()); + CDROutputObject outputObject = OutputStreamFactory.newCDROutputObject(orb, messageMediator, messageMediator.getRequestHeader(), + messageMediator.getStreamFormatVersion()); messageMediator.setOutputObject(outputObject); return outputObject; @@ -138,11 +114,11 @@ public void setAddressingDisposition(short addressingDisposition) { // REVISIT - remove this. public IOR getTargetIOR() { - return contactInfoList.getTargetIOR(); + return contactInfoList.getTargetIOR(); } public IOR getEffectiveTargetIOR() { - return effectiveTargetIOR ; + return effectiveTargetIOR; } public IIOPProfile getEffectiveProfile() { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoImpl.java index 5286d38b2..72dff7b6b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoImpl.java @@ -21,7 +21,7 @@ import com.sun.corba.ee.spi.transport.Connection; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.transport.ContactInfoList; import com.sun.corba.ee.spi.transport.TransportManager; @@ -33,81 +33,55 @@ /** * @author Harold Carr */ -public class ContactInfoImpl - extends ContactInfoBase - implements SocketInfo -{ +public class ContactInfoImpl extends ContactInfoBase implements SocketInfo { protected boolean isHashCodeCached = false; protected int cachedHashCode; protected String socketType; protected String hostname; - protected int port; + protected int port; - // XREVISIT + // XREVISIT // See SocketOrChannelAcceptorImpl.createMessageMediator // See SocketFactoryContactInfoImpl.constructor() // See SocketOrChannelContactInfoImpl.constructor() - protected ContactInfoImpl() - { + protected ContactInfoImpl() { } - protected ContactInfoImpl( - ORB orb, - ContactInfoList contactInfoList) - { + protected ContactInfoImpl(ORB orb, ContactInfoList contactInfoList) { this.orb = orb; this.contactInfoList = contactInfoList; } - public ContactInfoImpl( - ORB orb, - ContactInfoList contactInfoList, - String socketType, - String hostname, - int port) - { + public ContactInfoImpl(ORB orb, ContactInfoList contactInfoList, String socketType, String hostname, int port) { this(orb, contactInfoList); this.socketType = socketType; this.hostname = hostname; - this.port = port; + this.port = port; } // XREVISIT - public ContactInfoImpl( - ORB orb, - ContactInfoList contactInfoList, - IOR effectiveTargetIOR, - short addressingDisposition, - String socketType, - String hostname, - int port) - { + public ContactInfoImpl(ORB orb, ContactInfoList contactInfoList, IOR effectiveTargetIOR, short addressingDisposition, String socketType, + String hostname, int port) { this(orb, contactInfoList, socketType, hostname, port); this.effectiveTargetIOR = effectiveTargetIOR; this.addressingDisposition = addressingDisposition; } - public boolean isConnectionBased() - { + public boolean isConnectionBased() { return true; } - public boolean shouldCacheConnection() - { + public boolean shouldCacheConnection() { return true; } - public String getConnectionCacheType() - { + public String getConnectionCacheType() { return TransportManager.SOCKET_OR_CHANNEL_CONNECTION_CACHE; } - public Connection createConnection() - { - Connection connection = - new ConnectionImpl(orb, this, - socketType, hostname, port); + public Connection createConnection() { + Connection connection = new ConnectionImpl(orb, this, socketType, hostname, port); return connection; } @@ -116,23 +90,19 @@ public Connection createConnection() // spi.transport.CorbaContactInfo // - public String getMonitoringName() - { + public String getMonitoringName() { return "SocketConnections"; } - public String getType() - { + public String getType() { return socketType; } - public String getHost() - { + public String getHost() { return hostname; } - public int getPort() - { + public int getPort() { return port; } @@ -142,13 +112,12 @@ public int getPort() // // NOTE: hashCode should only check type/host/port, otherwise - // RMI-IIOP Failover will break. See IIOPPrimaryToContactInfoImpl.java + // RMI-IIOP Failover will break. See IIOPPrimaryToContactInfoImpl.java // in the app server or in the Corba unit tests. - + @Override - public int hashCode() - { - if (! isHashCodeCached) { + public int hashCode() { + if (!isHashCodeCached) { cachedHashCode = socketType.hashCode() ^ hostname.hashCode() ^ port; isHashCodeCached = true; } @@ -156,20 +125,18 @@ public int hashCode() } // NOTE: equals should only check type/host/port, otherwise - // RMI-IIOP Failover will break. See IIOPPrimaryToContactInfoImpl.java + // RMI-IIOP Failover will break. See IIOPPrimaryToContactInfoImpl.java // in the app server or in the Corba unit tests. - + @Override - public boolean equals(Object obj) - { + public boolean equals(Object obj) { if (obj == null) { return false; } else if (!(obj instanceof ContactInfoImpl)) { return false; } - ContactInfoImpl other = - (ContactInfoImpl) obj; + ContactInfoImpl other = (ContactInfoImpl) obj; if (port != other.port) { return false; @@ -187,14 +154,8 @@ public boolean equals(Object obj) return true; } - public String toString() - { - return - "SocketOrChannelContactInfoImpl[" - + socketType + " " - + hostname + " " - + port - + "]"; + public String toString() { + return "SocketOrChannelContactInfoImpl[" + socketType + " " + hostname + " " + port + "]"; } //////////////////////////////////////////////////// @@ -202,8 +163,7 @@ public String toString() // Implementation // - protected void dprint(String msg) - { + protected void dprint(String msg) { ORBUtility.dprint("SocketOrChannelContactInfoImpl", msg); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoListImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoListImpl.java index 1178ef8b6..a14443a87 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoListImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoListImpl.java @@ -23,21 +23,21 @@ import java.util.Iterator; import java.util.List; import java.util.LinkedList; -import java.util.concurrent.locks.ReentrantReadWriteLock ; -import java.util.concurrent.locks.ReadWriteLock ; - -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfile ; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.ee.spi.ior.iiop.LoadBalancingComponent ; -import com.sun.corba.ee.spi.ior.TaggedProfile ; -import com.sun.corba.ee.spi.ior.TaggedProfileTemplate ; -import com.sun.corba.ee.spi.ior.TaggedComponent ; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.concurrent.locks.ReadWriteLock; + +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfile; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; +import com.sun.corba.ee.spi.ior.iiop.LoadBalancingComponent; +import com.sun.corba.ee.spi.ior.TaggedProfile; +import com.sun.corba.ee.spi.ior.TaggedProfileTemplate; +import com.sun.corba.ee.spi.ior.TaggedComponent; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher; import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory; -import com.sun.corba.ee.spi.transport.ContactInfoList ; +import com.sun.corba.ee.spi.transport.ContactInfoList; import com.sun.corba.ee.spi.transport.SocketInfo; import com.sun.corba.ee.spi.transport.ContactInfo; @@ -46,7 +46,7 @@ import com.sun.corba.ee.spi.trace.IsLocal; import com.sun.corba.ee.spi.trace.Transport; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; import org.glassfish.pfl.basic.func.UnaryPredicate; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @@ -56,135 +56,127 @@ @Transport @IsLocal public class ContactInfoListImpl implements ContactInfoList { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; protected ORB orb; - private ReadWriteLock lcrdLock = new ReentrantReadWriteLock() ; + private ReadWriteLock lcrdLock = new ReentrantReadWriteLock(); protected LocalClientRequestDispatcher localClientRequestDispatcher; protected IOR targetIOR; protected IOR effectiveTargetIOR; protected List effectiveTargetIORContactInfoList; protected ContactInfo primaryContactInfo; - private boolean usePerRequestLoadBalancing = false ; + private boolean usePerRequestLoadBalancing = false; - private int startCount = 0 ; + private int startCount = 0; - private UnaryPredicate testPred = - new UnaryPredicate() { - public boolean evaluate( ContactInfo arg ) { - return !arg.getType().equals( SocketInfo.IIOP_CLEAR_TEXT ) ; - } - } ; + private UnaryPredicate testPred = new UnaryPredicate() { + public boolean evaluate(ContactInfo arg) { + return !arg.getType().equals(SocketInfo.IIOP_CLEAR_TEXT); + } + }; - private List filter( List arg, UnaryPredicate pred ) { - List result = new ArrayList() ; - for (T elem : arg ) { - if (pred.evaluate( elem )) { - result.add( elem ) ; + private List filter(List arg, UnaryPredicate pred) { + List result = new ArrayList(); + for (T elem : arg) { + if (pred.evaluate(elem)) { + result.add(elem); } } - return result ; + return result; } private static ThreadLocal skipRotate = new ThreadLocal() { @Override protected Boolean initialValue() { - return false ; + return false; } - } ; + }; // This is an ugly hack to avoid rotating the iterator when the // ClientGroupManager decides to update the iterator, which is only - // supposed to happen when the cluster shape changes. Unfortunately it + // supposed to happen when the cluster shape changes. Unfortunately it // is happening on EVERY REQUEST, at least in the Argela test. public static void setSkipRotate() { - skipRotate.set( true ) ; + skipRotate.set(true); } @InfoMethod - private void display( String msg, int value ) { } + private void display(String msg, int value) { + } @InfoMethod - private void display( String msg, Object value ) { } + private void display(String msg, Object value) { + } // Move the first startCount elements of the list to the end, so that // the list starts at the startCount'th element and continues - // through all elements. Each time we rotate, increment + // through all elements. Each time we rotate, increment // startCount for load balancing. @Transport - private synchronized List rotate( List arg ) { + private synchronized List rotate(List arg) { if (skipRotate.get()) { - skipRotate.set( false ) ; - return arg ; + skipRotate.set(false); + return arg; } if (usePerRequestLoadBalancing) { - display( "startCount", startCount ) ; - LinkedList tempList = null ; + display("startCount", startCount); + LinkedList tempList = null; // This may be the best way to support PRLB for now. // The GIS will return types like "iiop-listener-1", but we also get - // IIOP_CLEAR_TEXT for some, for both SSL and non-SSL ports. Invoking + // IIOP_CLEAR_TEXT for some, for both SSL and non-SSL ports. Invoking // clear on an SSL port leads to bad failures that are not retryable. - tempList = new LinkedList( filter( arg, testPred ) ) ; + tempList = new LinkedList(filter(arg, testPred)); // Really should just be this: // tempList = new LinkedList( arg ) ; if (startCount >= tempList.size()) { - startCount = 0 ; + startCount = 0; } - for (int ctr=0; ctr iterator() - { + + public synchronized Iterator iterator() { createContactInfoList(); - Iterator result = new ContactInfoListIteratorImpl( - orb, this, primaryContactInfo, - rotate( effectiveTargetIORContactInfoList ), - usePerRequestLoadBalancing ); + Iterator result = new ContactInfoListIteratorImpl(orb, this, primaryContactInfo, + rotate(effectiveTargetIORContactInfoList), usePerRequestLoadBalancing); - /* This doesn't work due to some strange behavior in FOLB: we are getting far - * too many IOR updates. Updates are received even when the cluster shape has not changed. + /* + * This doesn't work due to some strange behavior in FOLB: we are getting far too many IOR updates. Updates are received + * even when the cluster shape has not changed. */ /* - if (usePerRequestLoadBalancing) { - // Copy the list, otherwise we will get a ConcurrentModificationException as - // soon as next() is called on the iterator. - List newList = new ArrayList( effectiveTargetIORContactInfoList ) ; - CorbaContactInfo head = newList.remove(0) ; - newList.add( head ) ; - effectiveTargetIORContactInfoList = newList ; - } - */ + * if (usePerRequestLoadBalancing) { // Copy the list, otherwise we will get a ConcurrentModificationException as // + * soon as next() is called on the iterator. List newList = new ArrayList( + * effectiveTargetIORContactInfoList ) ; CorbaContactInfo head = newList.remove(0) ; newList.add( head ) ; + * effectiveTargetIORContactInfoList = newList ; } + */ - return result ; + return result; } //////////////////////////////////////////////////// @@ -192,94 +184,84 @@ public synchronized Iterator iterator() // spi.transport.CorbaContactInfoList // - public synchronized void setTargetIOR(IOR targetIOR) - { + public synchronized void setTargetIOR(IOR targetIOR) { this.targetIOR = targetIOR; setEffectiveTargetIOR(targetIOR); } - public synchronized IOR getTargetIOR() - { + public synchronized IOR getTargetIOR() { return targetIOR; } - - private IIOPAddress getPrimaryAddress( IOR ior ) { + + private IIOPAddress getPrimaryAddress(IOR ior) { if (ior != null) { for (TaggedProfile tprof : ior) { - TaggedProfileTemplate tpt = tprof.getTaggedProfileTemplate() ; + TaggedProfileTemplate tpt = tprof.getTaggedProfileTemplate(); if (tpt instanceof IIOPProfileTemplate) { - IIOPProfileTemplate ipt = (IIOPProfileTemplate)tpt ; - return ipt.getPrimaryAddress() ; + IIOPProfileTemplate ipt = (IIOPProfileTemplate) tpt; + return ipt.getPrimaryAddress(); } } } - return null ; + return null; } @InfoMethod - private void changingEffectiveAddress( IIOPAddress oldAddr, IIOPAddress newAddr ) { } + private void changingEffectiveAddress(IIOPAddress oldAddr, IIOPAddress newAddr) { + } @Transport - public synchronized void setEffectiveTargetIOR(IOR newIOR) - { + public synchronized void setEffectiveTargetIOR(IOR newIOR) { if (targetIOR != null) { - final String oldTypeId = targetIOR.getTypeId() ; - final String newTypeId = newIOR.getTypeId() ; - if (!oldTypeId.isEmpty() && !oldTypeId.equals( newTypeId )) { - // Good place for a breakpoint. This is probably always an + final String oldTypeId = targetIOR.getTypeId(); + final String newTypeId = newIOR.getTypeId(); + if (!oldTypeId.isEmpty() && !oldTypeId.equals(newTypeId)) { + // Good place for a breakpoint. This is probably always an // error, but not necessarily in the ORB. - wrapper.changedTypeIdOnSetEffectiveTargetIOR( oldTypeId, - newTypeId ) ; - // temporary? It looks like this happens due to some error + wrapper.changedTypeIdOnSetEffectiveTargetIOR(oldTypeId, newTypeId); + // temporary? It looks like this happens due to some error // in IIOP FOLB. - return ; + return; } } - final IIOPAddress oldAddress = getPrimaryAddress( this.effectiveTargetIOR ) ; - final IIOPAddress newAddress = getPrimaryAddress( newIOR ) ; - if ((oldAddress != null) && !oldAddress.equals( newAddress )) { - changingEffectiveAddress( oldAddress, newAddress ) ; + final IIOPAddress oldAddress = getPrimaryAddress(this.effectiveTargetIOR); + final IIOPAddress newAddress = getPrimaryAddress(newIOR); + if ((oldAddress != null) && !oldAddress.equals(newAddress)) { + changingEffectiveAddress(oldAddress, newAddress); } this.effectiveTargetIOR = newIOR; effectiveTargetIORContactInfoList = null; - if (primaryContactInfo != null && - orb.getORBData().getIIOPPrimaryToContactInfo() != null) - { - orb.getORBData().getIIOPPrimaryToContactInfo() - .reset(primaryContactInfo); + if (primaryContactInfo != null && orb.getORBData().getIIOPPrimaryToContactInfo() != null) { + orb.getORBData().getIIOPPrimaryToContactInfo().reset(primaryContactInfo); } primaryContactInfo = null; setLocalSubcontract(); // Set the per request load balancing flag. - IIOPProfile prof = newIOR.getProfile() ; - TaggedProfileTemplate temp = prof.getTaggedProfileTemplate() ; - Iterator lbcomps = - temp.iteratorById( ORBConstants.TAG_LOAD_BALANCING_ID ) ; + IIOPProfile prof = newIOR.getProfile(); + TaggedProfileTemplate temp = prof.getTaggedProfileTemplate(); + Iterator lbcomps = temp.iteratorById(ORBConstants.TAG_LOAD_BALANCING_ID); if (lbcomps.hasNext()) { - LoadBalancingComponent lbcomp = null ; - lbcomp = (LoadBalancingComponent)(lbcomps.next()) ; - usePerRequestLoadBalancing = - lbcomp.getLoadBalancingValue() == ORBConstants.PER_REQUEST_LOAD_BALANCING ; + LoadBalancingComponent lbcomp = null; + lbcomp = (LoadBalancingComponent) (lbcomps.next()); + usePerRequestLoadBalancing = lbcomp.getLoadBalancingValue() == ORBConstants.PER_REQUEST_LOAD_BALANCING; } } - public synchronized IOR getEffectiveTargetIOR() - { + public synchronized IOR getEffectiveTargetIOR() { return effectiveTargetIOR; } - public synchronized LocalClientRequestDispatcher getLocalClientRequestDispatcher() - { - lcrdLock.readLock().lock() ; + public synchronized LocalClientRequestDispatcher getLocalClientRequestDispatcher() { + lcrdLock.readLock().lock(); try { return localClientRequestDispatcher; } finally { - lcrdLock.readLock().unlock() ; + lcrdLock.readLock().unlock(); } } @@ -296,8 +278,7 @@ public synchronized LocalClientRequestDispatcher getLocalClientRequestDispatcher // @Override - public synchronized int hashCode() - { + public synchronized int hashCode() { return targetIOR.hashCode(); } @@ -310,8 +291,7 @@ public boolean equals(Object obj) { return false; } final ContactInfoListImpl other = (ContactInfoListImpl) obj; - if (this.targetIOR != other.targetIOR && - (this.targetIOR == null || !this.targetIOR.equals(other.targetIOR))) { + if (this.targetIOR != other.targetIOR && (this.targetIOR == null || !this.targetIOR.equals(other.targetIOR))) { return false; } return true; @@ -325,7 +305,7 @@ public boolean equals(Object obj) { @Transport private void createContactInfoList() { IIOPProfile iiopProfile = effectiveTargetIOR.getProfile(); - final boolean isLocal = iiopProfile.isLocal() ; + final boolean isLocal = iiopProfile.isLocal(); if (effectiveTargetIORContactInfoList == null) { effectiveTargetIORContactInfoList = new ArrayList<>(); @@ -336,82 +316,69 @@ private void createContactInfoList() { if (isLocal) { // NOTE: IMPORTANT: - // Only do local. The APP Server interceptors check + // Only do local. The APP Server interceptors check // effectiveTarget.isLocal - which is determined via // the IOR - so if we added other addresses then // transactions and interceptors would not execute. - ContactInfo contactInfo = new SharedCDRContactInfoImpl( - orb, this, effectiveTargetIOR, - orb.getORBData().getGIOPAddressDisposition()); + ContactInfo contactInfo = new SharedCDRContactInfoImpl(orb, this, effectiveTargetIOR, + orb.getORBData().getGIOPAddressDisposition()); effectiveTargetIORContactInfoList.add(contactInfo); } else { - addRemoteContactInfos(effectiveTargetIOR, - effectiveTargetIORContactInfoList); + addRemoteContactInfos(effectiveTargetIOR, effectiveTargetIORContactInfoList); } - display( "First time for iiopProfile", iiopProfile ) ; + display("First time for iiopProfile", iiopProfile); } else { if (!isLocal) { - display( "Subsequent time for iiopProfile", iiopProfile ) ; + display("Subsequent time for iiopProfile", iiopProfile); // 6152681 - this is so SSL can change its selection on each // invocation - addRemoteContactInfos(effectiveTargetIOR, - effectiveTargetIORContactInfoList); + addRemoteContactInfos(effectiveTargetIOR, effectiveTargetIORContactInfoList); } else { - display( "Subsequent time for (colocated) iiopProfile", - iiopProfile ) ; + display("Subsequent time for (colocated) iiopProfile", iiopProfile); } } - display( "effective list", effectiveTargetIORContactInfoList ) ; + display("effective list", effectiveTargetIORContactInfoList); } @Transport - private void addRemoteContactInfos( IOR effectiveTargetIOR, - List effectiveTargetIORContactInfoList) { + private void addRemoteContactInfos(IOR effectiveTargetIOR, List effectiveTargetIORContactInfoList) { ContactInfo contactInfo; - List socketInfos = orb.getORBData() - .getIORToSocketInfo().getSocketInfo( - effectiveTargetIOR, + List socketInfos = orb.getORBData().getIORToSocketInfo().getSocketInfo(effectiveTargetIOR, // 6152681 effectiveTargetIORContactInfoList); if (socketInfos == effectiveTargetIORContactInfoList) { - display( "socketInfos", socketInfos ) ; + display("socketInfos", socketInfos); return; } for (SocketInfo socketInfo : socketInfos) { String type = socketInfo.getType(); String host = socketInfo.getHost().toLowerCase(); - int port = socketInfo.getPort(); + int port = socketInfo.getPort(); contactInfo = createContactInfo(type, host, port); effectiveTargetIORContactInfoList.add(contactInfo); } } - protected ContactInfo createContactInfo(String type, String hostname, - int port) { + protected ContactInfo createContactInfo(String type, String hostname, int port) { - return new ContactInfoImpl( - orb, this, - // XREVISIT - See Base Line 62 - effectiveTargetIOR, - orb.getORBData().getGIOPAddressDisposition(), - type, hostname, port); + return new ContactInfoImpl(orb, this, + // XREVISIT - See Base Line 62 + effectiveTargetIOR, orb.getORBData().getGIOPAddressDisposition(), type, hostname, port); } /** - * setLocalSubcontract sets cached information that is set whenever - * the effectiveTargetIOR changes. + * setLocalSubcontract sets cached information that is set whenever the effectiveTargetIOR changes. * - * Note: this must be maintained accurately whether or not the ORB - * allows local optimization, because ServantManagers in the POA - * ALWAYS use local optimization ONLY (they do not have a remote case). + * Note: this must be maintained accurately whether or not the ORB allows local optimization, because ServantManagers in + * the POA ALWAYS use local optimization ONLY (they do not have a remote case). */ @IsLocal protected void setLocalSubcontract() { - lcrdLock.writeLock().lock() ; + lcrdLock.writeLock().lock(); try { if (!effectiveTargetIOR.getProfile().isLocal()) { localClientRequestDispatcher = new NotLocalLocalCRDImpl(); @@ -419,16 +386,13 @@ protected void setLocalSubcontract() { } // Note that we have no plan to support multi-profile IORs. - int scid = effectiveTargetIOR.getProfile().getObjectKeyTemplate(). - getSubcontractId() ; - LocalClientRequestDispatcherFactory lcsf = - orb.getRequestDispatcherRegistry(). - getLocalClientRequestDispatcherFactory( scid ) ; + int scid = effectiveTargetIOR.getProfile().getObjectKeyTemplate().getSubcontractId(); + LocalClientRequestDispatcherFactory lcsf = orb.getRequestDispatcherRegistry().getLocalClientRequestDispatcherFactory(scid); if (lcsf != null) { - localClientRequestDispatcher = lcsf.create( scid, effectiveTargetIOR ) ; + localClientRequestDispatcher = lcsf.create(scid, effectiveTargetIOR); } } finally { - lcrdLock.writeLock().unlock() ; + lcrdLock.writeLock().unlock(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoListIteratorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoListIteratorImpl.java index 0c38870bb..28214f4ab 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoListIteratorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ContactInfoListIteratorImpl.java @@ -21,16 +21,16 @@ import java.util.Iterator; import java.util.List; -import java.util.Set ; -import java.util.HashSet ; +import java.util.Set; +import java.util.HashSet; import org.omg.CORBA.COMM_FAILURE; import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.SystemException; import org.omg.CORBA.TRANSIENT; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.transport.TcpTimeouts; import com.sun.corba.ee.spi.transport.ContactInfo; import com.sun.corba.ee.spi.transport.ContactInfoList; @@ -46,18 +46,14 @@ // REVISIT: create a unit test for this class. @Transport -public class ContactInfoListIteratorImpl - implements - ContactInfoListIterator -{ - protected static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class ContactInfoListIteratorImpl implements ContactInfoListIterator { + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; protected ORB orb; protected ContactInfoList contactInfoList; protected RuntimeException failureException; - private boolean usePRLB ; - protected TcpTimeouts tcpTimeouts ; + private boolean usePRLB; + protected TcpTimeouts tcpTimeouts; // ITERATOR state protected Iterator effectiveTargetIORIterator; @@ -67,28 +63,23 @@ public class ContactInfoListIteratorImpl protected IIOPPrimaryToContactInfo primaryToContactInfo; protected ContactInfo primaryContactInfo; protected List listOfContactInfos; - protected TcpTimeouts.Waiter waiter ; + protected TcpTimeouts.Waiter waiter; // Set of endpoints that have failed since the last successful communication // with the IOR. - protected Set failedEndpoints ; + protected Set failedEndpoints; // End ITERATOR state - public ContactInfoListIteratorImpl( - ORB orb, - ContactInfoList corbaContactInfoList, - ContactInfo primaryContactInfo, - List listOfContactInfos, - boolean usePerRequestLoadBalancing ) - { + public ContactInfoListIteratorImpl(ORB orb, ContactInfoList corbaContactInfoList, ContactInfo primaryContactInfo, + List listOfContactInfos, boolean usePerRequestLoadBalancing) { this.orb = orb; - this.tcpTimeouts = orb.getORBData().getTransportTcpConnectTimeouts() ; + this.tcpTimeouts = orb.getORBData().getTransportTcpConnectTimeouts(); this.contactInfoList = corbaContactInfoList; this.primaryContactInfo = primaryContactInfo; if (listOfContactInfos != null) { // listOfContactInfos is null when used by the legacy - // socket factory. In that case this iterator is NOT used. - - this.effectiveTargetIORIterator = listOfContactInfos.iterator() ; + // socket factory. In that case this iterator is NOT used. + + this.effectiveTargetIORIterator = listOfContactInfos.iterator(); } // List is immutable so no need to synchronize access. this.listOfContactInfos = listOfContactInfos; @@ -99,27 +90,30 @@ public ContactInfoListIteratorImpl( this.failureException = null; - this.waiter = tcpTimeouts.waiter() ; - this.failedEndpoints = new HashSet() ; + this.waiter = tcpTimeouts.waiter(); + this.failedEndpoints = new HashSet(); - this.usePRLB = usePerRequestLoadBalancing ; + this.usePRLB = usePerRequestLoadBalancing; if (usePerRequestLoadBalancing) { // We certainly DON'T want sticky behavior if we are using PRLB. - primaryToContactInfo = null ; + primaryToContactInfo = null; } else { primaryToContactInfo = orb.getORBData().getIIOPPrimaryToContactInfo(); } } @InfoMethod - private void display( String msg ) { } + private void display(String msg) { + } @InfoMethod - private void display( String msg, Object value ) { } + private void display(String msg, Object value) { + } @InfoMethod - private void display( String msg, long value ) { } + private void display(String msg, long value) { + } //////////////////////////////////////////////////// // @@ -133,18 +127,16 @@ public boolean hasNext() { display("backoff before retry previous"); if (waiter.isExpired()) { - display("time to wait for connection exceeded " , - tcpTimeouts.get_max_time_to_wait()); - + display("time to wait for connection exceeded ", tcpTimeouts.get_max_time_to_wait()); + // NOTE: Need to indicate the timeout. // And it needs to break the loop in the delegate. - failureException = wrapper.communicationsRetryTimeout( - failureException, tcpTimeouts.get_max_time_to_wait()); + failureException = wrapper.communicationsRetryTimeout(failureException, tcpTimeouts.get_max_time_to_wait()); return false; } - waiter.sleepTime() ; - waiter.advance() ; + waiter.sleepTime(); + waiter.advance(); return true; } @@ -153,8 +145,7 @@ public boolean hasNext() { } if (primaryToContactInfo != null) { - result = primaryToContactInfo.hasNext( primaryContactInfo, - previousContactInfo, listOfContactInfos); + result = primaryToContactInfo.hasNext(primaryContactInfo, previousContactInfo, listOfContactInfos); } else { result = effectiveTargetIORIterator.hasNext(); } @@ -167,7 +158,7 @@ public boolean hasNext() { primaryToContactInfo.reset(primaryContactInfo); } else { // Argela: - effectiveTargetIORIterator = listOfContactInfos.iterator() ; + effectiveTargetIORIterator = listOfContactInfos.iterator(); } result = hasNext(); @@ -190,15 +181,12 @@ public ContactInfo next() { } // We hold onto the last in case we get an addressing - // disposition retry. Then we use it again. + // disposition retry. Then we use it again. // We also hold onto it for the sticky manager. if (primaryToContactInfo != null) { - previousContactInfo = (ContactInfo) - primaryToContactInfo.next(primaryContactInfo, - previousContactInfo, - listOfContactInfos); + previousContactInfo = (ContactInfo) primaryToContactInfo.next(primaryContactInfo, previousContactInfo, listOfContactInfos); } else { previousContactInfo = effectiveTargetIORIterator.next(); } @@ -207,45 +195,40 @@ public ContactInfo next() { // there is a IIOPPrimaryToContactInfo or not. // Failure to do this resulted in bug 6568174. if (failedEndpoints.contains(previousContactInfo)) { - failedEndpoints.clear() ; - waiter.sleepTime() ; - waiter.advance() ; + failedEndpoints.clear(); + waiter.sleepTime(); + waiter.advance(); } return previousContactInfo; } - public void remove() - { + public void remove() { throw new UnsupportedOperationException(); } - public ContactInfoList getContactInfoList() - { + public ContactInfoList getContactInfoList() { return contactInfoList; } @Transport - public void reportSuccess(ContactInfo contactInfo) - { - display( "contactInfo", contactInfo) ; - failedEndpoints.clear() ; - waiter.reset() ; // not strictly necessary + public void reportSuccess(ContactInfo contactInfo) { + display("contactInfo", contactInfo); + failedEndpoints.clear(); + waiter.reset(); // not strictly necessary } @Transport - public boolean reportException(ContactInfo contactInfo, - RuntimeException ex) { + public boolean reportException(ContactInfo contactInfo, RuntimeException ex) { boolean result = false; - display( "contactInfo", contactInfo) ; + display("contactInfo", contactInfo); - failedEndpoints.add( contactInfo ) ; + failedEndpoints.add(contactInfo); this.failureException = ex; if (ex instanceof COMM_FAILURE) { SystemException se = (SystemException) ex; if (se.minor == ORBUtilSystemException.CONNECTION_REBIND) { - display( "COMM_FAILURE(connection rebind): " - + "retry with previous contact info", ex ) ; + display("COMM_FAILURE(connection rebind): " + "retry with previous contact info", ex); retryWithPreviousContactInfo = true; result = true; @@ -253,16 +236,12 @@ public boolean reportException(ContactInfo contactInfo, } else { if (se.completed == CompletionStatus.COMPLETED_NO) { if (hasNext()) { - display( "COMM_FAILURE(COMPLETED_NO, hasNext true): " - + "retry with next contact info", ex ) ; + display("COMM_FAILURE(COMPLETED_NO, hasNext true): " + "retry with next contact info", ex); result = true; return result; } - if (contactInfoList.getEffectiveTargetIOR() != - contactInfoList.getTargetIOR()) { - display( "COMM_FAILURE(COMPLETED_NO, hasNext false, " + - "effective != target): " - + "retry with target", ex ) ; + if (contactInfoList.getEffectiveTargetIOR() != contactInfoList.getTargetIOR()) { + display("COMM_FAILURE(COMPLETED_NO, hasNext false, " + "effective != target): " + "retry with target", ex); // retry from root ior updateEffectiveTargetIOR(contactInfoList.getTargetIOR()); @@ -272,20 +251,19 @@ public boolean reportException(ContactInfo contactInfo, } } } else if (ex instanceof TRANSIENT) { - display( "TRANSIENT: retry with previous contact info", ex ) ; + display("TRANSIENT: retry with previous contact info", ex); retryWithPreviousContactInfo = true; result = true; return result; } result = false; - waiter.reset() ; // not strictly necessary. + waiter.reset(); // not strictly necessary. return result; } - public RuntimeException getFailureException() - { + public RuntimeException getFailureException() { if (failureException == null) { - return wrapper.invalidContactInfoListIteratorFailureException() ; + return wrapper.invalidContactInfoListIteratorFailureException(); } else { return failureException; } @@ -297,20 +275,16 @@ public RuntimeException getFailureException() // @Transport - public void reportAddrDispositionRetry(ContactInfo contactInfo, - short disposition) - { + public void reportAddrDispositionRetry(ContactInfo contactInfo, short disposition) { previousContactInfo.setAddressingDisposition(disposition); isAddrDispositionRetry = true; - waiter.reset() ; // necessary + waiter.reset(); // necessary } @Transport - public void reportRedirect(ContactInfo contactInfo, - IOR forwardedIOR) - { + public void reportRedirect(ContactInfo contactInfo, IOR forwardedIOR) { updateEffectiveTargetIOR(forwardedIOR); - waiter.reset() ; // Necessary + waiter.reset(); // Necessary } //////////////////////////////////////////////////// @@ -318,29 +292,28 @@ public void reportRedirect(ContactInfo contactInfo, // Implementation. // - // + // // REVISIT: - // + // // The normal operation for a standard iterator is to throw // ConcurrentModificationException whenever the underlying collection - // changes. This is implemented by keeping a modification counter (the + // changes. This is implemented by keeping a modification counter (the // timestamp may fail because the granularity is too coarse). // Essentially what you need to do is whenever the iterator fails this // way, go back to ContactInfoList and get a new iterator. // - // Need to update CorbaClientRequestDispatchImpl to catch and use + // Need to update CorbaClientRequestDispatchImpl to catch and use // that exception. // - public void updateEffectiveTargetIOR(IOR newIOR) - { + public void updateEffectiveTargetIOR(IOR newIOR) { contactInfoList.setEffectiveTargetIOR(newIOR); // If we report the exception in _request (i.e., beginRequest // we cannot throw RemarshalException to the stub because _request // does not declare that exception. // To keep the two-level dispatching (first level chooses ContactInfo, // second level is specific to that ContactInfo/EPT) we need to - // ensure that the request dispatchers get their iterator from the + // ensure that the request dispatchers get their iterator from the // InvocationStack (i.e., ThreadLocal). That way if the list iterator // needs a complete update it happens right here. @@ -349,10 +322,9 @@ public void updateEffectiveTargetIOR(IOR newIOR) // // Remove this hack once we figure out why we get all of the // membership changes when the cluster shape does not change. - ContactInfoListImpl.setSkipRotate() ; + ContactInfoListImpl.setSkipRotate(); - ((InvocationInfo)orb.getInvocationInfo()) - .setContactInfoListIterator(contactInfoList.iterator()); + ((InvocationInfo) orb.getInvocationInfo()).setContactInfoListIterator(contactInfoList.iterator()); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/DefaultIORToSocketInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/DefaultIORToSocketInfoImpl.java index ef85016ff..e82683197 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/DefaultIORToSocketInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/DefaultIORToSocketInfoImpl.java @@ -23,35 +23,31 @@ import java.util.Iterator; import java.util.List; -import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ; +import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS; import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; import com.sun.corba.ee.spi.ior.iiop.AlternateIIOPAddressComponent; import com.sun.corba.ee.spi.transport.IORToSocketInfo; import com.sun.corba.ee.spi.transport.SocketInfo; -public class DefaultIORToSocketInfoImpl - implements IORToSocketInfo -{ - public List getSocketInfo(IOR ior, - List previous) { +public class DefaultIORToSocketInfoImpl implements IORToSocketInfo { + public List getSocketInfo(IOR ior, List previous) { // 6152681 - if (! previous.isEmpty()) { + if (!previous.isEmpty()) { return previous; } SocketInfo socketInfo; List result = new ArrayList(); - IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) - ior.getProfile().getTaggedProfileTemplate() ; - IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress() ; + IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate(); + IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress(); String hostname = primary.getHost().toLowerCase(); - int port = primary.getPort(); - // NOTE: we could check for 0 (i.e., CSIv2) but, for a + int port = primary.getPort(); + // NOTE: we could check for 0 (i.e., CSIv2) but, for a // non-CSIv2-configured client ORB talking to a CSIv2 configured // server ORB you might end up with an empty contact info list // which would then report a failure which would not be as @@ -59,26 +55,32 @@ public List getSocketInfo(IOR ior, socketInfo = createSocketInfo(hostname, port); result.add(socketInfo); - Iterator iterator = iiopProfileTemplate.iteratorById( - TAG_ALTERNATE_IIOP_ADDRESS.value); + Iterator iterator = iiopProfileTemplate.iteratorById(TAG_ALTERNATE_IIOP_ADDRESS.value); while (iterator.hasNext()) { - AlternateIIOPAddressComponent alternate = - (AlternateIIOPAddressComponent) iterator.next(); + AlternateIIOPAddressComponent alternate = (AlternateIIOPAddressComponent) iterator.next(); hostname = alternate.getAddress().getHost().toLowerCase(); - port = alternate.getAddress().getPort(); - socketInfo= createSocketInfo(hostname, port); + port = alternate.getAddress().getPort(); + socketInfo = createSocketInfo(hostname, port); result.add(socketInfo); } return result; } - private SocketInfo createSocketInfo(final String hostname, final int port) - { + private SocketInfo createSocketInfo(final String hostname, final int port) { return new SocketInfo() { - public String getType() { return SocketInfo.IIOP_CLEAR_TEXT; } - public String getHost() { return hostname; } - public int getPort() { return port; }}; + public String getType() { + return SocketInfo.IIOP_CLEAR_TEXT; + } + + public String getHost() { + return hostname; + } + + public int getPort() { + return port; + } + }; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/DefaultSocketFactoryImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/DefaultSocketFactoryImpl.java index a80f292d7..e8b7777d8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/DefaultSocketFactoryImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/DefaultSocketFactoryImpl.java @@ -35,20 +35,14 @@ import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.impl.misc.ORBUtility; -public class DefaultSocketFactoryImpl - implements ORBSocketFactory -{ +public class DefaultSocketFactoryImpl implements ORBSocketFactory { private ORB orb; - public void setORB(ORB orb) - { + public void setORB(ORB orb) { this.orb = orb; } - public ServerSocket createServerSocket(String type, - InetSocketAddress inetSocketAddress) - throws IOException - { + public ServerSocket createServerSocket(String type, InetSocketAddress inetSocketAddress) throws IOException { ServerSocketChannel serverSocketChannel = null; ServerSocket serverSocket = null; @@ -62,10 +56,7 @@ public ServerSocket createServerSocket(String type, return serverSocket; } - public Socket createSocket(String type, - InetSocketAddress inetSocketAddress) - throws IOException - { + public Socket createSocket(String type, InetSocketAddress inetSocketAddress) throws IOException { SocketChannel socketChannel = null; Socket socket = null; @@ -73,8 +64,7 @@ public Socket createSocket(String type, socketChannel = ORBUtility.openSocketChannel(inetSocketAddress); socket = socketChannel.socket(); } else { - socket = new Socket(inetSocketAddress.getHostName(), - inetSocketAddress.getPort()); + socket = new Socket(inetSocketAddress.getHostName(), inetSocketAddress.getPort()); } // Disable Nagle's algorithm (i.e., always send immediately). @@ -83,11 +73,7 @@ public Socket createSocket(String type, return socket; } - public void setAcceptedSocketOptions(Acceptor acceptor, - ServerSocket serverSocket, - Socket socket) - throws SocketException - { + public void setAcceptedSocketOptions(Acceptor acceptor, ServerSocket serverSocket, Socket socket) throws SocketException { // Disable Nagle's algorithm (i.e., always send immediately). socket.setTcpNoDelay(true); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/EventHandlerBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/EventHandlerBase.java index 88a609368..90eeade39 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/EventHandlerBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/EventHandlerBase.java @@ -33,12 +33,8 @@ import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Transport -public abstract class EventHandlerBase - implements - EventHandler -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public abstract class EventHandlerBase implements EventHandler { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; protected ORB orb; protected Work work; @@ -51,49 +47,42 @@ public abstract class EventHandlerBase // EventHandler methods // - public void setUseSelectThreadToWait(boolean x) - { + public void setUseSelectThreadToWait(boolean x) { useSelectThreadToWait = x; } - public boolean shouldUseSelectThreadToWait() - { + public boolean shouldUseSelectThreadToWait() { return useSelectThreadToWait; } - public void setSelectionKey(SelectionKey selectionKey) - { + public void setSelectionKey(SelectionKey selectionKey) { this.selectionKey = selectionKey; } - public SelectionKey getSelectionKey() - { + public SelectionKey getSelectionKey() { return selectionKey; } @InfoMethod - private void display( String msg ) { } + private void display(String msg) { + } @InfoMethod - private void display( String msg, Object value ) { } + private void display(String msg, Object value) { + } /* - * NOTE: - * This is not thread-safe by design. - * Only one thread should call it - a reader/listener/select thread. - * Not stateless: interest ops, registration. + * NOTE: This is not thread-safe by design. Only one thread should call it - a reader/listener/select thread. Not + * stateless: interest ops, registration. */ @Transport - public void handleEvent() - { - getSelectionKey().interestOps(getSelectionKey().interestOps() & - (~ getInterestOps())); + public void handleEvent() { + getSelectionKey().interestOps(getSelectionKey().interestOps() & (~getInterestOps())); if (shouldUseWorkerThreadForEvent()) { Throwable throwable = null; try { - display( "add work to pool 0") ; - orb.getThreadPoolManager().getThreadPool(0) - .getWorkQueue(0).addWork(getWork()); + display("add work to pool 0"); + orb.getThreadPoolManager().getThreadPool(0).getWorkQueue(0).addWork(getWork()); } catch (NoSuchThreadPoolException e) { throwable = e; } catch (NoSuchWorkQueueException e) { @@ -101,32 +90,28 @@ public void handleEvent() } // REVISIT: need to close connection. if (throwable != null) { - display( "unexpected exception", throwable ) ; + display("unexpected exception", throwable); throw wrapper.noSuchThreadpoolOrQueue(throwable, 0); } } else { - display( "doWork" ) ; + display("doWork"); getWork().doWork(); } } - public boolean shouldUseWorkerThreadForEvent() - { + public boolean shouldUseWorkerThreadForEvent() { return useWorkerThreadForEvent; } - public void setUseWorkerThreadForEvent(boolean x) - { + public void setUseWorkerThreadForEvent(boolean x) { useWorkerThreadForEvent = x; } - public void setWork(Work work) - { + public void setWork(Work work) { this.work = work; } - public Work getWork() - { + public Work getWork() { return work; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/InboundConnectionCacheImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/InboundConnectionCacheImpl.java index 3f67aabed..5bf6a5c98 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/InboundConnectionCacheImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/InboundConnectionCacheImpl.java @@ -29,57 +29,46 @@ import com.sun.corba.ee.spi.trace.Transport; -import org.glassfish.gmbal.ManagedObject ; -import org.glassfish.gmbal.AMXMetadata ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedObject; +import org.glassfish.gmbal.AMXMetadata; +import org.glassfish.gmbal.Description; /** * @author Harold Carr */ @Transport @ManagedObject -@Description( "Cache of connections accepted by the ORB" ) -@AMXMetadata( type="corba-inbound-connection-cache-mon", group="monitoring" ) -public class InboundConnectionCacheImpl - extends - ConnectionCacheBase - implements - InboundConnectionCache -{ +@Description("Cache of connections accepted by the ORB") +@AMXMetadata(type = "corba-inbound-connection-cache-mon", group = "monitoring") +public class InboundConnectionCacheImpl extends ConnectionCacheBase implements InboundConnectionCache { protected Collection connectionCache; - private InboundConnectionCacheProbeProvider pp = - new InboundConnectionCacheProbeProvider() ; + private InboundConnectionCacheProbeProvider pp = new InboundConnectionCacheProbeProvider(); - public InboundConnectionCacheImpl(ORB orb, Acceptor acceptor) - { - super(orb, acceptor.getConnectionCacheType(), - ((Acceptor)acceptor).getMonitoringName()); + public InboundConnectionCacheImpl(ORB orb, Acceptor acceptor) { + super(orb, acceptor.getConnectionCacheType(), ((Acceptor) acceptor).getMonitoringName()); this.connectionCache = new ArrayList(); } - public Connection get(Acceptor acceptor) - { + public Connection get(Acceptor acceptor) { throw wrapper.methodShouldNotBeCalled(); } - + @Transport - public void put(Acceptor acceptor, Connection connection) - { + public void put(Acceptor acceptor, Connection connection) { synchronized (backingStore()) { connectionCache.add(connection); connection.setConnectionCache(this); cacheStatisticsInfo(); - pp.connectionOpenedEvent( acceptor.toString(), connection.toString() ) ; + pp.connectionOpenedEvent(acceptor.toString(), connection.toString()); } } @Transport - public void remove(Connection connection) - { + public void remove(Connection connection) { synchronized (backingStore()) { connectionCache.remove(connection); cacheStatisticsInfo(); - pp.connectionClosedEvent( connection.toString() ) ; + pp.connectionClosedEvent(connection.toString()); } } @@ -88,13 +77,11 @@ public void remove(Connection connection) // Implementation // - public Collection values() - { + public Collection values() { return connectionCache; } - protected Object backingStore() - { + protected Object backingStore() { return connectionCache; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/InboundConnectionCacheProbeProvider.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/InboundConnectionCacheProbeProvider.java index 844577702..fb9dc1cef 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/InboundConnectionCacheProbeProvider.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/InboundConnectionCacheProbeProvider.java @@ -19,27 +19,24 @@ package com.sun.corba.ee.impl.transport; -import org.glassfish.external.probe.provider.annotations.Probe ; -import org.glassfish.external.probe.provider.annotations.ProbeProvider ; -import org.glassfish.external.probe.provider.annotations.ProbeParam ; +import org.glassfish.external.probe.provider.annotations.Probe; +import org.glassfish.external.probe.provider.annotations.ProbeProvider; +import org.glassfish.external.probe.provider.annotations.ProbeParam; -/** This simple class is for the GFv3 probe mechanism. As of - * 9/16/09, gfprobes have the unfortunate requirement that ALL - * methods in the class MUST be probe methods (see issue 9536). - * Otherwise I would put these methods in the CorbaInboundConnectionCacheImpl class. +/** + * This simple class is for the GFv3 probe mechanism. As of 9/16/09, gfprobes have the unfortunate requirement that ALL + * methods in the class MUST be probe methods (see issue 9536). Otherwise I would put these methods in the + * CorbaInboundConnectionCacheImpl class. * - * @author Ken Cavanaugh + * @author Ken Cavanaugh */ -@ProbeProvider(moduleProviderName="glassfish", moduleName="orb" , probeProviderName="inboundconnection") +@ProbeProvider(moduleProviderName = "glassfish", moduleName = "orb", probeProviderName = "inboundconnection") public class InboundConnectionCacheProbeProvider { - @Probe(name="inboundConnectionOpened" ) - public void connectionOpenedEvent( - @ProbeParam( "acceptor" ) String acceptor, - @ProbeParam( "connection" ) String connection ) {} + @Probe(name = "inboundConnectionOpened") + public void connectionOpenedEvent(@ProbeParam("acceptor") String acceptor, @ProbeParam("connection") String connection) { + } - @Probe(name="inboundConnectionClosed" ) - public void connectionClosedEvent( - @ProbeParam( "connection" ) String connection ) {} + @Probe(name = "inboundConnectionClosed") + public void connectionClosedEvent(@ProbeParam("connection") String connection) { + } } - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ListenerThreadImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ListenerThreadImpl.java index fb9703a48..5376f7506 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ListenerThreadImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ListenerThreadImpl.java @@ -19,7 +19,6 @@ package com.sun.corba.ee.impl.transport; - import com.sun.corba.ee.spi.transport.Acceptor; import com.sun.corba.ee.spi.transport.ListenerThread; @@ -31,45 +30,37 @@ import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Transport -public class ListenerThreadImpl - implements - ListenerThread, - Work -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class ListenerThreadImpl implements ListenerThread, Work { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private ORB orb; private Acceptor acceptor; private boolean keepRunning; private long enqueueTime; - public ListenerThreadImpl(ORB orb, Acceptor acceptor) - { + public ListenerThreadImpl(ORB orb, Acceptor acceptor) { this.orb = orb; this.acceptor = acceptor; keepRunning = true; } //////////////////////////////////////////////////// - // + // // ListenerThread methods. // - public Acceptor getAcceptor() - { + public Acceptor getAcceptor() { return acceptor; } @Transport - public synchronized void close() - { + public synchronized void close() { keepRunning = false; - acceptor.close() ; + acceptor.close(); } private synchronized boolean isRunning() { - return keepRunning ; + return keepRunning; } //////////////////////////////////////////////////// @@ -79,49 +70,49 @@ private synchronized boolean isRunning() { // REVISIT - this needs alot more from previous ListenerThread @InfoMethod - private void display( String msg ) { } + private void display(String msg) { + } @InfoMethod - private void display( String msg, Object value ) { } + private void display(String msg, Object value) { + } @Transport - public void doWork() - { + public void doWork() { while (isRunning()) { - display( "acceptor", acceptor ) ; + display("acceptor", acceptor); try { - display( "Before Accept cycle" ) ; - acceptor.processSocket( acceptor.getAcceptedSocket() ) ; - display( "After Accept cycle" ) ; + display("Before Accept cycle"); + acceptor.processSocket(acceptor.getAcceptedSocket()); + display("After Accept cycle"); } catch (Throwable t) { - wrapper.exceptionInListenerThread( t ) ; - display( "Exception in accept", t ) ; + wrapper.exceptionInListenerThread(t); + display("Exception in accept", t); - orb.getTransportManager().getSelector(0) - .unregisterForEvent(getAcceptor().getEventHandler()); + orb.getTransportManager().getSelector(0).unregisterForEvent(getAcceptor().getEventHandler()); try { if (isRunning()) { getAcceptor().close(); } } catch (Exception exc) { - wrapper.ioExceptionOnClose( exc ) ; + wrapper.ioExceptionOnClose(exc); } } } } - public void setEnqueueTime(long timeInMillis) - { + public void setEnqueueTime(long timeInMillis) { enqueueTime = timeInMillis; } - public long getEnqueueTime() - { + public long getEnqueueTime() { return enqueueTime; } - public String getName() { return "ListenerThread"; } + public String getName() { + return "ListenerThread"; + } //////////////////////////////////////////////////// // diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/MessageTraceManagerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/MessageTraceManagerImpl.java index 827376a8e..c1fa7fb20 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/MessageTraceManagerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/MessageTraceManagerImpl.java @@ -19,122 +19,107 @@ package com.sun.corba.ee.impl.transport; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; -import java.util.List ; -import java.util.ArrayList ; +import java.util.List; +import java.util.ArrayList; -import com.sun.corba.ee.spi.transport.MessageTraceManager ; +import com.sun.corba.ee.spi.transport.MessageTraceManager; -public class MessageTraceManagerImpl implements MessageTraceManager -{ +public class MessageTraceManagerImpl implements MessageTraceManager { // Note: this implementation does not need to be syncronized // because an instance of this class is only called from a single // thread. - private List /* */ dataSent ; - private List /* */ dataReceived ; - private boolean enabled ; - private boolean RHRCalled ; // Set to true whenever recordHeaderReceived is called. - private byte[] header ; - - public MessageTraceManagerImpl() - { - init() ; - enabled = false ; + private List /* */ dataSent; + private List /* */ dataReceived; + private boolean enabled; + private boolean RHRCalled; // Set to true whenever recordHeaderReceived is called. + private byte[] header; + + public MessageTraceManagerImpl() { + init(); + enabled = false; } - public void clear() - { - init() ; + public void clear() { + init(); } - private void init() - { - dataSent = new ArrayList() ; - dataReceived = new ArrayList() ; - initHeaderRecorder() ; + private void init() { + dataSent = new ArrayList(); + dataReceived = new ArrayList(); + initHeaderRecorder(); } - public boolean isEnabled() - { - return enabled ; + public boolean isEnabled() { + return enabled; } - public void enable( boolean flag ) - { - enabled = flag ; + public void enable(boolean flag) { + enabled = flag; } - public byte[][] getDataSent() - { - return (byte[][])dataSent.toArray( - new byte[dataSent.size()][] ) ; + public byte[][] getDataSent() { + return (byte[][]) dataSent.toArray(new byte[dataSent.size()][]); } - public byte[][] getDataReceived() - { - return (byte[][])dataReceived.toArray( - new byte[dataReceived.size()][] ) ; + public byte[][] getDataReceived() { + return (byte[][]) dataReceived.toArray(new byte[dataReceived.size()][]); } // Methods that are used internally to record messages - - private void initHeaderRecorder() - { - RHRCalled = false ; - header = null ; + + private void initHeaderRecorder() { + RHRCalled = false; + header = null; } - /** Return the contents of the byte buffer. The ByteBuffer - * is not modified. The result is written starting at - * index offset in the byte[]. + /** + * Return the contents of the byte buffer. The ByteBuffer is not modified. The result is written starting at index + * offset in the byte[]. + * * @param bb Buffer to read from * @param offset Offset to start from, must be non-negative * @return Contents of the buffer */ - public byte[] getBytes( ByteBuffer bb, int offset ) - { - ByteBuffer view = bb.asReadOnlyBuffer() ; - view.flip() ; - int len = view.remaining() ; - byte[] buffer = new byte[ len + offset ] ; - view.get( buffer, offset, len ) ; - - return buffer ; + public byte[] getBytes(ByteBuffer bb, int offset) { + ByteBuffer view = bb.asReadOnlyBuffer(); + view.flip(); + int len = view.remaining(); + byte[] buffer = new byte[len + offset]; + view.get(buffer, offset, len); + + return buffer; } @Override - public void recordDataSent(ByteBuffer message) - { - byte[] buffer = getBytes( message, 0 ) ; - dataSent.add( buffer ) ; + public void recordDataSent(ByteBuffer message) { + byte[] buffer = getBytes(message, 0); + dataSent.add(buffer); } - - public void recordHeaderReceived( ByteBuffer message ) - { + + public void recordHeaderReceived(ByteBuffer message) { if (RHRCalled) { // Previous call was for header only: no body - dataReceived.add( header ) ; - initHeaderRecorder() ; + dataReceived.add(header); + initHeaderRecorder(); } - RHRCalled = true ; - header = getBytes( message, 0 ) ; + RHRCalled = true; + header = getBytes(message, 0); } - public void recordBodyReceived( ByteBuffer message ) - { + public void recordBodyReceived(ByteBuffer message) { if (!RHRCalled) // This string is 12 characters long, so the ASCII // representation should have the same length as a // GIOP header. - header = "NO HEADER!!!".getBytes() ; + header = "NO HEADER!!!".getBytes(); - byte[] buffer = getBytes( message, header.length ) ; - System.arraycopy( header, 0, buffer, header.length, - message.remaining() ) ; - dataReceived.add( buffer ) ; + byte[] buffer = getBytes(message, header.length); + System.arraycopy(header, 0, buffer, header.length, message.remaining()); + dataReceived.add(buffer); - initHeaderRecorder() ; + initHeaderRecorder(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/NioBufferWriter.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/NioBufferWriter.java index 017d2a99c..df26cd9c0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/NioBufferWriter.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/NioBufferWriter.java @@ -44,13 +44,12 @@ void write(ByteBuffer byteBuffer) throws IOException { // Can only occur on non-blocking connections. // Using long for backoff_factor to avoid floating point // calculations. - TcpTimeouts.Waiter waiter = tcpTimeouts.waiter() ; + TcpTimeouts.Waiter waiter = tcpTimeouts.waiter(); SelectionKey sk = null; TemporarySelector tmpSelector = null; try { tmpSelector = getTemporaryWriteSelector(socketChannel); - sk = tmpSelector.registerChannel(socketChannel, - SelectionKey.OP_WRITE); + sk = tmpSelector.registerChannel(socketChannel, SelectionKey.OP_WRITE); while (byteBuffer.hasRemaining() && !waiter.isExpired()) { int nsel = tmpSelector.select(waiter.getTimeForSleep()); if (nsel > 0) { @@ -62,13 +61,12 @@ void write(ByteBuffer byteBuffer) throws IOException { } // selector timed out or no bytes have been written if (nsel == 0 || nbytes == 0) { - waiter.advance() ; + waiter.advance(); } } } catch (IOException ioe) { ioe.printStackTrace(); - throw ConnectionImpl.wrapper.exceptionWhenWritingWithTemporarySelector(ioe, - byteBuffer.position(), byteBuffer.limit(), + throw ConnectionImpl.wrapper.exceptionWhenWritingWithTemporarySelector(ioe, byteBuffer.position(), byteBuffer.limit(), waiter.timeWaiting(), tcpTimeouts.get_max_time_to_wait()); } finally { if (tmpSelector != null) { @@ -78,8 +76,7 @@ void write(ByteBuffer byteBuffer) throws IOException { // if message not fully written, throw exception if (byteBuffer.hasRemaining() && waiter.isExpired()) { // failed to write entire message - throw ConnectionImpl.wrapper.transportWriteTimeoutExceeded( - tcpTimeouts.get_max_time_to_wait(), waiter.timeWaiting()); + throw ConnectionImpl.wrapper.transportWriteTimeoutExceeded(tcpTimeouts.get_max_time_to_wait(), waiter.timeWaiting()); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/OutboundConnectionCacheImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/OutboundConnectionCacheImpl.java index 51a972e25..6b38c8d25 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/OutboundConnectionCacheImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/OutboundConnectionCacheImpl.java @@ -30,61 +30,50 @@ import com.sun.corba.ee.spi.transport.Connection; import com.sun.corba.ee.spi.transport.OutboundConnectionCache; -import org.glassfish.gmbal.ManagedObject ; -import org.glassfish.gmbal.AMXMetadata ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedObject; +import org.glassfish.gmbal.AMXMetadata; +import org.glassfish.gmbal.Description; /** * @author Harold Carr */ @Transport @ManagedObject -@Description( "Cache of connections originated by the ORB" ) -@AMXMetadata( type="corba-outbound-connection-cache-mon", group="monitoring" ) -public class OutboundConnectionCacheImpl - extends - ConnectionCacheBase - implements - OutboundConnectionCache -{ +@Description("Cache of connections originated by the ORB") +@AMXMetadata(type = "corba-outbound-connection-cache-mon", group = "monitoring") +public class OutboundConnectionCacheImpl extends ConnectionCacheBase implements OutboundConnectionCache { protected Map connectionCache; - private OutboundConnectionCacheProbeProvider pp = - new OutboundConnectionCacheProbeProvider() ; + private OutboundConnectionCacheProbeProvider pp = new OutboundConnectionCacheProbeProvider(); - public OutboundConnectionCacheImpl(ORB orb, ContactInfo contactInfo) - { - super(orb, contactInfo.getConnectionCacheType(), - ((ContactInfo)contactInfo).getMonitoringName()); - this.connectionCache = new HashMap(); + public OutboundConnectionCacheImpl(ORB orb, ContactInfo contactInfo) { + super(orb, contactInfo.getConnectionCacheType(), ((ContactInfo) contactInfo).getMonitoringName()); + this.connectionCache = new HashMap(); } @Transport - public Connection get(ContactInfo contactInfo) - { + public Connection get(ContactInfo contactInfo) { synchronized (backingStore()) { cacheStatisticsInfo(); return connectionCache.get(contactInfo); } } - + @Transport - public void put(ContactInfo contactInfo, Connection connection) - { + public void put(ContactInfo contactInfo, Connection connection) { synchronized (backingStore()) { connectionCache.put(contactInfo, connection); connection.setConnectionCache(this); - pp.connectionOpenedEvent( contactInfo.toString(), connection.toString() ) ; + pp.connectionOpenedEvent(contactInfo.toString(), connection.toString()); cacheStatisticsInfo(); } } @Transport - public void remove(ContactInfo contactInfo) - { + public void remove(ContactInfo contactInfo) { synchronized (backingStore()) { if (contactInfo != null) { Connection connection = connectionCache.remove(contactInfo); - pp.connectionClosedEvent( contactInfo.toString(), connection.toString() ) ; + pp.connectionClosedEvent(contactInfo.toString(), connection.toString()); } cacheStatisticsInfo(); } @@ -95,22 +84,17 @@ public void remove(ContactInfo contactInfo) // Implementation // - public Collection values() - { + public Collection values() { return connectionCache.values(); } - protected Object backingStore() - { + protected Object backingStore() { return connectionCache; } @Override - public String toString() - { - return "CorbaOutboundConnectionCacheImpl[" - + connectionCache - + "]"; + public String toString() { + return "CorbaOutboundConnectionCacheImpl[" + connectionCache + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/OutboundConnectionCacheProbeProvider.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/OutboundConnectionCacheProbeProvider.java index e3ab9b6a6..e16b14ed2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/OutboundConnectionCacheProbeProvider.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/OutboundConnectionCacheProbeProvider.java @@ -23,28 +23,26 @@ import java.util.HashMap; import java.util.Map; -import org.glassfish.external.probe.provider.annotations.Probe ; -import org.glassfish.external.probe.provider.annotations.ProbeProvider ; -import org.glassfish.external.probe.provider.annotations.ProbeParam ; +import org.glassfish.external.probe.provider.annotations.Probe; +import org.glassfish.external.probe.provider.annotations.ProbeProvider; +import org.glassfish.external.probe.provider.annotations.ProbeParam; -/** This simple class is for the GFv3 probe mechanism. As of - * 9/16/09, gfprobes have the unfortunate requirement that ALL - * methods in the class MUST be probe methods (see issue 9536). - * Otherwise I would put these methods in the CorbaOutboundConnectionCacheImpl class. +/** + * This simple class is for the GFv3 probe mechanism. As of 9/16/09, gfprobes have the unfortunate requirement that ALL + * methods in the class MUST be probe methods (see issue 9536). Otherwise I would put these methods in the + * CorbaOutboundConnectionCacheImpl class. * - * @author Ken Cavanaugh + * @author Ken Cavanaugh */ -@ProbeProvider(moduleProviderName="glassfish", moduleName="orb" , probeProviderName="outboundconnection") +@ProbeProvider(moduleProviderName = "glassfish", moduleName = "orb", probeProviderName = "outboundconnection") public class OutboundConnectionCacheProbeProvider { - @Probe(name="outboundConnectionOpened" ) - public void connectionOpenedEvent( - @ProbeParam( "contactInfo" ) String contactInfo, - @ProbeParam( "connection" ) String connection ) {} + @Probe(name = "outboundConnectionOpened") + public void connectionOpenedEvent(@ProbeParam("contactInfo") String contactInfo, @ProbeParam("connection") String connection) { + } - @Probe(name="outboundConnectionClosed" ) - public void connectionClosedEvent( - @ProbeParam( "contactInfo" ) String contactInfo, - @ProbeParam( "connection" ) String connection ) {} + @Probe(name = "outboundConnectionClosed") + public void connectionClosedEvent(@ProbeParam("contactInfo") String contactInfo, @ProbeParam("connection") String connection) { + } } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ReaderThreadImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ReaderThreadImpl.java index 0f67cb2ee..26bb7915b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ReaderThreadImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ReaderThreadImpl.java @@ -35,18 +35,16 @@ public class ReaderThreadImpl implements ReaderThread, Work { private Connection connection; private boolean keepRunning; private long enqueueTime; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - public ReaderThreadImpl(ORB orb, Connection connection) - { + public ReaderThreadImpl(ORB orb, Connection connection) { this.orb = orb; this.connection = connection; keepRunning = true; } //////////////////////////////////////////////////// - // + // // ReaderThread methods. // @@ -58,7 +56,7 @@ public Connection getConnection() { public synchronized void close() { keepRunning = false; - // Note: do not close the connection here, as it may be + // Note: do not close the connection here, as it may be // re-used if we are simply closing the ReaderThread // because it has completed its operation. // If we are calling close because of transport shutdown, @@ -66,7 +64,7 @@ public synchronized void close() { } private synchronized boolean isRunning() { - return keepRunning ; + return keepRunning; } //////////////////////////////////////////////////// @@ -75,39 +73,38 @@ private synchronized boolean isRunning() { // @InfoMethod - private void display( String msg ) { } + private void display(String msg) { + } @InfoMethod - private void display( String msg, Object value ) { } - + private void display(String msg, Object value) { + } // REVISIT - this needs alot more from previous ReaderThread. @Transport - public void doWork() - { + public void doWork() { while (isRunning()) { try { - display( "Start readerThread cycle", connection ) ; + display("Start readerThread cycle", connection); if (connection.read()) { // REVISIT - put in pool; return; } - display( "End readerThread cycle" ) ; + display("End readerThread cycle"); } catch (Throwable t) { - wrapper.exceptionInReaderThread( t ) ; - display( "Exception in read", t ) ; + wrapper.exceptionInReaderThread(t); + display("Exception in read", t); - orb.getTransportManager().getSelector(0) - .unregisterForEvent(getConnection().getEventHandler()); + orb.getTransportManager().getSelector(0).unregisterForEvent(getConnection().getEventHandler()); try { if (isRunning()) { getConnection().close(); } } catch (Exception exc) { - wrapper.ioExceptionOnClose( exc ) ; + wrapper.ioExceptionOnClose(exc); } } } @@ -121,7 +118,9 @@ public long getEnqueueTime() { return enqueueTime; } - public String getName() { return "ReaderThread"; } + public String getName() { + return "ReaderThread"; + } } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ResponseWaitingRoomImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ResponseWaitingRoomImpl.java index 00f887198..9c7d18e41 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ResponseWaitingRoomImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/ResponseWaitingRoomImpl.java @@ -29,7 +29,6 @@ import org.omg.CORBA.CompletionStatus; import org.omg.CORBA.SystemException; - import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.protocol.MessageMediator; import com.sun.corba.ee.spi.transport.Connection; @@ -47,15 +46,10 @@ * @author Harold Carr */ @Transport -public class ResponseWaitingRoomImpl - implements - ResponseWaitingRoom -{ - final private static ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - - final static class OutCallDesc - { +public class ResponseWaitingRoomImpl implements ResponseWaitingRoom { + final private static ORBUtilSystemException wrapper = ORBUtilSystemException.self; + + final static class OutCallDesc { MessageMediator messageMediator; SystemException exception; CDRInputObject inputObject; @@ -68,44 +62,33 @@ final static class OutCallDesc final private ORB orb; final private Connection connection; - - public ResponseWaitingRoomImpl(ORB orb, Connection connection) - { + public ResponseWaitingRoomImpl(ORB orb, Connection connection) { this.orb = orb; this.connection = connection; - this.out_calls = - Collections.synchronizedMap(new HashMap()); + this.out_calls = Collections.synchronizedMap(new HashMap()); } @Transport - public void registerWaiter(MessageMediator messageMediator) - { - display( "messageMediator request ID", - messageMediator.getRequestId() ) ; - display( "messageMediator operation name", - messageMediator.getOperationName() ) ; + public void registerWaiter(MessageMediator messageMediator) { + display("messageMediator request ID", messageMediator.getRequestId()); + display("messageMediator operation name", messageMediator.getOperationName()); Integer requestId = messageMediator.getRequestId(); - + OutCallDesc call = new OutCallDesc(); call.messageMediator = messageMediator; OutCallDesc exists = out_calls.put(requestId, call); if (exists != null) { - wrapper.duplicateRequestIdsInResponseWaitingRoom( - ORBUtility.operationNameAndRequestId( - (MessageMediator)exists.messageMediator), - ORBUtility.operationNameAndRequestId(messageMediator)); + wrapper.duplicateRequestIdsInResponseWaitingRoom(ORBUtility.operationNameAndRequestId((MessageMediator) exists.messageMediator), + ORBUtility.operationNameAndRequestId(messageMediator)); } } @Transport - public void unregisterWaiter(MessageMediator mediator) - { + public void unregisterWaiter(MessageMediator mediator) { MessageMediator messageMediator = mediator; - display( "messageMediator request ID", - messageMediator.getRequestId() ) ; - display( "messageMediator operation name", - messageMediator.getOperationName() ) ; + display("messageMediator request ID", messageMediator.getRequestId()); + display("messageMediator operation name", messageMediator.getOperationName()); Integer requestId = messageMediator.getRequestId(); @@ -115,31 +98,28 @@ public void unregisterWaiter(MessageMediator mediator) @Transport public CDRInputObject waitForResponse(MessageMediator messageMediator) { CDRInputObject returnStream = null; - - display( "messageMediator request ID", - messageMediator.getRequestId() ) ; - display( "messageMediator operation name", - messageMediator.getOperationName() ) ; - + + display("messageMediator request ID", messageMediator.getRequestId()); + display("messageMediator operation name", messageMediator.getOperationName()); + Integer requestId = messageMediator.getRequestId(); - + if (messageMediator.isOneWay()) { // The waiter is removed in releaseReply in the same // way as a normal request. - display( "Oneway request: not waiting") ; + display("Oneway request: not waiting"); return null; } - + OutCallDesc call = out_calls.get(requestId); if (call == null) { - throw wrapper.nullOutCall() ; + throw wrapper.nullOutCall(); } // Value from ORBData is in milliseconds, will convert it nanoseconds // to use it with Condition.awaitNanos() - long waitForResponseTimeout = - orb.getORBData().getWaitForResponseTimeout() * 1000 * 1000; - + long waitForResponseTimeout = orb.getORBData().getWaitForResponseTimeout() * 1000 * 1000; + try { call.lock.lock(); while (call.inputObject == null && call.exception == null) { @@ -147,87 +127,85 @@ public CDRInputObject waitForResponse(MessageMediator messageMediator) { // The ReaderThread reads in the reply IIOP message // and signals us. try { - display( "Waiting for response..." ) ; - - waitForResponseTimeout = - call.condition.awaitNanos(waitForResponseTimeout); + display("Waiting for response..."); + + waitForResponseTimeout = call.condition.awaitNanos(waitForResponseTimeout); if (call.inputObject == null && call.exception == null) { if (waitForResponseTimeout > 0) { // it's a "spurious wait wakeup", need to // continue to wait for a response - display( "Spurious wakeup, continuing to wait for ", - waitForResponseTimeout/1000000 ); + display("Spurious wakeup, continuing to wait for ", waitForResponseTimeout / 1000000); } else { // timed out waiting for data - call.exception = - wrapper.communicationsTimeoutWaitingForResponse( - orb.getORBData().getWaitForResponseTimeout()); + call.exception = wrapper.communicationsTimeoutWaitingForResponse(orb.getORBData().getWaitForResponseTimeout()); // REVISIT: // Normally the inputObject or exception is // created from the response stream. // Need to fake encoding version since // it is expected to be popped in endRequest. - ORBUtility.pushEncVersionToThreadLocalState( - ORBConstants.JAVA_ENC_VERSION); + ORBUtility.pushEncVersionToThreadLocalState(ORBConstants.JAVA_ENC_VERSION); } } - } catch (InterruptedException ie) {}; + } catch (InterruptedException ie) { + } + ; } if (call.exception != null) { - display( "Exception from call", call.exception ) ; + display("Exception from call", call.exception); throw call.exception; } - + returnStream = call.inputObject; } finally { call.lock.unlock(); } - + // REVISIT -- exceptions from unmarshaling code will // go up through this client thread! - + if (returnStream != null) { // On fragmented streams the header MUST be unmarshaled here // (in the client thread) in case it blocks. // If the header was already unmarshaled, this won't // do anything // REVISIT: cast - need interface method. - ((CDRInputObject)returnStream).unmarshalHeader(); + ((CDRInputObject) returnStream).unmarshalHeader(); } - + return returnStream; } @InfoMethod - private void display( String msg ) { } + private void display(String msg) { + } @InfoMethod - private void display( String msg, int value ) { } + private void display(String msg, int value) { + } @InfoMethod - private void display( String msg, Object value ) { } + private void display(String msg, Object value) { + } @Transport - public void responseReceived(CDRInputObject is) - { + public void responseReceived(CDRInputObject is) { CDRInputObject inputObject = (CDRInputObject) is; - LocateReplyOrReplyMessage header = (LocateReplyOrReplyMessage) - inputObject.getMessageHeader(); - display( "requestId", header.getRequestId()) ; - display( "header", header ) ; + LocateReplyOrReplyMessage header = (LocateReplyOrReplyMessage) inputObject.getMessageHeader(); + display("requestId", header.getRequestId()); + display("header", header); OutCallDesc call = out_calls.get(header.getRequestId()); - // This is an interesting case. It could mean that someone sent us a - // reply message, but we don't know what request it was for. That - // would probably call for an error. However, there's another case + // This is an interesting case. It could mean that someone sent us a + // reply message, but we don't know what request it was for. That + // would probably call for an error. However, there's another case // that's normal and we should think about -- // // If the unmarshaling thread does all of its work inbetween the time // the ReaderThread gives it the last fragment and gets to the // out_calls.get line, then it will also be null, so just return; if (call == null) { - display( "No waiter" ) ; + display("No waiter"); return; } @@ -236,17 +214,14 @@ public void responseReceived(CDRInputObject is) // The thread signalled will remove outcall descriptor if appropriate. // Otherwise, it'll be removed when last fragment for it has been put on // BufferManagerRead's queue. - + try { call.lock.lock(); - MessageMediator messageMediator = - (MessageMediator)call.messageMediator; + MessageMediator messageMediator = (MessageMediator) call.messageMediator; - display( "Notifying waiters") ; - display( "messageMediator request ID", - messageMediator.getRequestId() ) ; - display( "messageMediator operation name", - messageMediator.getOperationName() ) ; + display("Notifying waiters"); + display("messageMediator request ID", messageMediator.getRequestId()); + display("messageMediator operation name", messageMediator.getOperationName()); messageMediator.setReplyHeader(header); messageMediator.setInputObject(is); @@ -258,8 +233,7 @@ public void responseReceived(CDRInputObject is) } } - public int numberRegistered() - { + public int numberRegistered() { return out_calls.size(); } @@ -277,7 +251,7 @@ public void signalExceptionToAllWaiters(SystemException systemException) { call = itr.next(); try { call.lock.lock(); - ((MessageMediator)call.messageMediator).cancelRequest(); + ((MessageMediator) call.messageMediator).cancelRequest(); call.inputObject = null; call.exception = systemException; call.condition.signal(); @@ -288,8 +262,7 @@ public void signalExceptionToAllWaiters(SystemException systemException) { } } - public MessageMediator getMessageMediator(int requestId) - { + public MessageMediator getMessageMediator(int requestId) { OutCallDesc call = out_calls.get(requestId); if (call == null) { // This can happen when getting early reply fragments for a diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SelectorImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SelectorImpl.java index 030a6f5d9..0573ee1ab 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SelectorImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SelectorImpl.java @@ -45,9 +45,9 @@ import com.sun.corba.ee.spi.trace.Transport; import java.util.Map; -import org.glassfish.gmbal.ManagedObject ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedObject; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; /** @@ -55,15 +55,9 @@ */ @Transport @ManagedObject -@Description( "The Selector, which handles incoming requests to the ORB" ) -public class SelectorImpl - extends - Thread - implements - com.sun.corba.ee.spi.transport.Selector -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +@Description("The Selector, which handles incoming requests to the ORB") +public class SelectorImpl extends Thread implements com.sun.corba.ee.spi.transport.Selector { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private ORB orb; private Timer timer; @@ -71,8 +65,8 @@ public class SelectorImpl private long timeout; private final List deferredRegistrations; private final List interestOpsList; - private final Map listenerThreads; - private final Map readerThreads; + private final Map listenerThreads; + private final Map readerThreads; private boolean selectorStarted; private volatile boolean closed; private Map lastActivityTimers = new HashMap(); @@ -99,31 +93,32 @@ public SelectorImpl(ORB orb) { timeout = 60000; deferredRegistrations = new ArrayList(); interestOpsList = new ArrayList(); - listenerThreads = new HashMap(); - readerThreads = new HashMap(); + listenerThreads = new HashMap(); + readerThreads = new HashMap(); closed = false; } - public void setTimeout(long timeout) - { + public void setTimeout(long timeout) { this.timeout = timeout; } @ManagedAttribute - @Description( "The selector timeout" ) - public long getTimeout() - { + @Description("The selector timeout") + public long getTimeout() { return timeout; } @InfoMethod - private void display( String msg, Object value ) { } + private void display(String msg, Object value) { + } @InfoMethod - private void closedEventHandler() { } + private void closedEventHandler() { + } @InfoMethod - private void defaultCaseForEventHandler() { } + private void defaultCaseForEventHandler() { + } @Transport public void registerInterestOps(EventHandler eventHandler) { @@ -131,21 +126,19 @@ public void registerInterestOps(EventHandler eventHandler) { if (selectionKey.isValid()) { int ehOps = eventHandler.getInterestOps(); SelectionKeyAndOp keyAndOp = new SelectionKeyAndOp(selectionKey, ehOps); - synchronized(interestOpsList) { + synchronized (interestOpsList) { interestOpsList.add(keyAndOp); } // tell Selector Thread there's an update to a SelectorKey's Ops selector.wakeup(); - } - else { + } else { wrapper.selectionKeyInvalid(eventHandler.toString()); - display( "EventHandler SelectionKey not valid", eventHandler); + display("EventHandler SelectionKey not valid", eventHandler); } } @Transport - public void registerForEvent(EventHandler eventHandler) - { + public void registerForEvent(EventHandler eventHandler) { if (isClosed()) { closedEventHandler(); return; @@ -161,16 +154,15 @@ public void registerForEvent(EventHandler eventHandler) } switch (eventHandler.getInterestOps()) { - case SelectionKey.OP_ACCEPT : + case SelectionKey.OP_ACCEPT: createListenerThread(eventHandler); break; - case SelectionKey.OP_READ : + case SelectionKey.OP_READ: createReaderThread(eventHandler); break; default: defaultCaseForEventHandler(); - throw new RuntimeException( - "SelectorImpl.registerForEvent: unknown interest ops"); + throw new RuntimeException("SelectorImpl.registerForEvent: unknown interest ops"); } } @@ -192,23 +184,22 @@ public void unregisterForEvent(EventHandler eventHandler) { } switch (eventHandler.getInterestOps()) { - case SelectionKey.OP_ACCEPT : + case SelectionKey.OP_ACCEPT: destroyListenerThread(eventHandler); break; - case SelectionKey.OP_READ : + case SelectionKey.OP_READ: destroyReaderThread(eventHandler); break; default: defaultCaseForEventHandler(); - throw new RuntimeException( - "SelectorImpl.uregisterForEvent: unknown interest ops"); + throw new RuntimeException("SelectorImpl.uregisterForEvent: unknown interest ops"); } } @Transport public void close() { if (isClosed()) { - closedEventHandler() ; + closedEventHandler(); return; } @@ -217,14 +208,14 @@ public void close() { // Kill listeners. synchronized (this) { for (ListenerThread lthread : listenerThreads.values()) { - lthread.close() ; + lthread.close(); } } // Kill readers. synchronized (this) { for (ReaderThread rthread : readerThreads.values()) { - rthread.close() ; + rthread.close(); } } @@ -235,7 +226,7 @@ public void close() { selector.wakeup(); } } catch (Throwable t) { - display( "Exception in close", t ) ; + display("Exception in close", t); } } @@ -245,30 +236,34 @@ public void close() { // @InfoMethod - private void beginSelect() { } + private void beginSelect() { + } @InfoMethod - private void endSelect() { } + private void endSelect() { + } @InfoMethod - private void selectorClosed() { } + private void selectorClosed() { + } @InfoMethod - private void selectResult( boolean hasNext, int count ) { } + private void selectResult(boolean hasNext, int count) { + } @InfoMethod - private void skippingEventForCancelledKey() { } + private void skippingEventForCancelledKey() { + } @Transport @Override public void run() { - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - setName("SelectorThread"); - return null; - } - }); + java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() { + public Object run() { + setName("SelectorThread"); + return null; + } + }); while (!closed) { try { @@ -276,7 +271,7 @@ public Object run() { } catch (Throwable t) { // IMPORTANT: ignore all errors so the select thread keeps running. // Otherwise a guaranteed hang. - display( "Ignoring exception", t ) ; + display("Ignoring exception", t); } } } @@ -289,16 +284,15 @@ void runSelectionLoopOnce() throws IOException { enableInterestOps(); try { n = selector.select(timeout); - } catch (IOException e) { - display( "Exception in select:", e ) ; + } catch (IOException e) { + display("Exception in select:", e); } if (closed) { selector.close(); selectorClosed(); return; } - Iterator iterator = - selector.selectedKeys().iterator(); + Iterator iterator = selector.selectedKeys().iterator(); selectResult(iterator.hasNext(), n); while (iterator.hasNext()) { SelectionKey selectionKey = iterator.next(); @@ -315,16 +309,16 @@ void runSelectionLoopOnce() throws IOException { // been active in addition to closing the Connection. if (selectionKey.isValid()) { - EventHandler eventHandler = (EventHandler)selectionKey.attachment(); + EventHandler eventHandler = (EventHandler) selectionKey.attachment(); try { eventHandler.handleEvent(); if (lastActivityTimers.containsKey(eventHandler)) lastActivityTimers.put(eventHandler, timer.getCurrentTime()); } catch (Throwable t) { - wrapper.exceptionInSelector( t, eventHandler ) ; + wrapper.exceptionInSelector(t, eventHandler); } } else { - wrapper.canceledSelectionKey( selectionKey ) ; + wrapper.canceledSelectionKey(selectionKey); skippingEventForCancelledKey(); // skipping event since this EventHandler's // SelectionKey has been found to be cancelled. @@ -340,37 +334,35 @@ void runSelectionLoopOnce() throws IOException { endSelect(); } - ///////////////////////////////////////////////////// // // Implementation. // - private synchronized boolean isClosed () - { + private synchronized boolean isClosed() { return closed; } - private synchronized void setClosed(boolean closed) - { + private synchronized void setClosed(boolean closed) { this.closed = closed; } @InfoMethod - private void selectorStarted() {} + private void selectorStarted() { + } @Transport private synchronized void startSelector() { // Make sure this is only called once, or setDaemon will // throw an IllegalStateException since the Selector will already - // be running. Note this must be synchronized to protect against + // be running. Note this must be synchronized to protect against // concurrent startups of the Selector. if (!selectorStarted) { - selectorStarted() ; + selectorStarted(); try { selector = Selector.open(); } catch (IOException e) { - throw new RuntimeException( ".startSelector: Selector.open exception", e); + throw new RuntimeException(".startSelector: Selector.open exception", e); } setDaemon(true); start(); @@ -379,19 +371,20 @@ private synchronized void startSelector() { } @InfoMethod - private void registeringEventHandler( EventHandler eh ) { } + private void registeringEventHandler(EventHandler eh) { + } @Transport private void handleDeferredRegistrations() { synchronized (deferredRegistrations) { - for (EventHandler eventHandler : deferredRegistrations ) { + for (EventHandler eventHandler : deferredRegistrations) { registeringEventHandler(eventHandler); SelectableChannel channel = eventHandler.getChannel(); SelectionKey selectionKey = null; try { selectionKey = channel.register(selector, eventHandler.getInterestOps(), eventHandler); } catch (ClosedChannelException e) { - display( "Exception", e ) ; + display("Exception", e); } eventHandler.setSelectionKey(selectionKey); if (eventHandler instanceof Timeoutable) @@ -402,15 +395,17 @@ private void handleDeferredRegistrations() { } @InfoMethod - private void ignoringCancelledKeyException() { } + private void ignoringCancelledKeyException() { + } @InfoMethod - private void keyAndOpInfo( SelectionKeyAndOp val ) { } + private void keyAndOpInfo(SelectionKeyAndOp val) { + } @Transport private void enableInterestOps() { synchronized (interestOpsList) { - for (SelectionKeyAndOp keyAndOp : interestOpsList ) { + for (SelectionKeyAndOp keyAndOp : interestOpsList) { SelectionKey selectionKey = keyAndOp.selectionKey; // Need to check if the SelectionKey is valid because a @@ -439,7 +434,7 @@ private void enableInterestOps() { // enabled by Thread 1 that the Connection // associated with the SelectionKey was closed by // Thread 2 where Thread 2 will cancel the - // SelectionKey. As a result, we catch and + // SelectionKey. As a result, we catch and // ignore this exception condition. ignoringCancelledKeyException(); } @@ -453,15 +448,13 @@ private void enableInterestOps() { @Transport private void createListenerThread(EventHandler eventHandler) { Acceptor acceptor = eventHandler.getAcceptor(); - ListenerThread listenerThread = - new ListenerThreadImpl(orb, acceptor); + ListenerThread listenerThread = new ListenerThreadImpl(orb, acceptor); synchronized (this) { listenerThreads.put(eventHandler, listenerThread); } Throwable throwable = null; try { - orb.getThreadPoolManager().getThreadPool(0) - .getWorkQueue(0).addWork((Work)listenerThread); + orb.getThreadPoolManager().getThreadPool(0).getWorkQueue(0).addWork((Work) listenerThread); } catch (NoSuchThreadPoolException e) { throwable = e; } catch (NoSuchWorkQueueException e) { @@ -473,15 +466,16 @@ private void createListenerThread(EventHandler eventHandler) { } @InfoMethod - private void cannotFindListenerThread() { } + private void cannotFindListenerThread() { + } @Transport private void destroyListenerThread(EventHandler eventHandler) { - ListenerThread listenerThread ; + ListenerThread listenerThread; synchronized (this) { listenerThread = listenerThreads.get(eventHandler); if (listenerThread == null) { - cannotFindListenerThread() ; + cannotFindListenerThread(); return; } listenerThreads.remove(eventHandler); @@ -493,15 +487,13 @@ private void destroyListenerThread(EventHandler eventHandler) { @Transport private void createReaderThread(EventHandler eventHandler) { Connection connection = eventHandler.getConnection(); - ReaderThread readerThread = - new ReaderThreadImpl(orb, connection ); + ReaderThread readerThread = new ReaderThreadImpl(orb, connection); synchronized (this) { readerThreads.put(eventHandler, readerThread); } Throwable throwable = null; try { - orb.getThreadPoolManager().getThreadPool(0) - .getWorkQueue(0).addWork((Work)readerThread); + orb.getThreadPoolManager().getThreadPool(0).getWorkQueue(0).addWork((Work) readerThread); } catch (NoSuchThreadPoolException e) { throwable = e; } catch (NoSuchWorkQueueException e) { @@ -513,11 +505,12 @@ private void createReaderThread(EventHandler eventHandler) { } @InfoMethod - private void cannotFindReaderThread() { } + private void cannotFindReaderThread() { + } @Transport private void destroyReaderThread(EventHandler eventHandler) { - ReaderThread readerThread ; + ReaderThread readerThread; synchronized (this) { readerThread = readerThreads.get(eventHandler); if (readerThread == null) { @@ -533,9 +526,8 @@ private void destroyReaderThread(EventHandler eventHandler) { // Used only by SelectorImpl to register and enable SelectionKey // Op. // REVISIT - Could do away with this class and use the EventHanlder - // directly. - private static class SelectionKeyAndOp - { + // directly. + private static class SelectionKeyAndOp { // A SelectionKey.[OP_READ|OP_WRITE|OP_ACCEPT|OP_CONNECT] public int keyOp; public SelectionKey selectionKey; @@ -549,4 +541,3 @@ public SelectionKeyAndOp(SelectionKey selectionKey, int keyOp) { // End of file. } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SharedCDRContactInfoImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SharedCDRContactInfoImpl.java index 4ecd6902d..7c5470af1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SharedCDRContactInfoImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SharedCDRContactInfoImpl.java @@ -37,109 +37,74 @@ import com.sun.corba.ee.impl.protocol.MessageMediatorImpl; import com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl; -public class SharedCDRContactInfoImpl - extends - ContactInfoBase -{ +public class SharedCDRContactInfoImpl extends ContactInfoBase { // This is only necessary for the pi.clientrequestinfo test. // It tests that request ids are different. // Rather than rewrite the test, just fake it. private static int requestId = 0; - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - public SharedCDRContactInfoImpl( - ORB orb, - ContactInfoList contactInfoList, - IOR effectiveTargetIOR, - short addressingDisposition) - { + public SharedCDRContactInfoImpl(ORB orb, ContactInfoList contactInfoList, IOR effectiveTargetIOR, short addressingDisposition) { this.orb = orb; this.contactInfoList = contactInfoList; this.effectiveTargetIOR = effectiveTargetIOR; this.addressingDisposition = addressingDisposition; } - public String getType() - { - throw wrapper.undefinedSocketinfoOperation() ; + public String getType() { + throw wrapper.undefinedSocketinfoOperation(); } - public String getHost() - { - throw wrapper.undefinedSocketinfoOperation() ; + public String getHost() { + throw wrapper.undefinedSocketinfoOperation(); } - public int getPort() - { - throw wrapper.undefinedSocketinfoOperation() ; + public int getPort() { + throw wrapper.undefinedSocketinfoOperation(); } - public ClientRequestDispatcher getClientRequestDispatcher() - { + public ClientRequestDispatcher getClientRequestDispatcher() { // REVISIT - use registry return new SharedCDRClientRequestDispatcherImpl(); } - public boolean isConnectionBased() - { + public boolean isConnectionBased() { return false; } - public boolean shouldCacheConnection() - { + public boolean shouldCacheConnection() { return false; } - public String getConnectionCacheType() - { + public String getConnectionCacheType() { throw wrapper.methodShouldNotBeCalled(); } - - public Connection createConnection() - { + + public Connection createConnection() { throw wrapper.methodShouldNotBeCalled(); } - // Called when client making an invocation. + // Called when client making an invocation. @Override - public MessageMediator createMessageMediator(ORB broker, - ContactInfo contactInfo, - Connection connection, - String methodName, - boolean isOneWay) - { + public MessageMediator createMessageMediator(ORB broker, ContactInfo contactInfo, Connection connection, String methodName, + boolean isOneWay) { if (connection != null) { - throw wrapper.connectionNotNullInCreateMessageMediator( connection ) ; + throw wrapper.connectionNotNullInCreateMessageMediator(connection); } - MessageMediator messageMediator = - new MessageMediatorImpl( - (ORB) broker, - (ContactInfo)contactInfo, - null, // Connection; - GIOPVersion.chooseRequestVersion( (ORB)broker, - effectiveTargetIOR), - effectiveTargetIOR, - requestId++, // Fake RequestId - getAddressingDisposition(), - methodName, - isOneWay); + MessageMediator messageMediator = new MessageMediatorImpl((ORB) broker, (ContactInfo) contactInfo, null, // Connection; + GIOPVersion.chooseRequestVersion((ORB) broker, effectiveTargetIOR), effectiveTargetIOR, requestId++, // Fake RequestId + getAddressingDisposition(), methodName, isOneWay); return messageMediator; } - public CDROutputObject createOutputObject(MessageMediator messageMediator) - { - MessageMediator corbaMessageMediator = (MessageMediator) - messageMediator; + public CDROutputObject createOutputObject(MessageMediator messageMediator) { + MessageMediator corbaMessageMediator = (MessageMediator) messageMediator; // NOTE: GROW. - CDROutputObject outputObject = - OutputStreamFactory.newCDROutputObject(orb, messageMediator, - corbaMessageMediator.getRequestHeader(), - corbaMessageMediator.getStreamFormatVersion(), - BufferManagerFactory.GROW); + CDROutputObject outputObject = OutputStreamFactory.newCDROutputObject(orb, messageMediator, corbaMessageMediator.getRequestHeader(), + corbaMessageMediator.getStreamFormatVersion(), BufferManagerFactory.GROW); messageMediator.setOutputObject(outputObject); return outputObject; } @@ -149,8 +114,7 @@ public CDROutputObject createOutputObject(MessageMediator messageMediator) // spi.transport.CorbaContactInfo // - public String getMonitoringName() - { + public String getMonitoringName() { throw wrapper.methodShouldNotBeCalled(); } @@ -163,24 +127,18 @@ public String getMonitoringName() // See SocketOrChannelContactInfoImpl.equals. // This calculation must be identical to SocketOrChannelContactInfoImpl. - private int hashCode = - SocketInfo.IIOP_CLEAR_TEXT.hashCode() + "localhost".hashCode() ^ -1; + private int hashCode = SocketInfo.IIOP_CLEAR_TEXT.hashCode() + "localhost".hashCode() ^ -1; - public int hashCode() - { + public int hashCode() { return hashCode; } - public boolean equals(Object obj) - { + public boolean equals(Object obj) { return obj instanceof SharedCDRContactInfoImpl; } - public String toString() - { - return - "SharedCDRContactInfoImpl[" - + "]"; + public String toString() { + return "SharedCDRContactInfoImpl[" + "]"; } ////////////////////////////////////////////////// diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SocketChannelReader.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SocketChannelReader.java index 1912f04b3..143e396f5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SocketChannelReader.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/SocketChannelReader.java @@ -34,8 +34,8 @@ public SocketChannelReader(ORB orb) { } /** - * Reads all currently available data from the socket channel, appending it to any data left - * from a previous read. + * Reads all currently available data from the socket channel, appending it to any data left from a previous read. + * * @param channel the channel from which to read * @param previouslyReadData the old data to read; note: all data up to the limit is considered valid. * @param minNeeded the minimum number of bytes that should be present in the buffer before returning @@ -85,7 +85,7 @@ private ByteBuffer prepareToAppendTo(ByteBuffer byteBuffer) { private ByteBuffer reallocateBuffer(ByteBuffer byteBuffer) { try { - return orb.getByteBufferPool().reAllocate(byteBuffer, 2*byteBuffer.capacity()); + return orb.getByteBufferPool().reAllocate(byteBuffer, 2 * byteBuffer.capacity()); } finally { byteBuffer.position(0); // reAllocate call above moves the position; move it back now in case we need it } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TcpTimeoutsImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TcpTimeoutsImpl.java index d96b05319..066f573d5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TcpTimeoutsImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TcpTimeoutsImpl.java @@ -21,31 +21,29 @@ import com.sun.corba.ee.spi.transport.TcpTimeouts; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** * @author Charlie Hunt * @author Ken Cavanaugh */ -public class TcpTimeoutsImpl implements TcpTimeouts -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +public class TcpTimeoutsImpl implements TcpTimeouts { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private final int initial_time_to_wait; private final int max_time_to_wait; private int backoff_factor; private final int max_single_wait_time; - public TcpTimeoutsImpl( String args ) { - String[] data = args.split( ":" ) ; + public TcpTimeoutsImpl(String args) { + String[] data = args.split(":"); if ((data.length < 3) || (data.length > 4)) { throw wrapper.badTimeoutDataLength(); } - initial_time_to_wait = parseArg( "initial_time_to_wait", data[0] ) ; - max_time_to_wait = parseArg( "max_time_to_wait", data[1] ) ; - setBackoffFactor( parseArg( "backoff_factor", data[2] ) ) ; + initial_time_to_wait = parseArg("initial_time_to_wait", data[0]); + max_time_to_wait = parseArg("max_time_to_wait", data[1]); + setBackoffFactor(parseArg("backoff_factor", data[2])); if (data.length == 4) { max_single_wait_time = parseArg("max_single_wait_time", data[3]); } else { @@ -53,55 +51,61 @@ public TcpTimeoutsImpl( String args ) { } } - public TcpTimeoutsImpl( int initial_time, int max_time, - int backoff_percent) { - this( initial_time, max_time, backoff_percent, Integer.MAX_VALUE ) ; + public TcpTimeoutsImpl(int initial_time, int max_time, int backoff_percent) { + this(initial_time, max_time, backoff_percent, Integer.MAX_VALUE); } - public TcpTimeoutsImpl( int initial_time, int max_time, - int backoff_percent, int max_single_wait_time ) { + public TcpTimeoutsImpl(int initial_time, int max_time, int backoff_percent, int max_single_wait_time) { this.initial_time_to_wait = initial_time; this.max_time_to_wait = max_time; - setBackoffFactor( backoff_percent ) ; - this.max_single_wait_time = max_single_wait_time ; + setBackoffFactor(backoff_percent); + this.max_single_wait_time = max_single_wait_time; } - private void setBackoffFactor( int backoff_percent ) { + private void setBackoffFactor(int backoff_percent) { // Avoiding floating point number. Timeout is obtained by // dividing by 100 after multiplying by backoff_factor. this.backoff_factor = 100 + backoff_percent; } - private int parseArg( String name, String value ) { + private int parseArg(String name, String value) { try { - int result = Integer.parseInt( value ) ; + int result = Integer.parseInt(value); if (result <= 0) { throw wrapper.badTimeoutStringData(value, name); } - return result ; + return result; } catch (NumberFormatException exc) { - throw wrapper.badTimeoutStringData( exc, value, name ) ; + throw wrapper.badTimeoutStringData(exc, value, name); } } - public int get_initial_time_to_wait() { return initial_time_to_wait; } + public int get_initial_time_to_wait() { + return initial_time_to_wait; + } - public int get_max_time_to_wait() { return max_time_to_wait; } + public int get_max_time_to_wait() { + return max_time_to_wait; + } - public int get_backoff_factor() { return backoff_factor; } + public int get_backoff_factor() { + return backoff_factor; + } - public int get_max_single_wait_time() { return max_single_wait_time; } + public int get_max_single_wait_time() { + return max_single_wait_time; + } public Waiter waiter() { return new Waiter() { // Use long so that arithmetic works correctly if // max_single_wait_time is set to Integer.MAX_VALUE. - private long current_wait = initial_time_to_wait ; - private long total_time = 0 ; + private long current_wait = initial_time_to_wait; + private long total_time = 0; public void advance() { if (current_wait != max_single_wait_time) { - current_wait = (current_wait * backoff_factor) / 100 ; + current_wait = (current_wait * backoff_factor) / 100; if (current_wait > max_single_wait_time) { current_wait = max_single_wait_time; } @@ -109,23 +113,23 @@ public void advance() { } public void reset() { - current_wait = initial_time_to_wait ; + current_wait = initial_time_to_wait; } public int getTime() { - return (int)current_wait ; + return (int) current_wait; } public int getTimeForSleep() { - int result = (int)current_wait ; + int result = (int) current_wait; if (total_time < max_time_to_wait) { total_time += current_wait; } - return result ; + return result; } public int timeWaiting() { - return (int)total_time ; + return (int) total_time; } public boolean sleepTime() { @@ -134,35 +138,31 @@ public boolean sleepTime() { } try { - Thread.sleep( getTimeForSleep() ) ; - return true ; + Thread.sleep(getTimeForSleep()); + return true; } catch (InterruptedException exc) { // this happens so rarely that we will - // ignore it. Just log at FINE level. - wrapper.interruptedExceptionInTimeout() ; + // ignore it. Just log at FINE level. + wrapper.interruptedExceptionInTimeout(); } // actually unreachable, but the compiler doesn't know that - return false ; + return false; } public boolean isExpired() { - return total_time >= max_time_to_wait ; + return total_time >= max_time_to_wait; } - } ; + }; } @Override public String toString() { - return "TcpTimeoutsImpl[" - + initial_time_to_wait + ":" - + max_time_to_wait + ":" - + backoff_factor + ":" - + max_single_wait_time + "]" ; + return "TcpTimeoutsImpl[" + initial_time_to_wait + ":" + max_time_to_wait + ":" + backoff_factor + ":" + max_single_wait_time + "]"; } @Override - public boolean equals( Object obj ) { + public boolean equals(Object obj) { if (obj == this) { return true; } @@ -171,18 +171,15 @@ public boolean equals( Object obj ) { return false; } - TcpTimeouts other = (TcpTimeouts)obj ; + TcpTimeouts other = (TcpTimeouts) obj; - return (initial_time_to_wait == other.get_initial_time_to_wait()) && - (max_time_to_wait == other.get_max_time_to_wait()) && - (backoff_factor == other.get_backoff_factor()) && - (max_single_wait_time == other.get_max_single_wait_time()) ; + return (initial_time_to_wait == other.get_initial_time_to_wait()) && (max_time_to_wait == other.get_max_time_to_wait()) + && (backoff_factor == other.get_backoff_factor()) && (max_single_wait_time == other.get_max_single_wait_time()); } @Override public int hashCode() { - return initial_time_to_wait ^ max_time_to_wait ^ - backoff_factor ^ max_single_wait_time ; + return initial_time_to_wait ^ max_time_to_wait ^ backoff_factor ^ max_single_wait_time; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelector.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelector.java index b5727cf95..1ac54cfe2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelector.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelector.java @@ -29,14 +29,17 @@ /** * * Encapsulates a temporary Selector and temporary Selector state + * * @author Charlie Hunt */ public class TemporarySelector { - + private TemporarySelectorState itsState; private Selector itsSelector; - /** Creates a new instance of TemporarySelector + /** + * Creates a new instance of TemporarySelector + * * @param theSelectableChannel channel to select * @throws java.io.IOException If an I/O error occurs */ @@ -44,78 +47,59 @@ public TemporarySelector(SelectableChannel theSelectableChannel) throws IOExcept itsSelector = theSelectableChannel.provider().openSelector(); itsState = new TemporarySelectorStateOpen(); } - + /** - * NOTE: There is a potential for a situation, (albeit very remote), that - * some other thread may be initiating an explicit "close" of a - * Connection (if someone overrides the implementation of - * SocketOrChannelConnectionImpl and an explicit call to "close" - * the Connection), that call to close the Connection may also - * attempt to close a TemporarySelector. If that TemporarySelector - * is currently in the select(long theTimeout), then the closing - * of that TemporarySelector will not occur until the - * select(long theTimeout) method exits, (i.e. maximum blocking wait - * time for the close will be theTimeout milliseconds which by - * default is 2000 milliseconds).

    - * This artifact occurs as a result of the TemporarySelector's - * select() and close() operations being atomic operations. - * However, this potential issue does not exist in the current - * implementation of SocketOrChannelConnectionImpl. It may arise - * if someone chooses to extend the implementation of the - * SocketOrChannelConnectionImpl and make explicit calls to - * close the Connection. An example of this potential scenario - * can be found in the "no connection cache" plug-in implementation. - * To avoid this potential scenario, the "no connection - * cache" plug-in disables the read optimization to always - * enter a blocking read. - * @see com.sun.corba.ee.impl.plugin.hwlb.NoConnectionCacheImpl - * NoConnectionCacheImpl to see how the 'always enter blocking - * read' optimization is disabled. - * @param theTimeout If positive, block for up to theTimeout milliseconds, more or less, while waiting for a SelectableChannel to become ready; - * must be greater than 0 in value + * NOTE: There is a potential for a situation, (albeit very remote), that some other thread may be initiating an + * explicit "close" of a Connection (if someone overrides the implementation of SocketOrChannelConnectionImpl and an + * explicit call to "close" the Connection), that call to close the Connection may also attempt to close a + * TemporarySelector. If that TemporarySelector is currently in the select(long theTimeout), then the closing of that + * TemporarySelector will not occur until the select(long theTimeout) method exits, (i.e. maximum blocking wait time for + * the close will be theTimeout milliseconds which by default is 2000 milliseconds). + *

    + * This artifact occurs as a result of the TemporarySelector's select() and close() operations being atomic operations. + * However, this potential issue does not exist in the current implementation of SocketOrChannelConnectionImpl. It may + * arise if someone chooses to extend the implementation of the SocketOrChannelConnectionImpl and make explicit calls to + * close the Connection. An example of this potential scenario can be found in the "no connection cache" plug-in + * implementation. To avoid this potential scenario, the "no connection cache" plug-in disables the read optimization to + * always enter a blocking read. + * + * @see com.sun.corba.ee.impl.plugin.hwlb.NoConnectionCacheImpl NoConnectionCacheImpl to see how the 'always enter + * blocking read' optimization is disabled. + * @param theTimeout If positive, block for up to theTimeout milliseconds, more or less, while waiting for a + * SelectableChannel to become ready; must be greater than 0 in value * @return The number of keys, possibly zero, whose ready-operation sets was updated. * @throws java.io.IOException If an I/O error occurs */ synchronized public int select(long theTimeout) throws IOException { return itsState.select(itsSelector, theTimeout); } - + synchronized public SelectionKey registerChannel(SelectableChannel theSelectableChannel, int theOps) throws IOException { return itsState.registerChannel(itsSelector, theSelectableChannel, theOps); } - + /** - * NOTE: There is a potential for a situation, (albiet very remote), that - * some other thread may be in this TemporarySelector's select() - * method while another thread is trying to call this "close" method - * as a result of an explicit close of a Connection (if someone - * overrides the implementation of SocketOrChannelConnectionImpl - * and makes an explicit call to "close" the Connection), that call - * to close the Connection may also attempt to call this close method. - * If that other thread is currently in this TemporarySelector's - * select(long theTimeout) method, then the call to this close method - * will block until the select(long theTimeout) method exits, (i.e. - * maximum blocking wait time for this close will be theTimeout - * milliseconds which by default is 2000 milliseconds). - * This artifact occurs as a result of the TemporarySelector's - * select() and close() operations being atomic operations. - * However, this potential issue does not exist in the current - * implementation of SocketOrChannelConnectionImpl. It may arise - * if someone chooses to extend the implementation of the - * SocketOrChannelConnectionImpl and make explicit calls to - * close the Connection. An example of this potential scenario - * exists in the "no connection cache" plug-in. To avoid this - * scenario, the "no connection cache" plug-in disables the read - * optimization to always enter a blocking read. - * See com.sun.corba.ee.impl.plugin.hwlb.NoConnectionCacheImpl.java - * to see how the 'always enter blocking read' optimization is - * disabled. + * NOTE: There is a potential for a situation, (albiet very remote), that some other thread may be in this + * TemporarySelector's select() method while another thread is trying to call this "close" method as a result of an + * explicit close of a Connection (if someone overrides the implementation of SocketOrChannelConnectionImpl and makes an + * explicit call to "close" the Connection), that call to close the Connection may also attempt to call this close + * method. If that other thread is currently in this TemporarySelector's select(long theTimeout) method, then the call + * to this close method will block until the select(long theTimeout) method exits, (i.e. maximum blocking wait time for + * this close will be theTimeout milliseconds which by default is 2000 milliseconds). This artifact occurs as a result + * of the TemporarySelector's select() and close() operations being atomic operations. However, this potential issue + * does not exist in the current implementation of SocketOrChannelConnectionImpl. It may arise if someone chooses to + * extend the implementation of the SocketOrChannelConnectionImpl and make explicit calls to close the Connection. An + * example of this potential scenario exists in the "no connection cache" plug-in. To avoid this scenario, the "no + * connection cache" plug-in disables the read optimization to always enter a blocking read. See + * com.sun.corba.ee.impl.plugin.hwlb.NoConnectionCacheImpl.java to see how the 'always enter blocking read' optimization + * is disabled. + * * @throws java.io.IOException If an I/O error occurs */ synchronized public void close() throws IOException { itsState = itsState.close(itsSelector); } - + synchronized public void removeSelectedKey(SelectionKey theSelectionKey) throws IOException { itsState = itsState.removeSelectedKey(itsSelector, theSelectionKey); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorClosedException.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorClosedException.java index d6234bda8..6ae9c9fc4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorClosedException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorClosedException.java @@ -23,13 +23,16 @@ /** * - * Thrown when an operation is performed on a TemporarySelector which - * is not allowed as a result of the current state of a TemporarySelector. + * Thrown when an operation is performed on a TemporarySelector which is not allowed as a result of the current state of + * a TemporarySelector. + * * @author Charlie Hunt */ public class TemporarySelectorClosedException extends IOException { - - /** Creates a new instance of TemporarySelectorClosedException + + /** + * Creates a new instance of TemporarySelectorClosedException + * * @param theMessage The details message */ public TemporarySelectorClosedException(String theMessage) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorStateClosed.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorStateClosed.java index a35584193..ef6aee197 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorStateClosed.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorStateClosed.java @@ -46,26 +46,17 @@ public TemporarySelectorStateClosed() { public int select(Selector theSelector, long theTimeout) throws IOException { String selectorToString = getSelectorToString(theSelector); - throw new TemporarySelectorClosedException("Temporary Selector " + - selectorToString + - " closed"); + throw new TemporarySelectorClosedException("Temporary Selector " + selectorToString + " closed"); } - public SelectionKey registerChannel(Selector theSelector, - SelectableChannel theSelectableChannel, - int theOps) throws IOException { + public SelectionKey registerChannel(Selector theSelector, SelectableChannel theSelectableChannel, int theOps) throws IOException { String selectorToString = getSelectorToString(theSelector); - throw new TemporarySelectorClosedException("Temporary Selector " + - selectorToString + - " closed"); + throw new TemporarySelectorClosedException("Temporary Selector " + selectorToString + " closed"); } - public TemporarySelectorState cancelKeyAndFlushSelector(Selector theSelector, - SelectionKey theSelectionKey) throws IOException { + public TemporarySelectorState cancelKeyAndFlushSelector(Selector theSelector, SelectionKey theSelectionKey) throws IOException { String selectorToString = getSelectorToString(theSelector); - throw new TemporarySelectorClosedException("Temporary Selector " + - selectorToString + - " closed"); + throw new TemporarySelectorClosedException("Temporary Selector " + selectorToString + " closed"); } @Transport @@ -76,12 +67,9 @@ public TemporarySelectorState close(Selector theSelector) throws IOException { return this; } - public TemporarySelectorState removeSelectedKey(Selector theSelector, - SelectionKey theSelectionKey) throws IOException { + public TemporarySelectorState removeSelectedKey(Selector theSelector, SelectionKey theSelectionKey) throws IOException { String selectorToString = getSelectorToString(theSelector); - throw new TemporarySelectorClosedException("Temporary Selector " + - selectorToString + - " closed"); + throw new TemporarySelectorClosedException("Temporary Selector " + selectorToString + " closed"); } private String getSelectorToString(Selector theSelector) { diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorStateOpen.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorStateOpen.java index c9ebe105f..606e13e43 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorStateOpen.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TemporarySelectorStateOpen.java @@ -40,8 +40,7 @@ */ @Transport public class TemporarySelectorStateOpen implements TemporarySelectorState { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; /** Creates a new instance of TemporarySelectorStateOpen */ public TemporarySelectorStateOpen() { @@ -54,35 +53,29 @@ public int select(Selector theSelector, long theTimeout) throws IOException { if (theTimeout > 0) { result = theSelector.select(theTimeout); } else { - throw wrapper.temporarySelectorSelectTimeoutLessThanOne( - theSelector, theTimeout); + throw wrapper.temporarySelectorSelectTimeoutLessThanOne(theSelector, theTimeout); } } else { - throw new TemporarySelectorClosedException( - "Selector " + theSelector.toString() + " is closed."); + throw new TemporarySelectorClosedException("Selector " + theSelector.toString() + " is closed."); } return result; } @Transport - public SelectionKey registerChannel(Selector theSelector, - SelectableChannel theSelectableChannel, int theOps) throws IOException { + public SelectionKey registerChannel(Selector theSelector, SelectableChannel theSelectableChannel, int theOps) throws IOException { SelectionKey key; if (theSelector.isOpen()) { key = theSelectableChannel.register(theSelector, theOps); } else { - throw new TemporarySelectorClosedException("Selector " + - theSelector.toString() + - " is closed."); + throw new TemporarySelectorClosedException("Selector " + theSelector.toString() + " is closed."); } return key; } @Transport - public TemporarySelectorState cancelKeyAndFlushSelector(Selector theSelector, - SelectionKey theSelectionKey) throws IOException { + public TemporarySelectorState cancelKeyAndFlushSelector(Selector theSelector, SelectionKey theSelectionKey) throws IOException { if (theSelectionKey != null) { theSelectionKey.cancel(); @@ -91,8 +84,8 @@ public TemporarySelectorState cancelKeyAndFlushSelector(Selector theSelector, if (theSelector.isOpen()) { theSelector.selectNow(); } else { - throw new TemporarySelectorClosedException( - "Selector " + theSelector.toString() + " is closed."); } + throw new TemporarySelectorClosedException("Selector " + theSelector.toString() + " is closed."); + } return this; } @@ -104,14 +97,11 @@ public TemporarySelectorState close(Selector theSelector) throws IOException { } @Transport - public TemporarySelectorState removeSelectedKey(Selector theSelector, - SelectionKey theSelectionKey) throws IOException { + public TemporarySelectorState removeSelectedKey(Selector theSelector, SelectionKey theSelectionKey) throws IOException { if (theSelector.isOpen()) { theSelector.selectedKeys().remove(theSelectionKey); } else { - throw new TemporarySelectorClosedException("Selector " + - theSelector.toString() + - " is closed."); + throw new TemporarySelectorClosedException("Selector " + theSelector.toString() + " is closed."); } return this; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/Timeoutable.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/Timeoutable.java index e0cda4332..d3dc2bfc2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/Timeoutable.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/Timeoutable.java @@ -26,6 +26,7 @@ public interface Timeoutable { /** * Checks to see if a timeout has occurred. + * * @param timeSinceLastActivity the time in msec since the last activity for this action. */ void checkForTimeout(long timeSinceLastActivity); diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TransportManagerImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TransportManagerImpl.java index c8e2653ad..f1a70e7e4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TransportManagerImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/TransportManagerImpl.java @@ -46,8 +46,8 @@ import com.sun.corba.ee.spi.transport.InboundConnectionCache; import com.sun.corba.ee.spi.transport.OutboundConnectionCache; -import org.glassfish.external.probe.provider.StatsProviderManager ; -import org.glassfish.external.probe.provider.PluginPoint ; +import org.glassfish.external.probe.provider.StatsProviderManager; +import org.glassfish.external.probe.provider.PluginPoint; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; /** @@ -56,56 +56,43 @@ // Note that no ObjectKeyName attribute is needed, because there is only // one CorbaTransportManager per ORB. @Transport -public class TransportManagerImpl - implements - TransportManager -{ +public class TransportManagerImpl implements TransportManager { protected ORB orb; protected List acceptors; - protected final Map outboundConnectionCaches; - protected final Map inboundConnectionCaches; + protected final Map outboundConnectionCaches; + protected final Map inboundConnectionCaches; protected Selector selector; - - public TransportManagerImpl(ORB orb) - { + + public TransportManagerImpl(ORB orb) { this.orb = orb; acceptors = new ArrayList(); - outboundConnectionCaches = new HashMap(); - inboundConnectionCaches = new HashMap(); + outboundConnectionCaches = new HashMap(); + inboundConnectionCaches = new HashMap(); selector = new SelectorImpl(orb); - orb.mom().register( orb, this ) ; + orb.mom().register(orb, this); } - public ByteBufferPool getByteBufferPool(int id) - { - throw new RuntimeException(); + public ByteBufferPool getByteBufferPool(int id) { + throw new RuntimeException(); } - public OutboundConnectionCache getOutboundConnectionCache( - ContactInfo contactInfo) - { + public OutboundConnectionCache getOutboundConnectionCache(ContactInfo contactInfo) { synchronized (contactInfo) { if (contactInfo.getConnectionCache() == null) { OutboundConnectionCache connectionCache = null; synchronized (outboundConnectionCaches) { - connectionCache = outboundConnectionCaches.get( - contactInfo.getConnectionCacheType()); + connectionCache = outboundConnectionCaches.get(contactInfo.getConnectionCacheType()); if (connectionCache == null) { // REVISIT: Would like to be able to configure // the connection cache type used. - connectionCache = - new OutboundConnectionCacheImpl(orb, - contactInfo); + connectionCache = new OutboundConnectionCacheImpl(orb, contactInfo); // We need to clean up the multi-cache support: // this really only works with a single cache. - orb.mom().register( this, connectionCache ) ; - StatsProviderManager.register( "orb", PluginPoint.SERVER, - "orb/transport/connectioncache/outbound", connectionCache ) ; + orb.mom().register(this, connectionCache); + StatsProviderManager.register("orb", PluginPoint.SERVER, "orb/transport/connectioncache/outbound", connectionCache); - outboundConnectionCaches.put( - contactInfo.getConnectionCacheType(), - connectionCache); + outboundConnectionCaches.put(contactInfo.getConnectionCacheType(), connectionCache); } } contactInfo.setConnectionCache(connectionCache); @@ -114,38 +101,28 @@ public OutboundConnectionCache getOutboundConnectionCache( } } - public Collection getOutboundConnectionCaches() - { + public Collection getOutboundConnectionCaches() { return outboundConnectionCaches.values(); } - public Collection getInboundConnectionCaches() - { + public Collection getInboundConnectionCaches() { return inboundConnectionCaches.values(); } - public InboundConnectionCache getInboundConnectionCache( - Acceptor acceptor) - { + public InboundConnectionCache getInboundConnectionCache(Acceptor acceptor) { synchronized (acceptor) { if (acceptor.getConnectionCache() == null) { InboundConnectionCache connectionCache = null; synchronized (inboundConnectionCaches) { - connectionCache = inboundConnectionCaches.get( - acceptor.getConnectionCacheType()); + connectionCache = inboundConnectionCaches.get(acceptor.getConnectionCacheType()); if (connectionCache == null) { // REVISIT: Would like to be able to configure // the connection cache type used. - connectionCache = - new InboundConnectionCacheImpl(orb, - acceptor); - orb.mom().register( this, connectionCache ) ; - StatsProviderManager.register( "orb", PluginPoint.SERVER, - "orb/transport/connectioncache/inbound", connectionCache ) ; - - inboundConnectionCaches.put( - acceptor.getConnectionCacheType(), - connectionCache); + connectionCache = new InboundConnectionCacheImpl(orb, acceptor); + orb.mom().register(this, connectionCache); + StatsProviderManager.register("orb", PluginPoint.SERVER, "orb/transport/connectioncache/inbound", connectionCache); + + inboundConnectionCaches.put(acceptor.getConnectionCacheType(), connectionCache); } } acceptor.setConnectionCache(connectionCache); @@ -155,11 +132,10 @@ public InboundConnectionCache getInboundConnectionCache( } public Selector getSelector() { - return selector ; + return selector; } - public Selector getSelector(int id) - { + public Selector getSelector(int id) { return selector; } @@ -174,15 +150,14 @@ public synchronized void unregisterAcceptor(Acceptor acceptor) { } @Transport - public void close() - { + public void close() { for (OutboundConnectionCache cc : outboundConnectionCaches.values()) { - StatsProviderManager.unregister( cc ) ; - cc.close() ; + StatsProviderManager.unregister(cc); + cc.close(); } for (InboundConnectionCache cc : inboundConnectionCaches.values()) { - StatsProviderManager.unregister( cc ) ; - cc.close() ; + StatsProviderManager.unregister(cc); + cc.close(); } getSelector(0).close(); } @@ -193,26 +168,24 @@ public void close() // public Collection getAcceptors() { - return getAcceptors( null, null ) ; + return getAcceptors(null, null); } @InfoMethod - private void display( String msg ) { } + private void display(String msg) { + } @Transport - public Collection getAcceptors(String objectAdapterManagerId, - ObjectAdapterId objectAdapterId) - { + public Collection getAcceptors(String objectAdapterManagerId, ObjectAdapterId objectAdapterId) { // REVISIT - need to filter based on arguments. // REVISIT - initialization will be moved to OA. // Lazy initialization of acceptors. for (Acceptor acc : acceptors) { if (acc.initialize()) { - display( "initializing acceptors" ) ; + display("initializing acceptors"); if (acc.shouldRegisterAcceptEvent()) { - orb.getTransportManager().getSelector(0) - .registerForEvent(acc.getEventHandler()); + orb.getTransportManager().getSelector(0).registerForEvent(acc.getEventHandler()); } } } @@ -221,31 +194,23 @@ public Collection getAcceptors(String objectAdapterManagerId, // REVISIT - POA specific policies @Transport - public void addToIORTemplate(IORTemplate iorTemplate, - Policies policies, - String codebase, - String objectAdapterManagerId, - ObjectAdapterId objectAdapterId) - { - Iterator iterator = - getAcceptors(objectAdapterManagerId, objectAdapterId).iterator(); + public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, String codebase, String objectAdapterManagerId, + ObjectAdapterId objectAdapterId) { + Iterator iterator = getAcceptors(objectAdapterManagerId, objectAdapterId).iterator(); while (iterator.hasNext()) { Acceptor acceptor = (Acceptor) iterator.next(); acceptor.addToIORTemplate(iorTemplate, policies, codebase); } } - private ThreadLocal currentMessageTraceManager = - new ThreadLocal() { - public Object initialValue() - { - return new MessageTraceManagerImpl( ) ; - } - } ; + private ThreadLocal currentMessageTraceManager = new ThreadLocal() { + public Object initialValue() { + return new MessageTraceManagerImpl(); + } + }; - public MessageTraceManager getMessageTraceManager() - { - return (MessageTraceManager)(currentMessageTraceManager.get()) ; + public MessageTraceManager getMessageTraceManager() { + return (MessageTraceManager) (currentMessageTraceManager.get()); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueBlockingImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueBlockingImpl.java index ee09fab39..88e9ffd82 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueBlockingImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueBlockingImpl.java @@ -17,159 +17,158 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.transport.concurrent ; +package com.sun.corba.ee.impl.transport.concurrent; -import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue ; +import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue; public class ConcurrentQueueBlockingImpl implements ConcurrentQueue { // This implementation of ConcurrentQueue uses a single lock, which must be - // acquired to update the list. Every operation on this class updates the + // acquired to update the list. Every operation on this class updates the // structure, so read/write locking is probably not useful. // // Trying to build a lock-free implementation runs into the usual problems: // we need to atomically update more than one location at a time in the structure. // Short of a transactional memory implementation, we would either need a complicated // implementation implementing recursive fixup, or something like the Ladan-Mozes and - // Shavit algorithm (see "An Optimistic Approach to Lock-Free FIFO Queues" + // Shavit algorithm (see "An Optimistic Approach to Lock-Free FIFO Queues" // at http://people.csail.mit.edu/edya/publications/publicationsAndPatents.htm) - // that delays fixing up one direction in a double linked list. However, that + // that delays fixing up one direction in a double linked list. However, that // algorithm does not consider general deletion, and I don't know whether that // capability can be easily added or not. // Any of these approaches are quite complicated, and so we won't go there yet. // As always, first make it work, then make it fast(er), but only if necessary. - // + // // Structure: Head points to a node containing a null value, which is a special marker. - // head.next is the first element, head.prev is the last. The queue is empty if + // head.next is the first element, head.prev is the last. The queue is empty if // head.next == head.prev == head. - final Entry head = new Entry( null, 0 ) ; - final Object lock = new Object() ; - int count = 0 ; - private long ttl ; - - public ConcurrentQueueBlockingImpl( long ttl ) { - head.next = head ; - head.prev = head ; - this.ttl = ttl ; + final Entry head = new Entry(null, 0); + final Object lock = new Object(); + int count = 0; + private long ttl; + + public ConcurrentQueueBlockingImpl(long ttl) { + head.next = head; + head.prev = head; + this.ttl = ttl; } private final class Entry { - Entry next = null ; - Entry prev = null ; - private HandleImpl handle ; - private long expiration ; - - Entry( V value, long expiration ) { - handle = new HandleImpl( this, value, expiration ) ; - this.expiration = expiration ; + Entry next = null; + Entry prev = null; + private HandleImpl handle; + private long expiration; + + Entry(V value, long expiration) { + handle = new HandleImpl(this, value, expiration); + this.expiration = expiration; } HandleImpl handle() { - return handle ; + return handle; } } private final class HandleImpl implements Handle { - private Entry entry ; - private final V value ; - private boolean valid ; - private long expiration ; - - HandleImpl( Entry entry, V value, long expiration ) { - this.entry = entry ; - this.value = value ; - this.valid = true ; - this.expiration = expiration ; + private Entry entry; + private final V value; + private boolean valid; + private long expiration; + + HandleImpl(Entry entry, V value, long expiration) { + this.entry = entry; + this.value = value; + this.valid = true; + this.expiration = expiration; } Entry entry() { - return entry ; + return entry; } public V value() { - return value ; + return value; } - /** Delete the element corresponding to this handle - * from the queue. Takes constant time. + /** + * Delete the element corresponding to this handle from the queue. Takes constant time. */ public boolean remove() { synchronized (lock) { if (!valid) { - return false ; + return false; } - valid = false ; + valid = false; - entry.next.prev = entry.prev ; - entry.prev.next = entry.next ; - count-- ; + entry.next.prev = entry.prev; + entry.prev.next = entry.next; + count--; } - entry.prev = null ; - entry.next = null ; - entry.handle = null ; - entry = null ; - valid = false ; - return true ; + entry.prev = null; + entry.next = null; + entry.handle = null; + entry = null; + valid = false; + return true; } public long expiration() { - return expiration ; + return expiration; } } public int size() { synchronized (lock) { - return count ; + return count; } } - /** Add a new element to the tail of the queue. - * Returns a handle for the element in the queue. + /** + * Add a new element to the tail of the queue. Returns a handle for the element in the queue. */ - public Handle offer( V arg ) { + public Handle offer(V arg) { if (arg == null) - throw new IllegalArgumentException( "Argument cannot be null" ) ; + throw new IllegalArgumentException("Argument cannot be null"); + + Entry entry = new Entry(arg, System.currentTimeMillis() + ttl); - Entry entry = new Entry( arg, System.currentTimeMillis() + ttl ) ; - synchronized (lock) { - entry.next = head ; - entry.prev = head.prev ; - head.prev.next = entry ; - head.prev = entry ; - count++ ; + entry.next = head; + entry.prev = head.prev; + head.prev.next = entry; + head.prev = entry; + count++; } - return entry.handle() ; + return entry.handle(); } - /** Return an element from the head of the queue. - * The element is removed from the queue. + /** + * Return an element from the head of the queue. The element is removed from the queue. */ public Handle poll() { - Entry first = null ; + Entry first = null; synchronized (lock) { - first = head.next ; + first = head.next; if (first == head) - return null ; + return null; else { - final Handle result = first.handle() ; - result.remove() ; - return result ; + final Handle result = first.handle(); + result.remove(); + return result; } } } public Handle peek() { synchronized (lock) { - Entry first = head.next ; - if (first == head) - return null ; + Entry first = head.next; + if (first == head) + return null; else - return first.handle() ; + return first.handle(); } } -} - +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueImpl.java index 36998da48..0e522ec52 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueImpl.java @@ -17,134 +17,134 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.transport.concurrent ; +package com.sun.corba.ee.impl.transport.concurrent; -import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue ; +import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue; public class ConcurrentQueueImpl implements ConcurrentQueue { // This implementation of ConcurrentQueue is unsynchronized, for use in // other implementations that manage concurrency with locks. // // Structure: Head points to a node containing a null value, which is a special marker. - // head.next is the first element, head.prev is the last. The queue is empty if + // head.next is the first element, head.prev is the last. The queue is empty if // head.next == head.prev == head. - final Entry head = new Entry( null, 0 ) ; - int count = 0 ; - private long ttl ; - - public ConcurrentQueueImpl( long ttl ) { - head.next = head ; - head.prev = head ; - this.ttl = ttl ; + final Entry head = new Entry(null, 0); + int count = 0; + private long ttl; + + public ConcurrentQueueImpl(long ttl) { + head.next = head; + head.prev = head; + this.ttl = ttl; } private final class Entry { - Entry next = null ; - Entry prev = null ; - private HandleImpl handle ; - private long expiration ; - - Entry( V value, long expiration ) { - handle = new HandleImpl( this, value, expiration ) ; - this.expiration = expiration ; + Entry next = null; + Entry prev = null; + private HandleImpl handle; + private long expiration; + + Entry(V value, long expiration) { + handle = new HandleImpl(this, value, expiration); + this.expiration = expiration; } HandleImpl handle() { - return handle ; + return handle; } } private final class HandleImpl implements Handle { - private Entry entry ; - private final V value ; - private boolean valid ; - private long expiration ; - - HandleImpl( Entry entry, V value, long expiration ) { - this.entry = entry ; - this.value = value ; - this.valid = true ; - this.expiration = expiration ; + private Entry entry; + private final V value; + private boolean valid; + private long expiration; + + HandleImpl(Entry entry, V value, long expiration) { + this.entry = entry; + this.value = value; + this.valid = true; + this.expiration = expiration; } Entry entry() { - return entry ; + return entry; } public V value() { - return value ; + return value; } - /** Delete the element corresponding to this handle - * from the queue. Takes constant time. + /** + * Delete the element corresponding to this handle from the queue. Takes constant time. */ public boolean remove() { if (!valid) { - return false ; + return false; } - valid = false ; + valid = false; - entry.next.prev = entry.prev ; - entry.prev.next = entry.next ; - count-- ; + entry.next.prev = entry.prev; + entry.prev.next = entry.next; + count--; - entry.prev = null ; - entry.next = null ; - entry.handle = null ; - entry = null ; - valid = false ; - return true ; + entry.prev = null; + entry.next = null; + entry.handle = null; + entry = null; + valid = false; + return true; } public long expiration() { - return expiration ; + return expiration; } } public int size() { - return count ; + return count; } - /** Add a new element to the tail of the queue. - * Returns a handle for the element in the queue. + /** + * Add a new element to the tail of the queue. Returns a handle for the element in the queue. */ - public Handle offer( V arg ) { + public Handle offer(V arg) { if (arg == null) - throw new IllegalArgumentException( "Argument cannot be null" ) ; + throw new IllegalArgumentException("Argument cannot be null"); - Entry entry = new Entry( arg, System.currentTimeMillis() + ttl ) ; - - entry.next = head ; - entry.prev = head.prev ; - head.prev.next = entry ; - head.prev = entry ; - count++ ; + Entry entry = new Entry(arg, System.currentTimeMillis() + ttl); - return entry.handle() ; + entry.next = head; + entry.prev = head.prev; + head.prev.next = entry; + head.prev = entry; + count++; + + return entry.handle(); } - /** Return an element from the head of the queue. - * The element is removed from the queue. + /** + * Return an element from the head of the queue. The element is removed from the queue. */ public Handle poll() { - Entry first = null ; + Entry first = null; - first = head.next ; + first = head.next; if (first == head) { - return null ; + return null; } - final Handle result = first.handle() ; - result.remove() ; - return result ; + final Handle result = first.handle(); + result.remove(); + return result; } public Handle peek() { - Entry first = head.next ; - if (first == head) - return null ; + Entry first = head.next; + if (first == head) + return null; else - return first.handle() ; + return first.handle(); } -} +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueNonBlockingImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueNonBlockingImpl.java index 56bf48240..fc3a908a8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueNonBlockingImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/ConcurrentQueueNonBlockingImpl.java @@ -17,9 +17,9 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.impl.transport.concurrent ; +package com.sun.corba.ee.impl.transport.concurrent; -import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue ; +import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue; public class ConcurrentQueueNonBlockingImpl implements ConcurrentQueue { // This implementation of ConcurrentQueue uses a non-blocking algorithm (TBD). @@ -29,146 +29,145 @@ public class ConcurrentQueueNonBlockingImpl implements ConcurrentQueue { // we need to atomically update more than one location at a time in the structure. // Short of a transactional memory implementation, we would either need a complicated // implementation implementing recursive fixup, or something like the Ladan-Mozes and - // Shavit algorithm (see "An Optimistic Approach to Lock-Free FIFO Queues" + // Shavit algorithm (see "An Optimistic Approach to Lock-Free FIFO Queues" // at http://people.csail.mit.edu/edya/publications/publicationsAndPatents.htm) - // that delays fixing up one direction in a double linked list. However, that + // that delays fixing up one direction in a double linked list. However, that // algorithm does not consider general deletion, and I don't know whether that // capability can be easily added or not. // Any of these approaches are quite complicated, and so we won't go there yet. // As always, first make it work, then make it fast(er), but only if necessary. - // + // // Structure: Head points to a node containing a null value, which is a special marker. - // head.next is the first element, head.prev is the last. The queue is empty if + // head.next is the first element, head.prev is the last. The queue is empty if // head.next == head.prev == head. - final Entry head = new Entry( null, 0 ) ; - final Object lock = new Object() ; - int count = 0 ; - private long ttl ; - - public ConcurrentQueueNonBlockingImpl( long ttl ) { - head.next = head ; - head.prev = head ; - this.ttl = ttl ; + final Entry head = new Entry(null, 0); + final Object lock = new Object(); + int count = 0; + private long ttl; + + public ConcurrentQueueNonBlockingImpl(long ttl) { + head.next = head; + head.prev = head; + this.ttl = ttl; } private final class Entry { - Entry next = null ; - Entry prev = null ; - private HandleImpl handle ; - private long expiration ; - - Entry( V value, long expiration ) { - handle = new HandleImpl( this, value, expiration ) ; - this.expiration = expiration ; + Entry next = null; + Entry prev = null; + private HandleImpl handle; + private long expiration; + + Entry(V value, long expiration) { + handle = new HandleImpl(this, value, expiration); + this.expiration = expiration; } HandleImpl handle() { - return handle ; + return handle; } } private final class HandleImpl implements Handle { - private Entry entry ; - private final V value ; - private boolean valid ; - private long expiration ; - - HandleImpl( Entry entry, V value, long expiration ) { - this.entry = entry ; - this.value = value ; - this.valid = true ; - this.expiration = expiration ; + private Entry entry; + private final V value; + private boolean valid; + private long expiration; + + HandleImpl(Entry entry, V value, long expiration) { + this.entry = entry; + this.value = value; + this.valid = true; + this.expiration = expiration; } Entry entry() { - return entry ; + return entry; } public V value() { - return value ; + return value; } - /** Delete the element corresponding to this handle - * from the queue. Takes constant time. + /** + * Delete the element corresponding to this handle from the queue. Takes constant time. */ public boolean remove() { synchronized (lock) { if (!valid) { - return false ; + return false; } - valid = false ; + valid = false; - entry.next.prev = entry.prev ; - entry.prev.next = entry.next ; - count-- ; + entry.next.prev = entry.prev; + entry.prev.next = entry.next; + count--; } - entry.prev = null ; - entry.next = null ; - entry.handle = null ; - entry = null ; - valid = false ; - return true ; + entry.prev = null; + entry.next = null; + entry.handle = null; + entry = null; + valid = false; + return true; } public long expiration() { - return expiration ; + return expiration; } } public int size() { synchronized (lock) { - return count ; + return count; } } - /** Add a new element to the tail of the queue. - * Returns a handle for the element in the queue. + /** + * Add a new element to the tail of the queue. Returns a handle for the element in the queue. */ - public Handle offer( V arg ) { + public Handle offer(V arg) { if (arg == null) - throw new IllegalArgumentException( "Argument cannot be null" ) ; + throw new IllegalArgumentException("Argument cannot be null"); + + Entry entry = new Entry(arg, System.currentTimeMillis() + ttl); - Entry entry = new Entry( arg, System.currentTimeMillis() + ttl ) ; - synchronized (lock) { - entry.next = head ; - entry.prev = head.prev ; - head.prev.next = entry ; - head.prev = entry ; - count++ ; + entry.next = head; + entry.prev = head.prev; + head.prev.next = entry; + head.prev = entry; + count++; } - return entry.handle() ; + return entry.handle(); } - /** Return an element from the head of the queue. - * The element is removed from the queue. + /** + * Return an element from the head of the queue. The element is removed from the queue. */ public Handle poll() { - Entry first = null ; + Entry first = null; synchronized (lock) { - first = head.next ; + first = head.next; if (first == head) - return null ; + return null; else { - final Handle result = first.handle() ; - result.remove() ; - return result ; + final Handle result = first.handle(); + result.remove(); + return result; } } } public Handle peek() { synchronized (lock) { - Entry first = head.next ; - if (first == head) - return null ; + Entry first = head.next; + if (first == head) + return null; else - return first.handle() ; + return first.handle(); } } -} - +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/LMSQueue.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/LMSQueue.java index c4bd85465..30c94c25d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/LMSQueue.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/concurrent/LMSQueue.java @@ -20,109 +20,109 @@ /** Java implementation of the Lock-Free FIFO queue in Ladan-Mozes and Shavit, * "An Optimistic Approach to Lock-Free FIFO Queues". */ -package com.sun.corba.ee.impl.transport.concurrent ; +package com.sun.corba.ee.impl.transport.concurrent; -import java.util.concurrent.atomic.AtomicReference ; +import java.util.concurrent.atomic.AtomicReference; public class LMSQueue { static private class Node { - private V value ; - Node next ; - Node prev ; + private V value; + Node next; + Node prev; - public Node( V value ) { - this.value = value ; + public Node(V value) { + this.value = value; } public V getValue() { - return value ; + return value; } } - private AtomicReference> head ; - private AtomicReference> tail ; + private AtomicReference> head; + private AtomicReference> tail; - public final Node dummyNode = new Node( null ) ; + public final Node dummyNode = new Node(null); - public void enqueue( V val ) { + public void enqueue(V val) { if (val == null) - throw new IllegalArgumentException( "Cannot enqueue null value" ) ; + throw new IllegalArgumentException("Cannot enqueue null value"); - Node tl ; - Node nd = new Node( val ) ; + Node tl; + Node nd = new Node(val); while (true) { - tl = tail.get() ; - nd.next = tl ; - if (tail.compareAndSet( tl, nd )) { - tail.get().prev = nd ; - break ; + tl = tail.get(); + nd.next = tl; + if (tail.compareAndSet(tl, nd)) { + tail.get().prev = nd; + break; } } } public V dequeue() { - Node tl ; - Node hd ; - Node firstNodePrev ; - Node ndDummy ; - V val ; + Node tl; + Node hd; + Node firstNodePrev; + Node ndDummy; + V val; - while (true) { //D04 - hd = head.get() ; //D05 - tl = tail.get() ; //D06 - firstNodePrev = hd.prev ; //D07 - val = hd.getValue() ; //D08 - if (hd == head.get()) { //D09 - if (val != null) { //D10 - if (tl != hd) { //D11 - if (firstNodePrev == null) { //D12 - fixList( tl, hd ) ; //D13 - continue ; //D14 - } //D15 - } else { //D16,D17 - ndDummy = new Node( null ) ; //D18,D19 - ndDummy.next = tl ; //D20 - if (tail.compareAndSet( tl, ndDummy )) { //D21 - hd.prev = ndDummy ; //D22 - } else { //D23,D24 - ndDummy = null ; //D25 - } //D26 - continue ; //D27 - } //D28 - if (head.compareAndSet( hd, firstNodePrev )) { //D29 - hd = null ; //D30 - return val ; //D31 - } //D32 - } else { //D33,D34 - if (tail == head) { //D35 - return null ; //D36 - } else { //D37,D38 - if (firstNodePrev == null) { //D39 - fixList( tl, hd ) ; //D40 - continue ; //D41 - } //D42 - head.compareAndSet( hd, firstNodePrev ) ; //D43 + while (true) { // D04 + hd = head.get(); // D05 + tl = tail.get(); // D06 + firstNodePrev = hd.prev; // D07 + val = hd.getValue(); // D08 + if (hd == head.get()) { // D09 + if (val != null) { // D10 + if (tl != hd) { // D11 + if (firstNodePrev == null) { // D12 + fixList(tl, hd); // D13 + continue; // D14 + } // D15 + } else { // D16,D17 + ndDummy = new Node(null); // D18,D19 + ndDummy.next = tl; // D20 + if (tail.compareAndSet(tl, ndDummy)) { // D21 + hd.prev = ndDummy; // D22 + } else { // D23,D24 + ndDummy = null; // D25 + } // D26 + continue; // D27 + } // D28 + if (head.compareAndSet(hd, firstNodePrev)) { // D29 + hd = null; // D30 + return val; // D31 + } // D32 + } else { // D33,D34 + if (tail == head) { // D35 + return null; // D36 + } else { // D37,D38 + if (firstNodePrev == null) { // D39 + fixList(tl, hd); // D40 + continue; // D41 + } // D42 + head.compareAndSet(hd, firstNodePrev); // D43 } } } } } - private void fixList( Node tl, Node hd ) { - Node curNode = tl ; - Node curNodeNext = null ; - Node nextNodePrev = null ; + private void fixList(Node tl, Node hd) { + Node curNode = tl; + Node curNodeNext = null; + Node nextNodePrev = null; while ((hd == head.get()) && (curNode != head.get())) { - curNodeNext = curNode.next ; + curNodeNext = curNode.next; if (curNodeNext == null) { - return ; + return; } - nextNodePrev = curNodeNext.prev ; + nextNodePrev = curNodeNext.prev; if (nextNodePrev != curNode) { - curNodeNext.prev = curNode ; + curNodeNext.prev = curNode; } - curNode = curNodeNext ; + curNode = curNodeNext; } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheBase.java index 95502876a..c113f6704 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheBase.java @@ -19,107 +19,102 @@ package com.sun.corba.ee.impl.transport.connection; +import com.sun.corba.ee.spi.transport.connection.Connection; +import com.sun.corba.ee.spi.transport.connection.ConnectionCache; -import com.sun.corba.ee.spi.transport.connection.Connection ; -import com.sun.corba.ee.spi.transport.connection.ConnectionCache ; - -import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue ; +import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue; import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue.Handle; import com.sun.corba.ee.spi.trace.Transport; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Transport -public abstract class ConnectionCacheBase - implements ConnectionCache { +public abstract class ConnectionCacheBase implements ConnectionCache { - private boolean flag ; + private boolean flag; // A name for this instance, provided for convenience. - private final String cacheType ; + private final String cacheType; // Configuration data // XXX we may want this data to be dynamically re-configurable - private final int highWaterMark ; // Maximum number of - // connections before we start - // closing idle connections - private final int numberToReclaim ; // How many connections to - // reclaim at once + private final int highWaterMark; // Maximum number of + // connections before we start + // closing idle connections + private final int numberToReclaim; // How many connections to + // reclaim at once // MUST be initialized in a subclass - protected ConcurrentQueue reclaimableConnections = null ; + protected ConcurrentQueue reclaimableConnections = null; public final String getCacheType() { - return cacheType ; + return cacheType; } public final int numberToReclaim() { - return numberToReclaim ; + return numberToReclaim; } public final int highWaterMark() { - return highWaterMark ; + return highWaterMark; } // The name of this class, which is implemented in the subclass. // I could derive this from this.getClass().getClassName(), but // this is easier. - protected abstract String thisClassName() ; + protected abstract String thisClassName(); - ConnectionCacheBase( final String cacheType, - final int highWaterMark, final int numberToReclaim ) { + ConnectionCacheBase(final String cacheType, final int highWaterMark, final int numberToReclaim) { if (cacheType == null) - throw new IllegalArgumentException( - "cacheType must not be null" ) ; + throw new IllegalArgumentException("cacheType must not be null"); if (highWaterMark < 0) - throw new IllegalArgumentException( - "highWaterMark must be non-negative" ) ; + throw new IllegalArgumentException("highWaterMark must be non-negative"); if (numberToReclaim < 1) - throw new IllegalArgumentException( - "numberToReclaim must be at least 1" ) ; + throw new IllegalArgumentException("numberToReclaim must be at least 1"); - this.cacheType = cacheType ; - this.highWaterMark = highWaterMark ; - this.numberToReclaim = numberToReclaim ; + this.cacheType = cacheType; + this.highWaterMark = highWaterMark; + this.numberToReclaim = numberToReclaim; } - + @Override public String toString() { - return thisClassName() + "[" - + getCacheType() + "]"; + return thisClassName() + "[" + getCacheType() + "]"; } @InfoMethod - private void display( String msg, Object value ) {} + private void display(String msg, Object value) { + } - /** Reclaim some idle cached connections. Will never - * close a connection that is busy. + /** + * Reclaim some idle cached connections. Will never close a connection that is busy. + * * @return True if at least one connection was reclaimed */ @Transport protected boolean reclaim() { - int ctr = 0 ; + int ctr = 0; while (ctr < numberToReclaim()) { - Handle candidate = reclaimableConnections.poll() ; + Handle candidate = reclaimableConnections.poll(); if (candidate == null) // If we have closed all idle connections, we must stop // reclaiming. - break ; + break; try { - display("closing connection", candidate) ; - close( candidate.value() ) ; + display("closing connection", candidate); + close(candidate.value()); } catch (RuntimeException exc) { - display( "exception on close", exc ) ; - throw exc ; + display("exception on close", exc); + throw exc; } - ctr++ ; + ctr++; } - display( "number of connections reclaimed", ctr ) ; - return ctr > 0 ; + display("number of connections reclaimed", ctr); + return ctr > 0; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheBlockingBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheBlockingBase.java index c2be01990..ac940cb21 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheBlockingBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheBlockingBase.java @@ -19,43 +19,38 @@ package com.sun.corba.ee.impl.transport.connection; - -import com.sun.corba.ee.spi.transport.connection.Connection ; +import com.sun.corba.ee.spi.transport.connection.Connection; import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueueFactory; -abstract class ConnectionCacheBlockingBase - extends ConnectionCacheBase { +abstract class ConnectionCacheBlockingBase extends ConnectionCacheBase { - protected int totalBusy ; // Number of busy connections - protected int totalIdle ; // Number of idle connections + protected int totalBusy; // Number of busy connections + protected int totalIdle; // Number of idle connections - ConnectionCacheBlockingBase( String cacheType, int highWaterMark, - int numberToReclaim, long ttl ) { + ConnectionCacheBlockingBase(String cacheType, int highWaterMark, int numberToReclaim, long ttl) { - super( cacheType, highWaterMark, numberToReclaim) ; + super(cacheType, highWaterMark, numberToReclaim); - this.totalBusy = 0 ; - this.totalIdle = 0 ; + this.totalBusy = 0; + this.totalIdle = 0; - this.reclaimableConnections = - ConcurrentQueueFactory.makeConcurrentQueue( ttl ) ; + this.reclaimableConnections = ConcurrentQueueFactory.makeConcurrentQueue(ttl); } public synchronized long numberOfConnections() { - return totalIdle + totalBusy ; + return totalIdle + totalBusy; } public synchronized long numberOfIdleConnections() { - return totalIdle ; + return totalIdle; } public synchronized long numberOfBusyConnections() { - return totalBusy ; + return totalBusy; } public synchronized long numberOfReclaimableConnections() { - return reclaimableConnections.size() ; + return reclaimableConnections.size(); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheNonBlockingBase.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheNonBlockingBase.java index 36f468997..3d66f41c1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheNonBlockingBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/ConnectionCacheNonBlockingBase.java @@ -19,46 +19,42 @@ package com.sun.corba.ee.impl.transport.connection; +import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicInteger ; +import com.sun.corba.ee.spi.transport.connection.Connection; -import com.sun.corba.ee.spi.transport.connection.Connection ; +import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueueFactory; -import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueueFactory ; +abstract class ConnectionCacheNonBlockingBase extends ConnectionCacheBase { -abstract class ConnectionCacheNonBlockingBase - extends ConnectionCacheBase { + protected final AtomicInteger totalBusy; // Number of busy connections + protected final AtomicInteger totalIdle; // Number of idle connections - protected final AtomicInteger totalBusy ; // Number of busy connections - protected final AtomicInteger totalIdle ; // Number of idle connections + ConnectionCacheNonBlockingBase(String cacheType, int highWaterMark, int numberToReclaim, long ttl) { - ConnectionCacheNonBlockingBase( String cacheType, int highWaterMark, - int numberToReclaim, long ttl ) { + super(cacheType, highWaterMark, numberToReclaim); - super( cacheType, highWaterMark, numberToReclaim) ; + this.totalBusy = new AtomicInteger(); + this.totalIdle = new AtomicInteger(); - this.totalBusy = new AtomicInteger() ; - this.totalIdle = new AtomicInteger() ; - - this.reclaimableConnections = - // XXX make this the non-blocking version once we write it. - ConcurrentQueueFactory.makeBlockingConcurrentQueue( ttl ) ; + this.reclaimableConnections = + // XXX make this the non-blocking version once we write it. + ConcurrentQueueFactory.makeBlockingConcurrentQueue(ttl); } public long numberOfConnections() { - return totalIdle.get() + totalBusy.get() ; + return totalIdle.get() + totalBusy.get(); } public long numberOfIdleConnections() { - return totalIdle.get() ; + return totalIdle.get(); } public long numberOfBusyConnections() { - return totalBusy.get() ; + return totalBusy.get(); } public long numberOfReclaimableConnections() { - return reclaimableConnections.size() ; + return reclaimableConnections.size(); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/InboundConnectionCacheBlockingImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/InboundConnectionCacheBlockingImpl.java index a9577e1de..15e58e17a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/InboundConnectionCacheBlockingImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/InboundConnectionCacheBlockingImpl.java @@ -19,191 +19,190 @@ package com.sun.corba.ee.impl.transport.connection; -import java.io.IOException ; +import java.io.IOException; -import java.util.logging.Logger ; +import java.util.logging.Logger; -import java.util.Map ; -import java.util.HashMap ; +import java.util.Map; +import java.util.HashMap; -import com.sun.corba.ee.spi.transport.connection.Connection ; -import com.sun.corba.ee.spi.transport.connection.InboundConnectionCache ; +import com.sun.corba.ee.spi.transport.connection.Connection; +import com.sun.corba.ee.spi.transport.connection.InboundConnectionCache; import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue; import com.sun.corba.ee.spi.trace.Transport; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; -/** Manage connections that are initiated from another VM. +/** + * Manage connections that are initiated from another VM. * * @author Ken Cavanaugh */ @Transport -public final class InboundConnectionCacheBlockingImpl - extends ConnectionCacheBlockingBase - implements InboundConnectionCache { +public final class InboundConnectionCacheBlockingImpl extends ConnectionCacheBlockingBase + implements InboundConnectionCache { - private final Map> connectionMap ; + private final Map> connectionMap; protected String thisClassName() { - return "InboundConnectionCacheBlockingImpl" ; + return "InboundConnectionCacheBlockingImpl"; } private static final class ConnectionState { - final C connection ; // Connection of the - // ConnectionState - int busyCount ; // Number of calls to - // get without release - int expectedResponseCount ; // Number of expected - // responses not yet - // received - - ConcurrentQueue.Handle reclaimableHandle ; // non-null iff connection - // is not in use and has no - // outstanding requests - - ConnectionState( final C conn ) { - this.connection = conn ; - - busyCount = 0 ; - expectedResponseCount = 0 ; - reclaimableHandle = null ; + final C connection; // Connection of the + // ConnectionState + int busyCount; // Number of calls to + // get without release + int expectedResponseCount; // Number of expected + // responses not yet + // received + + ConcurrentQueue.Handle reclaimableHandle; // non-null iff connection + // is not in use and has no + // outstanding requests + + ConnectionState(final C conn) { + this.connection = conn; + + busyCount = 0; + expectedResponseCount = 0; + reclaimableHandle = null; } } - public InboundConnectionCacheBlockingImpl( final String cacheType, - final int highWaterMark, final int numberToReclaim, final long ttl ) { + public InboundConnectionCacheBlockingImpl(final String cacheType, final int highWaterMark, final int numberToReclaim, final long ttl) { - super( cacheType, highWaterMark, numberToReclaim, ttl ) ; + super(cacheType, highWaterMark, numberToReclaim, ttl); - this.connectionMap = new HashMap>() ; + this.connectionMap = new HashMap>(); } // We do not need to define equals or hashCode for this class. @InfoMethod - private void display( String msg, Object value ) {} + private void display(String msg, Object value) { + } @InfoMethod - private void msg( String msg ) {} + private void msg(String msg) { + } @Transport - public synchronized void requestReceived( final C conn ) { - ConnectionState cs = getConnectionState( conn ) ; + public synchronized void requestReceived(final C conn) { + ConnectionState cs = getConnectionState(conn); - final int totalConnections = totalBusy + totalIdle ; + final int totalConnections = totalBusy + totalIdle; if (totalConnections > highWaterMark()) - reclaim() ; + reclaim(); - ConcurrentQueue.Handle reclaimHandle = cs.reclaimableHandle ; + ConcurrentQueue.Handle reclaimHandle = cs.reclaimableHandle; if (reclaimHandle != null) { - reclaimHandle.remove() ; - display( "removed from reclaimableQueue", conn ) ; + reclaimHandle.remove(); + display("removed from reclaimableQueue", conn); } - int count = cs.busyCount++ ; + int count = cs.busyCount++; if (count == 0) { - display( "moved from idle to busy", conn ) ; + display("moved from idle to busy", conn); - totalIdle-- ; - totalBusy++ ; + totalIdle--; + totalBusy++; } } @Transport - public synchronized void requestProcessed( final C conn, - final int numResponsesExpected ) { - final ConnectionState cs = connectionMap.get( conn ) ; + public synchronized void requestProcessed(final C conn, final int numResponsesExpected) { + final ConnectionState cs = connectionMap.get(conn); if (cs == null) { - msg( "connection was closed") ; - return ; + msg("connection was closed"); + return; } else { - cs.expectedResponseCount += numResponsesExpected ; - int numResp = cs.expectedResponseCount ; - int numBusy = --cs.busyCount ; + cs.expectedResponseCount += numResponsesExpected; + int numResp = cs.expectedResponseCount; + int numBusy = --cs.busyCount; - display( "responses expected", numResp ) ; - display( "connection busy count", numBusy ) ; + display("responses expected", numResp); + display("connection busy count", numBusy); if (numBusy == 0) { - totalBusy-- ; - totalIdle++ ; + totalBusy--; + totalIdle++; if (numResp == 0) { - display( "queuing reclaimable connection", conn ) ; + display("queuing reclaimable connection", conn); - if ((totalBusy+totalIdle) > highWaterMark()) { - close( conn ) ; + if ((totalBusy + totalIdle) > highWaterMark()) { + close(conn); } else { - cs.reclaimableHandle = - reclaimableConnections.offer( conn ) ; + cs.reclaimableHandle = reclaimableConnections.offer(conn); } } } } } - /** Decrement the number of expected responses. When a connection is idle - * and has no expected responses, it can be reclaimed. + /** + * Decrement the number of expected responses. When a connection is idle and has no expected responses, it can be + * reclaimed. */ @Transport - public synchronized void responseSent( final C conn ) { - final ConnectionState cs = connectionMap.get( conn ) ; - final int waitCount = --cs.expectedResponseCount ; + public synchronized void responseSent(final C conn) { + final ConnectionState cs = connectionMap.get(conn); + final int waitCount = --cs.expectedResponseCount; if (waitCount == 0) { - display( "reclaimable connection", conn ) ; + display("reclaimable connection", conn); - if ((totalBusy+totalIdle) > highWaterMark()) { - close( conn ) ; + if ((totalBusy + totalIdle) > highWaterMark()) { + close(conn); } else { - cs.reclaimableHandle = - reclaimableConnections.offer( conn ) ; + cs.reclaimableHandle = reclaimableConnections.offer(conn); } } else { - display( "wait count", waitCount ) ; + display("wait count", waitCount); } } - /** Close a connection, regardless of whether the connection is busy - * or not. + /** + * Close a connection, regardless of whether the connection is busy or not. */ @Transport - public synchronized void close( final C conn ) { - final ConnectionState cs = connectionMap.remove( conn ) ; - display( "connection state", cs ) ; + public synchronized void close(final C conn) { + final ConnectionState cs = connectionMap.remove(conn); + display("connection state", cs); - int count = cs.busyCount ; + int count = cs.busyCount; if (count == 0) - totalIdle-- ; + totalIdle--; else - totalBusy-- ; + totalBusy--; - final ConcurrentQueue.Handle rh = cs.reclaimableHandle ; + final ConcurrentQueue.Handle rh = cs.reclaimableHandle; if (rh != null) { - msg( "connection was reclaimable") ; - rh.remove() ; + msg("connection was reclaimable"); + rh.remove(); } try { - conn.close() ; + conn.close(); } catch (IOException exc) { - display( "close threw", exc ) ; + display("close threw", exc); } } - // Atomically either get the ConnectionState for conn OR + // Atomically either get the ConnectionState for conn OR // create a new one AND put it in the cache - private ConnectionState getConnectionState( C conn ) { + private ConnectionState getConnectionState(C conn) { // This should be the only place a CacheEntry is constructed. - ConnectionState result = connectionMap.get( conn ) ; + ConnectionState result = connectionMap.get(conn); if (result == null) { - result = new ConnectionState( conn ) ; - connectionMap.put( conn, result ) ; - totalIdle++ ; + result = new ConnectionState(conn); + connectionMap.put(conn, result); + totalIdle++; } - return result ; + return result; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/InboundConnectionCacheImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/InboundConnectionCacheImpl.java index e5060dded..adeb5d57a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/InboundConnectionCacheImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/InboundConnectionCacheImpl.java @@ -19,179 +19,175 @@ package com.sun.corba.ee.impl.transport.connection; -import java.io.IOException ; +import java.io.IOException; -import java.util.concurrent.ConcurrentMap ; -import java.util.concurrent.ConcurrentHashMap ; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger ; +import java.util.concurrent.atomic.AtomicInteger; -import com.sun.corba.ee.spi.transport.connection.Connection ; -import com.sun.corba.ee.spi.transport.connection.InboundConnectionCache ; +import com.sun.corba.ee.spi.transport.connection.Connection; +import com.sun.corba.ee.spi.transport.connection.InboundConnectionCache; import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue; import com.sun.corba.ee.spi.trace.Transport; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; -/** Manage connections that are initiated from another VM. - * Connections are reclaimed when - * they are no longer in use and there are too many connections open. +/** + * Manage connections that are initiated from another VM. Connections are reclaimed when they are no longer in use and + * there are too many connections open. + *

    + * A connection basically represents some sort of communication channel, but few requirements are placed on the + * connection. Basically the ability to close a connection is required in order for reclamation to work. *

    - * A connection basically represents some sort of communication channel, but - * few requirements are placed on the connection. Basically the ability to - * close a connection is required in order for reclamation to work. - *

    * * @author Ken Cavanaugh */ @Transport -public final class InboundConnectionCacheImpl - extends ConnectionCacheNonBlockingBase - implements InboundConnectionCache { +public final class InboundConnectionCacheImpl extends ConnectionCacheNonBlockingBase + implements InboundConnectionCache { - private final ConcurrentMap> connectionMap ; + private final ConcurrentMap> connectionMap; protected String thisClassName() { - return "InboundConnectionCacheImpl" ; + return "InboundConnectionCacheImpl"; } private static final class ConnectionState { - final C connection ; // Connection of the - // ConnectionState - final AtomicInteger busyCount ; // Number of calls to - // get without release - final AtomicInteger expectedResponseCount ; // Number of expected - // responses not yet - // received - - // At all times, a connection is either on the busy or idle queue in - // its ConnectionEntry, and so only the corresponding handle is - // non-null. If idleHandle is non-null, reclaimableHandle may also - // be non-null if the Connection is also on the + final C connection; // Connection of the + // ConnectionState + final AtomicInteger busyCount; // Number of calls to + // get without release + final AtomicInteger expectedResponseCount; // Number of expected + // responses not yet + // received + + // At all times, a connection is either on the busy or idle queue in + // its ConnectionEntry, and so only the corresponding handle is + // non-null. If idleHandle is non-null, reclaimableHandle may also + // be non-null if the Connection is also on the // reclaimableConnections queue. - ConcurrentQueue.Handle reclaimableHandle ; // non-null iff connection - // is not in use and has no - // outstanding requests + ConcurrentQueue.Handle reclaimableHandle; // non-null iff connection + // is not in use and has no + // outstanding requests - ConnectionState( final C conn ) { - this.connection = conn ; + ConnectionState(final C conn) { + this.connection = conn; - busyCount = new AtomicInteger() ; - expectedResponseCount = new AtomicInteger() ; - reclaimableHandle = null ; + busyCount = new AtomicInteger(); + expectedResponseCount = new AtomicInteger(); + reclaimableHandle = null; } } - public InboundConnectionCacheImpl( final String cacheType, - final int highWaterMark, final int numberToReclaim, long ttl ) { + public InboundConnectionCacheImpl(final String cacheType, final int highWaterMark, final int numberToReclaim, long ttl) { - super( cacheType, highWaterMark, numberToReclaim, ttl ) ; + super(cacheType, highWaterMark, numberToReclaim, ttl); - this.connectionMap = - new ConcurrentHashMap>() ; + this.connectionMap = new ConcurrentHashMap>(); } // We do not need to define equals or hashCode for this class. - public void requestReceived( final C conn ) { - ConnectionState cs = getConnectionState( conn ) ; + public void requestReceived(final C conn) { + ConnectionState cs = getConnectionState(conn); - final int totalConnections = totalBusy.get() + totalIdle.get() ; + final int totalConnections = totalBusy.get() + totalIdle.get(); if (totalConnections > highWaterMark()) - reclaim() ; + reclaim(); - ConcurrentQueue.Handle reclaimHandle = cs.reclaimableHandle ; - if (reclaimHandle != null) - reclaimHandle.remove() ; + ConcurrentQueue.Handle reclaimHandle = cs.reclaimableHandle; + if (reclaimHandle != null) + reclaimHandle.remove(); - int count = cs.busyCount.getAndIncrement() ; + int count = cs.busyCount.getAndIncrement(); if (count == 0) { - totalIdle.decrementAndGet() ; - totalBusy.incrementAndGet() ; + totalIdle.decrementAndGet(); + totalBusy.incrementAndGet(); } } @InfoMethod - private void msg( String m ) {} + private void msg(String m) { + } @InfoMethod - private void display( String m, Object value ) {} + private void display(String m, Object value) { + } @Transport - public void requestProcessed( final C conn, - final int numResponsesExpected ) { + public void requestProcessed(final C conn, final int numResponsesExpected) { - final ConnectionState cs = connectionMap.get( conn ) ; + final ConnectionState cs = connectionMap.get(conn); if (cs == null) { - msg( "connection was closed"); - return ; + msg("connection was closed"); + return; } else { - int numResp = cs.expectedResponseCount.addAndGet( - numResponsesExpected ) ; - int numBusy = cs.busyCount.decrementAndGet() ; + int numResp = cs.expectedResponseCount.addAndGet(numResponsesExpected); + int numBusy = cs.busyCount.decrementAndGet(); - display( "numResp", numResp ) ; - display( "numBusy", numBusy ) ; + display("numResp", numResp); + display("numBusy", numBusy); if (numBusy == 0) { - totalBusy.decrementAndGet() ; - totalIdle.incrementAndGet() ; + totalBusy.decrementAndGet(); + totalIdle.incrementAndGet(); if (numResp == 0) { - display( "queing reclaimalbe connection", conn ) ; - cs.reclaimableHandle = - reclaimableConnections.offer( conn ) ; + display("queing reclaimalbe connection", conn); + cs.reclaimableHandle = reclaimableConnections.offer(conn); } } } } - /** Decrement the number of expected responses. When a connection is idle - * and has no expected responses, it can be reclaimed. + /** + * Decrement the number of expected responses. When a connection is idle and has no expected responses, it can be + * reclaimed. */ @Transport - public void responseSent( final C conn ) { - final ConnectionState cs = connectionMap.get( conn ) ; - final int waitCount = cs.expectedResponseCount.decrementAndGet() ; + public void responseSent(final C conn) { + final ConnectionState cs = connectionMap.get(conn); + final int waitCount = cs.expectedResponseCount.decrementAndGet(); if (waitCount == 0) { - cs.reclaimableHandle = reclaimableConnections.offer( conn ) ; + cs.reclaimableHandle = reclaimableConnections.offer(conn); } } - /** Close a connection, regardless of whether the connection is busy - * or not. + /** + * Close a connection, regardless of whether the connection is busy or not. */ - public void close( final C conn ) { - final ConnectionState cs = connectionMap.remove( conn ) ; - int count = cs.busyCount.get() ; + public void close(final C conn) { + final ConnectionState cs = connectionMap.remove(conn); + int count = cs.busyCount.get(); if (count == 0) - totalIdle.decrementAndGet() ; + totalIdle.decrementAndGet(); else - totalBusy.decrementAndGet() ; + totalBusy.decrementAndGet(); - final ConcurrentQueue.Handle rh = cs.reclaimableHandle ; + final ConcurrentQueue.Handle rh = cs.reclaimableHandle; if (rh != null) - rh.remove() ; + rh.remove(); try { - conn.close() ; + conn.close(); } catch (IOException exc) { // XXX log this } } - // Atomically either get the ConnectionState for conn OR + // Atomically either get the ConnectionState for conn OR // create a new one AND put it in the cache - private ConnectionState getConnectionState( C conn ) { + private ConnectionState getConnectionState(C conn) { // This should be the only place a ConnectionState is constructed. - ConnectionState cs = new ConnectionState( conn ) ; - ConnectionState result = connectionMap.putIfAbsent( conn, cs ) ; + ConnectionState cs = new ConnectionState(conn); + ConnectionState result = connectionMap.putIfAbsent(conn, cs); if (result != null) { - totalIdle.incrementAndGet() ; - return result ; + totalIdle.incrementAndGet(); + return result; } else { - return cs ; + return cs; } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundCacheEntry.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundCacheEntry.java index 0ac5fe33e..078e90a75 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundCacheEntry.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundCacheEntry.java @@ -19,20 +19,20 @@ package com.sun.corba.ee.impl.transport.connection; -import java.util.Queue ; -import java.util.Collection ; -import java.util.Collections ; +import java.util.Queue; +import java.util.Collection; +import java.util.Collections; -import java.util.concurrent.LinkedBlockingQueue ; +import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.locks.ReentrantLock ; -import java.util.concurrent.locks.Condition ; +import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.locks.Condition; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; -import com.sun.corba.ee.spi.transport.connection.Connection ; +import com.sun.corba.ee.spi.transport.connection.Connection; import java.util.ArrayList; // Represents an entry in the outbound connection cache. @@ -40,107 +40,102 @@ // (we also need to handle no share). @ManagedData public class OutboundCacheEntry { - private ReentrantLock lock ; - private final Condition waitForPendingConnections ; + private ReentrantLock lock; + private final Condition waitForPendingConnections; - public OutboundCacheEntry( ReentrantLock lock ) { - this.lock = lock ; - waitForPendingConnections = lock.newCondition() ; + public OutboundCacheEntry(ReentrantLock lock) { + this.lock = lock; + waitForPendingConnections = lock.newCondition(); } - final Queue idleConnections = new LinkedBlockingQueue() ; - final Collection idleConnectionsView = - Collections.unmodifiableCollection( idleConnections ) ; + final Queue idleConnections = new LinkedBlockingQueue(); + final Collection idleConnectionsView = Collections.unmodifiableCollection(idleConnections); - final Queue busyConnections = new LinkedBlockingQueue() ; - final Collection busyConnectionsView = - Collections.unmodifiableCollection( busyConnections ) ; + final Queue busyConnections = new LinkedBlockingQueue(); + final Collection busyConnectionsView = Collections.unmodifiableCollection(busyConnections); - private int pendingConnections = 0 ; + private int pendingConnections = 0; @Override public String toString() { - lock.lock() ; + lock.lock(); try { - return "OutboundCacheEntry[numIdle=" + idleConnections.size() - + ",numBusy=" + busyConnections.size() - + ",numPending=" + pendingConnections + "]" ; + return "OutboundCacheEntry[numIdle=" + idleConnections.size() + ",numBusy=" + busyConnections.size() + ",numPending=" + + pendingConnections + "]"; } finally { lock.unlock(); } } @ManagedAttribute - @Description( "list of idle connections") + @Description("list of idle connections") private Collection idleConnections() { - lock.lock() ; + lock.lock(); try { - return new ArrayList( idleConnections ) ; + return new ArrayList(idleConnections); } finally { - lock.unlock() ; + lock.unlock(); } } @ManagedAttribute - @Description( "list of idle connections") + @Description("list of idle connections") private Collection busyConnections() { - lock.lock() ; + lock.lock(); try { - return new ArrayList( busyConnections ) ; + return new ArrayList(busyConnections); } finally { - lock.unlock() ; + lock.unlock(); } } - @ManagedAttribute( id="numIdleConnections" ) - @Description( "Number of idle connections" ) + @ManagedAttribute(id = "numIdleConnections") + @Description("Number of idle connections") private int numIdleConnectionsAttribute() { - lock.lock() ; + lock.lock(); try { - return idleConnections.size() ; + return idleConnections.size(); } finally { - lock.unlock() ; + lock.unlock(); } } - @ManagedAttribute( id="numPendingConnections" ) - @Description( "Number of pending connections" ) + @ManagedAttribute(id = "numPendingConnections") + @Description("Number of pending connections") private int numPendingConnectionsAttribute() { - lock.lock() ; + lock.lock(); try { - return pendingConnections ; + return pendingConnections; } finally { - lock.unlock() ; + lock.unlock(); } } - @ManagedAttribute( id="numBusyConnections" ) - @Description( "Number of busy connections" ) + @ManagedAttribute(id = "numBusyConnections") + @Description("Number of busy connections") private int numBusyConnectionsAttribute() { - lock.lock() ; + lock.lock(); try { - return busyConnections.size() ; + return busyConnections.size(); } finally { - lock.unlock() ; + lock.unlock(); } } public int totalConnections() { - return idleConnections.size() + busyConnections.size() - + pendingConnections ; + return idleConnections.size() + busyConnections.size() + pendingConnections; } public void startConnect() { - pendingConnections++ ; + pendingConnections++; } public void finishConnect() { - pendingConnections-- ; - waitForPendingConnections.signal() ; + pendingConnections--; + waitForPendingConnections.signal(); } public void waitForConnection() { - waitForPendingConnections.awaitUninterruptibly() ; + waitForPendingConnections.awaitUninterruptibly(); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionCacheBlockingImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionCacheBlockingImpl.java index 2b126140a..f8f5c60c1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionCacheBlockingImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionCacheBlockingImpl.java @@ -19,356 +19,341 @@ package com.sun.corba.ee.impl.transport.connection; -import java.io.IOException ; +import java.io.IOException; -import java.util.Map ; -import java.util.HashMap ; +import java.util.Map; +import java.util.HashMap; -import java.util.concurrent.locks.ReentrantLock ; +import java.util.concurrent.locks.ReentrantLock; -import com.sun.corba.ee.spi.transport.connection.Connection ; -import com.sun.corba.ee.spi.transport.connection.ConnectionFinder ; -import com.sun.corba.ee.spi.transport.connection.ContactInfo ; -import com.sun.corba.ee.spi.transport.connection.OutboundConnectionCache ; +import com.sun.corba.ee.spi.transport.connection.Connection; +import com.sun.corba.ee.spi.transport.connection.ConnectionFinder; +import com.sun.corba.ee.spi.transport.connection.ContactInfo; +import com.sun.corba.ee.spi.transport.connection.OutboundConnectionCache; import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueueFactory; import com.sun.corba.ee.spi.trace.Transport; import java.util.logging.Level; import java.util.logging.Logger; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.ManagedObject ; -import org.glassfish.gmbal.ManagedAttribute ; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.ManagedObject; +import org.glassfish.gmbal.ManagedAttribute; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Transport @ManagedObject -@Description( "Outbound connection cache for connections opened by the client" ) -public final class OutboundConnectionCacheBlockingImpl - extends ConnectionCacheBlockingBase - implements OutboundConnectionCache { - - private ReentrantLock lock = new ReentrantLock() ; +@Description("Outbound connection cache for connections opened by the client") +public final class OutboundConnectionCacheBlockingImpl extends ConnectionCacheBlockingBase + implements OutboundConnectionCache { + + private ReentrantLock lock = new ReentrantLock(); // Configuration data // XXX we may want this data to be dynamically re-configurable - private final int maxParallelConnections ; // Maximum number of - // connections we will open - // to the same endpoint + private final int maxParallelConnections; // Maximum number of + // connections we will open + // to the same endpoint @ManagedAttribute - public int maxParallelConnections() { return maxParallelConnections ; } - - private Map,OutboundCacheEntry> entryMap ; + public int maxParallelConnections() { + return maxParallelConnections; + } + + private Map, OutboundCacheEntry> entryMap; - @ManagedAttribute( id="cacheEntries" ) - private Map,OutboundCacheEntry> entryMap() { - return new HashMap,OutboundCacheEntry>( entryMap ) ; + @ManagedAttribute(id = "cacheEntries") + private Map, OutboundCacheEntry> entryMap() { + return new HashMap, OutboundCacheEntry>(entryMap); } - - private Map> connectionMap ; - @ManagedAttribute( id="connections" ) - private Map> connectionMap() { - return new HashMap>( connectionMap ) ; + private Map> connectionMap; + + @ManagedAttribute(id = "connections") + private Map> connectionMap() { + return new HashMap>(connectionMap); } protected String thisClassName() { - return "OutboundConnectionCacheBlockingImpl" ; + return "OutboundConnectionCacheBlockingImpl"; } - public OutboundConnectionCacheBlockingImpl( final String cacheType, - final int highWaterMark, final int numberToReclaim, - final int maxParallelConnections, final long ttl ) { + public OutboundConnectionCacheBlockingImpl(final String cacheType, final int highWaterMark, final int numberToReclaim, + final int maxParallelConnections, final long ttl) { - super( cacheType, highWaterMark, numberToReclaim, ttl ) ; + super(cacheType, highWaterMark, numberToReclaim, ttl); - if (maxParallelConnections < 1) - throw new IllegalArgumentException( - "maxParallelConnections must be > 0" ) ; + if (maxParallelConnections < 1) + throw new IllegalArgumentException("maxParallelConnections must be > 0"); - this.maxParallelConnections = maxParallelConnections ; + this.maxParallelConnections = maxParallelConnections; - this.entryMap = - new HashMap,OutboundCacheEntry>() ; - this.connectionMap = new HashMap>() ; - this.reclaimableConnections = - ConcurrentQueueFactory.makeConcurrentQueue( ttl ) ; + this.entryMap = new HashMap, OutboundCacheEntry>(); + this.connectionMap = new HashMap>(); + this.reclaimableConnections = ConcurrentQueueFactory.makeConcurrentQueue(ttl); } - public boolean canCreateNewConnection( ContactInfo cinfo ) { - lock.lock() ; + public boolean canCreateNewConnection(ContactInfo cinfo) { + lock.lock(); try { - OutboundCacheEntry entry = entryMap.get( cinfo ) ; + OutboundCacheEntry entry = entryMap.get(cinfo); if (entry == null) - return true ; + return true; - return internalCanCreateNewConnection( entry ) ; + return internalCanCreateNewConnection(entry); } finally { - lock.unlock() ; + lock.unlock(); } } - private boolean internalCanCreateNewConnection( - final OutboundCacheEntry entry ) { - lock.lock() ; + private boolean internalCanCreateNewConnection(final OutboundCacheEntry entry) { + lock.lock(); try { - final boolean createNewConnection = (entry.totalConnections() == 0) || - ((numberOfConnections() < highWaterMark()) && - (entry.totalConnections() < maxParallelConnections)) ; + final boolean createNewConnection = (entry.totalConnections() == 0) + || ((numberOfConnections() < highWaterMark()) && (entry.totalConnections() < maxParallelConnections)); - return createNewConnection ; + return createNewConnection; } finally { - lock.unlock() ; + lock.unlock(); } } - public C get( final ContactInfo cinfo) throws IOException { - return get( cinfo, null ) ; + public C get(final ContactInfo cinfo) throws IOException { + return get(cinfo, null); } @InfoMethod - private void msg( String m ) {} + private void msg(String m) { + } @InfoMethod - private void display( String m, Object value ) {} + private void display(String m, Object value) { + } @Transport - public C get( final ContactInfo cinfo, - final ConnectionFinder finder ) throws IOException { - lock.lock() ; - C result = null ; + public C get(final ContactInfo cinfo, final ConnectionFinder finder) throws IOException { + lock.lock(); + C result = null; try { while (true) { - final OutboundCacheEntry entry = getEntry( cinfo ) ; + final OutboundCacheEntry entry = getEntry(cinfo); if (finder != null) { - msg( "calling finder to get a connection" ) ; - - entry.startConnect() ; - // Finder may block, especially on opening a new + msg("calling finder to get a connection"); + + entry.startConnect(); + // Finder may block, especially on opening a new // connection, so we can't hold the lock during the // finder call. - lock.unlock() ; + lock.unlock(); try { - result = finder.find( cinfo, - entry.idleConnectionsView, - entry.busyConnectionsView ) ; + result = finder.find(cinfo, entry.idleConnectionsView, entry.busyConnectionsView); } finally { - lock.lock() ; - entry.finishConnect() ; + lock.lock(); + entry.finishConnect(); } if (result != null) { - display( "finder got connection", result ) ; + display("finder got connection", result); } } if (result == null) { - result = entry.idleConnections.poll() ; + result = entry.idleConnections.poll(); } if (result == null) { - result = tryNewConnection( entry, cinfo ) ; + result = tryNewConnection(entry, cinfo); } if (result == null) { - result = entry.busyConnections.poll() ; + result = entry.busyConnections.poll(); } - if (result == null) { - msg( "No connection available: " - + "awaiting a pending connection" ) ; - entry.waitForConnection() ; - continue ; + if (result == null) { + msg("No connection available: " + "awaiting a pending connection"); + entry.waitForConnection(); + continue; } else { - OutboundConnectionState cs = getConnectionState( - cinfo, entry, result ) ; + OutboundConnectionState cs = getConnectionState(cinfo, entry, result); if (cs.isBusy()) { // Nothing to do in this case } else if (cs.isIdle()) { - totalBusy++ ; - decrementTotalIdle() ; + totalBusy++; + decrementTotalIdle(); } else { // state is NEW - totalBusy++ ; + totalBusy++; } - cs.acquire() ; - break ; + cs.acquire(); + break; } } } finally { - display( "totalIdle", totalIdle ) ; - display( "totalBusy", totalBusy ) ; - lock.unlock() ; + display("totalIdle", totalIdle); + display("totalBusy", totalBusy); + lock.unlock(); } - return result ; + return result; } @Transport - private OutboundCacheEntry getEntry( final ContactInfo cinfo - ) throws IOException { + private OutboundCacheEntry getEntry(final ContactInfo cinfo) throws IOException { - OutboundCacheEntry result = null ; + OutboundCacheEntry result = null; // This is the only place a OutboundCacheEntry is constructed. - result = entryMap.get( cinfo ) ; + result = entryMap.get(cinfo); if (result == null) { - result = new OutboundCacheEntry( lock ) ; - display( "creating new OutboundCacheEntry", result ) ; - entryMap.put( cinfo, result ) ; + result = new OutboundCacheEntry(lock); + display("creating new OutboundCacheEntry", result); + entryMap.put(cinfo, result); } else { - display( "re-using existing OutboundCacheEntry", result ) ; + display("re-using existing OutboundCacheEntry", result); } - return result ; + return result; } // Note that tryNewConnection will ALWAYS create a new connection if // no connection currently exists. @Transport - private C tryNewConnection( final OutboundCacheEntry entry, - final ContactInfo cinfo ) throws IOException { - - C conn = null ; + private C tryNewConnection(final OutboundCacheEntry entry, final ContactInfo cinfo) throws IOException { + + C conn = null; if (internalCanCreateNewConnection(entry)) { // If this throws an exception just let it // propagate: let a higher layer handle a // connection creation failure. - entry.startConnect() ; - lock.unlock() ; + entry.startConnect(); + lock.unlock(); try { - conn = cinfo.createConnection() ; + conn = cinfo.createConnection(); } finally { - lock.lock() ; - entry.finishConnect() ; + lock.lock(); + entry.finishConnect(); } } - return conn ; + return conn; } @Transport - private OutboundConnectionState getConnectionState( - ContactInfo cinfo, OutboundCacheEntry entry, C conn ) { - lock.lock() ; - + private OutboundConnectionState getConnectionState(ContactInfo cinfo, OutboundCacheEntry entry, C conn) { + lock.lock(); + try { - OutboundConnectionState cs = connectionMap.get( conn ) ; + OutboundConnectionState cs = connectionMap.get(conn); if (cs == null) { - cs = new OutboundConnectionState( cinfo, entry, conn ) ; - display( "creating new OutboundConnectionState ", cs ) ; - connectionMap.put( conn, cs ) ; + cs = new OutboundConnectionState(cinfo, entry, conn); + display("creating new OutboundConnectionState ", cs); + connectionMap.put(conn, cs); } else { - display( "found OutboundConnectionState ", cs ) ; + display("found OutboundConnectionState ", cs); } - return cs ; + return cs; } finally { - lock.unlock() ; + lock.unlock(); } } @Transport - public void release( final C conn, - final int numResponsesExpected ) { - lock.lock() ; - OutboundConnectionState cs = null ; + public void release(final C conn, final int numResponsesExpected) { + lock.lock(); + OutboundConnectionState cs = null; try { - cs = connectionMap.get( conn ) ; + cs = connectionMap.get(conn); if (cs == null) { - msg( "connection was already closed" ) ; - return ; + msg("connection was already closed"); + return; } else { - int numResp = cs.release( numResponsesExpected ) ; - display( "numResponsesExpected", numResponsesExpected ) ; + int numResp = cs.release(numResponsesExpected); + display("numResponsesExpected", numResponsesExpected); if (!cs.isBusy()) { - boolean connectionClosed = false ; + boolean connectionClosed = false; if (numResp == 0) { - connectionClosed = reclaimOrClose( cs, conn ) ; + connectionClosed = reclaimOrClose(cs, conn); } - decrementTotalBusy() ; + decrementTotalBusy(); if (!connectionClosed) { - msg( "idle connection queued" ) ; - totalIdle++ ; + msg("idle connection queued"); + totalIdle++; } } } } finally { - display( "cs", cs ) ; - display( "totalIdle", totalIdle ) ; - display( "totalBusy", totalBusy ) ; - lock.unlock() ; + display("cs", cs); + display("totalIdle", totalIdle); + display("totalBusy", totalBusy); + lock.unlock(); } } - /** Decrement the number of expected responses. When a connection is idle - * and has no expected responses, it can be reclaimed. + /** + * Decrement the number of expected responses. When a connection is idle and has no expected responses, it can be + * reclaimed. */ @Transport - public void responseReceived( final C conn ) { - lock.lock() ; + public void responseReceived(final C conn) { + lock.lock(); try { - final OutboundConnectionState cs = connectionMap.get( conn ) ; + final OutboundConnectionState cs = connectionMap.get(conn); if (cs == null) { - msg( "response received on closed connection" ) ; - return ; + msg("response received on closed connection"); + return; } if (cs.responseReceived()) { - reclaimOrClose( cs, conn ) ; + reclaimOrClose(cs, conn); } } finally { - lock.unlock() ; + lock.unlock(); } } - + // If overflow, close conn and return true, // otherwise enqueue on reclaimable queue and return false. @Transport - private boolean reclaimOrClose( OutboundConnectionState cs, - final C conn ) { + private boolean reclaimOrClose(OutboundConnectionState cs, final C conn) { - final boolean isOverflow = numberOfConnections() > - highWaterMark() ; + final boolean isOverflow = numberOfConnections() > highWaterMark(); if (isOverflow) { - msg( "closing overflow connection" ) ; - close( conn ) ; + msg("closing overflow connection"); + close(conn); } else { - msg( "queuing reclaimable connection" ) ; - cs.setReclaimableHandle( - reclaimableConnections.offer( conn ) ) ; + msg("queuing reclaimable connection"); + cs.setReclaimableHandle(reclaimableConnections.offer(conn)); } - return isOverflow ; + return isOverflow; } - - /** Close a connection, regardless of whether the connection is busy - * or not. + /** + * Close a connection, regardless of whether the connection is busy or not. */ @Transport - public void close( final C conn ) { - lock.lock() ; + public void close(final C conn) { + lock.lock(); try { - final OutboundConnectionState cs = connectionMap.remove( conn ) ; + final OutboundConnectionState cs = connectionMap.remove(conn); if (cs == null) { - msg( "connection was already closed" ) ; - return ; + msg("connection was already closed"); + return; } - display( "cs", cs ) ; + display("cs", cs); if (cs.isBusy()) { - msg( "connection removed from busy connections" ) ; - decrementTotalBusy() ; + msg("connection removed from busy connections"); + decrementTotalBusy(); } else if (cs.isIdle()) { - msg( "connection removed from idle connections" ) ; - decrementTotalIdle() ; + msg("connection removed from idle connections"); + decrementTotalIdle(); } try { cs.close(); @@ -376,25 +361,25 @@ public void close( final C conn ) { // ignore this } } finally { - lock.unlock() ; + lock.unlock(); } } @Transport private void decrementTotalIdle() { if (totalIdle > 0) { - totalIdle-- ; + totalIdle--; } else { - msg( "ERROR: was already 0!" ) ; + msg("ERROR: was already 0!"); } } @Transport private void decrementTotalBusy() { if (totalBusy > 0) { - totalBusy-- ; + totalBusy--; } else { - msg( "ERROR: count was already 0!" ) ; + msg("ERROR: count was already 0!"); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionCacheImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionCacheImpl.java index ea880e757..cf03e43e6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionCacheImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionCacheImpl.java @@ -19,252 +19,235 @@ package com.sun.corba.ee.impl.transport.connection; -import java.io.IOException ; +import java.io.IOException; -import java.util.concurrent.ConcurrentMap ; -import java.util.concurrent.ConcurrentHashMap ; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger ; +import java.util.concurrent.atomic.AtomicInteger; -import com.sun.corba.ee.spi.transport.connection.Connection ; -import com.sun.corba.ee.spi.transport.connection.ConnectionFinder ; -import com.sun.corba.ee.spi.transport.connection.ContactInfo ; -import com.sun.corba.ee.spi.transport.connection.OutboundConnectionCache ; +import com.sun.corba.ee.spi.transport.connection.Connection; +import com.sun.corba.ee.spi.transport.connection.ConnectionFinder; +import com.sun.corba.ee.spi.transport.connection.ContactInfo; +import com.sun.corba.ee.spi.transport.connection.OutboundConnectionCache; import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue; import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueueFactory; -/** Manage connections that are initiated from this VM. Connections are managed - * by a get/release mechanism and cached by the ContactInfo used to create them. - * For efficiency, multiple connections (referred to as parallel connections) - * may be created using the same ContactInfo. Connections are reclaimed when - * they are no longer in use and there are too many connections open. +/** + * Manage connections that are initiated from this VM. Connections are managed by a get/release mechanism and cached by + * the ContactInfo used to create them. For efficiency, multiple connections (referred to as parallel connections) may + * be created using the same ContactInfo. Connections are reclaimed when they are no longer in use and there are too + * many connections open. *

    - * A connection is obtained through the get method, and released back to the - * cache through the release method. Note that a connection that is released - * may still be expecting a response, in which case the connection is NOT - * eligible for reclamation. If a connection is released to the cache while - * expecting a response, the connection must me made available for reclamation - * by calling responseReceived. + * A connection is obtained through the get method, and released back to the cache through the release method. Note that + * a connection that is released may still be expecting a response, in which case the connection is NOT eligible for + * reclamation. If a connection is released to the cache while expecting a response, the connection must me made + * available for reclamation by calling responseReceived. * - * XXX Should a get/release cycle expect at most one response? - * Should it support more than one response? - * Are there cases where we don't know in advance how many responses - * are expected? + * XXX Should a get/release cycle expect at most one response? Should it support more than one response? Are there cases + * where we don't know in advance how many responses are expected? + *

    + * A connection basically represents some sort of communication channel, but few requirements are placed on the + * connection. Basically the ability to close a connection is required in order for reclamation to work. *

    - * A connection basically represents some sort of communication channel, but - * few requirements are placed on the connection. Basically the ability to - * close a connection is required in order for reclamation to work. - *

    * Also we need the ContactInfo as a factory for the Connection. * * @author Ken Cavanaugh */ -public final class OutboundConnectionCacheImpl - extends ConnectionCacheNonBlockingBase - implements OutboundConnectionCache { +public final class OutboundConnectionCacheImpl extends ConnectionCacheNonBlockingBase + implements OutboundConnectionCache { - private final int maxParallelConnections ; // Maximum number of connections - // we will open to the same - // endpoint + private final int maxParallelConnections; // Maximum number of connections + // we will open to the same + // endpoint - private final ConcurrentMap,CacheEntry> entryMap ; - private final ConcurrentMap> connectionMap ; + private final ConcurrentMap, CacheEntry> entryMap; + private final ConcurrentMap> connectionMap; public int maxParallelConnections() { - return maxParallelConnections ; + return maxParallelConnections; } protected String thisClassName() { - return "OutboundConnectionCacheImpl" ; + return "OutboundConnectionCacheImpl"; } private static final class ConnectionState { - final ContactInfo cinfo ; // ContactInfo used to - // create this Connection - final C connection ; // Connection of the - // ConnectionState - final CacheEntry entry ; // This Connection's - // CacheEntry - - final AtomicInteger busyCount ; // Number of calls to - // get without release - final AtomicInteger expectedResponseCount ; // Number of expected - // responses not yet - // received - - // At all times, a connection is either on the busy or idle queue in - // its ConnectionEntry, and so only the corresponding handle is - // non-null. If idleHandle is non-null, reclaimableHandle may also - // be non-null if the Connection is also on the + final ContactInfo cinfo; // ContactInfo used to + // create this Connection + final C connection; // Connection of the + // ConnectionState + final CacheEntry entry; // This Connection's + // CacheEntry + + final AtomicInteger busyCount; // Number of calls to + // get without release + final AtomicInteger expectedResponseCount; // Number of expected + // responses not yet + // received + + // At all times, a connection is either on the busy or idle queue in + // its ConnectionEntry, and so only the corresponding handle is + // non-null. If idleHandle is non-null, reclaimableHandle may also + // be non-null if the Connection is also on the // reclaimableConnections queue. - volatile ConcurrentQueue.Handle reclaimableHandle ; // non-null iff connection - // is not in use and has no - // outstanding requests - volatile ConcurrentQueue.Handle idleHandle ; // non-null iff connection - // is not in use - volatile ConcurrentQueue.Handle busyHandle ; // non-null iff connection - // is in use - - ConnectionState( final ContactInfo cinfo, final CacheEntry entry, - final C conn ) { - - this.cinfo = cinfo ; - this.connection = conn ; - this.entry = entry ; - - busyCount = new AtomicInteger() ; - expectedResponseCount = new AtomicInteger() ; - reclaimableHandle = null ; - idleHandle = null ; - busyHandle = null ; + volatile ConcurrentQueue.Handle reclaimableHandle; // non-null iff connection + // is not in use and has no + // outstanding requests + volatile ConcurrentQueue.Handle idleHandle; // non-null iff connection + // is not in use + volatile ConcurrentQueue.Handle busyHandle; // non-null iff connection + // is in use + + ConnectionState(final ContactInfo cinfo, final CacheEntry entry, final C conn) { + + this.cinfo = cinfo; + this.connection = conn; + this.entry = entry; + + busyCount = new AtomicInteger(); + expectedResponseCount = new AtomicInteger(); + reclaimableHandle = null; + idleHandle = null; + busyHandle = null; } } - // Represents an entry in the outbound connection cache. - // This version handles normal shareable ContactInfo + // Represents an entry in the outbound connection cache. + // This version handles normal shareable ContactInfo // (we also need to handle no share). private static final class CacheEntry { - final ConcurrentQueue idleConnections = - ConcurrentQueueFactory.makeBlockingConcurrentQueue(0) ; + final ConcurrentQueue idleConnections = ConcurrentQueueFactory.makeBlockingConcurrentQueue(0); - final ConcurrentQueue busyConnections = - ConcurrentQueueFactory.makeBlockingConcurrentQueue(0) ; + final ConcurrentQueue busyConnections = ConcurrentQueueFactory.makeBlockingConcurrentQueue(0); public int totalConnections() { - return idleConnections.size() + busyConnections.size() ; + return idleConnections.size() + busyConnections.size(); } } - public OutboundConnectionCacheImpl( final String cacheType, - final int highWaterMark, final int numberToReclaim, - final int maxParallelConnections, final long ttl ) { + public OutboundConnectionCacheImpl(final String cacheType, final int highWaterMark, final int numberToReclaim, + final int maxParallelConnections, final long ttl) { - super( cacheType, highWaterMark, numberToReclaim, ttl ) ; - this.maxParallelConnections = maxParallelConnections ; + super(cacheType, highWaterMark, numberToReclaim, ttl); + this.maxParallelConnections = maxParallelConnections; - this.entryMap = - new ConcurrentHashMap,CacheEntry>() ; - this.connectionMap = - new ConcurrentHashMap>() ; - this.reclaimableConnections = - ConcurrentQueueFactory.makeBlockingConcurrentQueue( ttl ) ; + this.entryMap = new ConcurrentHashMap, CacheEntry>(); + this.connectionMap = new ConcurrentHashMap>(); + this.reclaimableConnections = ConcurrentQueueFactory.makeBlockingConcurrentQueue(ttl); } // We do not need to define equals or hashCode for this class. - public C get( final ContactInfo cinfo, - ConnectionFinder finder ) throws IOException { + public C get(final ContactInfo cinfo, ConnectionFinder finder) throws IOException { - return get( cinfo ) ; + return get(cinfo); } - public C get( final ContactInfo cinfo ) throws IOException { - final CacheEntry entry = getEntry( cinfo ) ; - C result = null ; + public C get(final ContactInfo cinfo) throws IOException { + final CacheEntry entry = getEntry(cinfo); + C result = null; - final int totalConnections = totalBusy.get() + totalIdle.get() ; + final int totalConnections = totalBusy.get() + totalIdle.get(); if (totalConnections >= highWaterMark()) - reclaim() ; + reclaim(); do { - result = entry.idleConnections.poll().value() ; + result = entry.idleConnections.poll().value(); if (result == null) { - if (canCreateNewConnection( entry )) { + if (canCreateNewConnection(entry)) { // If this throws an exception just let it // propagate: let a higher layer handle a // connection creation failure. - result = cinfo.createConnection() ; + result = cinfo.createConnection(); - final ConnectionState cs = new ConnectionState( cinfo, - entry, result ) ; - connectionMap.put( result, cs ) ; + final ConnectionState cs = new ConnectionState(cinfo, entry, result); + connectionMap.put(result, cs); // Make sure this connection is busy: it is // available to other get calls as soon as - // it is added to the busy queue. For this reason we - // must increment busyCount BEFORE we add the result + // it is added to the busy queue. For this reason we + // must increment busyCount BEFORE we add the result // to the entry busy queue. - cs.busyCount.incrementAndGet() ; - entry.busyConnections.offer( result ) ; - totalBusy.incrementAndGet() ; - } else { + cs.busyCount.incrementAndGet(); + entry.busyConnections.offer(result); + totalBusy.incrementAndGet(); + } else { // use a busy connection, move to end of busyConnections // to indicate that the connection has been used recently. - result = entry.busyConnections.poll().value() ; + result = entry.busyConnections.poll().value(); if (result != null) { - entry.busyConnections.offer( result ) ; + entry.busyConnections.offer(result); } } } else { // got result from idlConnections; update queues and counts - final ConnectionState cs = connectionMap.get( result ) ; + final ConnectionState cs = connectionMap.get(result); if (cs == null) { // Connection was closed, so we can't use it - result = null ; + result = null; } else { - final ConcurrentQueue.Handle handle = cs.reclaimableHandle ; + final ConcurrentQueue.Handle handle = cs.reclaimableHandle; if (handle != null) { if (handle.remove()) { - totalIdle.decrementAndGet() ; - totalBusy.incrementAndGet() ; - entry.busyConnections.offer( result ) ; + totalIdle.decrementAndGet(); + totalBusy.incrementAndGet(); + entry.busyConnections.offer(result); } else { // another thread closed this connection: try again - result = null ; - } + result = null; + } } } } - } while (result == null) ; + } while (result == null); - return result ; + return result; } - public void release( final C conn, final int numResponsesExpected ) { + public void release(final C conn, final int numResponsesExpected) { try { - final ConnectionState cs = connectionMap.get( conn ) ; + final ConnectionState cs = connectionMap.get(conn); if (cs == null) { - return ; + return; } else { - int numResp = cs.expectedResponseCount.addAndGet( - numResponsesExpected ) ; - int numBusy = cs.busyCount.decrementAndGet() ; + int numResp = cs.expectedResponseCount.addAndGet(numResponsesExpected); + int numBusy = cs.busyCount.decrementAndGet(); if (numBusy == 0) { - final ConcurrentQueue.Handle busyHandle = cs.busyHandle ; - final CacheEntry entry = cs.entry ; - boolean wasOnBusy = false ; + final ConcurrentQueue.Handle busyHandle = cs.busyHandle; + final CacheEntry entry = cs.entry; + boolean wasOnBusy = false; if (busyHandle != null) - wasOnBusy = busyHandle.remove() ; + wasOnBusy = busyHandle.remove(); if (wasOnBusy) { - // At this point, it is possible that we have removed a - // busy connection from the busy queue, because the - // connection became busy again between the - // decrementAndGet call and the remove call. But, now - // that the entry is NOT on the busy or idle queues - // (because a connection is + // At this point, it is possible that we have removed a + // busy connection from the busy queue, because the + // connection became busy again between the + // decrementAndGet call and the remove call. But, now + // that the entry is NOT on the busy or idle queues + // (because a connection is // never on both queues at the same time), // it cannot again change state. - + if (cs.busyCount.get() > 0) { - cs.busyHandle = entry.busyConnections.offer( conn ) ; + cs.busyHandle = entry.busyConnections.offer(conn); } else { // If the connection does not have waiters, put it on // the global idle queue. // - // This is probably unlikely here, because - // release usually requires some response before + // This is probably unlikely here, because + // release usually requires some response before // the connection is eligible for reclamation. if (cs.expectedResponseCount.get() == 0) { - cs.reclaimableHandle = - reclaimableConnections.offer( conn ) ; - totalBusy.decrementAndGet() ; + cs.reclaimableHandle = reclaimableConnections.offer(conn); + totalBusy.decrementAndGet(); } - cs.idleHandle = entry.idleConnections.offer( conn ) ; + cs.idleHandle = entry.idleConnections.offer(conn); } } } @@ -273,87 +256,87 @@ public void release( final C conn, final int numResponsesExpected ) { } } - /** Decrement the number of expected responses. When a connection is idle - * and has no expected responses, it can be reclaimed. + /** + * Decrement the number of expected responses. When a connection is idle and has no expected responses, it can be + * reclaimed. */ - public void responseReceived( final C conn ) { - final ConnectionState cs = connectionMap.get( conn ) ; + public void responseReceived(final C conn) { + final ConnectionState cs = connectionMap.get(conn); if (cs == null) { - return ; + return; } - final ConcurrentQueue.Handle idleHandle = cs.idleHandle ; - final CacheEntry entry = cs.entry ; - final int waitCount = cs.expectedResponseCount.decrementAndGet() ; + final ConcurrentQueue.Handle idleHandle = cs.idleHandle; + final CacheEntry entry = cs.entry; + final int waitCount = cs.expectedResponseCount.decrementAndGet(); if (waitCount == 0) { - boolean wasOnIdle = false ; + boolean wasOnIdle = false; if (cs != null) - wasOnIdle = cs.idleHandle.remove() ; + wasOnIdle = cs.idleHandle.remove(); if (wasOnIdle) - cs.reclaimableHandle = reclaimableConnections.offer( conn ) ; + cs.reclaimableHandle = reclaimableConnections.offer(conn); } } - /** Close a connection, regardless of whether the connection is busy - * or not. + /** + * Close a connection, regardless of whether the connection is busy or not. */ - public void close( final C conn ) { - final ConnectionState cs = connectionMap.remove( conn ) ; + public void close(final C conn) { + final ConnectionState cs = connectionMap.remove(conn); if (cs == null) { - return ; + return; } - final CacheEntry entry = entryMap.remove( cs.cinfo ) ; + final CacheEntry entry = entryMap.remove(cs.cinfo); - final ConcurrentQueue.Handle rh = cs.reclaimableHandle ; + final ConcurrentQueue.Handle rh = cs.reclaimableHandle; if (rh != null) - rh.remove() ; + rh.remove(); - final ConcurrentQueue.Handle bh = cs.busyHandle ; + final ConcurrentQueue.Handle bh = cs.busyHandle; if (bh != null) - bh.remove() ; + bh.remove(); - final ConcurrentQueue.Handle ih = cs.idleHandle ; + final ConcurrentQueue.Handle ih = cs.idleHandle; if (ih != null) - ih.remove() ; + ih.remove(); - try { - conn.close() ; + try { + conn.close(); } catch (IOException exc) { // XXX log this } } - // Atomically either get the entry for ContactInfo OR + // Atomically either get the entry for ContactInfo OR // create a new one AND put it in the cache - private CacheEntry getEntry( ContactInfo cinfo ) { + private CacheEntry getEntry(ContactInfo cinfo) { // This should be the only place a CacheEntry is constructed. - CacheEntry entry = new CacheEntry() ; - CacheEntry result = entryMap.putIfAbsent( cinfo, entry ) ; + CacheEntry entry = new CacheEntry(); + CacheEntry result = entryMap.putIfAbsent(cinfo, entry); if (result != null) - return result ; + return result; else - return entry ; + return entry; } - // Return true iff the configuration and the current entry support - // creating another connection. Note that it must ALWAYS be + // Return true iff the configuration and the current entry support + // creating another connection. Note that it must ALWAYS be // legal to create a new connection if there is currently no connection. - private boolean canCreateNewConnection( final CacheEntry entry ) { - final int totalConnections = totalBusy.get() + totalIdle.get() ; - final int totalConnectionsInEntry = entry.totalConnections() ; - return (totalConnectionsInEntry == 0) || - ((totalConnections < highWaterMark()) && - (totalConnectionsInEntry < maxParallelConnections)) ; + private boolean canCreateNewConnection(final CacheEntry entry) { + final int totalConnections = totalBusy.get() + totalIdle.get(); + final int totalConnectionsInEntry = entry.totalConnections(); + return (totalConnectionsInEntry == 0) + || ((totalConnections < highWaterMark()) && (totalConnectionsInEntry < maxParallelConnections)); } - public boolean canCreateNewConnection( final ContactInfo cinfo ) { - final CacheEntry entry = entryMap.get( cinfo ) ; + public boolean canCreateNewConnection(final ContactInfo cinfo) { + final CacheEntry entry = entryMap.get(cinfo); if (entry == null) - return true ; + return true; - return canCreateNewConnection( entry ) ; + return canCreateNewConnection(entry); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionState.java b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionState.java index 81a94bed8..eda54cf48 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionState.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/transport/connection/OutboundConnectionState.java @@ -19,203 +19,211 @@ package com.sun.corba.ee.impl.transport.connection; -import java.io.IOException ; +import java.io.IOException; -import com.sun.corba.ee.spi.transport.connection.Connection ; -import com.sun.corba.ee.spi.transport.connection.ContactInfo ; +import com.sun.corba.ee.spi.transport.connection.Connection; +import com.sun.corba.ee.spi.transport.connection.ContactInfo; -import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue ; +import com.sun.corba.ee.spi.transport.concurrent.ConcurrentQueue; import com.sun.corba.ee.spi.trace.Transport; import org.glassfish.gmbal.Description; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; import org.glassfish.pfl.tf.spi.annotation.InfoMethod; @Transport @ManagedData public class OutboundConnectionState { // The real state of the connection - private enum ConnectionStateValue { NEW, BUSY, IDLE } + private enum ConnectionStateValue { + NEW, BUSY, IDLE + } + + private ConnectionStateValue csv; // Indicates state of connection - private ConnectionStateValue csv ; // Indicates state of connection + final ContactInfo cinfo; // ContactInfo used to create this + // Connection + final C connection; // Connection of the ConnectionState + // + final OutboundCacheEntry entry; // This Connection's OutboundCacheEntry - final ContactInfo cinfo ; // ContactInfo used to create this - // Connection - final C connection ; // Connection of the ConnectionState - // - final OutboundCacheEntry entry ; // This Connection's OutboundCacheEntry + private int busyCount; // Number of calls to get without release - private int busyCount ; // Number of calls to get without release - - int expectedResponseCount ; // Number of expected responses not yet - // received + int expectedResponseCount; // Number of expected responses not yet + // received - // At all times, a connection is either on the busy or idle queue in - // its ConnectionEntry. If the connection is on the idle queue, - // reclaimableHandle may also be non-null if the Connection is also on + // At all times, a connection is either on the busy or idle queue in + // its ConnectionEntry. If the connection is on the idle queue, + // reclaimableHandle may also be non-null if the Connection is also on // the reclaimableConnections queue. - ConcurrentQueue.Handle reclaimableHandle ; // non-null iff - // connection is not - // in use and has no - // outstanding requests + ConcurrentQueue.Handle reclaimableHandle; // non-null iff + // connection is not + // in use and has no + // outstanding requests public String toString() { - return "OutboundConnectionState[csv=" + csv - + ",cinfo=" + cinfo - + ",connection=" + connection - + ",busyCount=" + busyCount - + ",expectedResponceCount=" + expectedResponseCount + "]" ; + return "OutboundConnectionState[csv=" + csv + ",cinfo=" + cinfo + ",connection=" + connection + ",busyCount=" + busyCount + + ",expectedResponceCount=" + expectedResponseCount + "]"; } // State exposed as managed attributes @ManagedAttribute - @Description( "The current state of this connection") - private synchronized ConnectionStateValue state() { return csv ; } + @Description("The current state of this connection") + private synchronized ConnectionStateValue state() { + return csv; + } @ManagedAttribute - @Description( "The contactInfo used to create this connection") - private synchronized ContactInfo contactInfo() { return cinfo ; } + @Description("The contactInfo used to create this connection") + private synchronized ContactInfo contactInfo() { + return cinfo; + } @ManagedAttribute - @Description( "The underlying connection for this ConnectionState") - private synchronized C connection() { return connection ; } + @Description("The underlying connection for this ConnectionState") + private synchronized C connection() { + return connection; + } @ManagedAttribute - private synchronized OutboundCacheEntry cacheEntry() { return entry ; } - + private synchronized OutboundCacheEntry cacheEntry() { + return entry; + } + @ManagedAttribute - private synchronized int busyCount() { return busyCount ; } + private synchronized int busyCount() { + return busyCount; + } @ManagedAttribute private synchronized int expectedResponseCount() { - return expectedResponseCount ; + return expectedResponseCount; } @ManagedAttribute public synchronized boolean isReclaimable() { - return reclaimableHandle != null ; + return reclaimableHandle != null; } - public OutboundConnectionState( final ContactInfo cinfo, - final OutboundCacheEntry entry, final C conn ) { + public OutboundConnectionState(final ContactInfo cinfo, final OutboundCacheEntry entry, final C conn) { - this.csv = ConnectionStateValue.NEW ; - this.cinfo = cinfo ; - this.connection = conn ; - this.entry = entry ; + this.csv = ConnectionStateValue.NEW; + this.cinfo = cinfo; + this.connection = conn; + this.entry = entry; - busyCount = 0 ; - expectedResponseCount = 0 ; - reclaimableHandle = null ; + busyCount = 0; + expectedResponseCount = 0; + reclaimableHandle = null; } // Methods used in OutboundConnectionCacheBlockingImpl - public synchronized boolean isBusy() { - return csv == ConnectionStateValue.BUSY ; - } + public synchronized boolean isBusy() { + return csv == ConnectionStateValue.BUSY; + } - public synchronized boolean isIdle() { - return csv == ConnectionStateValue.IDLE ; - } + public synchronized boolean isIdle() { + return csv == ConnectionStateValue.IDLE; + } - // Mark this connection as being busy, and increment + // Mark this connection as being busy, and increment // busyCount. @Transport - public synchronized void acquire() { + public synchronized void acquire() { if (busyCount == 0) { - entry.idleConnections.remove( connection ) ; - removeFromReclaim() ; - csv = ConnectionStateValue.BUSY ; + entry.idleConnections.remove(connection); + removeFromReclaim(); + csv = ConnectionStateValue.BUSY; } else { // Remove from busy queue so we can add it // back to LRU end later. - entry.busyConnections.remove( connection ) ; + entry.busyConnections.remove(connection); } - busyCount++ ; - entry.busyConnections.offer( connection ) ; + busyCount++; + entry.busyConnections.offer(connection); } - public synchronized void setReclaimableHandle( - ConcurrentQueue.Handle handle ) { - reclaimableHandle = handle ; + public synchronized void setReclaimableHandle(ConcurrentQueue.Handle handle) { + reclaimableHandle = handle; } @InfoMethod - private void msg( String m ) {} + private void msg(String m) { + } @InfoMethod - private void display( String m, Object value ) {} + private void display(String m, Object value) { + } // Decrement busyCount, and move to IDLE if busyCount is 0. // Returns total number of expected responses @Transport - public synchronized int release( int numResponsesExpected ) { - expectedResponseCount += numResponsesExpected ; - busyCount-- ; + public synchronized int release(int numResponsesExpected) { + expectedResponseCount += numResponsesExpected; + busyCount--; if (busyCount < 0) { - msg( "ERROR: numBusy is <0!" ) ; + msg("ERROR: numBusy is <0!"); } if (busyCount == 0) { - csv = ConnectionStateValue.IDLE ; - boolean wasOnBusy = entry.busyConnections.remove( connection ) ; + csv = ConnectionStateValue.IDLE; + boolean wasOnBusy = entry.busyConnections.remove(connection); if (!wasOnBusy) { - msg( "connection not on busy queue, should have been" ) ; + msg("connection not on busy queue, should have been"); } - entry.idleConnections.offer( connection ) ; + entry.idleConnections.offer(connection); } - display( "expectedResponseCount", expectedResponseCount ) ; - display( "busyCount", busyCount ) ; + display("expectedResponseCount", expectedResponseCount); + display("busyCount", busyCount); - return expectedResponseCount ; + return expectedResponseCount; } // Returns true iff the connection is idle and reclaimable @Transport public synchronized boolean responseReceived() { - boolean result = false ; - --expectedResponseCount ; - display( "expectedResponseCount", expectedResponseCount ) ; + boolean result = false; + --expectedResponseCount; + display("expectedResponseCount", expectedResponseCount); if (expectedResponseCount < 0) { - msg( "ERROR: expectedResponseCount<0!" ) ; - expectedResponseCount = 0 ; + msg("ERROR: expectedResponseCount<0!"); + expectedResponseCount = 0; } - result = (expectedResponseCount == 0) && (busyCount == 0) ; + result = (expectedResponseCount == 0) && (busyCount == 0); - return result ; + return result; } @Transport public synchronized void close() throws IOException { - removeFromReclaim() ; + removeFromReclaim(); if (csv == ConnectionStateValue.IDLE) { - entry.idleConnections.remove( connection ) ; + entry.idleConnections.remove(connection); } else if (csv == ConnectionStateValue.BUSY) { - entry.busyConnections.remove( connection ) ; + entry.busyConnections.remove(connection); } - csv = ConnectionStateValue.NEW ; - busyCount = 0 ; - expectedResponseCount = 0 ; + csv = ConnectionStateValue.NEW; + busyCount = 0; + expectedResponseCount = 0; - connection.close() ; + connection.close(); } @Transport private void removeFromReclaim() { if (reclaimableHandle != null) { if (!reclaimableHandle.remove()) { - display( "result was not on reclaimable Q", cinfo ) ; + display("result was not on reclaimable Q", cinfo); } - reclaimableHandle = null ; + reclaimableHandle = null; } } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/txpoa/TSIdentificationImpl.java b/orbmain/src/main/java/com/sun/corba/ee/impl/txpoa/TSIdentificationImpl.java index b053e42eb..f30373cbb 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/txpoa/TSIdentificationImpl.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/txpoa/TSIdentificationImpl.java @@ -21,63 +21,52 @@ import org.omg.CORBA.TSIdentification; -public class TSIdentificationImpl extends org.omg.CORBA.LocalObject - implements TSIdentification { +public class TSIdentificationImpl extends org.omg.CORBA.LocalObject implements TSIdentification { - private org.omg.CosTSPortability.Sender sender=null; - private org.omg.CosTSPortability.Receiver receiver=null; + private org.omg.CosTSPortability.Sender sender = null; + private org.omg.CosTSPortability.Receiver receiver = null; - /** identify_sender is called by the OTS during initialization - to register its Sender callback interface with the ORB. - identify_sender may throw a AlreadyIdentified exception if - the registration has already been done previously. - */ - public void - identify_sender(org.omg.CosTSPortability.Sender senderOTS) - throws org.omg.CORBA.TSIdentificationPackage.NotAvailable, - org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified - { - if ( sender == null ) + /** + * identify_sender is called by the OTS during initialization to register its Sender callback interface with the ORB. + * identify_sender may throw a AlreadyIdentified exception if the registration has already been done previously. + */ + public void identify_sender(org.omg.CosTSPortability.Sender senderOTS) + throws org.omg.CORBA.TSIdentificationPackage.NotAvailable, org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified { + if (sender == null) sender = senderOTS; else throw new org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified(); } - - /** identify_receiver is called by the OTS during initialization - to register its Receiver callback interface with the ORB. - identify_receiver may throw a AlreadyIdentified exception if - the registration has already been done previously. - */ - public void - identify_receiver(org.omg.CosTSPortability.Receiver receiverOTS) - throws org.omg.CORBA.TSIdentificationPackage.NotAvailable, - org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified - { - if ( receiver == null ) + /** + * identify_receiver is called by the OTS during initialization to register its Receiver callback interface with the + * ORB. identify_receiver may throw a AlreadyIdentified exception if the registration has already been done previously. + */ + public void identify_receiver(org.omg.CosTSPortability.Receiver receiverOTS) + throws org.omg.CORBA.TSIdentificationPackage.NotAvailable, org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified { + if (receiver == null) receiver = receiverOTS; else throw new org.omg.CORBA.TSIdentificationPackage.AlreadyIdentified(); } - - /** getSender is not defined in the OTS spec. It is just a convenience - method to allow the ORB to access the Sender subsequent to - initialization. - * @return the ORB's Sender - */ + /** + * getSender is not defined in the OTS spec. It is just a convenience method to allow the ORB to access the Sender + * subsequent to initialization. + * + * @return the ORB's Sender + */ public org.omg.CosTSPortability.Sender getSender() { return sender; } - /** getReceiver is not defined in the OTS spec. It is just a convenience - method to allow the ORB to access the Receiver subsequent to - initialization. + /** + * getReceiver is not defined in the OTS spec. It is just a convenience method to allow the ORB to access the Receiver + * subsequent to initialization. + * * @return The receiver - */ - public org.omg.CosTSPortability.Receiver - getReceiver() - { + */ + public org.omg.CosTSPortability.Receiver getReceiver() { return receiver; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/util/JDKBridge.java b/orbmain/src/main/java/com/sun/corba/ee/impl/util/JDKBridge.java index c1e598a88..b3d4a6ad0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/util/JDKBridge.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/util/JDKBridge.java @@ -21,202 +21,190 @@ package com.sun.corba.ee.impl.util; - import java.rmi.server.RMIClassLoader; import java.security.AccessController; import java.net.MalformedURLException; -import java.util.Map ; -import java.util.HashMap ; -import java.util.WeakHashMap ; +import java.util.Map; +import java.util.HashMap; +import java.util.WeakHashMap; import java.util.logging.Logger; import java.util.logging.Level; -import java.lang.ref.SoftReference ; -import java.lang.ref.ReferenceQueue ; +import java.lang.ref.SoftReference; +import java.lang.ref.ReferenceQueue; import com.sun.corba.ee.org.omg.CORBA.GetPropertyAction; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; /** - * Utility methods for doing various method calls which are used - * by multiple classes + * Utility methods for doing various method calls which are used by multiple classes */ public class JDKBridge { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - private static Logger logger = Logger.getLogger(JDKBridge.class.getName()) ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + private static Logger logger = Logger.getLogger(JDKBridge.class.getName()); /** - * Get local codebase System property (java.rmi.server.codebase). - * May be null or a space separated array of URLS. + * Get local codebase System property (java.rmi.server.codebase). May be null or a space separated array of URLS. + * * @return The value of the property */ - public static String getLocalCodebase () { + public static String getLocalCodebase() { return localCodebase; } - + /** - * Return true if the system property "java.rmi.server.useCodebaseOnly" - * is set, false otherwise. + * Return true if the system property "java.rmi.server.useCodebaseOnly" is set, false otherwise. + * * @return If the property is set */ - public static boolean useCodebaseOnly () { + public static boolean useCodebaseOnly() { return useCodebaseOnly; } - + // Building caches for loadClass // // There are two cases: // 1. loader == null - // In this case, we need Maps remoteCodeBase -> className -> SoftReference to Class + // In this case, we need Maps remoteCodeBase -> className -> SoftReference to Class // 2. loader != null, - // In this case, we need Maps (weak) loader -> className -> SoftReference to Class + // In this case, we need Maps (weak) loader -> className -> SoftReference to Class // - // We might also want to cache not found results. This can be represented by: + // We might also want to cache not found results. This can be represented by: // 1. Map remoteCodeBase -> Set classname // 2. Map (weak) loader -> Set classname // But this is assuming that if a ClassLoader cannot load a class at one time, it also cannot // load it later! That is not always true, e.g. a new class file is added to a directory. // Best to avoid this! // - // We reclaim soft references using a ReferenceQueue. + // We reclaim soft references using a ReferenceQueue. private static class LoadClassCache { - private static Map> nullLoaderMap = - new HashMap>() ; - private static Map> nonNullLoaderMap = - new WeakHashMap>() ; - private static ReferenceQueue queue = - new ReferenceQueue() ; + private static Map> nullLoaderMap = new HashMap>(); + private static Map> nonNullLoaderMap = new WeakHashMap>(); + private static ReferenceQueue queue = new ReferenceQueue(); private static class Entry extends SoftReference { - String codeBase ; - ClassLoader loader ; + String codeBase; + ClassLoader loader; - public Entry( Class cls, String codeBase, ClassLoader loader ) { - super( cls, queue ) ; - this.codeBase = codeBase ; - this.loader = loader ; + public Entry(Class cls, String codeBase, ClassLoader loader) { + super(cls, queue); + this.codeBase = codeBase; + this.loader = loader; } @Override public void clear() { - codeBase = null ; - loader = null ; + codeBase = null; + loader = null; } } - + private static void checkQueue() { while (true) { - Object obj = queue.poll() ; + Object obj = queue.poll(); if (obj == null) { - return ; + return; } else { - Entry entry = (Entry)obj ; - String className = entry.get().getName() ; + Entry entry = (Entry) obj; + String className = entry.get().getName(); if (entry.loader == null) { - Map mse = nullLoaderMap.get( entry.codeBase ) ; - mse.remove( className ) ; + Map mse = nullLoaderMap.get(entry.codeBase); + mse.remove(className); if (mse.isEmpty()) { - nullLoaderMap.remove( entry.codeBase ) ; + nullLoaderMap.remove(entry.codeBase); } } else { - Map mse = nonNullLoaderMap.get( entry.loader ) ; - mse.remove( className ) ; + Map mse = nonNullLoaderMap.get(entry.loader); + mse.remove(className); if (mse.isEmpty()) { - nonNullLoaderMap.remove( entry.loader ) ; + nonNullLoaderMap.remove(entry.loader); } } - entry.clear() ; + entry.clear(); } - } + } } - /** Returns Class if it is still known to be the resolution of the parameters, - * throws ClassNotFoundException if it is still known that the class - * can NOT be resolved, or return null if nothing is known. + /** + * Returns Class if it is still known to be the resolution of the parameters, throws ClassNotFoundException if it is + * still known that the class can NOT be resolved, or return null if nothing is known. */ - public static synchronized Class get( String className, String remoteCodebase, - ClassLoader loader ) throws ClassNotFoundException { - - checkQueue() ; + public static synchronized Class get(String className, String remoteCodebase, ClassLoader loader) throws ClassNotFoundException { + + checkQueue(); - Map scm ; + Map scm; if (loader == null) { - scm = nullLoaderMap.get( remoteCodebase ) ; + scm = nullLoaderMap.get(remoteCodebase); } else { - scm = nonNullLoaderMap.get( loader ) ; + scm = nonNullLoaderMap.get(loader); } - Class cls = null ; + Class cls = null; if (scm != null) { - Entry entry = scm.get( className ) ; + Entry entry = scm.get(className); if (entry != null) - cls = entry.get() ; + cls = entry.get(); } - return cls ; + return cls; } - public static synchronized void put( String className, String remoteCodebase, - ClassLoader loader, Class cls ) { - - checkQueue() ; + public static synchronized void put(String className, String remoteCodebase, ClassLoader loader, Class cls) { + + checkQueue(); - Map scm ; + Map scm; if (loader == null) { - scm = nullLoaderMap.get( remoteCodebase ) ; + scm = nullLoaderMap.get(remoteCodebase); if (scm == null) { - scm = new HashMap() ; - nullLoaderMap.put( remoteCodebase, scm ) ; + scm = new HashMap(); + nullLoaderMap.put(remoteCodebase, scm); } } else { - scm = nonNullLoaderMap.get( loader ) ; + scm = nonNullLoaderMap.get(loader); if (scm == null) { - scm = new HashMap() ; - nonNullLoaderMap.put( loader, scm ) ; + scm = new HashMap(); + nonNullLoaderMap.put(loader, scm); } } - scm.put( className, new Entry( cls, remoteCodebase, loader ) ) ; + scm.put(className, new Entry(cls, remoteCodebase, loader)); } } /** - * Returns a class instance for the specified class. + * Returns a class instance for the specified class. + * * @param className the name of the class - * @param remoteCodebase a space-separated array of urls at which - * the class might be found. May be null. - * @param loader a ClassLoader who may be used to - * load the class if all other methods fail. + * @param remoteCodebase a space-separated array of urls at which the class might be found. May be null. + * @param loader a ClassLoader who may be used to load the class if all other methods fail. * @return the Class object representing the loaded class. * @throws ClassNotFoundException if class cannot be loaded. */ - public static Class loadClass (String className, - String remoteCodebase, - ClassLoader loader) - throws ClassNotFoundException { - + public static Class loadClass(String className, String remoteCodebase, ClassLoader loader) throws ClassNotFoundException { + // XXX GFv3 Disable use of the cache for now: // // it is caching different classes incorrectly that have // the same name, but different ClassLoaders. - Class cls = null ; + Class cls = null; // NOCACHE LoadClassCache.get( className, remoteCodebase, loader ) ; if (cls == null) { if (loader == null) { - cls = loadClassM(className,remoteCodebase,useCodebaseOnly); + cls = loadClassM(className, remoteCodebase, useCodebaseOnly); } else { try { - cls = loadClassM(className,remoteCodebase,useCodebaseOnly); + cls = loadClassM(className, remoteCodebase, useCodebaseOnly); } catch (ClassNotFoundException e) { - // GLASSFISH-18986 [PERF] Failed ClassLoading consuming too much logging time - // limit the logger calls to finest level only + // GLASSFISH-18986 [PERF] Failed ClassLoading consuming too much logging time + // limit the logger calls to finest level only if (logger.isLoggable(Level.FINE)) { - wrapper.classNotFoundInCodebase( className, remoteCodebase ) ; + wrapper.classNotFoundInCodebase(className, remoteCodebase); } cls = loader.loadClass(className); } @@ -224,32 +212,30 @@ public static Class loadClass (String className, // NOCACHE LoadClassCache.put( className, remoteCodebase, loader, cls ) ; } - return cls ; + return cls; } - + /** - * Returns a class instance for the specified class. + * Returns a class instance for the specified class. + * * @param className the name of the class - * @param remoteCodebase a space-separated array of urls at which - * the class might be found. May be null. + * @param remoteCodebase a space-separated array of urls at which the class might be found. May be null. * @return the Class object representing the loaded class. * @throws ClassNotFoundException if class cannot be loaded. */ - public static Class loadClass (String className, - String remoteCodebase) - throws ClassNotFoundException { - return loadClass(className,remoteCodebase,null); + public static Class loadClass(String className, String remoteCodebase) throws ClassNotFoundException { + return loadClass(className, remoteCodebase, null); } - + /** - * Returns a class instance for the specified class. + * Returns a class instance for the specified class. + * * @param className the name of the class * @return the Class object representing the loaded class. * @throws ClassNotFoundException if class cannot be loaded. */ - public static Class loadClass (String className) - throws ClassNotFoundException { - return loadClass(className,null,null); + public static Class loadClass(String className) throws ClassNotFoundException { + return loadClass(className, null, null); } private static final String LOCAL_CODEBASE_KEY = "java.rmi.server.codebase"; @@ -260,21 +246,18 @@ public static Class loadClass (String className) static { setCodebaseProperties(); } - + /** - * Set the codebase and useCodebaseOnly properties. This is public - * only for test code. + * Set the codebase and useCodebaseOnly properties. This is public only for test code. */ - public static synchronized void setCodebaseProperties () { - String prop = (String)AccessController.doPrivileged( - new GetPropertyAction(LOCAL_CODEBASE_KEY)); + public static synchronized void setCodebaseProperties() { + String prop = (String) AccessController.doPrivileged(new GetPropertyAction(LOCAL_CODEBASE_KEY)); if (prop != null && prop.trim().length() > 0) { localCodebase = prop; } - prop = (String)AccessController.doPrivileged( - new GetPropertyAction(USE_CODEBASE_ONLY_KEY)); + prop = (String) AccessController.doPrivileged(new GetPropertyAction(USE_CODEBASE_ONLY_KEY)); if (prop != null && prop.trim().length() > 0) { useCodebaseOnly = Boolean.valueOf(prop).booleanValue(); @@ -282,31 +265,29 @@ public static synchronized void setCodebaseProperties () { } /** - * Set the default code base. This method is here only - * for test code. + * Set the default code base. This method is here only for test code. + * * @param codebase The local codebase */ public static synchronized void setLocalCodebase(String codebase) { - localCodebase = codebase; + localCodebase = codebase; } - - private static Class loadClassM (String className, String remoteCodebase, - boolean useCodebaseOnly) throws ClassNotFoundException { + + private static Class loadClassM(String className, String remoteCodebase, boolean useCodebaseOnly) throws ClassNotFoundException { try { - return JDKClassLoader.loadClass(null,className); + return JDKClassLoader.loadClass(null, className); } catch (ClassNotFoundException e) { - // GLASSFISH-18986 [PERF] Failed ClassLoading consuming too much logging time - // limit the logger calls to finest level only + // GLASSFISH-18986 [PERF] Failed ClassLoading consuming too much logging time + // limit the logger calls to finest level only if (logger.isLoggable(Level.FINE)) { - wrapper.classNotFoundInJDKClassLoader( className, e ) ; + wrapper.classNotFoundInJDKClassLoader(className, e); } } try { if (!useCodebaseOnly && remoteCodebase != null) { - return RMIClassLoader.loadClass(remoteCodebase, - className); + return RMIClassLoader.loadClass(remoteCodebase, className); } else { return RMIClassLoader.loadClass(className); } @@ -317,4 +298,3 @@ private static Class loadClassM (String className, String remoteCodebase, throw new ClassNotFoundException(className); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/util/JDKClassLoader.java b/orbmain/src/main/java/com/sun/corba/ee/impl/util/JDKClassLoader.java index 1a1f6aa3f..d1ee8fbed 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/util/JDKClassLoader.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/util/JDKClassLoader.java @@ -22,32 +22,27 @@ import org.glassfish.pfl.basic.reflection.Bridge; -import java.util.Map ; -import java.util.WeakHashMap ; -import java.util.Collections ; +import java.util.Map; +import java.util.WeakHashMap; +import java.util.Collections; -import java.security.AccessController ; -import java.security.PrivilegedAction ; +import java.security.AccessController; +import java.security.PrivilegedAction; /** - * Utility method for crawling call stack to load class + * Utility method for crawling call stack to load class */ class JDKClassLoader { - private static final JDKClassLoaderCache classCache - = new JDKClassLoaderCache(); + private static final JDKClassLoaderCache classCache = new JDKClassLoaderCache(); - private static final Bridge bridge = - (Bridge)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return Bridge.get() ; - } - } - ) ; + private static final Bridge bridge = (Bridge) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return Bridge.get(); + } + }); - static Class loadClass(Class aClass, String className) - throws ClassNotFoundException { + static Class loadClass(Class aClass, String className) throws ClassNotFoundException { // Maintain the same error semantics as Class.forName() if (className == null) { @@ -62,7 +57,7 @@ static Class loadClass(Class aClass, String className) // fail. // // Otherwise, we end up calling Class.forName here as well as in - // the next step in JDKBridge. That can take a long time depending + // the next step in JDKBridge. That can take a long time depending // on the length of the classpath. // Note: Looking at the only place in JDKBridge where this code @@ -84,23 +79,22 @@ static Class loadClass(Class aClass, String className) // loader isn't known to fail, so try // to load it. return Class.forName(className, false, loader); - } catch(ClassNotFoundException cnfe) { + } catch (ClassNotFoundException cnfe) { // Record that we failed to find the class - // with this particular loader. This way, we won't + // with this particular loader. This way, we won't // waste time looking with this loader, again. classCache.recordFailure(key); throw cnfe; } } } - + /** * Private cache implementation specific to JDKClassLoader. */ - private static class JDKClassLoaderCache - { + private static class JDKClassLoaderCache { // JDKClassLoader couldn't find the class with the located - // ClassLoader. Note this in our cache so JDKClassLoader + // ClassLoader. Note this in our cache so JDKClassLoader // can abort early next time. public final void recordFailure(Object key) { cache.put(key, JDKClassLoaderCache.KNOWN_TO_FAIL); @@ -112,7 +106,7 @@ public final void recordFailure(Object key) { // A key currently consists of the class name as well as // the latest user defined class loader, so it's fairly // expensive to create. - public final Object createKey(String className, ClassLoader latestLoader) { + public final Object createKey(String className, ClassLoader latestLoader) { return new CacheKey(className, latestLoader); } @@ -123,8 +117,7 @@ public final boolean knownToFail(Object key) { } // Synchronized WeakHashMap - private final Map cache - = Collections.synchronizedMap(new WeakHashMap()); + private final Map cache = Collections.synchronizedMap(new WeakHashMap()); // Cache result used to mark the caches when there is // no way JDKClassLoader could succeed with the given @@ -133,11 +126,10 @@ public final boolean knownToFail(Object key) { // Key consisting of the class name and the latest // user defined class loader - private static class CacheKey - { + private static class CacheKey { String className; ClassLoader loader; - + public CacheKey(String className, ClassLoader loader) { this.className = className; this.loader = loader; @@ -159,19 +151,18 @@ public boolean equals(Object obj) { if (obj == null) return false; - CacheKey other = (CacheKey)obj; + CacheKey other = (CacheKey) obj; // I've made a decision to actually compare the - // loader references. I don't want a case when + // loader references. I don't want a case when // two loader instances override their equals // methods and only compare code base. // // This way, at worst, our performance will // be slower, but we know we'll do the correct // loading. - return (className.equals(other.className) && - loader == other.loader); - + return (className.equals(other.className) && loader == other.loader); + } catch (ClassCastException cce) { return false; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/util/ORBProperties.java b/orbmain/src/main/java/com/sun/corba/ee/impl/util/ORBProperties.java index 3fcb45385..2c69102d1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/util/ORBProperties.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/util/ORBProperties.java @@ -26,26 +26,22 @@ public class ORBProperties { - public static final String ORB_CLASS = - "org.omg.CORBA.ORBClass=com.sun.corba.ee.impl.orb.ORBImpl"; - public static final String ORB_SINGLETON_CLASS = - "org.omg.CORBA.ORBSingletonClass=com.sun.corba.ee.impl.orb.ORBSingleton"; - - public static void main (String[] args) { + public static final String ORB_CLASS = "org.omg.CORBA.ORBClass=com.sun.corba.ee.impl.orb.ORBImpl"; + public static final String ORB_SINGLETON_CLASS = "org.omg.CORBA.ORBSingletonClass=com.sun.corba.ee.impl.orb.ORBSingleton"; + + public static void main(String[] args) { try { // Check if orb.properties exists String javaHome = System.getProperty("java.home"); - File propFile = new File(javaHome + File.separator - + "lib" + File.separator - + "orb.properties"); - + File propFile = new File(javaHome + File.separator + "lib" + File.separator + "orb.properties"); + if (propFile.exists()) return; // Write properties to orb.properties FileOutputStream out = new FileOutputStream(propFile); - PrintWriter pw = new PrintWriter(out); + PrintWriter pw = new PrintWriter(out); try { pw.println(ORB_CLASS); @@ -55,7 +51,8 @@ public static void main (String[] args) { out.close(); } - } catch (Exception ex) { } - + } catch (Exception ex) { + } + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/util/PackagePrefixChecker.java b/orbmain/src/main/java/com/sun/corba/ee/impl/util/PackagePrefixChecker.java index 454711adc..73e1d1747 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/util/PackagePrefixChecker.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/util/PackagePrefixChecker.java @@ -23,44 +23,41 @@ /** * PackagePrefixChecker provides static utility methods for getting package prefixes. + * * @author M. Mortazavi */ -public final class PackagePrefixChecker -{ +public final class PackagePrefixChecker { private static final String PACKAGE_PREFIX = "org.omg.stub."; - private static final int PACKAGE_PREFIX_LENGTH = PACKAGE_PREFIX.length() ; + private static final int PACKAGE_PREFIX_LENGTH = PACKAGE_PREFIX.length(); - public static String packagePrefix(){ return PACKAGE_PREFIX;} + public static String packagePrefix() { + return PACKAGE_PREFIX; + } - public static String correctPackageName (String p) - { + public static String correctPackageName(String p) { if (isOffendingPackage(p)) - return PACKAGE_PREFIX+p; - else + return PACKAGE_PREFIX + p; + else return p; } - public static boolean isOffendingPackage(String p) - { - return p!=null && (p.equals("java") || p.equals("javax")) ; + public static boolean isOffendingPackage(String p) { + return p != null && (p.equals("java") || p.equals("javax")); } - public static boolean hasOffendingPrefix(String p) - { - return p.startsWith("java.") || p.startsWith("javax.") ; + public static boolean hasOffendingPrefix(String p) { + return p.startsWith("java.") || p.startsWith("javax."); } - public static boolean hasBeenPrefixed(String p) - { - return p.startsWith(PACKAGE_PREFIX) ; + public static boolean hasBeenPrefixed(String p) { + return p.startsWith(PACKAGE_PREFIX); } - public static String withoutPackagePrefix(String p) - { - if (hasBeenPrefixed(p)) - return p.substring(PACKAGE_PREFIX_LENGTH) ; - else + public static String withoutPackagePrefix(String p) { + if (hasBeenPrefixed(p)) + return p.substring(PACKAGE_PREFIX_LENGTH); + else return p; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/util/RepositoryId.java b/orbmain/src/main/java/com/sun/corba/ee/impl/util/RepositoryId.java index 272a6f9e5..a3d829f4a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/util/RepositoryId.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/util/RepositoryId.java @@ -35,11 +35,11 @@ import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; -import com.sun.corba.ee.impl.misc.ClassInfoCache ; +import com.sun.corba.ee.impl.misc.ClassInfoCache; import org.glassfish.pfl.basic.concurrent.SoftCache; public class RepositoryId { - + // Legal IDL Identifier characters (1 = legal). Note // that '.' (2E) is marked as legal even though it is // not legal in IDL. This allows us to treat a fully @@ -48,31 +48,30 @@ public class RepositoryId { // legal use of '.' in a Java name. public static final byte[] IDL_IDENTIFIER_CHARS = { - - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f - 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff + + // 0 1 2 3 4 5 6 7 8 9 a b c d e f + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00-0f + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10-1f + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, // 20-2f + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 30-3f + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 40-4f + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 50-5f + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 60-6f + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, // 70-7f + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80-8f + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 90-9f + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // a0-af + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // b0-bf + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // c0-cf + 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, // d0-df + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // e0-ef + 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, // f0-ff }; - private static final long serialVersionUID = 123456789L; - private static final String defaultServerURL = JDKBridge.getLocalCodebase() ; - private static final boolean useCodebaseOnly = JDKBridge.useCodebaseOnly() ; + private static final String defaultServerURL = JDKBridge.getLocalCodebase(); + private static final boolean useCodebaseOnly = JDKBridge.useCodebaseOnly(); private static final Map, String> classToRepStr = new WeakHashMap<>(); private static final Map, String> classIDLToRepStr = new WeakHashMap<>(); @@ -93,8 +92,7 @@ public class RepositoryId { private String definedInId = null; private Class clazz = null; private String suid = null, actualSuid = null; - private long suidLong = ObjectStreamClass.kDefaultUID, actualSuidLong = - ObjectStreamClass.kDefaultUID; + private long suidLong = ObjectStreamClass.kDefaultUID, actualSuidLong = ObjectStreamClass.kDefaultUID; // Repository ID fragments private static final String kSequenceKeyword = "seq"; @@ -104,8 +102,7 @@ public class RepositoryId { private static final String kIDLClassnamePrefix = "org.omg."; private static final String kSequencePrefix = "["; private static final String kCORBAPrefix = "CORBA/"; - private static final String kArrayPrefix = kValuePrefix - + kSequencePrefix + kCORBAPrefix; + private static final String kArrayPrefix = kValuePrefix + kSequencePrefix + kCORBAPrefix; private static final int kValuePrefixLength = kValuePrefix.length(); private static final int kIDLPrefixLength = kIDLPrefix.length(); private static final int kSequencePrefixLength = kSequencePrefix.length(); @@ -114,64 +111,43 @@ public class RepositoryId { private static final String kExternalizableHashStr = "0000000000000001"; // Value tag utility methods and constants - public static final int kInitialValueTag= 0x7fffff00; + public static final int kInitialValueTag = 0x7fffff00; public static final int kNoTypeInfo = 0; public static final int kSingleRepTypeInfo = 0x02; - public static final int kPartialListTypeInfo = 0x06; - public static final int kChunkedMask = 0x08; - public static final int kPreComputed_StandardRMIUnchunked = - RepositoryId.computeValueTag(false, - RepositoryId.kSingleRepTypeInfo, false); - public static final int kPreComputed_CodeBaseRMIUnchunked = - RepositoryId.computeValueTag(true, - RepositoryId.kSingleRepTypeInfo, false); - public static final int kPreComputed_StandardRMIChunked = - RepositoryId.computeValueTag(false, - RepositoryId.kSingleRepTypeInfo, true); - public static final int kPreComputed_CodeBaseRMIChunked = - RepositoryId.computeValueTag(true, - RepositoryId.kSingleRepTypeInfo, true); - - public static final int kPreComputed_StandardRMIUnchunked_NoRep = - RepositoryId.computeValueTag(false, RepositoryId.kNoTypeInfo, false); - public static final int kPreComputed_CodeBaseRMIUnchunked_NoRep = - RepositoryId.computeValueTag(true, RepositoryId.kNoTypeInfo, false); - public static final int kPreComputed_StandardRMIChunked_NoRep = - RepositoryId.computeValueTag(false, RepositoryId.kNoTypeInfo, true); - public static final int kPreComputed_CodeBaseRMIChunked_NoRep = - RepositoryId.computeValueTag(true, RepositoryId.kNoTypeInfo, true); + public static final int kPartialListTypeInfo = 0x06; + public static final int kChunkedMask = 0x08; + public static final int kPreComputed_StandardRMIUnchunked = RepositoryId.computeValueTag(false, RepositoryId.kSingleRepTypeInfo, false); + public static final int kPreComputed_CodeBaseRMIUnchunked = RepositoryId.computeValueTag(true, RepositoryId.kSingleRepTypeInfo, false); + public static final int kPreComputed_StandardRMIChunked = RepositoryId.computeValueTag(false, RepositoryId.kSingleRepTypeInfo, true); + public static final int kPreComputed_CodeBaseRMIChunked = RepositoryId.computeValueTag(true, RepositoryId.kSingleRepTypeInfo, true); + + public static final int kPreComputed_StandardRMIUnchunked_NoRep = RepositoryId.computeValueTag(false, RepositoryId.kNoTypeInfo, false); + public static final int kPreComputed_CodeBaseRMIUnchunked_NoRep = RepositoryId.computeValueTag(true, RepositoryId.kNoTypeInfo, false); + public static final int kPreComputed_StandardRMIChunked_NoRep = RepositoryId.computeValueTag(false, RepositoryId.kNoTypeInfo, true); + public static final int kPreComputed_CodeBaseRMIChunked_NoRep = RepositoryId.computeValueTag(true, RepositoryId.kNoTypeInfo, true); // Public, well known repository IDs - - // _REVISIT_ : A table structure with a good search routine for all of this + + // _REVISIT_ : A table structure with a good search routine for all of this // would be more efficient and easier to maintain... // String - public static final String kWStringValueVersion = "1.0"; - public static final String kWStringValueHash = ":"+kWStringValueVersion; + public static final String kWStringValueVersion = "1.0"; + public static final String kWStringValueHash = ":" + kWStringValueVersion; public static final String kWStringStubValue = "WStringValue"; - public static final String kWStringTypeStr = "omg.org/CORBA/" - + kWStringStubValue; - public static final String kWStringValueRepID = kIDLPrefix - + kWStringTypeStr + kWStringValueHash; + public static final String kWStringTypeStr = "omg.org/CORBA/" + kWStringStubValue; + public static final String kWStringValueRepID = kIDLPrefix + kWStringTypeStr + kWStringValueHash; // Any public static final String kAnyRepID = kIDLPrefix + "omg.org/CORBA/Any"; // Class - public static final String kClassDescValueHash = ":" - + Long.toHexString( - ObjectStreamClass.getActualSerialVersionUID( - javax.rmi.CORBA.ClassDesc.class)).toUpperCase() - + ":" - + Long.toHexString( - ObjectStreamClass.getSerialVersionUID( - javax.rmi.CORBA.ClassDesc.class)).toUpperCase(); + public static final String kClassDescValueHash = ":" + + Long.toHexString(ObjectStreamClass.getActualSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase() + ":" + + Long.toHexString(ObjectStreamClass.getSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase(); public static final String kClassDescStubValue = "ClassDesc"; - public static final String kClassDescTypeStr = - "javax.rmi.CORBA."+kClassDescStubValue; - public static final String kClassDescValueRepID = - kValuePrefix + kClassDescTypeStr + kClassDescValueHash; + public static final String kClassDescTypeStr = "javax.rmi.CORBA." + kClassDescStubValue; + public static final String kClassDescValueRepID = kValuePrefix + kClassDescTypeStr + kClassDescValueHash; // Object public static final String kObjectValueHash = ":1.0"; @@ -243,57 +219,40 @@ public class RepositoryId { kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class); // 6793820: need to handle classes of primitive types! - kSpecialCasesClasses.put( "boolean", boolean.class ) ; - kSpecialCasesClasses.put( "byte", byte.class ) ; - kSpecialCasesClasses.put( "char", char.class ) ; - kSpecialCasesClasses.put( "short", short.class ) ; - kSpecialCasesClasses.put( "int", int.class ) ; - kSpecialCasesClasses.put( "long", long.class ) ; - kSpecialCasesClasses.put( "float", float.class ) ; - kSpecialCasesClasses.put( "double", double.class ) ; + kSpecialCasesClasses.put("boolean", boolean.class); + kSpecialCasesClasses.put("byte", byte.class); + kSpecialCasesClasses.put("char", char.class); + kSpecialCasesClasses.put("short", short.class); + kSpecialCasesClasses.put("int", int.class); + kSpecialCasesClasses.put("long", long.class); + kSpecialCasesClasses.put("float", float.class); + kSpecialCasesClasses.put("double", double.class); } public static final Hashtable, String> kSpecialCasesArrayPrefix = new Hashtable<>(); static { - kSpecialCasesArrayPrefix.put( java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); - kSpecialCasesArrayPrefix.put( java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/"); - kSpecialCasesArrayPrefix.put( java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/"); - kSpecialCasesArrayPrefix.put( java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/"); - kSpecialCasesArrayPrefix.put( java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/"); - kSpecialCasesArrayPrefix.put( java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); + kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); + kSpecialCasesArrayPrefix.put(java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/"); + kSpecialCasesArrayPrefix.put(java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/"); + kSpecialCasesArrayPrefix.put(java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/"); + kSpecialCasesArrayPrefix.put(java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/"); + kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); } public static final Hashtable kSpecialPrimitives = new Hashtable<>(); static { - kSpecialPrimitives.put("int","long"); - kSpecialPrimitives.put("long","longlong"); - kSpecialPrimitives.put("byte","octet"); + kSpecialPrimitives.put("int", "long"); + kSpecialPrimitives.put("long", "longlong"); + kSpecialPrimitives.put("byte", "octet"); } /** * Used to convert ascii to hex. */ - private static final byte ASCII_HEX[] = { - (byte)'0', - (byte)'1', - (byte)'2', - (byte)'3', - (byte)'4', - (byte)'5', - (byte)'6', - (byte)'7', - (byte)'8', - (byte)'9', - (byte)'A', - (byte)'B', - (byte)'C', - (byte)'D', - (byte)'E', - (byte)'F', - }; - + private static final byte ASCII_HEX[] = { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', + (byte) '7', (byte) '8', (byte) '9', (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', }; // bug fix for 4328952; to eliminate possibility of overriding this // in a subclass. @@ -305,16 +264,17 @@ public class RepositoryId { // To create a RepositoryID, use code similar to the following: // RepositoryId.cache.getId( id ); - - RepositoryId(){} - RepositoryId(String aRepId){ + RepositoryId() { + } + + RepositoryId(String aRepId) { init(aRepId); } RepositoryId init(String aRepId) { this.repId = aRepId; - + // Special case for remote if (aRepId.length() == 0) { clazz = java.rmi.Remote.class; @@ -326,95 +286,86 @@ RepositoryId init(String aRepId) { clazz = java.lang.String.class; typeString = kWStringTypeStr; isIDLType = true; - // fix where Attempting to obtain a FullValueDescription - // for an RMI value type with a String field causes an exception. + // fix where Attempting to obtain a FullValueDescription + // for an RMI value type with a String field causes an exception. completeClassName = "java.lang.String"; versionString = kWStringValueVersion; - return this; + return this; } else { String repId = convertFromISOLatin1(aRepId); - int firstIndex = repId.indexOf(':') ; + int firstIndex = repId.indexOf(':'); if (firstIndex == -1) - throw new IllegalArgumentException( - "RepositoryId must have the form :" ) ; - int secondIndex = repId.indexOf( ':', firstIndex + 1 ) ; + throw new IllegalArgumentException("RepositoryId must have the form :"); + int secondIndex = repId.indexOf(':', firstIndex + 1); if (secondIndex == -1) - versionString = "" ; - else - versionString = repId.substring(secondIndex) ; + versionString = ""; + else + versionString = repId.substring(secondIndex); if (repId.startsWith(kIDLPrefix)) { - typeString = - repId.substring(kIDLPrefixLength, - repId.indexOf(':', kIDLPrefixLength)); + typeString = repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength)); isIDLType = true; if (typeString.startsWith(kIDLNamePrefix)) - completeClassName = kIDLClassnamePrefix + - typeString.substring( - kIDLNamePrefix.length()).replace('/','.'); - else - completeClassName = typeString.replace('/','.'); + completeClassName = kIDLClassnamePrefix + typeString.substring(kIDLNamePrefix.length()).replace('/', '.'); + else + completeClassName = typeString.replace('/', '.'); } else if (repId.startsWith(kValuePrefix)) { - typeString = - repId.substring(kValuePrefixLength, - repId.indexOf(':', kValuePrefixLength)); + typeString = repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength)); isRMIValueType = true; if (versionString.indexOf('.') == -1) { actualSuid = versionString.substring(1); - suid = actualSuid; // default if not explicitly specified - - if (actualSuid.indexOf(':') != -1){ - // we have a declared hash also - int pos = actualSuid.indexOf(':')+1; + suid = actualSuid; // default if not explicitly specified + + if (actualSuid.indexOf(':') != -1) { + // we have a declared hash also + int pos = actualSuid.indexOf(':') + 1; // actualSuid = suid.substring(pos); // suid = suid.substring(0, pos-1); suid = actualSuid.substring(pos); - actualSuid = actualSuid.substring(0, pos-1); + actualSuid = actualSuid.substring(0, pos - 1); } } else { // _REVISIT_ : Special case version failure ? } } else { isSupportedFormat = false; - typeString = "" ; + typeString = ""; } if (typeString.startsWith(kSequencePrefix)) { isSequence = true; } - + return this; } } public final String getUnqualifiedName() { - if (unqualifiedName == null){ + if (unqualifiedName == null) { String className = getClassName(); int index = className.lastIndexOf('.'); - if (index == -1){ + if (index == -1) { unqualifiedName = className; definedInId = "IDL::1.0"; - } - else { + } else { unqualifiedName = className.substring(index); - definedInId = "IDL:" - + className.substring(0, index).replace('.','/') + ":1.0"; + definedInId = "IDL:" + className.substring(0, index).replace('.', '/') + ":1.0"; } } - + return unqualifiedName; } public final String getDefinedInId() { - if (definedInId == null){ + if (definedInId == null) { getUnqualifiedName(); } - + return definedInId; } @@ -425,7 +376,7 @@ public final String getTypeString() { public final String getVersionString() { return versionString; } - + public final String getSerialVersionUID() { return suid; } @@ -433,6 +384,7 @@ public final String getSerialVersionUID() { public final String getActualSerialVersionUID() { return actualSuid; } + public final long getSerialVersionUIDAsLong() { return suidLong; } @@ -444,7 +396,7 @@ public final long getActualSerialVersionUIDAsLong() { public final boolean isRMIValueType() { return isRMIValueType; } - + public final boolean isIDLType() { return isIDLType; } @@ -454,13 +406,13 @@ public final String getRepositoryId() { } public static byte[] getByteArray(String repStr) { - synchronized (repStrToByteArray){ + synchronized (repStrToByteArray) { return repStrToByteArray.get(repStr); } } public static void setByteArray(String repStr, byte[] repStrBytes) { - synchronized (repStrToByteArray){ + synchronized (repStrToByteArray) { repStrToByteArray.put(repStr, repStrBytes); } } @@ -473,8 +425,8 @@ public final boolean isSupportedFormat() { return isSupportedFormat; } - // This method will return the classname from the typestring OR - // if the classname turns out to be a special class "pseudo" name, + // This method will return the classname from the typestring OR + // if the classname turns out to be a special class "pseudo" name, // then the matching real classname is returned. public final String getClassName() { @@ -482,12 +434,12 @@ public final String getClassName() { return typeString; else if (isIDLType) return completeClassName; - else + else return null; } // This method calls getClazzFromType() and falls back to the repStrToClass - // cache if no class was found. It's used where any class matching the + // cache if no class was found. It's used where any class matching the // given repid is an acceptable result. public final Class getAnyClassFromType() throws ClassNotFoundException { try { @@ -504,21 +456,20 @@ public final Class getAnyClassFromType() throws ClassNotFoundException { public final Class getClassFromType() throws ClassNotFoundException { if (clazz != null) return clazz; - - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); + + Class specialCase = (Class) kSpecialCasesClasses.get(getClassName()); if (specialCase != null) { clazz = specialCase; return specialCase; } else { try { - return Util.getInstance().loadClass(getClassName(), - null, null); - } catch(ClassNotFoundException cnfe) { + return Util.getInstance().loadClass(getClassName(), null, null); + } catch (ClassNotFoundException cnfe) { if (defaultServerURL != null) { try { return getClassFromType(defaultServerURL); - } catch(MalformedURLException mue){ + } catch (MalformedURLException mue) { throw cnfe; } } else { @@ -528,36 +479,29 @@ public final Class getClassFromType() throws ClassNotFoundException { } } - public final Class getClassFromType(Class expectedType, String codebase) - throws ClassNotFoundException { + public final Class getClassFromType(Class expectedType, String codebase) throws ClassNotFoundException { if (clazz != null) return clazz; - - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); - if (specialCase != null){ + Class specialCase = (Class) kSpecialCasesClasses.get(getClassName()); + + if (specialCase != null) { clazz = specialCase; return specialCase; } else { - ClassLoader expectedTypeClassLoader = - (expectedType == null ? null : expectedType.getClassLoader()); - return Utility.loadClassOfType(getClassName(), - codebase, - expectedTypeClassLoader, - expectedType, - expectedTypeClassLoader); + ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); + return Utility.loadClassOfType(getClassName(), codebase, expectedTypeClassLoader, expectedType, expectedTypeClassLoader); } } - public final Class getClassFromType(String url) - throws ClassNotFoundException, MalformedURLException { - + public final Class getClassFromType(String url) throws ClassNotFoundException, MalformedURLException { + // 6793820: check special cases BEFORE going to ClassLoader. if (clazz != null) return clazz; - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); + Class specialCase = (Class) kSpecialCasesClasses.get(getClassName()); if (specialCase != null) { clazz = specialCase; @@ -574,33 +518,29 @@ public final String toString() { /** * Checks to see if the FullValueDescription should be retrieved. + * * @param clazz The type to get description for * @param repositoryID The repository ID * @return If full description should be retrieved - * @throws IOException If suids do not match or if the repositoryID - * is not an RMIValueType. + * @throws IOException If suids do not match or if the repositoryID is not an RMIValueType. */ - public static boolean useFullValueDescription(Class clazz, - String repositoryID) throws IOException{ + public static boolean useFullValueDescription(Class clazz, String repositoryID) throws IOException { - return useFullValueDescription( clazz, ClassInfoCache.get( clazz ), - repositoryID ) ; + return useFullValueDescription(clazz, ClassInfoCache.get(clazz), repositoryID); } /** * Checks to see if the FullValueDescription should be retrieved. + * * @param clazz The type to get description for * @param cinfo The ClassInfo for the type. * @param repositoryID The repository ID * @return If full description should be retrieved - * @exception IOException If suids do not match or if the repositoryID - * is not an RMIValueType. + * @exception IOException If suids do not match or if the repositoryID is not an RMIValueType. */ - public static boolean useFullValueDescription(Class clazz, - ClassInfoCache.ClassInfo cinfo, - String repositoryID) throws IOException{ + public static boolean useFullValueDescription(Class clazz, ClassInfoCache.ClassInfo cinfo, String repositoryID) throws IOException { - String clazzRepIDStr = createForAnyType(clazz, cinfo ); + String clazzRepIDStr = createForAnyType(clazz, cinfo); if (clazzRepIDStr.equals(repositoryID)) return false; @@ -608,7 +548,7 @@ public static boolean useFullValueDescription(Class clazz, RepositoryId targetRepid; RepositoryId clazzRepid; - synchronized(cache) { + synchronized (cache) { // to avoid race condition where multiple threads could be // accessing this method, and their access to the cache may // be interleaved giving unexpected results @@ -616,31 +556,25 @@ public static boolean useFullValueDescription(Class clazz, targetRepid = cache.getId(repositoryID); clazzRepid = cache.getId(clazzRepIDStr); } - - if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){ - if (!targetRepid.getSerialVersionUID() - .equals(clazzRepid.getSerialVersionUID())) { - - String mssg = - "Mismatched serialization UIDs : Source (Rep. ID" - + clazzRepid + ") = " - + clazzRepid.getSerialVersionUID() - + " whereas Target (Rep. ID " + repositoryID - + ") = " + targetRepid.getSerialVersionUID(); + + if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())) { + if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) { + + String mssg = "Mismatched serialization UIDs : Source (Rep. ID" + clazzRepid + ") = " + clazzRepid.getSerialVersionUID() + + " whereas Target (Rep. ID " + repositoryID + ") = " + targetRepid.getSerialVersionUID(); throw new IOException(mssg); } else { return true; - } + } } else { - throw new IOException( - "The repository ID is not of an RMI value type (Expected ID = " - + clazzRepIDStr + "; Received ID = " + repositoryID +")"); + throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + + repositoryID + ")"); } } private static String createHashString(Class clazz) { - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( clazz ) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(clazz); if (cinfo.isInterface() || !cinfo.isASerializable(clazz)) return kInterfaceHashCode; @@ -652,7 +586,7 @@ else if (actualLong == 1) hash = kExternalizableHashStr; else hash = Long.toHexString(actualLong).toUpperCase(); - while(hash.length() < 16) { + while (hash.length() < 16) { hash = "0" + hash; } @@ -673,25 +607,25 @@ else if (declaredLong == 1) } /** - * Creates a repository ID for a sequence. This is for expert users only as - * this method assumes the object passed is an array. If passed an object - * that is not an array, it will produce a rep id for a sequence of zero - * length. This would be an error. + * Creates a repository ID for a sequence. This is for expert users only as this method assumes the object passed is an + * array. If passed an object that is not an array, it will produce a rep id for a sequence of zero length. This would + * be an error. + * * @param ser The Java object to create a repository ID for * @return Created repository ID **/ - public static String createSequenceRepID(java.lang.Object ser){ + public static String createSequenceRepID(java.lang.Object ser) { return createSequenceRepID(ser.getClass()); } /** - * Creates a repository ID for a sequence. This is for expert users only as - * this method assumes the object passed is an array. If passed an object - * that is not an array, it will produce a malformed rep id. + * Creates a repository ID for a sequence. This is for expert users only as this method assumes the object passed is an + * array. If passed an object that is not an array, it will produce a malformed rep id. + * * @param clazz The Java class to create a repository ID for * @return Created repository ID **/ - public static String createSequenceRepID(Class clazz){ + public static String createSequenceRepID(Class clazz) { synchronized (classSeqToRepStr) { String repid = classSeqToRepStr.get(clazz); if (repid != null) @@ -708,12 +642,11 @@ public static String createSequenceRepID(Class clazz){ } if (clazz.isPrimitive()) { - repid = kValuePrefix + originalClazz.getName() - + kPrimitiveSequenceValueHash; + repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash; } else { StringBuilder buf = new StringBuilder(); buf.append(kValuePrefix); - while(numOfDims-- > 0) { + while (numOfDims-- > 0) { buf.append("["); } buf.append("L"); @@ -722,32 +655,30 @@ public static String createSequenceRepID(Class clazz){ buf.append(createHashString(clazz)); repid = buf.toString(); } - classSeqToRepStr.put(originalClazz,repid); + classSeqToRepStr.put(originalClazz, repid); return repid; } } - - public static String createForSpecialCase(java.lang.Class clazz){ - return createForSpecialCase( clazz, ClassInfoCache.get( clazz ) ) ; + public static String createForSpecialCase(java.lang.Class clazz) { + return createForSpecialCase(clazz, ClassInfoCache.get(clazz)); } - public static String createForSpecialCase(java.lang.Class clazz, - ClassInfoCache.ClassInfo cinfo ){ + public static String createForSpecialCase(java.lang.Class clazz, ClassInfoCache.ClassInfo cinfo) { if (cinfo.isArray()) { return createSequenceRepID(clazz); } else { if (clazz == String.class) - return kWStringValueRepID ; - if (clazz == Class.class) - return kClassDescValueRepID ; - if (clazz == java.rmi.Remote.class) - return kRemoteValueRepID ; - return null ; + return kWStringValueRepID; + if (clazz == Class.class) + return kClassDescValueRepID; + if (clazz == java.rmi.Remote.class) + return kRemoteValueRepID; + return null; } } - public static String createForSpecialCase(java.io.Serializable ser){ + public static String createForSpecialCase(java.io.Serializable ser) { Class clazz = ser.getClass(); if (ClassInfoCache.get(clazz).isArray()) { return createSequenceRepID(ser); @@ -755,18 +686,16 @@ public static String createForSpecialCase(java.io.Serializable ser){ return createForSpecialCase(clazz); } } - + /** - * Creates a repository ID for a normal Java Type. + * Creates a repository ID for a normal Java Type. + * * @param ser The Java object to create a repository ID for * @return Created repository ID - * @exception com.sun.corba.ee.impl.io.TypeMismatchException if - * ser implements the org.omg.CORBA.portable.IDLEntity interface - * which indicates it is an IDL Value type. + * @exception com.sun.corba.ee.impl.io.TypeMismatchException if ser implements the org.omg.CORBA.portable.IDLEntity + * interface which indicates it is an IDL Value type. **/ - public static String createForJavaType(java.io.Serializable ser) - throws com.sun.corba.ee.impl.io.TypeMismatchException - { + public static String createForJavaType(java.io.Serializable ser) throws com.sun.corba.ee.impl.io.TypeMismatchException { synchronized (classToRepStr) { String repid = createForSpecialCase(ser); if (repid != null) @@ -777,8 +706,7 @@ public static String createForJavaType(java.io.Serializable ser) if (repid != null) return repid; - repid = kValuePrefix + convertToISOLatin1(clazz.getName()) + - createHashString(clazz); + repid = kValuePrefix + convertToISOLatin1(clazz.getName()) + createHashString(clazz); classToRepStr.put(clazz, repid); repStrToClass.put(repid, clazz); @@ -786,26 +714,23 @@ public static String createForJavaType(java.io.Serializable ser) } } - public static String createForJavaType(Class clz) - throws com.sun.corba.ee.impl.io.TypeMismatchException - { - return createForJavaType( clz, ClassInfoCache.get( clz ) ) ; + public static String createForJavaType(Class clz) throws com.sun.corba.ee.impl.io.TypeMismatchException { + return createForJavaType(clz, ClassInfoCache.get(clz)); } /** * Creates a repository ID for a normal Java Type. + * * @param clz The Java class to create a repository ID for * @param cinfo ClassInfo; may be null * @return Created repository ID - * @exception com.sun.corba.ee.impl.io.TypeMismatchException if - * ser implements the * org.omg.CORBA.portable.IDLEntity interface - * which indicates it is an IDL Value type. + * @exception com.sun.corba.ee.impl.io.TypeMismatchException if ser implements the * org.omg.CORBA.portable.IDLEntity + * interface which indicates it is an IDL Value type. **/ - public static String createForJavaType(Class clz, ClassInfoCache.ClassInfo cinfo ) - throws com.sun.corba.ee.impl.io.TypeMismatchException - { - synchronized (classToRepStr){ - String repid = createForSpecialCase(clz,cinfo); + public static String createForJavaType(Class clz, ClassInfoCache.ClassInfo cinfo) + throws com.sun.corba.ee.impl.io.TypeMismatchException { + synchronized (classToRepStr) { + String repid = createForSpecialCase(clz, cinfo); if (repid != null) return repid; @@ -813,8 +738,7 @@ public static String createForJavaType(Class clz, ClassInfoCache.ClassInfo ci if (repid != null) return repid; - repid = kValuePrefix + convertToISOLatin1(clz.getName()) + - createHashString(clz); + repid = kValuePrefix + convertToISOLatin1(clz.getName()) + createHashString(clz); classToRepStr.put(clz, repid); repStrToClass.put(repid, clz); @@ -824,6 +748,7 @@ public static String createForJavaType(Class clz, ClassInfoCache.ClassInfo ci /** * Creates a repository ID for an IDL Java Type. + * * @param ser The IDL Value object to create a repository ID for * @param major The major version number * @param minor The minor version number @@ -831,83 +756,75 @@ public static String createForJavaType(Class clz, ClassInfoCache.ClassInfo ci * @exception com.sun.corba.ee.impl.io.TypeMismatchException if ser does not implement the * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. **/ - public static String createForIDLType(Class ser, int major, int minor) - throws com.sun.corba.ee.impl.io.TypeMismatchException - { - synchronized (classIDLToRepStr){ + public static String createForIDLType(Class ser, int major, int minor) throws com.sun.corba.ee.impl.io.TypeMismatchException { + synchronized (classIDLToRepStr) { String repid = classIDLToRepStr.get(ser); if (repid != null) return repid; - repid = kIDLPrefix - + convertToISOLatin1(ser.getName()).replace('.','/') - + ":" + major + "." + minor; + repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.', '/') + ":" + major + "." + minor; classIDLToRepStr.put(ser, repid); return repid; } } - private static String getIdFromHelper(Class clazz){ + private static String getIdFromHelper(Class clazz) { try { - Class helperClazz = - Utility.loadClassForClass(clazz.getName()+"Helper", - null, clazz.getClassLoader(), clazz, clazz.getClassLoader()); + Class helperClazz = Utility.loadClassForClass(clazz.getName() + "Helper", null, clazz.getClassLoader(), clazz, + clazz.getClassLoader()); Method idMethod = helperClazz.getDeclaredMethod("id"); - return (String)idMethod.invoke(null); - } catch (java.lang.ClassNotFoundException | java.lang.NoSuchMethodException - | java.lang.reflect.InvocationTargetException | java.lang.IllegalAccessException cnfe) { + return (String) idMethod.invoke(null); + } catch (java.lang.ClassNotFoundException | java.lang.NoSuchMethodException | java.lang.reflect.InvocationTargetException + | java.lang.IllegalAccessException cnfe) { throw new org.omg.CORBA.MARSHAL(cnfe.toString()); } } - public static String createForAnyType(Class type ) { - return createForAnyType( type, ClassInfoCache.get( type ) ) ; + public static String createForAnyType(Class type) { + return createForAnyType(type, ClassInfoCache.get(type)); } /** - * Createa a repository ID for the type if it is either a java type - * or an IDL type. + * Createa a repository ID for the type if it is either a java type or an IDL type. + * * @param type The type to create rep. id for * @param cinfo The ClassInfo for the type (pre-computed elsewhere to save time) * @return The rep. id. **/ public static String createForAnyType(Class type, ClassInfoCache.ClassInfo cinfo) { - try{ + try { // We may re-compute the repo id more than once, but that's OK, because // it's always the same. - String result = cinfo.getRepositoryId() ; + String result = cinfo.getRepositoryId(); if (result == null) { if (cinfo.isArray()) { result = createSequenceRepID(type); } else if (cinfo.isAIDLEntity(type)) { - try{ + try { result = getIdFromHelper(type); - } catch(Throwable t) { + } catch (Throwable t) { return createForIDLType(type, 1, 0); } - } else - result = createForJavaType(type, cinfo ); + } else + result = createForJavaType(type, cinfo); - cinfo.setRepositoryId( result ) ; + cinfo.setRepositoryId(result); } - return result ; - } catch(com.sun.corba.ee.impl.io.TypeMismatchException e){ - return null; + return result; + } catch (com.sun.corba.ee.impl.io.TypeMismatchException e) { + return null; } } public static boolean isAbstractBase(Class clazz) { - ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get( clazz ) ; - return cinfo.isInterface() && cinfo.isAIDLEntity(clazz) - && !cinfo.isAValueBase(clazz) && !cinfo.isACORBAObject(clazz) ; + ClassInfoCache.ClassInfo cinfo = ClassInfoCache.get(clazz); + return cinfo.isInterface() && cinfo.isAIDLEntity(clazz) && !cinfo.isAValueBase(clazz) && !cinfo.isACORBAObject(clazz); } public static boolean isAnyRequired(Class clazz) { - return ((clazz == java.lang.Object.class) || - (clazz == java.io.Serializable.class) || - (clazz == java.io.Externalizable.class)); + return ((clazz == java.lang.Object.class) || (clazz == java.io.Serializable.class) || (clazz == java.io.Externalizable.class)); } public static long fromHex(String hexNumber) { @@ -921,10 +838,11 @@ public static long fromHex(String hexNumber) { * Convert strings with illegal IDL identifier characters. *

    * Section 5.5.7 of OBV spec. + * * @param name String to convert * @return Converted String */ - public static String convertToISOLatin1 (String name) { + public static String convertToISOLatin1(String name) { int length = name.length(); if (length == 0) { @@ -937,96 +855,85 @@ public static String convertToISOLatin1 (String name) { char c = name.charAt(i); if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { - + // We gotta convert. Have we already started? if (buffer == null) { // No, so get set up... - buffer = new StringBuilder(name.substring(0,i)); + buffer = new StringBuilder(name.substring(0, i)); } // Convert the character into the IDL escape syntax... - buffer.append("\\U") - .append((char)ASCII_HEX[(c & 0xF000) >>> 12]) - .append((char)ASCII_HEX[(c & 0x0F00) >>> 8]) - .append((char)ASCII_HEX[(c & 0x00F0) >>> 4]) - .append((char)ASCII_HEX[(c & 0x000F)]); - + buffer.append("\\U").append((char) ASCII_HEX[(c & 0xF000) >>> 12]).append((char) ASCII_HEX[(c & 0x0F00) >>> 8]) + .append((char) ASCII_HEX[(c & 0x00F0) >>> 4]).append((char) ASCII_HEX[(c & 0x000F)]); + } else { if (buffer != null) { buffer.append(c); } } } - + if (buffer != null) { name = buffer.toString(); } - + return name; } - + /** - * Convert strings with ISO Latin 1 escape sequences back to original - * strings. + * Convert strings with ISO Latin 1 escape sequences back to original strings. *

    * Section 5.5.7 of OBV spec. */ - private static String convertFromISOLatin1 (String name) { + private static String convertFromISOLatin1(String name) { int index = -1; StringBuilder buf = new StringBuilder(name); - while ((index = buf.toString().indexOf("\\U")) != -1){ - String str = "0000" + buf.toString().substring(index+2, index+6); + while ((index = buf.toString().indexOf("\\U")) != -1) { + String str = "0000" + buf.toString().substring(index + 2, index + 6); // Convert Hexadecimal byte[] buffer = new byte[(str.length() - 4) / 2]; - for (int i=4, j=0; i < str.length(); i +=2, j++) { - buffer[j] = - (byte)((Utility.hexOf(str.charAt(i)) << 4) & 0xF0); - buffer[j] |= - (byte)((Utility.hexOf(str.charAt(i+1)) << 0) & 0x0F); - } - buf = new StringBuilder(delete(buf.toString(), index, index+6)); - buf.insert(index, (char)buffer[1]); + for (int i = 4, j = 0; i < str.length(); i += 2, j++) { + buffer[j] = (byte) ((Utility.hexOf(str.charAt(i)) << 4) & 0xF0); + buffer[j] |= (byte) ((Utility.hexOf(str.charAt(i + 1)) << 0) & 0x0F); + } + buf = new StringBuilder(delete(buf.toString(), index, index + 6)); + buf.insert(index, (char) buffer[1]); } - - return buf.toString(); + return buf.toString(); } - private static String delete(String str, int from, int to) - { - return str.substring(0, from) + str.substring(to, str.length()); + private static String delete(String str, int from, int to) { + return str.substring(0, from) + str.substring(to, str.length()); } - private static String replace(String target, String arg, String source) - { + private static String replace(String target, String arg, String source) { int i = 0; i = target.indexOf(arg); - while(i != -1) - { - String left = target.substring(0, i); - String right = target.substring(i+arg.length()); - target = left+source+right; - i = target.indexOf(arg); - } + while (i != -1) { + String left = target.substring(0, i); + String right = target.substring(i + arg.length()); + target = left + source + right; + i = target.indexOf(arg); + } return target; } - public static int computeValueTag(boolean codeBasePresent, int typeInfo, - boolean chunkedEncoding){ + public static int computeValueTag(boolean codeBasePresent, int typeInfo, boolean chunkedEncoding) { int value_tag = kInitialValueTag; - + if (codeBasePresent) value_tag = value_tag | 0x00000001; - + value_tag = value_tag | typeInfo; if (chunkedEncoding) @@ -1035,20 +942,19 @@ public static int computeValueTag(boolean codeBasePresent, int typeInfo, return value_tag; } - public static boolean isCodeBasePresent(int value_tag){ + public static boolean isCodeBasePresent(int value_tag) { return ((value_tag & 0x00000001) == 1); } - public static int getTypeInfo(int value_tag){ + public static int getTypeInfo(int value_tag) { return (value_tag & 0x00000006); } - public static boolean isChunkedEncoding(int value_tag){ - return ((value_tag & kChunkedMask) != 0); + public static boolean isChunkedEncoding(int value_tag) { + return ((value_tag & kChunkedMask) != 0); } - - public static String getServerURL(){ + + public static String getServerURL() { return defaultServerURL; } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/util/Utility.java b/orbmain/src/main/java/com/sun/corba/ee/impl/util/Utility.java index 64d178b0f..40f28fd11 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/util/Utility.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/util/Utility.java @@ -22,9 +22,9 @@ package com.sun.corba.ee.impl.util; -import java.util.List ; -import java.util.ArrayList ; -import java.util.Iterator ; +import java.util.List; +import java.util.ArrayList; +import java.util.Iterator; import org.omg.CORBA.SystemException; import org.omg.CORBA.CompletionStatus; @@ -42,173 +42,159 @@ import javax.rmi.CORBA.Tie; import com.sun.corba.ee.spi.presentation.rmi.PresentationManager; -import com.sun.corba.ee.spi.presentation.rmi.StubAdapter ; +import com.sun.corba.ee.spi.presentation.rmi.StubAdapter; -import com.sun.corba.ee.spi.logging.UtilSystemException ; -import com.sun.corba.ee.spi.logging.OMGSystemException ; +import com.sun.corba.ee.spi.logging.UtilSystemException; +import com.sun.corba.ee.spi.logging.OMGSystemException; import com.sun.corba.ee.impl.javax.rmi.CORBA.Util; -import com.sun.corba.ee.spi.misc.ORBClassLoader ; +import com.sun.corba.ee.spi.misc.ORBClassLoader; import java.util.IdentityHashMap; - /** - * Handy class full of static functions. + * Handy class full of static functions. */ public final class Utility { public static final String STUB_PREFIX = "_"; public static final String RMI_STUB_SUFFIX = "_Stub"; - public static final String DYNAMIC_STUB_SUFFIX = "_DynamicStub" ; + public static final String DYNAMIC_STUB_SUFFIX = "_DynamicStub"; public static final String IDL_STUB_SUFFIX = "Stub"; public static final String TIE_SUFIX = "_Tie"; private static final IdentityHashMap tieCache = new IdentityHashMap(); private static final IdentityHashMap tieToStubCache = new IdentityHashMap(); private static final IdentityHashMap stubToTieCache = new IdentityHashMap(); private static final Object CACHE_MISS = new Object(); - private static final UtilSystemException wrapper = - UtilSystemException.self ; - private static final OMGSystemException omgWrapper = - OMGSystemException.self ; + private static final UtilSystemException wrapper = UtilSystemException.self; + private static final OMGSystemException omgWrapper = OMGSystemException.self; /** - * Ensure that stubs, ties, and implementation objects - * are 'connected' to the runtime. Converts implementation - * objects to a type suitable for sending on the wire. + * Ensure that stubs, ties, and implementation objects are 'connected' to the runtime. Converts implementation objects + * to a type suitable for sending on the wire. + * * @param obj the object to connect. * @param orb the ORB to connect to if obj is exported to IIOP. - * @param convertToStub true if implementation types should be - * converted to Stubs rather than just org.omg.CORBA.Object. + * @param convertToStub true if implementation types should be converted to Stubs rather than just org.omg.CORBA.Object. * @return the connected object. - * @exception org.omg.CORBA.INV_OBJREF if obj is an implementation - * which has not been exported. + * @exception org.omg.CORBA.INV_OBJREF if obj is an implementation which has not been exported. */ - public static Object autoConnect(Object obj, ORB orb, boolean convertToStub) - { + public static Object autoConnect(Object obj, ORB orb, boolean convertToStub) { if (obj == null) { return obj; } - + if (StubAdapter.isStub(obj)) { try { - StubAdapter.getDelegate(obj) ; + StubAdapter.getDelegate(obj); } catch (BAD_OPERATION okay) { try { - StubAdapter.connect( obj, orb ) ; + StubAdapter.connect(obj, orb); } catch (RemoteException e) { // The stub could not be connected because it // has an invalid IOR... - throw wrapper.objectNotConnected( e, - obj.getClass().getName() ) ; + throw wrapper.objectNotConnected(e, obj.getClass().getName()); } - } - + } + return obj; } - + if (obj instanceof Remote) { - Remote remoteObj = (Remote)obj; + Remote remoteObj = (Remote) obj; Tie theTie = Util.getInstance().getTie(remoteObj); if (theTie != null) { try { theTie.orb(); } catch (SystemException okay) { - theTie.orb(orb); - } - + theTie.orb(orb); + } + if (convertToStub) { - Object result = loadStub(theTie,null,null,true); + Object result = loadStub(theTie, null, null, true); if (result != null) { return result; } else { throw wrapper.couldNotLoadStub(obj.getClass().getName()); } } else { - return StubAdapter.activateTie( theTie ); + return StubAdapter.activateTie(theTie); } } else { // This is an implementation object which has not been // exported to IIOP OR is a JRMP stub or implementation // object which cannot be marshalled into an ORB stream... - throw wrapper.objectNotExported( obj.getClass().getName() ) ; + throw wrapper.objectNotExported(obj.getClass().getName()); } } - + // Didn't need to do anything, just return the input... - + return obj; } - + /* - * Get a new instance of an RMI-IIOP Tie for the - * given server object. + * Get a new instance of an RMI-IIOP Tie for the given server object. * - * This code is rather confused. tieCache maps impls to Ties, - * but loadTie returns a new Tie instance if the impl is already - * cached. Also this method is useless with dynamic RMI-IIOP, since - * we just call new ReflectiveTie to create a Tie. Even with - * static RMI-IIOP this seems a bit questionable. In the static - * case, I think we want to avoid possibly expensive ClassLoader - * searches. But this is really a mapping from stub class - * to corresponding Tie class. The new stub/tie architecture - * clearly indicates that this responsibility should lie with - * the StubFactoryFactory, and this method should be eliminated. + * This code is rather confused. tieCache maps impls to Ties, but loadTie returns a new Tie instance if the impl is + * already cached. Also this method is useless with dynamic RMI-IIOP, since we just call new ReflectiveTie to create a + * Tie. Even with static RMI-IIOP this seems a bit questionable. In the static case, I think we want to avoid possibly + * expensive ClassLoader searches. But this is really a mapping from stub class to corresponding Tie class. The new + * stub/tie architecture clearly indicates that this responsibility should lie with the StubFactoryFactory, and this + * method should be eliminated. */ public static Tie loadTie(Remote obj) { Tie result = null; Class objClass = obj.getClass(); - + // Have we tried to find this guy before? - + synchronized (tieCache) { - + Object it = tieCache.get(obj); - + if (it == null) { - + // No, so try it... - + try { // First try the classname... - + result = loadTie(objClass); - + // If we don't have a valid tie at this point, // walk up the parent chain until we either // load a tie or encounter PortableRemoteObject // or java.lang.Object... - while (result == null && - (objClass = objClass.getSuperclass()) != null && - objClass != PortableRemoteObject.class && - objClass != Object.class) { - - result = loadTie(objClass); + while (result == null && (objClass = objClass.getSuperclass()) != null && objClass != PortableRemoteObject.class + && objClass != Object.class) { + + result = loadTie(objClass); } } catch (Exception ex) { - wrapper.loadTieFailed( ex, objClass.getName() ) ; + wrapper.loadTieFailed(ex, objClass.getName()); } - + // Did we get it? - + if (result == null) { - + // Nope, so cache that fact... - - tieCache.put(obj,CACHE_MISS); - + + tieCache.put(obj, CACHE_MISS); + } else { - + // Yes, so cache it... - - tieCache.put(obj,result); + + tieCache.put(obj, result); } } else { - + // Yes, return a new instance or fail again if // it was a miss last time... - + if (it != CACHE_MISS) { try { result = (Tie) it.getClass().newInstance(); @@ -217,22 +203,19 @@ public static Tie loadTie(Remote obj) { } } } - - return result; + + return result; } - + /* * Load an RMI-IIOP Tie */ - private static Tie loadTie(Class theClass) - { - return com.sun.corba.ee.spi.orb.ORB.getStubFactoryFactory(). - getTie( theClass ) ; + private static Tie loadTie(Class theClass) { + return com.sun.corba.ee.spi.orb.ORB.getStubFactoryFactory().getTie(theClass); } - + /* - * Clear the stub/tie caches. Intended for use by - * test code. + * Clear the stub/tie caches. Intended for use by test code. */ public static void clearCaches() { synchronized (tieToStubCache) { @@ -245,41 +228,37 @@ public static void clearCaches() { stubToTieCache.clear(); } } - + /** * Load a class and check that it is assignable to a given type. + * * @param className the class name. * @param remoteCodebase the codebase to use. May be null. * @param loader the class loader of last resort. May be null. * @param expectedType the expected type. May be null. * @return the loaded class. */ - static Class loadClassOfType(String className, String remoteCodebase, - ClassLoader loader, Class expectedType, - ClassLoader expectedTypeClassLoader) throws ClassNotFoundException - { + static Class loadClassOfType(String className, String remoteCodebase, ClassLoader loader, Class expectedType, + ClassLoader expectedTypeClassLoader) throws ClassNotFoundException { Class loadedClass = null; try { - //Sequence finding of the stubs according to spec - try{ - //If-else is put here for speed up of J2EE. - //According to the OMG spec, the if clause is not dead code. - //It can occur if some compiler has allowed generation - //into org.omg.stub hierarchy for non-offending - //classes. This will encourage people to - //produce non-offending class stubs in their own hierarchy. - final String wpp = PackagePrefixChecker.withoutPackagePrefix(className) ; - if (!PackagePrefixChecker.hasOffendingPrefix( wpp )) { - loadedClass = Util.getInstance().loadClass( - wpp, remoteCodebase, loader); + // Sequence finding of the stubs according to spec + try { + // If-else is put here for speed up of J2EE. + // According to the OMG spec, the if clause is not dead code. + // It can occur if some compiler has allowed generation + // into org.omg.stub hierarchy for non-offending + // classes. This will encourage people to + // produce non-offending class stubs in their own hierarchy. + final String wpp = PackagePrefixChecker.withoutPackagePrefix(className); + if (!PackagePrefixChecker.hasOffendingPrefix(wpp)) { + loadedClass = Util.getInstance().loadClass(wpp, remoteCodebase, loader); } else { - loadedClass = Util.getInstance().loadClass(className, remoteCodebase, - loader); + loadedClass = Util.getInstance().loadClass(className, remoteCodebase, loader); } } catch (ClassNotFoundException cnfe) { - loadedClass = Util.getInstance().loadClass(className, remoteCodebase, - loader); + loadedClass = Util.getInstance().loadClass(className, remoteCodebase, loader); } if (expectedType == null) { return loadedClass; @@ -289,18 +268,17 @@ static Class loadClassOfType(String className, String remoteCodebase, throw cnfe; } } - - // If no class was loaded, or if the loaded class is not of the + + // If no class was loaded, or if the loaded class is not of the // correct type, make a further attempt to load the correct class // using the classloader of the expected type. // _REVISIT_ Is this step necessary, or should the Util,loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? - if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)){ + if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)) { if (expectedType.getClassLoader() != expectedTypeClassLoader) { - throw new IllegalArgumentException("expectedTypeClassLoader not class loader of " + - "expected Type."); + throw new IllegalArgumentException("expectedTypeClassLoader not class loader of " + "expected Type."); } try { @@ -319,6 +297,7 @@ static Class loadClassOfType(String className, String remoteCodebase, /** * Load a class and check that it is compatible with a given type. + * * @param className the class name. * @param remoteCodebase the codebase to use. May be null. * @param loader the loading context. May be null. @@ -327,16 +306,10 @@ static Class loadClassOfType(String className, String remoteCodebase, * @return the loaded class. * @throws java.lang.ClassNotFoundException If the className cannot be found */ - public static Class loadClassForClass (String className, - String remoteCodebase, - ClassLoader loader, - Class relatedType, - ClassLoader relatedTypeClassLoader) - throws ClassNotFoundException - { + public static Class loadClassForClass(String className, String remoteCodebase, ClassLoader loader, Class relatedType, + ClassLoader relatedTypeClassLoader) throws ClassNotFoundException { if (relatedType == null) { - return Util.getInstance().loadClass(className, remoteCodebase, - loader); + return Util.getInstance().loadClass(className, remoteCodebase, loader); } Class loadedClass = null; @@ -347,19 +320,16 @@ public static Class loadClassForClass (String className, throw cnfe; } } - - // If no class was not loaded, or if the loaded class is not of the + + // If no class was not loaded, or if the loaded class is not of the // correct type, make a further attempt to load the correct class // using the classloader of the related type. // _REVISIT_ Is this step necessary, or should the Util,loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? - if (loadedClass == null || - (loadedClass.getClassLoader() != null && - loadedClass.getClassLoader().loadClass(relatedType.getName()) != - relatedType)) - { + if (loadedClass == null + || (loadedClass.getClassLoader() != null && loadedClass.getClassLoader().loadClass(relatedType.getName()) != relatedType)) { if (relatedType.getClassLoader() != relatedTypeClassLoader) { throw new IllegalArgumentException("relatedTypeClassLoader not class loader of relatedType."); } @@ -368,7 +338,7 @@ public static Class loadClassForClass (String className, loadedClass = relatedTypeClassLoader.loadClass(className); } } - + return loadedClass; } @@ -376,25 +346,22 @@ public static Class loadClassForClass (String className, * Get the helper for an IDLValue * * Throws MARSHAL exception if no helper found. + * * @param clazz Class to get helper for * @param codebase The codebase to use. May be null. * @param repId The repository ID * @return The Helper */ - public static BoxedValueHelper getHelper(Class clazz, String codebase, - String repId) - { + public static BoxedValueHelper getHelper(Class clazz, String codebase, String repId) { String className = null; if (clazz != null) { className = clazz.getName(); if (codebase == null) { - codebase = - Util.getInstance().getCodebase(clazz); + codebase = Util.getInstance().getCodebase(clazz); } } else { if (repId != null) { - className = - RepositoryId.cache.getId(repId).getClassName(); + className = RepositoryId.cache.getId(repId).getClassName(); } if (className == null) { throw wrapper.unableLocateValueHelper(); @@ -402,35 +369,31 @@ public static BoxedValueHelper getHelper(Class clazz, String codebase, } try { - ClassLoader clazzLoader = - (clazz == null ? null : clazz.getClassLoader()); - Class helperClass = - loadClassForClass(className+"Helper", codebase, clazzLoader, - clazz, clazzLoader); - return (BoxedValueHelper)helperClass.newInstance(); + ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader()); + Class helperClass = loadClassForClass(className + "Helper", codebase, clazzLoader, clazz, clazzLoader); + return (BoxedValueHelper) helperClass.newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | ClassCastException cnfe) { - throw wrapper.unableLocateValueHelper( cnfe ); - } + throw wrapper.unableLocateValueHelper(cnfe); + } } /** * Get the factory for an IDLValue * * Throws MARSHAL exception if no factory found. + * * @param clazz The Class * @param codebase The codebase to use. May be null. * @param orb the ORB * @param repId Repository ID * @return The Factory */ - public static ValueFactory getFactory(Class clazz, String codebase, ORB orb, String repId) - { + public static ValueFactory getFactory(Class clazz, String codebase, ORB orb, String repId) { ValueFactory factory = null; if ((orb != null) && (repId != null)) { try { - factory = ((org.omg.CORBA_2_3.ORB)orb).lookup_value_factory( - repId); + factory = ((org.omg.CORBA_2_3.ORB) orb).lookup_value_factory(repId); } catch (org.omg.CORBA.BAD_PARAM ex) { // Try other way } @@ -440,13 +403,11 @@ public static ValueFactory getFactory(Class clazz, String codebase, ORB orb, Str if (clazz != null) { className = clazz.getName(); if (codebase == null) { - codebase = - Util.getInstance().getCodebase(clazz); + codebase = Util.getInstance().getCodebase(clazz); } } else { if (repId != null) { - className = - RepositoryId.cache.getId(repId).getClassName(); + className = RepositoryId.cache.getId(repId).getClassName(); } if (className == null) { throw omgWrapper.unableLocateValueFactory(); @@ -454,39 +415,31 @@ public static ValueFactory getFactory(Class clazz, String codebase, ORB orb, Str } // if earlier search found a non-default factory, or the same default - // factory that loadClassForClass would return, bale out now... - if (factory != null && - (!factory.getClass().getName().equals(className+"DefaultFactory") || - (clazz == null && codebase == null))) + // factory that loadClassForClass would return, bale out now... + if (factory != null && (!factory.getClass().getName().equals(className + "DefaultFactory") || (clazz == null && codebase == null))) return factory; try { - ClassLoader clazzLoader = - (clazz == null ? null : clazz.getClassLoader()); - Class factoryClass = - loadClassForClass(className+"DefaultFactory", codebase, - clazzLoader, clazz, clazzLoader); - return (ValueFactory)factoryClass.newInstance(); + ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader()); + Class factoryClass = loadClassForClass(className + "DefaultFactory", codebase, clazzLoader, clazz, clazzLoader); + return (ValueFactory) factoryClass.newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | ClassCastException cnfe) { - throw omgWrapper.unableLocateValueFactory( cnfe); - } + throw omgWrapper.unableLocateValueFactory(cnfe); + } } /** * Load an RMI-IIOP Stub given a Tie. + * * @param tie the tie. * @param stubFactory the Stub factory. * @param remoteCodebase the codebase to use. May be null. - * @param onlyMostDerived if true, will fail if cannot load a stub for the - * first repID in the tie. If false, will walk all repIDs. + * @param onlyMostDerived if true, will fail if cannot load a stub for the first repID in the tie. If false, will walk + * all repIDs. * @return the stub or null if not found. */ - public static Remote loadStub(Tie tie, - PresentationManager.StubFactory stubFactory, - String remoteCodebase, - boolean onlyMostDerived) - { + public static Remote loadStub(Tie tie, PresentationManager.StubFactory stubFactory, String remoteCodebase, boolean onlyMostDerived) { StubEntry entry = null; // Do we already have it cached? @@ -494,15 +447,14 @@ public static Remote loadStub(Tie tie, Object cached = tieToStubCache.get(tie); if (cached == null) { // No, so go try to load it... - entry = loadStubAndUpdateCache( - tie, stubFactory, remoteCodebase, onlyMostDerived); + entry = loadStubAndUpdateCache(tie, stubFactory, remoteCodebase, onlyMostDerived); } else { - // Yes, is it a stub? If not, it was a miss last + // Yes, is it a stub? If not, it was a miss last // time, so return null again... if (cached != CACHE_MISS) { // It's a stub. entry = (StubEntry) cached; - + // Does the cached stub meet the requirements // of the caller? If the caller does not require // the most derived stub and does not require @@ -515,73 +467,64 @@ public static Remote loadStub(Tie tie, // The stubFactory arg must be null here // to force onlyMostDerived=true to work // correctly. - entry = loadStubAndUpdateCache(tie,null, - remoteCodebase,true); - } else if (stubFactory != null && - !StubAdapter.getTypeIds(entry.stub)[0].equals( - stubFactory.getTypeIds()[0]) ) - { + entry = loadStubAndUpdateCache(tie, null, remoteCodebase, true); + } else if (stubFactory != null && !StubAdapter.getTypeIds(entry.stub)[0].equals(stubFactory.getTypeIds()[0])) { // We do not have exactly the right stub. First, try to // upgrade the cached stub by forcing it to the most // derived stub... - entry = loadStubAndUpdateCache(tie,null, - remoteCodebase,true); + entry = loadStubAndUpdateCache(tie, null, remoteCodebase, true); // If that failed, try again with the exact type // we need... if (entry == null) { - entry = loadStubAndUpdateCache(tie,stubFactory, - remoteCodebase,onlyMostDerived); + entry = loadStubAndUpdateCache(tie, stubFactory, remoteCodebase, onlyMostDerived); } } else { // Use the cached stub. Is the delegate set? try { - Delegate stubDel = StubAdapter.getDelegate( - entry.stub ) ; + Delegate stubDel = StubAdapter.getDelegate(entry.stub); } catch (Exception e2) { // No, so set it if we can... - try { - Delegate del = StubAdapter.getDelegate( - tie ) ; - StubAdapter.setDelegate( entry.stub, - del ) ; - } catch (Exception e) {} + try { + Delegate del = StubAdapter.getDelegate(tie); + StubAdapter.setDelegate(entry.stub, del); + } catch (Exception e) { + } } } } } } - + if (entry != null) { - return (Remote)entry.stub; + return (Remote) entry.stub; } else { return null; } } - + /** - * Load an RMI-IIOP Stub given a Tie, but do not look in the cache. - * This method must be called with the lock held for tieToStubCache. + * Load an RMI-IIOP Stub given a Tie, but do not look in the cache. This method must be called with the lock held for + * tieToStubCache. + * * @param tie the tie. * @param stubFactory the stub factory. May be null. * @param remoteCodebase the codebase to use. May be null. - * @param onlyMostDerived if true, will fail if cannot load a stub for the - * first repID in the tie. If false, will walk all repIDs. + * @param onlyMostDerived if true, will fail if cannot load a stub for the first repID in the tie. If false, will walk + * all repIDs. * @return the StubEntry or null if not found. */ - private static StubEntry loadStubAndUpdateCache ( - Tie tie, PresentationManager.StubFactory stubFactory, - String remoteCodebase, boolean onlyMostDerived) - { + private static StubEntry loadStubAndUpdateCache(Tie tie, PresentationManager.StubFactory stubFactory, String remoteCodebase, + boolean onlyMostDerived) { org.omg.CORBA.Object stub = null; StubEntry entry = null; - boolean tieIsStub = StubAdapter.isStub( tie ) ; + boolean tieIsStub = StubAdapter.isStub(tie); if (stubFactory != null) { try { stub = stubFactory.makeStub(); } catch (Throwable e) { - wrapper.stubFactoryCouldNotMakeStub( e ) ; + wrapper.stubFactoryCouldNotMakeStub(e); if (e instanceof ThreadDeath) { throw (ThreadDeath) e; } @@ -589,23 +532,22 @@ private static StubEntry loadStubAndUpdateCache ( } else { String[] ids = null; if (tieIsStub) { - ids = StubAdapter.getTypeIds( tie ) ; + ids = StubAdapter.getTypeIds(tie); } else { // This will throw an exception if the tie - // is not a Servant. - ids = ((org.omg.PortableServer.Servant)tie). - _all_interfaces( null, null ); + // is not a Servant. + ids = ((org.omg.PortableServer.Servant) tie)._all_interfaces(null, null); } - + if (remoteCodebase == null) { remoteCodebase = Util.getInstance().getCodebase(tie.getClass()); } - + if (ids.length == 0) { stub = new org.omg.stub.java.rmi._Remote_Stub(); } else { // Keep track of the errors for reporting after all attempts - List errors = new ArrayList() ; + List errors = new ArrayList(); // Now walk all the RepIDs till we find a stub or fail... for (int i = 0; i < ids.length; i++) { @@ -613,116 +555,112 @@ private static StubEntry loadStubAndUpdateCache ( stub = new org.omg.stub.java.rmi._Remote_Stub(); break; } - + try { - PresentationManager.StubFactoryFactory stubFactoryFactory = - com.sun.corba.ee.spi.orb.ORB.getStubFactoryFactory(); - RepositoryId rid = RepositoryId.cache.getId( ids[i] ) ; - String className = rid.getClassName() ; - boolean isIDLInterface = rid.isIDLType() ; - stubFactory = stubFactoryFactory.createStubFactory( - className, isIDLInterface, remoteCodebase, null, - // This used to use the Tie's ClassLoader, but - // that is probably wrong for dynamic RMI-IIOP, - // since the Tie is always ReflectiveTie, which - // would always be loaded by the ORB ClassLoader, - // which may not be the application ClassLoader - // in some cases. - ORBClassLoader.getClassLoader() ) ; + PresentationManager.StubFactoryFactory stubFactoryFactory = com.sun.corba.ee.spi.orb.ORB.getStubFactoryFactory(); + RepositoryId rid = RepositoryId.cache.getId(ids[i]); + String className = rid.getClassName(); + boolean isIDLInterface = rid.isIDLType(); + stubFactory = stubFactoryFactory.createStubFactory(className, isIDLInterface, remoteCodebase, null, + // This used to use the Tie's ClassLoader, but + // that is probably wrong for dynamic RMI-IIOP, + // since the Tie is always ReflectiveTie, which + // would always be loaded by the ORB ClassLoader, + // which may not be the application ClassLoader + // in some cases. + ORBClassLoader.getClassLoader()); stub = stubFactory.makeStub(); break; } catch (Exception e) { // save exception for reporting after all attempts are completed. - errors.add( e ) ; + errors.add(e); } - + if (onlyMostDerived) { break; } } - // Report errors. Errors are logged at FINE level if - // we got a stub (stub != null). Errors are logged + // Report errors. Errors are logged at FINE level if + // we got a stub (stub != null). Errors are logged // as WARNINGs if we did not get a stub. - Iterator iter = errors.iterator() ; - if (stub == null ) { + Iterator iter = errors.iterator(); + if (stub == null) { while (iter.hasNext()) { - Exception exc = (Exception)iter.next() ; - wrapper.failureInMakeStubFromRepositoryId( exc ) ; + Exception exc = (Exception) iter.next(); + wrapper.failureInMakeStubFromRepositoryId(exc); } - wrapper.couldNotMakeStubFromRepositoryId() ; + wrapper.couldNotMakeStubFromRepositoryId(); } else { while (iter.hasNext()) { - Exception exc = (Exception)iter.next() ; - wrapper.errorInMakeStubFromRepositoryId( exc ) ; + Exception exc = (Exception) iter.next(); + wrapper.errorInMakeStubFromRepositoryId(exc); } } } } - + if (stub == null) { // Stub == null, so cache the miss... - tieToStubCache.put(tie,CACHE_MISS); + tieToStubCache.put(tie, CACHE_MISS); } else { if (tieIsStub) { try { - Delegate del = StubAdapter.getDelegate( tie ) ; - StubAdapter.setDelegate( stub, del ) ; - } catch( Exception e1 ) { + Delegate del = StubAdapter.getDelegate(tie); + StubAdapter.setDelegate(stub, del); + } catch (Exception e1) { // The tie does not have a delegate set, so stash // this tie away using the stub as a key so that // later, when the stub is connected, we can find // and connect the tie as well... - + synchronized (stubToTieCache) { - stubToTieCache.put(stub,tie); + stubToTieCache.put(stub, tie); } } } else { // Tie extends Servant try { - Delegate delegate = StubAdapter.getDelegate( tie ) ; - StubAdapter.setDelegate( stub, delegate ) ; - } catch( org.omg.CORBA.BAD_INV_ORDER bad) { + Delegate delegate = StubAdapter.getDelegate(tie); + StubAdapter.setDelegate(stub, delegate); + } catch (org.omg.CORBA.BAD_INV_ORDER bad) { synchronized (stubToTieCache) { - stubToTieCache.put(stub,tie); + stubToTieCache.put(stub, tie); } - } catch( Exception e ) { - // Exception is caught because of any of the + } catch (Exception e) { + // Exception is caught because of any of the // following reasons - // 1) POA is not associated with the TIE + // 1) POA is not associated with the TIE // 2) POA Policies for the tie-associated POA - // does not support _this_object() call. - throw wrapper.noPoa( e ) ; + // does not support _this_object() call. + throw wrapper.noPoa(e); } } // Update the cache... - entry = new StubEntry(stub,onlyMostDerived); - tieToStubCache.put(tie,entry); - } - + entry = new StubEntry(stub, onlyMostDerived); + tieToStubCache.put(tie, entry); + } + return entry; } - + /* - * If we loadStub(Tie,...) stashed away a tie which was - * not connected, remove it from the cache and return - * it. + * If we loadStub(Tie,...) stashed away a tie which was not connected, remove it from the cache and return it. */ - public static Tie getAndForgetTie (org.omg.CORBA.Object stub) { + public static Tie getAndForgetTie(org.omg.CORBA.Object stub) { synchronized (stubToTieCache) { return (Tie) stubToTieCache.remove(stub); } } - + /* * Remove any cached Stub for the given tie. */ - public static void purgeStubForTie (Tie tie) { + public static void purgeStubForTie(Tie tie) { StubEntry entry; synchronized (tieToStubCache) { - entry = (StubEntry)tieToStubCache.remove(tie); + entry = (StubEntry) tieToStubCache.remove(tie); } if (entry != null) { synchronized (stubToTieCache) { @@ -730,11 +668,11 @@ public static void purgeStubForTie (Tie tie) { } } } - + /* * Remove cached tie/servant pair. */ - public static void purgeTieAndServant (Tie tie) { + public static void purgeTieAndServant(Tie tie) { synchronized (tieCache) { Object target = tie.getTarget(); if (target != null) { @@ -746,14 +684,14 @@ public static void purgeTieAndServant (Tie tie) { /* * Convert a RepId to a stubName... */ - public static String stubNameFromRepID (String repID) { - + public static String stubNameFromRepID(String repID) { + // Convert the typeid to a RepositoryId instance, get // the className and mangle it as needed... RepositoryId id = RepositoryId.cache.getId(repID); String className = id.getClassName(); - + if (id.isIDLType()) { className = idlStubName(className); } else { @@ -761,146 +699,118 @@ public static String stubNameFromRepID (String repID) { } return className; } - - + /* - * Load an RMI-IIOP Stub. This is used in PortableRemoteObject.narrow. + * Load an RMI-IIOP Stub. This is used in PortableRemoteObject.narrow. */ - public static Remote loadStub (org.omg.CORBA.Object narrowFrom, - Class narrowTo) - { + public static Remote loadStub(org.omg.CORBA.Object narrowFrom, Class narrowTo) { Remote result = null; - + try { // Get the codebase from the delegate to use when loading // the new stub, if possible... String codebase = null; - Delegate delegate = null ; + Delegate delegate = null; try { // We can't assume that narrowFrom is a CORBA_2_3 stub, yet - // it may have a 2_3 Delegate that provides a codebase. Swallow + // it may have a 2_3 Delegate that provides a codebase. Swallow // the ClassCastException otherwise. - delegate = StubAdapter.getDelegate( narrowFrom ) ; - codebase = ((org.omg.CORBA_2_3.portable.Delegate)delegate). - get_codebase(narrowFrom); + delegate = StubAdapter.getDelegate(narrowFrom); + codebase = ((org.omg.CORBA_2_3.portable.Delegate) delegate).get_codebase(narrowFrom); } catch (ClassCastException e) { - wrapper.classCastExceptionInLoadStub( e ) ; + wrapper.classCastExceptionInLoadStub(e); } // Fix for bug 6344962 // // Note that we (currently) only support Dynamic RMI-IIOP - // for our own ORB. Consequently, we need to check here - // whether our own ORB is in use or not. If not, + // for our own ORB. Consequently, we need to check here + // whether our own ORB is in use or not. If not, // we must use the static StubFactoryFactory ONLY. - ORB orb = delegate.orb(narrowFrom) ; - PresentationManager.StubFactoryFactory sff = null ; + ORB orb = delegate.orb(narrowFrom); + PresentationManager.StubFactoryFactory sff = null; if (orb instanceof com.sun.corba.ee.spi.orb.ORB) { // This can be either static or dynamic - sff = com.sun.corba.ee.spi.orb.ORB.getStubFactoryFactory() ; + sff = com.sun.corba.ee.spi.orb.ORB.getStubFactoryFactory(); } else { - PresentationManager pm = com.sun.corba.ee.spi.orb.ORB.getPresentationManager() ; - sff = pm.getStaticStubFactoryFactory() ; + PresentationManager pm = com.sun.corba.ee.spi.orb.ORB.getPresentationManager(); + sff = pm.getStaticStubFactoryFactory(); } - PresentationManager.StubFactory sf = sff.createStubFactory( - narrowTo.getName(), false, codebase, narrowTo, - narrowTo.getClassLoader() ) ; - result = (Remote)sf.makeStub() ; - StubAdapter.setDelegate( result, - StubAdapter.getDelegate( narrowFrom ) ) ; + PresentationManager.StubFactory sf = sff.createStubFactory(narrowTo.getName(), false, codebase, narrowTo, + narrowTo.getClassLoader()); + result = (Remote) sf.makeStub(); + StubAdapter.setDelegate(result, StubAdapter.getDelegate(narrowFrom)); } catch (Exception err) { - wrapper.exceptionInLoadStub( err ) ; + wrapper.exceptionInLoadStub(err); } - + return result; } - + /* - * Load an RMI-IIOP Stub class. This is used in the - * StaticStubFactoryFactory code. + * Load an RMI-IIOP Stub class. This is used in the StaticStubFactoryFactory code. */ - public static Class loadStubClass(String repID, - String remoteCodebase, - Class expectedType) - throws ClassNotFoundException - { + public static Class loadStubClass(String repID, String remoteCodebase, Class expectedType) throws ClassNotFoundException { // Get the repID and check for "" special case. // We should never be called with it (See CDRInputStream // and the loadStub() method)... - + if (repID.length() == 0) { - throw new ClassNotFoundException(); + throw new ClassNotFoundException(); } - + // Get the stubname from the repID and load // the class. If we have a valid 'sender', fall // back to using its codebase if we need to... String className = Utility.stubNameFromRepID(repID); - ClassLoader expectedTypeClassLoader = (expectedType == null ? null : - expectedType.getClassLoader()); + ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); try { - return loadClassOfType(className, - remoteCodebase, - expectedTypeClassLoader, - expectedType, - expectedTypeClassLoader); + return loadClassOfType(className, remoteCodebase, expectedTypeClassLoader, expectedType, expectedTypeClassLoader); } catch (ClassNotFoundException e) { - return loadClassOfType(PackagePrefixChecker.packagePrefix() + className, - remoteCodebase, - expectedTypeClassLoader, - expectedType, - expectedTypeClassLoader); + return loadClassOfType(PackagePrefixChecker.packagePrefix() + className, remoteCodebase, expectedTypeClassLoader, expectedType, + expectedTypeClassLoader); } } /** * Create an RMI stub name. + * * @param className Class to create stub of * @return RMI stub name */ - public static String stubName (String className) - { - return stubName( className, false ) ; + public static String stubName(String className) { + return stubName(className, false); } - public static String dynamicStubName( String className ) - { - return stubName( className, true ) ; + public static String dynamicStubName(String className) { + return stubName(className, true); } - private static String stubName( String className, - boolean isDynamic ) - { - String name = stubNameForCompiler( className, isDynamic ) ; - if (PackagePrefixChecker.hasOffendingPrefix( name )) { - name = - PackagePrefixChecker.packagePrefix() + name; + private static String stubName(String className, boolean isDynamic) { + String name = stubNameForCompiler(className, isDynamic); + if (PackagePrefixChecker.hasOffendingPrefix(name)) { + name = PackagePrefixChecker.packagePrefix() + name; } - return name ; + return name; } - public static String stubNameForCompiler (String className) - { - return stubNameForCompiler( className, false ) ; + public static String stubNameForCompiler(String className) { + return stubNameForCompiler(className, false); } - private static String stubNameForCompiler( String className, - boolean isDynamic ) - { + private static String stubNameForCompiler(String className, boolean isDynamic) { int index = className.indexOf('$'); if (index < 0) { index = className.lastIndexOf('.'); } - String suffix = isDynamic ? DYNAMIC_STUB_SUFFIX : - RMI_STUB_SUFFIX ; - + String suffix = isDynamic ? DYNAMIC_STUB_SUFFIX : RMI_STUB_SUFFIX; + if (index > 0) { - return className.substring(0,index+1) + STUB_PREFIX + - className.substring(index+1) + suffix; + return className.substring(0, index + 1) + STUB_PREFIX + className.substring(index + 1) + suffix; } else { return STUB_PREFIX + className + suffix; } @@ -908,84 +818,69 @@ private static String stubNameForCompiler( String className, /** * Create an RMI tie name. + * * @param className Class used for RMI * @return RMI Tie name */ - public static String tieName (String className) - { - return - PackagePrefixChecker.hasOffendingPrefix(tieNameForCompiler(className)) ? - PackagePrefixChecker.packagePrefix() + tieNameForCompiler(className) : - tieNameForCompiler(className); + public static String tieName(String className) { + return PackagePrefixChecker.hasOffendingPrefix(tieNameForCompiler(className)) + ? PackagePrefixChecker.packagePrefix() + tieNameForCompiler(className) + : tieNameForCompiler(className); } - public static String tieNameForCompiler (String className) - { + public static String tieNameForCompiler(String className) { int index = className.indexOf('$'); if (index < 0) { index = className.lastIndexOf('.'); } if (index > 0) { - return className.substring(0,index+1) + - STUB_PREFIX + - className.substring(index+1) + - TIE_SUFIX; + return className.substring(0, index + 1) + STUB_PREFIX + className.substring(index + 1) + TIE_SUFIX; } else { - return STUB_PREFIX + - className + - TIE_SUFIX; + return STUB_PREFIX + className + TIE_SUFIX; } } /** * Throws the CORBA equivalent of a java.io.NotSerializableException + * * @param className Class that is non-serializable */ public static void throwNotSerializableForCorba(String className) { - throw omgWrapper.notSerializable( className ) ; + throw omgWrapper.notSerializable(className); } /** * Create an IDL stub name. + * * @param className Class to create stub name of * @return Created stub name */ - public static String idlStubName(String className) - { + public static String idlStubName(String className) { String result = null; int index = className.lastIndexOf('.'); if (index > 0) { - result = className.substring(0,index+1) + - STUB_PREFIX + - className.substring(index+1) + - IDL_STUB_SUFFIX; + result = className.substring(0, index + 1) + STUB_PREFIX + className.substring(index + 1) + IDL_STUB_SUFFIX; } else { - result = STUB_PREFIX + - className + - IDL_STUB_SUFFIX; + result = STUB_PREFIX + className + IDL_STUB_SUFFIX; } return result; } - - public static void printStackTrace() - { - Throwable thr = new Throwable( "Printing stack trace:" ) ; - thr.fillInStackTrace() ; - thr.printStackTrace() ; + + public static void printStackTrace() { + Throwable thr = new Throwable("Printing stack trace:"); + thr.fillInStackTrace(); + thr.printStackTrace(); } /** - * Read an object reference from the input stream and narrow - * it to the desired type. + * Read an object reference from the input stream and narrow it to the desired type. + * * @param in the stream to read from. * @param narrowTo Desired class * @return Narrowed object * @throws ClassCastException if narrowFrom cannot be cast to narrowTo. */ - public static Object readObjectAndNarrow(InputStream in, - Class narrowTo) - throws ClassCastException - { + public static Object readObjectAndNarrow(InputStream in, Class narrowTo) throws ClassCastException { Object result = in.read_Object(); if (result != null) { return PortableRemoteObject.narrow(result, narrowTo); @@ -995,17 +890,14 @@ public static Object readObjectAndNarrow(InputStream in, } /** - * Read an abstract interface type from the input stream and narrow - * it to the desired type. + * Read an abstract interface type from the input stream and narrow it to the desired type. + * * @param in the stream to read from. * @param narrowTo Desired class * @return Narrowed object * @throws ClassCastException if narrowFrom cannot be cast to narrowTo. */ - public static Object readAbstractAndNarrow( - org.omg.CORBA_2_3.portable.InputStream in, Class narrowTo) - throws ClassCastException - { + public static Object readAbstractAndNarrow(org.omg.CORBA_2_3.portable.InputStream in, Class narrowTo) throws ClassCastException { Object result = in.read_abstract_interface(); if (result != null) { return PortableRemoteObject.narrow(result, narrowTo); @@ -1014,15 +906,14 @@ public static Object readAbstractAndNarrow( } } - - /** Converts an Ascii Character into Hexadecimal digit + /** + * Converts an Ascii Character into Hexadecimal digit */ - static int hexOf( char x ) - { + static int hexOf(char x) { int val; val = x - '0'; - if (val >=0 && val <= 9) { + if (val >= 0 && val <= 9) { return val; } @@ -1036,14 +927,14 @@ static int hexOf( char x ) return val; } - throw wrapper.badHexDigit() ; + throw wrapper.badHexDigit(); } } class StubEntry { org.omg.CORBA.Object stub; boolean mostDerived; - + StubEntry(org.omg.CORBA.Object stub, boolean mostDerived) { this.stub = stub; this.mostDerived = mostDerived; diff --git a/orbmain/src/main/java/com/sun/corba/ee/impl/util/Version.java b/orbmain/src/main/java/com/sun/corba/ee/impl/util/Version.java index 8beab782f..9eb273bba 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/impl/util/Version.java +++ b/orbmain/src/main/java/com/sun/corba/ee/impl/util/Version.java @@ -19,22 +19,22 @@ */ package com.sun.corba.ee.impl.util; + import java.util.Date; public class Version { - public static final String PROJECT_NAME = "RMI-IIOP"; - public static final String VERSION = "1.0"; - public static final String BUILD = "0.0"; - public static final String BUILD_TIME = "unknown"; - public static final String FULL = PROJECT_NAME + " " + VERSION + " (" - + BUILD_TIME + ")"; - - public static String asString () { + public static final String PROJECT_NAME = "RMI-IIOP"; + public static final String VERSION = "1.0"; + public static final String BUILD = "0.0"; + public static final String BUILD_TIME = "unknown"; + public static final String FULL = PROJECT_NAME + " " + VERSION + " (" + BUILD_TIME + ")"; + + public static String asString() { return FULL; } - - public static void main (String[] args) { + + public static void main(String[] args) { System.out.println(FULL); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/copyobject/CopierManager.java b/orbmain/src/main/java/com/sun/corba/ee/spi/copyobject/CopierManager.java index 42019c216..737c919aa 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/copyobject/CopierManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/copyobject/CopierManager.java @@ -17,36 +17,39 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.copyobject ; +package com.sun.corba.ee.spi.copyobject; -import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory ; +import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory; -/** Manager of ObjectCopier implementations used to support javax.rmi.CORBA.Util.copyObject(s). - * This provides simple methods for registering all supported ObjectCopier factories. - * A default copier is also supported, for use in contexts where no specific copier id - * is available. +/** + * Manager of ObjectCopier implementations used to support javax.rmi.CORBA.Util.copyObject(s). This provides simple + * methods for registering all supported ObjectCopier factories. A default copier is also supported, for use in contexts + * where no specific copier id is available. */ -public interface CopierManager -{ - /** Set the Id of the copier to use if no other copier has been set. +public interface CopierManager { + /** + * Set the Id of the copier to use if no other copier has been set. + * * @param id ID of the copier */ - void setDefaultId( int id ) ; + void setDefaultId(int id); - /** Return the copier for the default copier id. Throws a BAD_PARAM exception - * if no default copier id has been set. + /** + * Return the copier for the default copier id. Throws a BAD_PARAM exception if no default copier id has been set. + * * @return ID of the copier */ - int getDefaultId() ; + int getDefaultId(); - ObjectCopierFactory getObjectCopierFactory( int id ) ; + ObjectCopierFactory getObjectCopierFactory(int id); - ObjectCopierFactory getDefaultObjectCopierFactory() ; + ObjectCopierFactory getDefaultObjectCopierFactory(); - /** Register an ObjectCopierFactory under a particular id. This can be retrieved - * later by getObjectCopierFactory. + /** + * Register an ObjectCopierFactory under a particular id. This can be retrieved later by getObjectCopierFactory. + * * @param factory Factory to register * @param id ID of the factory */ - void registerObjectCopierFactory( ObjectCopierFactory factory, int id ) ; + void registerObjectCopierFactory(ObjectCopierFactory factory, int id); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/copyobject/CopyobjectDefaults.java b/orbmain/src/main/java/com/sun/corba/ee/spi/copyobject/CopyobjectDefaults.java index cd3a0e5a6..c0094369d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/copyobject/CopyobjectDefaults.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/copyobject/CopyobjectDefaults.java @@ -17,120 +17,110 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.copyobject ; +package com.sun.corba.ee.spi.copyobject; -import com.sun.corba.ee.spi.orb.ORB ; -import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopier ; -import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory ; -import org.glassfish.pfl.dynamic.copyobject.impl.FallbackObjectCopierImpl ; +import com.sun.corba.ee.spi.orb.ORB; +import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopier; +import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory; +import org.glassfish.pfl.dynamic.copyobject.impl.FallbackObjectCopierImpl; -import com.sun.corba.ee.impl.copyobject.ReferenceObjectCopierImpl ; -import com.sun.corba.ee.impl.copyobject.ORBStreamObjectCopierImpl ; -import com.sun.corba.ee.impl.copyobject.JavaStreamORBObjectCopierImpl ; -import com.sun.corba.ee.impl.copyobject.OldReflectObjectCopierImpl ; -import com.sun.corba.ee.impl.copyobject.ReflectObjectCopierImpl ; +import com.sun.corba.ee.impl.copyobject.ReferenceObjectCopierImpl; +import com.sun.corba.ee.impl.copyobject.ORBStreamObjectCopierImpl; +import com.sun.corba.ee.impl.copyobject.JavaStreamORBObjectCopierImpl; +import com.sun.corba.ee.impl.copyobject.OldReflectObjectCopierImpl; +import com.sun.corba.ee.impl.copyobject.ReflectObjectCopierImpl; -public abstract class CopyobjectDefaults -{ - private CopyobjectDefaults() { } +public abstract class CopyobjectDefaults { + private CopyobjectDefaults() { + } - /** Obtain the ORB stream copier factory. Note that this version behaves differently - * than the others: each ObjectCopier produced by the factory only preserves aliasing - * within a single call to copy. The others copiers all preserve aliasing across - * all calls to copy (on the same ObjectCopier instance). + /** + * Obtain the ORB stream copier factory. Note that this version behaves differently than the others: each ObjectCopier + * produced by the factory only preserves aliasing within a single call to copy. The others copiers all preserve + * aliasing across all calls to copy (on the same ObjectCopier instance). + * * @param orb ORB to use for remote instances * @return CopierFactory */ - public static ObjectCopierFactory makeORBStreamObjectCopierFactory( final ORB orb ) - { + public static ObjectCopierFactory makeORBStreamObjectCopierFactory(final ORB orb) { return new ObjectCopierFactory() { - public ObjectCopier make( ) - { - return new ORBStreamObjectCopierImpl( orb ) ; + public ObjectCopier make() { + return new ORBStreamObjectCopierImpl(orb); } - } ; + }; } - public static ObjectCopierFactory makeJavaStreamObjectCopierFactory( final ORB orb ) - { + public static ObjectCopierFactory makeJavaStreamObjectCopierFactory(final ORB orb) { return new ObjectCopierFactory() { - public ObjectCopier make( ) - { - return new JavaStreamORBObjectCopierImpl( orb ) ; + public ObjectCopier make() { + return new JavaStreamORBObjectCopierImpl(orb); } - } ; + }; } - private static final ObjectCopier referenceObjectCopier = new ReferenceObjectCopierImpl() ; + private static final ObjectCopier referenceObjectCopier = new ReferenceObjectCopierImpl(); - private static ObjectCopierFactory referenceObjectCopierFactory = - new ObjectCopierFactory() { - public ObjectCopier make() - { - return referenceObjectCopier ; - } - } ; + private static ObjectCopierFactory referenceObjectCopierFactory = new ObjectCopierFactory() { + public ObjectCopier make() { + return referenceObjectCopier; + } + }; - /** Obtain the reference object "copier". This does no copies: it just - * returns whatever is passed to it. + /** + * Obtain the reference object "copier". This does no copies: it just returns whatever is passed to it. + * * @return the reference copier */ - public static ObjectCopierFactory getReferenceObjectCopierFactory() - { - return referenceObjectCopierFactory ; + public static ObjectCopierFactory getReferenceObjectCopierFactory() { + return referenceObjectCopierFactory; } - /** Create a fallback copier factory from the two ObjectCopierFactory - * arguments. This copier makes an ObjectCopierFactory that creates - * instances of a fallback copier that first tries an ObjectCopier - * created from f1, then tries one created from f2, if the first - * throws a ReflectiveCopyException. + /** + * Create a fallback copier factory from the two ObjectCopierFactory arguments. This copier makes an ObjectCopierFactory + * that creates instances of a fallback copier that first tries an ObjectCopier created from f1, then tries one created + * from f2, if the first throws a ReflectiveCopyException. + * * @param f1 Factory to try first * @param f2 Factory to try second * @return CopierFactory */ - public static ObjectCopierFactory makeFallbackObjectCopierFactory( - final ObjectCopierFactory f1, final ObjectCopierFactory f2 ) - { + public static ObjectCopierFactory makeFallbackObjectCopierFactory(final ObjectCopierFactory f1, final ObjectCopierFactory f2) { return new ObjectCopierFactory() { - public ObjectCopier make() - { - ObjectCopier c1 = f1.make() ; - ObjectCopier c2 = f2.make() ; - return new FallbackObjectCopierImpl( c1, c2 ) ; + public ObjectCopier make() { + ObjectCopier c1 = f1.make(); + ObjectCopier c2 = f2.make(); + return new FallbackObjectCopierImpl(c1, c2); } - } ; + }; } - /** Obtain the old version of the reflective copier factory. This is provided only - * for benchmarking purposes. + /** + * Obtain the old version of the reflective copier factory. This is provided only for benchmarking purposes. + * * @param orb ORB to use for remote instances * @return CopierFactory */ - public static ObjectCopierFactory makeOldReflectObjectCopierFactory( final ORB orb ) - { + public static ObjectCopierFactory makeOldReflectObjectCopierFactory(final ORB orb) { return new ObjectCopierFactory() { - public ObjectCopier make() - { - return new OldReflectObjectCopierImpl( orb ) ; + public ObjectCopier make() { + return new OldReflectObjectCopierImpl(orb); } - } ; + }; } - /** Obtain the new reflective copier factory. This is 3-4 times faster than the stream - * copier, and about 10% faster than the old reflective copier. It should - * normally be used with a fallback copier, as there are some classes that simply + /** + * Obtain the new reflective copier factory. This is 3-4 times faster than the stream copier, and about 10% faster than + * the old reflective copier. It should normally be used with a fallback copier, as there are some classes that simply * cannot be copied reflectively. + * * @param orb ORB to use for remote instances * @return CopierFactory */ - public static ObjectCopierFactory makeReflectObjectCopierFactory( final ORB orb ) - { + public static ObjectCopierFactory makeReflectObjectCopierFactory(final ORB orb) { return new ObjectCopierFactory() { - public ObjectCopier make( ) - { - return new ReflectObjectCopierImpl( orb ) ; + public ObjectCopier make() { + return new ReflectObjectCopierImpl(orb); } - } ; + }; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/CopyObjectPolicy.java b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/CopyObjectPolicy.java index dbbdf2f40..93684befd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/CopyObjectPolicy.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/CopyObjectPolicy.java @@ -17,45 +17,39 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.extension ; +package com.sun.corba.ee.spi.extension; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import org.omg.CORBA.Policy; +import org.omg.CORBA.LocalObject; +import com.sun.corba.ee.spi.misc.ORBConstants; -/** Policy used to specify the copyObject implementation to use. -*/ -public class CopyObjectPolicy extends LocalObject implements Policy -{ - private final int value ; +/** + * Policy used to specify the copyObject implementation to use. + */ +public class CopyObjectPolicy extends LocalObject implements Policy { + private final int value; - public CopyObjectPolicy( int value ) - { - this.value = value ; + public CopyObjectPolicy(int value) { + this.value = value; } - public int getValue() - { - return value ; + public int getValue() { + return value; } - public int policy_type () - { - return ORBConstants.COPY_OBJECT_POLICY ; + public int policy_type() { + return ORBConstants.COPY_OBJECT_POLICY; } - public org.omg.CORBA.Policy copy () - { - return this ; + public org.omg.CORBA.Policy copy() { + return this; } - public void destroy () - { + public void destroy() { // NO-OP } - public String toString() - { - return "CopyObjectPolicy[" + value + "]" ; + public String toString() { + return "CopyObjectPolicy[" + value + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/LoadBalancingPolicy.java b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/LoadBalancingPolicy.java index dcc8d0080..cd3226889 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/LoadBalancingPolicy.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/LoadBalancingPolicy.java @@ -17,58 +17,48 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.extension ; +package com.sun.corba.ee.spi.extension; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; +import org.omg.CORBA.Policy; +import org.omg.CORBA.LocalObject; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; +import com.sun.corba.ee.spi.misc.ORBConstants; -/** Policy used to support the request partitioning feature and to - * specify the partition to use. -*/ -public class LoadBalancingPolicy extends LocalObject implements Policy -{ - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +/** + * Policy used to support the request partitioning feature and to specify the partition to use. + */ +public class LoadBalancingPolicy extends LocalObject implements Policy { + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; private final int value; - public LoadBalancingPolicy( int value ) - { - if (value < ORBConstants.FIRST_LOAD_BALANCING_VALUE || - value > ORBConstants.LAST_LOAD_BALANCING_VALUE) { - throw wrapper.invalidLoadBalancingPolicyValue( - value, ORBConstants.FIRST_LOAD_BALANCING_VALUE, - ORBConstants.LAST_LOAD_BALANCING_VALUE); + public LoadBalancingPolicy(int value) { + if (value < ORBConstants.FIRST_LOAD_BALANCING_VALUE || value > ORBConstants.LAST_LOAD_BALANCING_VALUE) { + throw wrapper.invalidLoadBalancingPolicyValue(value, ORBConstants.FIRST_LOAD_BALANCING_VALUE, + ORBConstants.LAST_LOAD_BALANCING_VALUE); } this.value = value; } - public int getValue() - { + public int getValue() { return value; } - public int policy_type() - { - return ORBConstants.LOAD_BALANCING_POLICY ; + public int policy_type() { + return ORBConstants.LOAD_BALANCING_POLICY; } - public org.omg.CORBA.Policy copy() - { + public org.omg.CORBA.Policy copy() { return this; } - public void destroy() - { + public void destroy() { // NO-OP } @Override - public String toString() - { - return "LoadBalancingPolicy[" + value + "]" ; + public String toString() { + return "LoadBalancingPolicy[" + value + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/RequestPartitioningPolicy.java b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/RequestPartitioningPolicy.java index 541415223..88f19f387 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/RequestPartitioningPolicy.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/RequestPartitioningPolicy.java @@ -17,60 +17,49 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.extension ; +package com.sun.corba.ee.spi.extension; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; +import org.omg.CORBA.Policy; +import org.omg.CORBA.LocalObject; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; +import com.sun.corba.ee.spi.misc.ORBConstants; -/** Policy used to support the request partitioning feature and to - * specify the partition to use. -*/ -public class RequestPartitioningPolicy extends LocalObject implements Policy -{ - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; +/** + * Policy used to support the request partitioning feature and to specify the partition to use. + */ +public class RequestPartitioningPolicy extends LocalObject implements Policy { + private static ORBUtilSystemException wrapper = ORBUtilSystemException.self; public final static int DEFAULT_VALUE = 0; private final int value; - public RequestPartitioningPolicy( int value ) - { - if (value < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID || - value > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { - throw wrapper.invalidRequestPartitioningPolicyValue( - value, - ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID, - ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID); + public RequestPartitioningPolicy(int value) { + if (value < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID || value > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { + throw wrapper.invalidRequestPartitioningPolicyValue(value, ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID, + ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID); } this.value = value; } - public int getValue() - { + public int getValue() { return value; } - public int policy_type() - { + public int policy_type() { return ORBConstants.REQUEST_PARTITIONING_POLICY; } - public org.omg.CORBA.Policy copy() - { + public org.omg.CORBA.Policy copy() { return this; } - public void destroy() - { + public void destroy() { // NO-OP } @Override - public String toString() - { - return "RequestPartitioningPolicy[" + value + "]" ; + public String toString() { + return "RequestPartitioningPolicy[" + value + "]"; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/ServantCachingPolicy.java b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/ServantCachingPolicy.java index e32c65870..8bd275026 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/ServantCachingPolicy.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/ServantCachingPolicy.java @@ -17,140 +17,125 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.extension ; - -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; -import com.sun.corba.ee.spi.misc.ORBConstants ; - -/** Policy used to implement servant caching optimization in the POA. -* Creating a POA with an instance pol of this policy where -* pol.getType() > NO_SERVANT_CACHING will cause the servant to be -* looked up in the POA and cached in the LocalClientRequestDispatcher when -* the ClientRequestDispatcher is colocated with the implementation of the -* objref. This greatly speeds up invocations at the cost of violating the -* POA semantics. In particular, every request to a particular objref -* must be handled by the same servant. Note that this is typically the -* case for EJB implementations. -*

    -* If servant caching is used, there are two different additional -* features of the POA that are expensive: -*

      -*
    1. POA current semantics
    2. -*
    3. Proper handling of POA destroy.
    4. -*
    -* POA current semantics requires maintaining a ThreadLocal stack of -* invocation information that is always available for POACurrent operations. -* Maintaining this stack is expensive on the timescale of optimized co-located -* calls, so the option is provided to turn it off. Similarly, causing -* POA.destroy() calls to wait for all active calls in the POA to complete -* requires careful tracking of the entry and exit of invocations in the POA. -* Again, tracking this is somewhat expensive. -*/ -public class ServantCachingPolicy extends LocalObject implements Policy -{ - /** Do not cache servants in the ClientRequestDispatcher. This will - * always support the full POA semantics, including changing the - * servant that handles requests on a particular objref. +package com.sun.corba.ee.spi.extension; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.LocalObject; +import com.sun.corba.ee.spi.misc.ORBConstants; + +/** + * Policy used to implement servant caching optimization in the POA. Creating a POA with an instance pol of this policy + * where pol.getType() > NO_SERVANT_CACHING will cause the servant to be looked up in the POA and cached in the + * LocalClientRequestDispatcher when the ClientRequestDispatcher is colocated with the implementation of the objref. + * This greatly speeds up invocations at the cost of violating the POA semantics. In particular, every request to a + * particular objref must be handled by the same servant. Note that this is typically the case for EJB implementations. + *

    + * If servant caching is used, there are two different additional features of the POA that are expensive: + *

      + *
    1. POA current semantics
    2. + *
    3. Proper handling of POA destroy.
    4. + *
    + * POA current semantics requires maintaining a ThreadLocal stack of invocation information that is always available for + * POACurrent operations. Maintaining this stack is expensive on the timescale of optimized co-located calls, so the + * option is provided to turn it off. Similarly, causing POA.destroy() calls to wait for all active calls in the POA to + * complete requires careful tracking of the entry and exit of invocations in the POA. Again, tracking this is somewhat + * expensive. + */ +public class ServantCachingPolicy extends LocalObject implements Policy { + /** + * Do not cache servants in the ClientRequestDispatcher. This will always support the full POA semantics, including + * changing the servant that handles requests on a particular objref. + */ + public static final int NO_SERVANT_CACHING = 0; + + /** + * Perform servant caching, preserving POA current and POA destroy semantics. We will use this as the new default, as + * the app server is making heavier use now of POA facilities. */ - public static final int NO_SERVANT_CACHING = 0 ; - - /** Perform servant caching, preserving POA current and POA destroy semantics. - * We will use this as the new default, as the app server is making heavier use - * now of POA facilities. - */ - public static final int FULL_SEMANTICS = 1 ; - - /** Perform servant caching, preservent only POA current semantics. - * At least this level is required in order to support selection of ObjectCopiers - * for co-located RMI-IIOP calls, as the current copier is stored in - * OAInvocationInfo, which must be present on the stack inside the call. - */ - public static final int INFO_ONLY_SEMANTICS = 2 ; - - /** Perform servant caching, not preserving POA current or POA destroy semantics. - */ - public static final int MINIMAL_SEMANTICS = 3 ; - - private static ServantCachingPolicy policy = null ; - private static ServantCachingPolicy infoOnlyPolicy = null ; - private static ServantCachingPolicy minimalPolicy = null ; - - private int type ; - - public String typeToName() - { + public static final int FULL_SEMANTICS = 1; + + /** + * Perform servant caching, preservent only POA current semantics. At least this level is required in order to support + * selection of ObjectCopiers for co-located RMI-IIOP calls, as the current copier is stored in OAInvocationInfo, which + * must be present on the stack inside the call. + */ + public static final int INFO_ONLY_SEMANTICS = 2; + + /** + * Perform servant caching, not preserving POA current or POA destroy semantics. + */ + public static final int MINIMAL_SEMANTICS = 3; + + private static ServantCachingPolicy policy = null; + private static ServantCachingPolicy infoOnlyPolicy = null; + private static ServantCachingPolicy minimalPolicy = null; + + private int type; + + public String typeToName() { switch (type) { - case FULL_SEMANTICS: - return "FULL" ; - case INFO_ONLY_SEMANTICS: - return "INFO_ONLY" ; - case MINIMAL_SEMANTICS: - return "MINIMAL" ; - default: - return "UNKNOWN(" + type + ")" ; + case FULL_SEMANTICS: + return "FULL"; + case INFO_ONLY_SEMANTICS: + return "INFO_ONLY"; + case MINIMAL_SEMANTICS: + return "MINIMAL"; + default: + return "UNKNOWN(" + type + ")"; } } - public String toString() - { - return "ServantCachingPolicy[" + typeToName() + "]" ; + public String toString() { + return "ServantCachingPolicy[" + typeToName() + "]"; } - private ServantCachingPolicy( int type ) - { - this.type = type ; + private ServantCachingPolicy(int type) { + this.type = type; } - public int getType() - { - return type ; + public int getType() { + return type; } - /** Return the default servant caching policy. + /** + * Return the default servant caching policy. + * * @return default policy - */ - public synchronized static ServantCachingPolicy getPolicy() - { - return getFullPolicy() ; + */ + public synchronized static ServantCachingPolicy getPolicy() { + return getFullPolicy(); } - public synchronized static ServantCachingPolicy getFullPolicy() - { + public synchronized static ServantCachingPolicy getFullPolicy() { if (policy == null) - policy = new ServantCachingPolicy( FULL_SEMANTICS ) ; + policy = new ServantCachingPolicy(FULL_SEMANTICS); - return policy ; + return policy; } - public synchronized static ServantCachingPolicy getInfoOnlyPolicy() - { + public synchronized static ServantCachingPolicy getInfoOnlyPolicy() { if (infoOnlyPolicy == null) - infoOnlyPolicy = new ServantCachingPolicy( INFO_ONLY_SEMANTICS ) ; + infoOnlyPolicy = new ServantCachingPolicy(INFO_ONLY_SEMANTICS); - return infoOnlyPolicy ; + return infoOnlyPolicy; } - public synchronized static ServantCachingPolicy getMinimalPolicy() - { + public synchronized static ServantCachingPolicy getMinimalPolicy() { if (minimalPolicy == null) - minimalPolicy = new ServantCachingPolicy( MINIMAL_SEMANTICS ) ; + minimalPolicy = new ServantCachingPolicy(MINIMAL_SEMANTICS); - return minimalPolicy ; + return minimalPolicy; } - public int policy_type () - { - return ORBConstants.SERVANT_CACHING_POLICY ; + public int policy_type() { + return ORBConstants.SERVANT_CACHING_POLICY; } - public org.omg.CORBA.Policy copy () - { - return this ; + public org.omg.CORBA.Policy copy() { + return this; } - public void destroy () - { + public void destroy() { // NO-OP } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/ZeroPortPolicy.java b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/ZeroPortPolicy.java index ba6f51e4f..83fe3cdac 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/extension/ZeroPortPolicy.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/extension/ZeroPortPolicy.java @@ -17,52 +17,45 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.extension ; +package com.sun.corba.ee.spi.extension; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import org.omg.CORBA.Policy; +import org.omg.CORBA.LocalObject; +import com.sun.corba.ee.spi.misc.ORBConstants; -/** Policy used to implement zero IIOP port policy in the POA. -*/ -public class ZeroPortPolicy extends LocalObject implements Policy -{ - private static ZeroPortPolicy policy = new ZeroPortPolicy( true ) ; +/** + * Policy used to implement zero IIOP port policy in the POA. + */ +public class ZeroPortPolicy extends LocalObject implements Policy { + private static ZeroPortPolicy policy = new ZeroPortPolicy(true); - private boolean flag = true ; + private boolean flag = true; - private ZeroPortPolicy( boolean type ) - { - this.flag = type ; + private ZeroPortPolicy(boolean type) { + this.flag = type; } - public String toString() - { - return "ZeroPortPolicy[" + flag + "]" ; + public String toString() { + return "ZeroPortPolicy[" + flag + "]"; } - public boolean forceZeroPort() - { - return flag ; + public boolean forceZeroPort() { + return flag; } - public synchronized static ZeroPortPolicy getPolicy() - { - return policy ; + public synchronized static ZeroPortPolicy getPolicy() { + return policy; } - public int policy_type () - { - return ORBConstants.ZERO_PORT_POLICY ; + public int policy_type() { + return ORBConstants.ZERO_PORT_POLICY; } - public org.omg.CORBA.Policy copy () - { - return this ; + public org.omg.CORBA.Policy copy() { + return this; } - public void destroy () - { + public void destroy() { // NO-OP } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/folb/ClusterInstanceInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/folb/ClusterInstanceInfo.java index 5269f7e0a..e81792679 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/folb/ClusterInstanceInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/folb/ClusterInstanceInfo.java @@ -23,7 +23,7 @@ import java.util.Collections; import java.util.List; -import java.io.Serializable ; +import java.io.Serializable; import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; @@ -33,54 +33,61 @@ * @author ken */ public class ClusterInstanceInfo implements Serializable { - private final String name ; - private final int weight ; - private final List endpoints ; - - public ClusterInstanceInfo( InputStream is ) { - name = is.read_string() ; - weight = is.read_long() ; - int size = is.read_long() ; - List elist = new ArrayList( size ) ; - for (int ctr = 0; ctr endpoints; + + public ClusterInstanceInfo(InputStream is) { + name = is.read_string(); + weight = is.read_long(); + int size = is.read_long(); + List elist = new ArrayList(size); + for (int ctr = 0; ctr < size; ctr++) { + elist.add(new SocketInfo(is)); } - endpoints = Collections.unmodifiableList(elist) ; + endpoints = Collections.unmodifiableList(elist); } - public ClusterInstanceInfo(String name, int weight, - List endpoints) { + public ClusterInstanceInfo(String name, int weight, List endpoints) { this.name = name; this.weight = weight; - this.endpoints = Collections.unmodifiableList( endpoints ) ; + this.endpoints = Collections.unmodifiableList(endpoints); } - public List endpoints() { return endpoints ; } - public String name() { return name; } - public int weight() { return weight; } + public List endpoints() { + return endpoints; + } + + public String name() { + return name; + } + + public int weight() { + return weight; + } - public void write( OutputStream os ) { - os.write_string( name ) ; - os.write_long( weight ); - os.write_long( endpoints.size() ) ; + public void write(OutputStream os) { + os.write_string(name); + os.write_long(weight); + os.write_long(endpoints.size()); for (SocketInfo si : endpoints) { - si.write( os ) ; + si.write(os); } } @Override public String toString() { - StringBuilder sb = new StringBuilder() ; - sb.append( "ClusterInstanceInfo[" ) ; - sb.append( "name=" ) ; - sb.append( name ) ; - sb.append( " weight=" ) ; - sb.append( weight ) ; - sb.append( " endpoints=" ) ; - sb.append( endpoints.toString() ) ; - sb.append( "]" ) ; - return sb.toString() ; + StringBuilder sb = new StringBuilder(); + sb.append("ClusterInstanceInfo["); + sb.append("name="); + sb.append(name); + sb.append(" weight="); + sb.append(weight); + sb.append(" endpoints="); + sb.append(endpoints.toString()); + sb.append("]"); + return sb.toString(); } @Override @@ -95,9 +102,7 @@ public boolean equals(Object obj) { final ClusterInstanceInfo other = (ClusterInstanceInfo) obj; - if ((this.name == null) ? - (other.name() != null) : - !this.name.equals(other.name())) { + if ((this.name == null) ? (other.name() != null) : !this.name.equals(other.name())) { return false; } @@ -106,9 +111,7 @@ public boolean equals(Object obj) { return false; } - if (this.endpoints != other.endpoints() && - (this.endpoints == null || - !this.endpoints.equals(other.endpoints()))) { + if (this.endpoints != other.endpoints() && (this.endpoints == null || !this.endpoints.equals(other.endpoints()))) { return false; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/folb/GroupInfoService.java b/orbmain/src/main/java/com/sun/corba/ee/spi/folb/GroupInfoService.java index 4b16c6232..ac68535cd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/folb/GroupInfoService.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/folb/GroupInfoService.java @@ -31,71 +31,62 @@ /** * @author Harold Carr */ -public interface GroupInfoService -{ +public interface GroupInfoService { /** - * Adds an observer that will receive a - * membershipChange - * invocation whenever the cluster membership changes. + * Adds an observer that will receive a membershipChange invocation whenever the cluster membership + * changes. * - * The - * membershipChange - * invocation tells the observer to call - * getClusterInstanceInfo - * to get info. + * The membershipChange invocation tells the observer to call getClusterInstanceInfo to get + * info. * * @param x observer to add - * @return true if the given observer is added. False otherwise. + * @return true if the given observer is added. False otherwise. */ public boolean addObserver(GroupInfoServiceObserver x); /** - * Causes the - * membershipChange - * method to be called on each registered observer. + * Causes the membershipChange method to be called on each registered observer. */ public void notifyObservers(); /** - * This is a separate call - * (rather than info being passed in membershipChange) - * so we can identifier the adapter. + * This is a separate call (rather than info being passed in membershipChange) so we can identifier the + * adapter. * * The adapter identification is used in testing. * * @param adapterName name of cluster * @return information about instances in the cluster */ - public List getClusterInstanceInfo( - String[] adapterName); + public List getClusterInstanceInfo(String[] adapterName); /** - * This is a separate call - * (rather than info being passed in membershipChange) - * so we can identifier the adapter. + * This is a separate call (rather than info being passed in membershipChange) so we can identifier the + * adapter. * * The adapter identification is used in testing. + * * @param adapterName adapter to use - * @param endpoints endpoints of cluster + * @param endpoints endpoints of cluster * @return info on cluster */ - public List getClusterInstanceInfo( - String[] adapterName, List endpoints ); + public List getClusterInstanceInfo(String[] adapterName, List endpoints); /** * This method only used during testing. + * * @param adapterName name to add * @return if addresses should be added */ - public boolean shouldAddAddressesToNonReferenceFactory( - String[] adapterName); + public boolean shouldAddAddressesToNonReferenceFactory(String[] adapterName); /** * This method only used during testing. + * * @param adapterName name to add * @return if label should be added */ - public boolean shouldAddMembershipLabel (String[] adapterName); + public boolean shouldAddMembershipLabel(String[] adapterName); } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/folb/GroupInfoServiceObserver.java b/orbmain/src/main/java/com/sun/corba/ee/spi/folb/GroupInfoServiceObserver.java index f207772de..f0985f27b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/folb/GroupInfoServiceObserver.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/folb/GroupInfoServiceObserver.java @@ -27,13 +27,10 @@ /** * @author Harold Carr */ -public interface GroupInfoServiceObserver -{ +public interface GroupInfoServiceObserver { /** - * Called when the GroupInfoService that you register with - * has a change. You should call the GroupInfoService - * getClusterInstanceInfo method to get - * updated info. + * Called when the GroupInfoService that you register with has a change. You should call the GroupInfoService + * getClusterInstanceInfo method to get updated info. */ public void membershipChange(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/folb/SocketInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/folb/SocketInfo.java index 0608f57ce..d977c48ee 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/folb/SocketInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/folb/SocketInfo.java @@ -19,54 +19,63 @@ package com.sun.corba.ee.spi.folb; -import java.io.Serializable ; +import java.io.Serializable; import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; -/** Class representing endpoint info for the ORB. +/** + * Class representing endpoint info for the ORB. * * @author ken */ public class SocketInfo implements Serializable { - private final String type ; - private final String host ; - private final int port ; - - public SocketInfo( InputStream is ) { - this.type = is.read_string() ; - this.host = is.read_string() ; - this.port = is.read_long() ; + private final String type; + private final String host; + private final int port; + + public SocketInfo(InputStream is) { + this.type = is.read_string(); + this.host = is.read_string(); + this.port = is.read_long(); } - public SocketInfo( String type, String host, int port ) { - this.type = type ; - this.host = host ; - this.port = port ; + public SocketInfo(String type, String host, int port) { + this.type = type; + this.host = host; + this.port = port; } - public String type() { return type ; } - public String host() { return host ; } - public int port() { return port ; } + public String type() { + return type; + } + + public String host() { + return host; + } + + public int port() { + return port; + } - public void write( OutputStream os ) { - os.write_string( type ) ; - os.write_string( host ) ; + public void write(OutputStream os) { + os.write_string(type); + os.write_string(host); os.write_long(port); } @Override public String toString() { - StringBuilder sb = new StringBuilder() ; - sb.append( "SocketInfo[" ) ; - sb.append( "type=" ) ; - sb.append( type ) ; - sb.append( " host=" ) ; - sb.append( host ) ; - sb.append( " port=" ) ; - sb.append( port ) ; - sb.append( ']' ) ; - return sb.toString() ; + StringBuilder sb = new StringBuilder(); + sb.append("SocketInfo["); + sb.append("type="); + sb.append(type); + sb.append(" host="); + sb.append(host); + sb.append(" port="); + sb.append(port); + sb.append(']'); + return sb.toString(); } @Override @@ -81,14 +90,12 @@ public boolean equals(Object obj) { final SocketInfo other = (SocketInfo) obj; - if ((this.type == null) ? (other.type() != null) - : !this.type.equals(other.type())) { + if ((this.type == null) ? (other.type() != null) : !this.type.equals(other.type())) { return false; } - if ((this.host == null) ? (other.host() != null) - : !this.host.equals(other.host())) { + if ((this.host == null) ? (other.host() != null) : !this.host.equals(other.host())) { return false; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/EncapsulationFactoryBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/EncapsulationFactoryBase.java index 301f1ee06..dd17d4e57 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/EncapsulationFactoryBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/EncapsulationFactoryBase.java @@ -17,34 +17,30 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior ; +package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.impl.ior.EncapsulationUtility ; +import com.sun.corba.ee.impl.ior.EncapsulationUtility; -public abstract class EncapsulationFactoryBase - implements IdentifiableFactory { +public abstract class EncapsulationFactoryBase implements IdentifiableFactory { - private int id ; + private int id; - public int getId() - { - return id ; + public int getId() { + return id; } - public EncapsulationFactoryBase( int id ) - { - this.id = id ; + public EncapsulationFactoryBase(int id) { + this.id = id; } - public final E create( ORB orb, InputStream in ) - { - InputStream is = EncapsulationUtility.getEncapsulationStream( orb, in ) ; - return readContents( is ) ; + public final E create(ORB orb, InputStream in) { + InputStream is = EncapsulationUtility.getEncapsulationStream(orb, in); + return readContents(is); } - protected abstract E readContents( InputStream is ) ; + protected abstract E readContents(InputStream is); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IOR.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IOR.java index e63f69652..f10c405d7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IOR.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IOR.java @@ -19,78 +19,85 @@ package com.sun.corba.ee.spi.ior; -import java.util.List ; -import java.util.Iterator ; +import java.util.List; +import java.util.Iterator; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfile ; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfile; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; -/** An IOR is represented as a list of profiles. -* Only instances of TaggedProfile are contained in the list. -*/ +/** + * An IOR is represented as a list of profiles. Only instances of TaggedProfile are contained in the list. + */ @ManagedData -@Description( "Interoperable Object Reference: the internal structure of a remote object reference" ) -public interface IOR extends List, Writeable, MakeImmutable -{ +@Description("Interoperable Object Reference: the internal structure of a remote object reference") +public interface IOR extends List, Writeable, MakeImmutable { // This is used only for management @ManagedAttribute - @Description( "The list of profiles in this IOR" ) - Iterator getTaggedProfiles() ; + @Description("The list of profiles in this IOR") + Iterator getTaggedProfiles(); - ORB getORB() ; + ORB getORB(); - /** Return the type id string from the IOR. + /** + * Return the type id string from the IOR. + * * @return type id string - */ + */ @ManagedAttribute - @Description( "The repository ID of the IOR" ) - String getTypeId() ; - - /** Return an iterator that iterates over tagged profiles with - * identifier id. It is not possible to modify the list through this - * iterator. - * @param id identifier id - * @return Iterator over relevant tagged profiles - */ - Iterator iteratorById( int id ) ; - - /** Return a representation of this IOR in the standard GIOP stringified - * format that begins with "IOR:". - * This does not return the same as {@link Object#toString} + @Description("The repository ID of the IOR") + String getTypeId(); + + /** + * Return an iterator that iterates over tagged profiles with identifier id. It is not possible to modify the list + * through this iterator. + * + * @param id identifier id + * @return Iterator over relevant tagged profiles + */ + Iterator iteratorById(int id); + + /** + * Return a representation of this IOR in the standard GIOP stringified format that begins with "IOR:". This does not + * return the same as {@link Object#toString} + * * @return String representation - * @see java.lang.Object#toString() + * @see java.lang.Object#toString() */ - String stringify() ; + String stringify(); - /** Return a representation of this IOR in the standard GIOP marshalled - * form. + /** + * Return a representation of this IOR in the standard GIOP marshalled form. + * * @return a representation of this IOR */ - org.omg.IOP.IOR getIOPIOR() ; + org.omg.IOP.IOR getIOPIOR(); - /** Return true if this IOR has no profiles. + /** + * Return true if this IOR has no profiles. + * * @return true if there aren't any profiles, false otherwise */ - boolean isNil() ; + boolean isNil(); - /** Return true if this IOR is equivalent to ior. Here equivalent means - * that the typeids are the same, they have the same number of profiles, - * and each profile is equivalent to the corresponding profile. + /** + * Return true if this IOR is equivalent to ior. Here equivalent means that the typeids are the same, they have the same + * number of profiles, and each profile is equivalent to the corresponding profile. + * * @param ior IOR to compare to * @return true if they are equivalent * @see #equals(java.lang.Object) */ - boolean isEquivalent(IOR ior) ; - + boolean isEquivalent(IOR ior); + /** - * Return true if this IOR is equivalent to ior. Here equivalent means - * that the typeids and delegates are the same. It does not check if the profiles - * are the same or of the same number. + * Return true if this IOR is equivalent to ior. Here equivalent means that the typeids and delegates are the same. It + * does not check if the profiles are the same or of the same number. + * * @param other object to compare to * @return true if they are equivalent * @see #isEquivalent(IOR) @@ -98,15 +105,18 @@ public interface IOR extends List, Writeable, MakeImmutable @Override boolean equals(Object other); - /** Return the IORTemplate for this IOR. This is simply a list - * of all TaggedProfileTemplates derived from the TaggedProfiles - * of the IOR. + /** + * Return the IORTemplate for this IOR. This is simply a list of all TaggedProfileTemplates derived from the + * TaggedProfiles of the IOR. + * * @return the IORTemplate for this IOR */ - IORTemplateList getIORTemplates() ; + IORTemplateList getIORTemplates(); - /** Return the first IIOPProfile in this IOR. + /** + * Return the first IIOPProfile in this IOR. + * * @return the first IIOPProfile */ - IIOPProfile getProfile() ; + IIOPProfile getProfile(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORFactories.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORFactories.java index 550dfde2e..af570de4c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORFactories.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORFactories.java @@ -17,35 +17,35 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior ; +package com.sun.corba.ee.spi.ior; -import java.io.Serializable ; +import java.io.Serializable; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA.portable.ValueFactory ; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.ValueFactory; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceFactory ; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; +import org.omg.PortableInterceptor.ObjectReferenceFactory; -import com.sun.corba.ee.impl.ior.ObjectIdImpl ; -import com.sun.corba.ee.impl.ior.ObjectKeyImpl ; -import com.sun.corba.ee.impl.ior.IORImpl ; -import com.sun.corba.ee.impl.ior.IORTemplateImpl ; -import com.sun.corba.ee.impl.ior.IORTemplateListImpl ; -import com.sun.corba.ee.impl.ior.ObjectReferenceProducerBase ; -import com.sun.corba.ee.impl.ior.ObjectReferenceFactoryImpl ; -import com.sun.corba.ee.impl.ior.ObjectReferenceTemplateImpl ; -import com.sun.corba.ee.impl.ior.ObjectKeyFactoryImpl ; +import com.sun.corba.ee.impl.ior.ObjectIdImpl; +import com.sun.corba.ee.impl.ior.ObjectKeyImpl; +import com.sun.corba.ee.impl.ior.IORImpl; +import com.sun.corba.ee.impl.ior.IORTemplateImpl; +import com.sun.corba.ee.impl.ior.IORTemplateListImpl; +import com.sun.corba.ee.impl.ior.ObjectReferenceProducerBase; +import com.sun.corba.ee.impl.ior.ObjectReferenceFactoryImpl; +import com.sun.corba.ee.impl.ior.ObjectReferenceTemplateImpl; +import com.sun.corba.ee.impl.ior.ObjectKeyFactoryImpl; -import com.sun.corba.ee.impl.misc.ORBUtility ; +import com.sun.corba.ee.impl.misc.ORBUtility; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -/** This class provides a number of factory methods for creating - * various IOR SPI classes which are not subclassed for specific protocols. - * The following types must be created using this class: +/** + * This class provides a number of factory methods for creating various IOR SPI classes which are not subclassed for + * specific protocols. The following types must be created using this class: *
      *
    • ObjectId
    • *
    • ObjectKey
    • @@ -54,157 +54,149 @@ *
    */ public class IORFactories { - private IORFactories() {} + private IORFactories() { + } - /** Create an ObjectId for the given byte sequence. + /** + * Create an ObjectId for the given byte sequence. + * * @param id bytes to set as object id * @return created ObjectId */ - public static ObjectId makeObjectId( byte[] id ) - { - return new ObjectIdImpl( id ) ; + public static ObjectId makeObjectId(byte[] id) { + return new ObjectIdImpl(id); } - /** Create an ObjectKey for the given ObjectKeyTemplate and - * ObjectId. + /** + * Create an ObjectKey for the given ObjectKeyTemplate and ObjectId. + * * @param oktemp Template of object * @param oid id of object * @return created ObjectKey */ - public static ObjectKey makeObjectKey( ObjectKeyTemplate oktemp, ObjectId oid ) - { - return new ObjectKeyImpl( oktemp, oid ) ; + public static ObjectKey makeObjectKey(ObjectKeyTemplate oktemp, ObjectId oid) { + return new ObjectKeyImpl(oktemp, oid); } - /** Create an empty IOR for the given orb and typeid. The result is mutable. + /** + * Create an empty IOR for the given orb and typeid. The result is mutable. + * * @param orb orb to create IOR from * @param typeid id of type for IOR * @return created IOR */ - public static IOR makeIOR( ORB orb, String typeid ) - { - return new IORImpl( orb, typeid ) ; + public static IOR makeIOR(ORB orb, String typeid) { + return new IORImpl(orb, typeid); } - /** Create an empty IOR for the given orb with a null typeid. The result is mutable. + /** + * Create an empty IOR for the given orb with a null typeid. The result is mutable. + * * @param orb ORB to create IOR for * @return an empty IOR */ - public static IOR makeIOR( ORB orb ) - { - return new IORImpl( orb ) ; + public static IOR makeIOR(ORB orb) { + return new IORImpl(orb); } - /** Read an IOR from an InputStream. ObjectKeys are not shared. + /** + * Read an IOR from an InputStream. ObjectKeys are not shared. + * * @param orb ORB to use as factory * @param is stream to read from * @return IOR read from stream */ - public static IOR makeIOR( ORB orb, InputStream is ) - { - return new IORImpl( orb, is ) ; + public static IOR makeIOR(ORB orb, InputStream is) { + return new IORImpl(orb, is); } - /** Create an IORTemplate with the given ObjectKeyTemplate. The result - * is mutable. + /** + * Create an IORTemplate with the given ObjectKeyTemplate. The result is mutable. + * * @param oktemp template to use * @return created IORTemplate */ - public static IORTemplate makeIORTemplate( ObjectKeyTemplate oktemp ) - { - return new IORTemplateImpl( oktemp ) ; + public static IORTemplate makeIORTemplate(ObjectKeyTemplate oktemp) { + return new IORTemplateImpl(oktemp); } - /** Read an IORTemplate from an InputStream. + /** + * Read an IORTemplate from an InputStream. + * * @param is stream to read from * @return template read from stream */ - public static IORTemplate makeIORTemplate( InputStream is ) - { - return new IORTemplateImpl( is ) ; + public static IORTemplate makeIORTemplate(InputStream is) { + return new IORTemplateImpl(is); } - public static IORTemplateList makeIORTemplateList() - { - return new IORTemplateListImpl() ; + public static IORTemplateList makeIORTemplateList() { + return new IORTemplateListImpl(); } - public static IORTemplateList makeIORTemplateList( InputStream is ) - { - return new IORTemplateListImpl( is ) ; + public static IORTemplateList makeIORTemplateList(InputStream is) { + return new IORTemplateListImpl(is); } - public static IORFactory getIORFactory( ObjectReferenceTemplate ort ) - { + public static IORFactory getIORFactory(ObjectReferenceTemplate ort) { if (ort instanceof ObjectReferenceTemplateImpl) { - ObjectReferenceTemplateImpl orti = - (ObjectReferenceTemplateImpl)ort ; - return orti.getIORFactory() ; + ObjectReferenceTemplateImpl orti = (ObjectReferenceTemplateImpl) ort; + return orti.getIORFactory(); } - throw new BAD_PARAM() ; + throw new BAD_PARAM(); } - public static IORTemplateList getIORTemplateList( ObjectReferenceFactory orf ) - { + public static IORTemplateList getIORTemplateList(ObjectReferenceFactory orf) { if (orf instanceof ObjectReferenceProducerBase) { - ObjectReferenceProducerBase base = - (ObjectReferenceProducerBase)orf ; - return base.getIORTemplateList() ; + ObjectReferenceProducerBase base = (ObjectReferenceProducerBase) orf; + return base.getIORTemplateList(); } - throw new BAD_PARAM() ; + throw new BAD_PARAM(); } - public static ObjectReferenceTemplate makeObjectReferenceTemplate( ORB orb, - IORTemplate iortemp ) - { - return new ObjectReferenceTemplateImpl( orb, iortemp ) ; + public static ObjectReferenceTemplate makeObjectReferenceTemplate(ORB orb, IORTemplate iortemp) { + return new ObjectReferenceTemplateImpl(orb, iortemp); } - public static ObjectReferenceFactory makeObjectReferenceFactory( ORB orb, - IORTemplateList iortemps ) - { - return new ObjectReferenceFactoryImpl( orb, iortemps ) ; + public static ObjectReferenceFactory makeObjectReferenceFactory(ORB orb, IORTemplateList iortemps) { + return new ObjectReferenceFactoryImpl(orb, iortemps); } - public static ObjectKeyFactory makeObjectKeyFactory( ORB orb ) - { - return new ObjectKeyFactoryImpl( orb ) ; + public static ObjectKeyFactory makeObjectKeyFactory(ORB orb) { + return new ObjectKeyFactoryImpl(orb); } - public static org.omg.CORBA.Object makeObjectReference( IOR ior ) - { - return ORBUtility.makeObjectReference( ior ) ; + public static org.omg.CORBA.Object makeObjectReference(IOR ior) { + return ORBUtility.makeObjectReference(ior); } - /** This method must be called in order to register the value - * factories for the ObjectReferenceTemplate and ObjectReferenceFactory - * value types. + /** + * This method must be called in order to register the value factories for the ObjectReferenceTemplate and + * ObjectReferenceFactory value types. + * * @param orb ORB to register value factory against */ - public static void registerValueFactories( ORB orb ) - { + public static void registerValueFactories(ORB orb) { // Create and register the factory for the Object Reference Template // implementation. ValueFactory vf = new ValueFactory() { - public Serializable read_value( InputStream is ) - { - return new ObjectReferenceTemplateImpl( is ) ; + public Serializable read_value(InputStream is) { + return new ObjectReferenceTemplateImpl(is); } - } ; + }; - orb.register_value_factory( ObjectReferenceTemplateImpl.repositoryId, vf ) ; + orb.register_value_factory(ObjectReferenceTemplateImpl.repositoryId, vf); // Create and register the factory for the Object Reference Factory // implementation. vf = new ValueFactory() { - public Serializable read_value( InputStream is ) - { - return new ObjectReferenceFactoryImpl( is ) ; + public Serializable read_value(InputStream is) { + return new ObjectReferenceFactoryImpl(is); } - } ; + }; - orb.register_value_factory( ObjectReferenceFactoryImpl.repositoryId, vf ) ; + orb.register_value_factory(ObjectReferenceFactoryImpl.repositoryId, vf); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORFactory.java index e03555f2d..42af0cc38 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORFactory.java @@ -17,29 +17,32 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior ; +package com.sun.corba.ee.spi.ior; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -/** An IORFactory provides the capability of creating IORs. It contains - * some collection of TaggedProfileTemplates, which can be iterated over - * for portable interceptors. +/** + * An IORFactory provides the capability of creating IORs. It contains some collection of TaggedProfileTemplates, which + * can be iterated over for portable interceptors. */ public interface IORFactory extends Writeable, MakeImmutable { - /** Construct an IOR containing the given ORB, typeid, and ObjectId. - * The same ObjectId will be used for all TaggedProfileTemplates in - * the IORFactory. + /** + * Construct an IOR containing the given ORB, typeid, and ObjectId. The same ObjectId will be used for all + * TaggedProfileTemplates in the IORFactory. + * * @param orb ORB to use * @param typeid typeid of IOR * @param oid objectId IOR * @return created IOR */ - IOR makeIOR( ORB orb, String typeid, ObjectId oid ) ; + IOR makeIOR(ORB orb, String typeid, ObjectId oid); - /** Return true iff this.makeIOR(orb,typeid,oid).isEquivalent( - * other.makeIOR(orb,typeid,oid) for all orb, typeid, and oid. + /** + * Return true iff this.makeIOR(orb,typeid,oid).isEquivalent( other.makeIOR(orb,typeid,oid) for all orb, typeid, and + * oid. + * * @param other factory to compare with * @return true if they are equivalent */ - boolean isEquivalent( IORFactory other ) ; + boolean isEquivalent(IORFactory other); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORTemplate.java index f77e3a5c1..c16713a63 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORTemplate.java @@ -17,23 +17,22 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior ; +package com.sun.corba.ee.spi.ior; -import java.util.List ; -import java.util.Iterator ; +import java.util.List; +import java.util.Iterator; -/** An IORTemplate provides all of the data necessary to create an IOR except - * for the typeId and ObjectId. +/** + * An IORTemplate provides all of the data necessary to create an IOR except for the typeId and ObjectId. */ -public interface IORTemplate extends List, - IORFactory, MakeImmutable -{ - /** Iterate over all TaggedProfileTemplates in this IORTemplate - * with the given id. +public interface IORTemplate extends List, IORFactory, MakeImmutable { + /** + * Iterate over all TaggedProfileTemplates in this IORTemplate with the given id. + * * @param id id to look up * @return TaggedProfileTemplates in this IORTemplate */ - Iterator iteratorById( int id ) ; + Iterator iteratorById(int id); - ObjectKeyTemplate getObjectKeyTemplate() ; + ObjectKeyTemplate getObjectKeyTemplate(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORTemplateList.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORTemplateList.java index 0587879bb..f4989cbda 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORTemplateList.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IORTemplateList.java @@ -17,18 +17,14 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior ; +package com.sun.corba.ee.spi.ior; -import java.util.List ; +import java.util.List; -/** An IORTemplateList is a list of IORTemplate instances. It can be used to create IORs. - * This is useful for representing IORs made of profiles from different object - * adapters. - * Note that any IORFactory can be added to an IORTemplateList, but it is flattened - * so that the result is just a list of IORTemplate instances. +/** + * An IORTemplateList is a list of IORTemplate instances. It can be used to create IORs. This is useful for representing + * IORs made of profiles from different object adapters. Note that any IORFactory can be added to an IORTemplateList, + * but it is flattened so that the result is just a list of IORTemplate instances. */ -public interface IORTemplateList extends List, - IORFactory, MakeImmutable -{ +public interface IORTemplateList extends List, IORFactory, MakeImmutable { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/Identifiable.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/Identifiable.java index 39d336f73..7e27d7106 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/Identifiable.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/Identifiable.java @@ -19,21 +19,23 @@ package com.sun.corba.ee.spi.ior; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; -/** This interface represents an entity that can be written to an - * OutputStream and has an identity that is represented by an integer. - * This identity is essentially the type of the entity, and is used in - * order to know how to read the entity back from an InputStream. +/** + * This interface represents an entity that can be written to an OutputStream and has an identity that is represented by + * an integer. This identity is essentially the type of the entity, and is used in order to know how to read the entity + * back from an InputStream. + * * @author Ken Cavanaugh */ -public interface Identifiable extends Writeable -{ - /** Return the (type) identity of this entity. +public interface Identifiable extends Writeable { + /** + * Return the (type) identity of this entity. + * * @return int */ @ManagedAttribute - @Description( "Id of tagged component or profile" ) + @Description("Id of tagged component or profile") public int getId(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableBase.java index b55eccfa7..88279ef4f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableBase.java @@ -19,29 +19,25 @@ package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.ior.Writeable ; -import com.sun.corba.ee.spi.ior.WriteContents ; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.ior.Writeable; +import com.sun.corba.ee.spi.ior.WriteContents; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.impl.ior.EncapsulationUtility ; +import com.sun.corba.ee.impl.ior.EncapsulationUtility; -/** Provide support for properly reading and writing Identifiable objects -* that are also encapsulations (tagged profiles and components). -*/ -public abstract class IdentifiableBase implements Identifiable, - WriteContents -{ - /** Write the data for this object as a CDR encapsulation. - * This is used for writing tagged components and profiles. - * These data types must be written out as encapsulations, - * which means that we need to first write the data out to - * an encapsulation stream, then extract the data and write - * it to os as an array of octets. - */ - final public void write( OutputStream os ) - { - EncapsulationUtility.writeEncapsulation( (WriteContents)this, os ) ; +/** + * Provide support for properly reading and writing Identifiable objects that are also encapsulations (tagged profiles + * and components). + */ +public abstract class IdentifiableBase implements Identifiable, WriteContents { + /** + * Write the data for this object as a CDR encapsulation. This is used for writing tagged components and profiles. These + * data types must be written out as encapsulations, which means that we need to first write the data out to an + * encapsulation stream, then extract the data and write it to os as an array of octets. + */ + final public void write(OutputStream os) { + EncapsulationUtility.writeEncapsulation((WriteContents) this, os); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableContainerBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableContainerBase.java index 64b05718c..cf432895a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableContainerBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableContainerBase.java @@ -23,67 +23,60 @@ import java.util.ArrayList; import java.util.Iterator; -import com.sun.corba.ee.impl.ior.FreezableList ; +import com.sun.corba.ee.impl.ior.FreezableList; -/** Convenience class for defining objects that contain lists of Identifiables. - * Mainly implements iteratorById. Also note that the constructor creates the - * list, which here is always an ArrayList, as this is much more efficient overall - * for short lists. - * @author Ken Cavanaugh +/** + * Convenience class for defining objects that contain lists of Identifiables. Mainly implements iteratorById. Also note + * that the constructor creates the list, which here is always an ArrayList, as this is much more efficient overall for + * short lists. + * + * @author Ken Cavanaugh */ -public class IdentifiableContainerBase - extends FreezableList -{ - /** Create this class with an empty list of identifiables. - * The current implementation uses an ArrayList. +public class IdentifiableContainerBase extends FreezableList { + /** + * Create this class with an empty list of identifiables. The current implementation uses an ArrayList. */ - public IdentifiableContainerBase() - { - super( new ArrayList() ) ; + public IdentifiableContainerBase() { + super(new ArrayList()); } - - /** Return an iterator which iterates over all contained {@link Identifiable Identifiables} - * with type given by id. + + /** + * Return an iterator which iterates over all contained {@link Identifiable Identifiables} with type given by id. + * * @param id id of type * @return Iterator of contained {@link Identifiable Identifiables} */ - public Iterator iteratorById( final int id) - { + public Iterator iteratorById(final int id) { return new Iterator() { - Iterator iter = - IdentifiableContainerBase.this.iterator() ; - E current = advance() ; + Iterator iter = IdentifiableContainerBase.this.iterator(); + E current = advance(); - private E advance() - { + private E advance() { while (iter.hasNext()) { - E ide = iter.next() ; + E ide = iter.next(); if (ide.getId() == id) - return ide ; + return ide; } - return null ; + return null; } @Override - public boolean hasNext() - { - return current != null ; + public boolean hasNext() { + return current != null; } @Override - public E next() - { - E result = current ; - current = advance() ; - return result ; + public E next() { + E result = current; + current = advance(); + return result; } @Override - public void remove() - { - iter.remove() ; + public void remove() { + iter.remove(); } - } ; + }; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableFactory.java index f3b511dd4..de0900f95 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableFactory.java @@ -17,25 +17,28 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior ; +package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.InputStream ; -import com.sun.corba.ee.spi.orb.ORB ; +import org.omg.CORBA_2_3.portable.InputStream; +import com.sun.corba.ee.spi.orb.ORB; -/** Factory interface for creating Identifiables. +/** + * Factory interface for creating Identifiables. */ public interface IdentifiableFactory { - /** Return the id of this factory, which is the id of the result - * of any create call. + /** + * Return the id of this factory, which is the id of the result of any create call. + * * @return factory id */ - public int getId() ; + public int getId(); - /** Construct the appropriate Identifiable object with the - * given id from the InputStream is. + /** + * Construct the appropriate Identifiable object with the given id from the InputStream is. + * * @param orb ORB to use for creation * @param in stream to construct object from * @return constructed Identifiable */ - public E create( ORB orb, InputStream in ) ; + public E create(ORB orb, InputStream in); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableFactoryFinder.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableFactoryFinder.java index 22c0d942b..683789a5a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableFactoryFinder.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/IdentifiableFactoryFinder.java @@ -19,29 +19,30 @@ package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -/** Interface used to manage a group of related IdentifiableFactory instances. - * Factories can be registered, and invoked through a create method, which - * must be implemented to handle the case of no registered factory - * appropriately. +/** + * Interface used to manage a group of related IdentifiableFactory instances. Factories can be registered, and invoked + * through a create method, which must be implemented to handle the case of no registered factory appropriately. + * * @author Ken Cavanaugh */ -public interface IdentifiableFactoryFinder -{ - /** If there is a registered factory for id, use it to - * read an Identifiable from is. Otherwise create an - * appropriate generic container, or throw an error. - * The type of generic container, or error behavior is - * a property of the implementation. - * @param id id of registered factory +public interface IdentifiableFactoryFinder { + /** + * If there is a registered factory for id, use it to read an Identifiable from is. Otherwise create an appropriate + * generic container, or throw an error. The type of generic container, or error behavior is a property of the + * implementation. + * + * @param id id of registered factory * @param is stream to read from * @return {@link Identifiable} found */ E create(int id, InputStream is); - /** Register a factory for the given id. + /** + * Register a factory for the given id. + * * @param factory factory to register */ - void registerFactory( IdentifiableFactory factory ) ; + void registerFactory(IdentifiableFactory factory); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/MakeImmutable.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/MakeImmutable.java index 8025eeb6f..7e391f168 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/MakeImmutable.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/MakeImmutable.java @@ -17,8 +17,8 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior ; +package com.sun.corba.ee.spi.ior; public interface MakeImmutable { - void makeImmutable() ; + void makeImmutable(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectAdapterId.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectAdapterId.java index 14a6bab6c..db15ebfcf 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectAdapterId.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectAdapterId.java @@ -17,37 +17,42 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior ; +package com.sun.corba.ee.spi.ior; -import java.util.Iterator ; +import java.util.Iterator; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; -/** This is the object adapter ID for an object adapter. -* Typically this is the path of strings starting from the -* Root POA to get to a POA, but other implementations are possible. -*/ +/** + * This is the object adapter ID for an object adapter. Typically this is the path of strings starting from the Root POA + * to get to a POA, but other implementations are possible. + */ @ManagedData -@Description( "The identifier for a particular Object adapter in the ORB" ) +@Description("The identifier for a particular Object adapter in the ORB") public interface ObjectAdapterId extends Iterable, Writeable { - /** Return the number of elements in the adapter ID. + /** + * Return the number of elements in the adapter ID. + * * @return number of elements - */ - int getNumLevels() ; + */ + int getNumLevels(); - /** Return an iterator that iterates over the components - * of this adapter ID. Each element is returned as a String. - * @return iterator over components - */ + /** + * Return an iterator that iterates over the components of this adapter ID. Each element is returned as a String. + * + * @return iterator over components + */ @ManagedAttribute - @Description( "Sequence of strings in the ObjectAdapterId" ) + @Description("Sequence of strings in the ObjectAdapterId") @Override Iterator iterator(); - /** Get the adapter name simply as an array of strings. + /** + * Get the adapter name simply as an array of strings. + * * @return adapter name - */ - String[] getAdapterName() ; + */ + String[] getAdapterName(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectId.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectId.java index dd1a9c786..a98c526a8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectId.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectId.java @@ -19,20 +19,19 @@ package com.sun.corba.ee.spi.ior; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; /** * @author Ken Cavanaugh */ @ManagedData -@Description( "The ObjectId field within an ObjectKey in an IOR" ) -public interface ObjectId extends Writeable -{ - @ManagedAttribute( id = "Id" ) - @Description( "The actual bytes in the ObjectKey" ) - String getIdString() ; +@Description("The ObjectId field within an ObjectKey in an IOR") +public interface ObjectId extends Writeable { + @ManagedAttribute(id = "Id") + @Description("The actual bytes in the ObjectKey") + String getIdString(); - public byte[] getId() ; + public byte[] getId(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKey.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKey.java index 407d80f46..1826ac678 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKey.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKey.java @@ -19,28 +19,29 @@ package com.sun.corba.ee.spi.ior; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; -/** The full object key, which is contained in an IIOPProfile. -* The object identifier corresponds to the information passed into -* POA::create_reference_with_id and POA::create_reference -* (in the POA case). The template -* represents the information that is object adapter specific and -* shared across multiple ObjectKey instances. -*/ -public interface ObjectKey extends Writeable -{ - /** Return the object identifier for this Object key. +/** + * The full object key, which is contained in an IIOPProfile. The object identifier corresponds to the information + * passed into POA::create_reference_with_id and POA::create_reference (in the POA case). The template represents the + * information that is object adapter specific and shared across multiple ObjectKey instances. + */ +public interface ObjectKey extends Writeable { + /** + * Return the object identifier for this Object key. + * * @return the object identifier - */ - ObjectId getId() ; + */ + ObjectId getId(); - /** Return the template for this object key. + /** + * Return the template for this object key. + * * @return the template - */ - ObjectKeyTemplate getTemplate() ; + */ + ObjectKeyTemplate getTemplate(); + + byte[] getBytes(org.omg.CORBA.ORB orb); - byte[] getBytes( org.omg.CORBA.ORB orb ) ; - - ServerRequestDispatcher getServerRequestDispatcher() ; + ServerRequestDispatcher getServerRequestDispatcher(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKeyFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKeyFactory.java index 39fe19936..66a2cdb75 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKeyFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKeyFactory.java @@ -19,23 +19,25 @@ package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -/** Construct ObjectKey and ObjectKeyTemplate instances from their - * CDR-marshalled representation. +/** + * Construct ObjectKey and ObjectKeyTemplate instances from their CDR-marshalled representation. */ -public interface ObjectKeyFactory -{ - /** Create an ObjectKey from its octet sequence representation. +public interface ObjectKeyFactory { + /** + * Create an ObjectKey from its octet sequence representation. + * * @param key representation of key * @return created ObjectKey */ - ObjectKey create( byte[] key ) ; + ObjectKey create(byte[] key); - /** Create an ObjectKeyTemplate from its representation - * in an InputStream. + /** + * Create an ObjectKeyTemplate from its representation in an InputStream. + * * @param is stream to create template from * @return create template */ - ObjectKeyTemplate createTemplate( InputStream is ) ; + ObjectKeyTemplate createTemplate(InputStream is); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKeyTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKeyTemplate.java index 4bbfae9fe..7681e3866 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKeyTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/ObjectKeyTemplate.java @@ -19,72 +19,75 @@ package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.orb.ORBVersion ; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORBVersion; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; -/** An ObjectKeyTemplate represents the part of an Object Key - * that corresponds to the object adapter used to create an - * object reference. The template is shared between many - * object references. +/** + * An ObjectKeyTemplate represents the part of an Object Key that corresponds to the object adapter used to create an + * object reference. The template is shared between many object references. */ @ManagedData -@Description( "The template used to represent all IORs created by the same Object adapter" ) -public interface ObjectKeyTemplate extends Writeable -{ +@Description("The template used to represent all IORs created by the same Object adapter") +public interface ObjectKeyTemplate extends Writeable { @ManagedAttribute - @Description( "The ORB version that created this template" ) - public ORBVersion getORBVersion() ; + @Description("The ORB version that created this template") + public ORBVersion getORBVersion(); - /** An ID used to determine how to perform operations on this - * ObjectKeyTemplate. This id determines how to process requests - * on this object reference, and what object adapter type to use. + /** + * An ID used to determine how to perform operations on this ObjectKeyTemplate. This id determines how to process + * requests on this object reference, and what object adapter type to use. + * * @return The subcontract ID */ @ManagedAttribute - @Description( "The subcontract ID which identifies a particular type-independent " - + " implementation of an IOR" ) + @Description("The subcontract ID which identifies a particular type-independent " + " implementation of an IOR") public int getSubcontractId(); - /** Return the server ID for this template. - * For CORBA 3.0, this should be a String, but it is currently - * an int in the object key template. - * @return The ID of the server that handles requests to this IOR" - */ + /** + * Return the server ID for this template. For CORBA 3.0, this should be a String, but it is currently an int in the + * object key template. + * + * @return The ID of the server that handles requests to this IOR" + */ @ManagedAttribute - @Description( "The ID of the server that handles requests to this IOR" ) - public int getServerId() ; + @Description("The ID of the server that handles requests to this IOR") + public int getServerId(); - /** Return the ORB ID for this template. + /** + * Return the ORB ID for this template. + * * @return the ORB ID that created this IOR - */ + */ @ManagedAttribute - @Description( "the ORB ID that created this IOR" ) - public String getORBId() ; + @Description("the ORB ID that created this IOR") + public String getORBId(); - /** Return the object adapter ID for this template. + /** + * Return the object adapter ID for this template. + * * @return The ObjectAdapterId that identifies the ObjectAdapter that created this IOR - */ + */ @ManagedAttribute - @Description( "The ObjectAdapterId that identifies the ObjectAdapter that created this IOR" ) - public ObjectAdapterId getObjectAdapterId() ; + @Description("The ObjectAdapterId that identifies the ObjectAdapter that created this IOR") + public ObjectAdapterId getObjectAdapterId(); - /** Compute an adapter ID for this template than includes - * all of the template information. - * This value is cached to avoid the expense of recomputing - * it. - * @return adapter ID for this template - */ - public byte[] getAdapterId() ; + /** + * Compute an adapter ID for this template than includes all of the template information. This value is cached to avoid + * the expense of recomputing it. + * + * @return adapter ID for this template + */ + public byte[] getAdapterId(); public void write(ObjectId objectId, OutputStream os); - - public ServerRequestDispatcher getServerRequestDispatcher( ObjectId id ) ; + + public ServerRequestDispatcher getServerRequestDispatcher(ObjectId id); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponent.java index cbb48d703..1a814c425 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponent.java @@ -19,36 +19,31 @@ package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA.ORB ; +import org.omg.CORBA_2_3.portable.OutputStream; +import org.omg.CORBA.ORB; -import com.sun.corba.ee.spi.ior.iiop.AlternateIIOPAddressComponent ; -import com.sun.corba.ee.spi.ior.iiop.CodeSetsComponent ; -import com.sun.corba.ee.spi.ior.iiop.JavaCodebaseComponent ; -import com.sun.corba.ee.spi.ior.iiop.MaxStreamFormatVersionComponent ; -import com.sun.corba.ee.spi.ior.iiop.ORBTypeComponent ; -import com.sun.corba.ee.spi.ior.iiop.RequestPartitioningComponent ; +import com.sun.corba.ee.spi.ior.iiop.AlternateIIOPAddressComponent; +import com.sun.corba.ee.spi.ior.iiop.CodeSetsComponent; +import com.sun.corba.ee.spi.ior.iiop.JavaCodebaseComponent; +import com.sun.corba.ee.spi.ior.iiop.MaxStreamFormatVersionComponent; +import com.sun.corba.ee.spi.ior.iiop.ORBTypeComponent; +import com.sun.corba.ee.spi.ior.iiop.RequestPartitioningComponent; -import com.sun.corba.ee.impl.ior.GenericTaggedComponent ; +import com.sun.corba.ee.impl.ior.GenericTaggedComponent; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.IncludeSubclass ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.IncludeSubclass; -/** Generic interface for all tagged components. Users of the ORB may -* create implementations of this class and also corresponding factories -* of type TaggedComponentFactory. The factories can be registered with an -* ORB instance, in which case they will be used to unmarshal IORs containing -* the registered tagged component. -*/ +/** + * Generic interface for all tagged components. Users of the ORB may create implementations of this class and also + * corresponding factories of type TaggedComponentFactory. The factories can be registered with an ORB instance, in + * which case they will be used to unmarshal IORs containing the registered tagged component. + */ @ManagedData -@Description( "Base class for all TaggedComponents" ) -@IncludeSubclass( { AlternateIIOPAddressComponent.class, - CodeSetsComponent.class, JavaCodebaseComponent.class, - MaxStreamFormatVersionComponent.class, ORBTypeComponent.class, - RequestPartitioningComponent.class, - GenericTaggedComponent.class } ) -public interface TaggedComponent extends Identifiable -{ - org.omg.IOP.TaggedComponent getIOPComponent( ORB orb ) ; +@Description("Base class for all TaggedComponents") +@IncludeSubclass({ AlternateIIOPAddressComponent.class, CodeSetsComponent.class, JavaCodebaseComponent.class, + MaxStreamFormatVersionComponent.class, ORBTypeComponent.class, RequestPartitioningComponent.class, GenericTaggedComponent.class }) +public interface TaggedComponent extends Identifiable { + org.omg.IOP.TaggedComponent getIOPComponent(ORB orb); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponentBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponentBase.java index 11411c1db..f3e76f6cd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponentBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponentBase.java @@ -19,27 +19,24 @@ package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -import com.sun.corba.ee.impl.encoding.EncapsOutputStream ; +import com.sun.corba.ee.impl.encoding.EncapsOutputStream; import com.sun.corba.ee.impl.encoding.OutputStreamFactory; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; - -/** Base class to use for implementing TaggedComponents. It implements - * the getIOPComponent method using the TaggedComponent.write() method. +/** + * Base class to use for implementing TaggedComponents. It implements the getIOPComponent method using the + * TaggedComponent.write() method. + * * @author Ken Cavanaugh */ -public abstract class TaggedComponentBase extends IdentifiableBase - implements TaggedComponent -{ - public org.omg.IOP.TaggedComponent getIOPComponent( - org.omg.CORBA.ORB orb ) - { - EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream( (ORB)orb ) ; - os.write_ulong( getId() ) ; // Fix for 6158378 - write( os ) ; - InputStream is = (InputStream)(os.create_input_stream() ) ; - return org.omg.IOP.TaggedComponentHelper.read( is ) ; +public abstract class TaggedComponentBase extends IdentifiableBase implements TaggedComponent { + public org.omg.IOP.TaggedComponent getIOPComponent(org.omg.CORBA.ORB orb) { + EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream((ORB) orb); + os.write_ulong(getId()); // Fix for 6158378 + write(os); + InputStream is = (InputStream) (os.create_input_stream()); + return org.omg.IOP.TaggedComponentHelper.read(is); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponentFactoryFinder.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponentFactoryFinder.java index f80db61e2..a3511694e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponentFactoryFinder.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedComponentFactoryFinder.java @@ -19,15 +19,14 @@ package com.sun.corba.ee.spi.ior; -public interface TaggedComponentFactoryFinder - extends IdentifiableFactoryFinder -{ - /** Create a tagged component from a GIOP marshalled representation - * of a tagged component. This is needed for portable interceptors. +public interface TaggedComponentFactoryFinder extends IdentifiableFactoryFinder { + /** + * Create a tagged component from a GIOP marshalled representation of a tagged component. This is needed for portable + * interceptors. + * * @param orb ORB to use * @param comp representation of a component to create from * @return created tagged component */ - TaggedComponent create( org.omg.CORBA.ORB orb, - org.omg.IOP.TaggedComponent comp ) ; + TaggedComponent create(org.omg.CORBA.ORB orb, org.omg.IOP.TaggedComponent comp); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfile.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfile.java index 83b6db37d..997064c80 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfile.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfile.java @@ -19,60 +19,59 @@ package com.sun.corba.ee.spi.ior; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.IncludeSubclass ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.ManagedAttribute ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.IncludeSubclass; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.ManagedAttribute; -/** TaggedProfile represents a tagged profile in an IOR. - * A profile contains all of the information necessary for an invocation. - * It contains one or more endpoints that may be used for an invocation. - * A TaggedProfile conceptually has three parts: A TaggedProfileTemplate, - * an ObjectKeyTemplate, and an ObjectId. +/** + * TaggedProfile represents a tagged profile in an IOR. A profile contains all of the information necessary for an + * invocation. It contains one or more endpoints that may be used for an invocation. A TaggedProfile conceptually has + * three parts: A TaggedProfileTemplate, an ObjectKeyTemplate, and an ObjectId. */ @ManagedData -@Description( "A TaggedProfile contained in an IOR" ) -@IncludeSubclass( { com.sun.corba.ee.spi.ior.iiop.IIOPProfile.class } ) -public interface TaggedProfile extends Identifiable, MakeImmutable -{ +@Description("A TaggedProfile contained in an IOR") +@IncludeSubclass({ com.sun.corba.ee.spi.ior.iiop.IIOPProfile.class }) +public interface TaggedProfile extends Identifiable, MakeImmutable { @ManagedAttribute - @Description( "Template for this TaggedProfile" ) - TaggedProfileTemplate getTaggedProfileTemplate() ; + @Description("Template for this TaggedProfile") + TaggedProfileTemplate getTaggedProfileTemplate(); @ManagedAttribute - @Description( "The ObjectId used in the IIOPProfile in this IOR" ) - ObjectId getObjectId() ; + @Description("The ObjectId used in the IIOPProfile in this IOR") + ObjectId getObjectId(); @ManagedAttribute - @Description( "The template for the ObjectKey in the IIOPProfile in this IOR" ) - ObjectKeyTemplate getObjectKeyTemplate() ; + @Description("The template for the ObjectKey in the IIOPProfile in this IOR") + ObjectKeyTemplate getObjectKeyTemplate(); - ObjectKey getObjectKey() ; + ObjectKey getObjectKey(); - /** Return true is prof is equivalent to this TaggedProfile. - * This means that this and prof are indistinguishable for - * the purposes of remote invocation. Typically this means that - * the profile data is identical and both profiles contain exactly - * the same components (if components are applicable). - * isEquivalent( prof ) should imply that getObjectId().equals( - * prof.getObjectId() ) is true, and so is - * getObjectKeyTemplate().equals( prof.getObjectKeyTemplate() ). + /** + * Return true is prof is equivalent to this TaggedProfile. This means that this and prof are indistinguishable for the + * purposes of remote invocation. Typically this means that the profile data is identical and both profiles contain + * exactly the same components (if components are applicable). isEquivalent( prof ) should imply that + * getObjectId().equals( prof.getObjectId() ) is true, and so is getObjectKeyTemplate().equals( + * prof.getObjectKeyTemplate() ). + * * @param prof profile to compare with * @return true if they are equivalent */ - boolean isEquivalent( TaggedProfile prof ) ; + boolean isEquivalent(TaggedProfile prof); - /** Return the TaggedProfile as a CDR encapsulation in the standard - * format. This is required for Portable interceptors. + /** + * Return the TaggedProfile as a CDR encapsulation in the standard format. This is required for Portable interceptors. + * * @return the tagged profile */ org.omg.IOP.TaggedProfile getIOPProfile(); - /** Return true if this TaggedProfile was created in orb. - * Caches the result. + /** + * Return true if this TaggedProfile was created in orb. Caches the result. + * * @return if this TaggedProfile was created in orb */ - boolean isLocal() ; + boolean isLocal(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfileTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfileTemplate.java index e4f8cec88..8a2b90f9f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfileTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfileTemplate.java @@ -19,81 +19,83 @@ package com.sun.corba.ee.spi.ior; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; -import java.util.List ; -import java.util.Iterator ; +import java.util.List; +import java.util.Iterator; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.InheritedAttribute ; -import org.glassfish.gmbal.IncludeSubclass ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.InheritedAttribute; +import org.glassfish.gmbal.IncludeSubclass; -/** Base template for creating TaggedProfiles. A TaggedProfile will often contain -* tagged components. A template that does not contain components acts like -* an empty immutable list. -* -* @author Ken Cavanaugh -*/ +/** + * Base template for creating TaggedProfiles. A TaggedProfile will often contain tagged components. A template that does + * not contain components acts like an empty immutable list. + * + * @author Ken Cavanaugh + */ @ManagedData -@Description( "A template for creating a TaggedProfile" ) -@IncludeSubclass( { com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate.class } ) -public interface TaggedProfileTemplate extends List, - Identifiable, WriteContents, MakeImmutable -{ +@Description("A template for creating a TaggedProfile") +@IncludeSubclass({ com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate.class }) +public interface TaggedProfileTemplate extends List, Identifiable, WriteContents, MakeImmutable { @ManagedAttribute - @Description( "The list of TaggedComponents in this TaggedProfileTemplate" ) - public Iterator getTaggedComponents() ; + @Description("The list of TaggedComponents in this TaggedProfileTemplate") + public Iterator getTaggedComponents(); - /** Return an iterator that iterates over tagged components with - * identifier id. It is not possible to modify the list through this - * iterator. - * @param id id to look up - * @return Iterator over tagged components - */ - public Iterator iteratorById( int id ) ; + /** + * Return an iterator that iterates over tagged components with identifier id. It is not possible to modify the list + * through this iterator. + * + * @param id id to look up + * @return Iterator over tagged components + */ + public Iterator iteratorById(int id); - public Iterator iteratorById( int id, - Class cls ) ; + public Iterator iteratorById(int id, Class cls); - /** Create a TaggedProfile from this template. + /** + * Create a TaggedProfile from this template. + * * @param oktemp template to create from * @param id id of object * @return created TaggedProfile - */ - TaggedProfile create( ObjectKeyTemplate oktemp, ObjectId id ) ; + */ + TaggedProfile create(ObjectKeyTemplate oktemp, ObjectId id); - /** Write the profile create( oktemp, id ) to the OutputStream os. + /** + * Write the profile create( oktemp, id ) to the OutputStream os. + * * @param oktemp template to create from * @param id id of object * @param os stream to write to * @see #create(com.sun.corba.ee.spi.ior.ObjectKeyTemplate, com.sun.corba.ee.spi.ior.ObjectId) - */ - void write( ObjectKeyTemplate oktemp, ObjectId id, OutputStream os) ; + */ + void write(ObjectKeyTemplate oktemp, ObjectId id, OutputStream os); - /** Return true if temp is equivalent to this template. Equivalence - * means that in some sense an invocation on a profile created by this - * template has the same results as an invocation on a profile - * created from temp. Equivalence may be weaker than equality. + /** + * Return true if temp is equivalent to this template. Equivalence means that in some sense an invocation on a profile + * created by this template has the same results as an invocation on a profile created from temp. Equivalence may be + * weaker than equality. + * * @param temp template to compare with * @return true if they are equivalent */ - boolean isEquivalent( TaggedProfileTemplate temp ); + boolean isEquivalent(TaggedProfileTemplate temp); - /** Return the tagged components in this profile (if any) - * in the GIOP marshalled form, which is required for Portable - * Interceptors. Returns null if either the profile has no - * components, or if this type of profile can never contain + /** + * Return the tagged components in this profile (if any) in the GIOP marshalled form, which is required for Portable + * Interceptors. Returns null if either the profile has no components, or if this type of profile can never contain * components. + * * @param orb ORB to get components from * @param id ID of components to look up * @return tagged components in this profile */ - org.omg.IOP.TaggedComponent[] getIOPComponents( - ORB orb, int id ); + org.omg.IOP.TaggedComponent[] getIOPComponents(ORB orb, int id); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfileTemplateBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfileTemplateBase.java index 28806971e..728b1f9b8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfileTemplateBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/TaggedProfileTemplateBase.java @@ -19,48 +19,41 @@ package com.sun.corba.ee.spi.ior; -import java.util.Iterator ; +import java.util.Iterator; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.impl.ior.EncapsulationUtility ; +import com.sun.corba.ee.impl.ior.EncapsulationUtility; -public abstract class TaggedProfileTemplateBase - extends IdentifiableContainerBase - implements TaggedProfileTemplate -{ - public void write( OutputStream os ) - { - EncapsulationUtility.writeEncapsulation( this, os ) ; +public abstract class TaggedProfileTemplateBase extends IdentifiableContainerBase implements TaggedProfileTemplate { + public void write(OutputStream os) { + EncapsulationUtility.writeEncapsulation(this, os); } - public org.omg.IOP.TaggedComponent[] getIOPComponents( ORB orb, int id ) - { - int count = 0 ; - Iterator iter = iteratorById( id ) ; + public org.omg.IOP.TaggedComponent[] getIOPComponents(ORB orb, int id) { + int count = 0; + Iterator iter = iteratorById(id); while (iter.hasNext()) { - iter.next() ; - count++ ; + iter.next(); + count++; } - org.omg.IOP.TaggedComponent[] result = new - org.omg.IOP.TaggedComponent[count] ; + org.omg.IOP.TaggedComponent[] result = new org.omg.IOP.TaggedComponent[count]; - int index = 0 ; - iter = iteratorById( id ) ; + int index = 0; + iter = iteratorById(id); while (iter.hasNext()) { - TaggedComponent comp = iter.next() ; - result[index++] = comp.getIOPComponent( orb ) ; + TaggedComponent comp = iter.next(); + result[index++] = comp.getIOPComponent(orb); } - return result ; + return result; } - public Iterator iteratorById( int id, - Class cls ) { + public Iterator iteratorById(int id, Class cls) { - return (Iterator)iteratorById( id ) ; + return (Iterator) iteratorById(id); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/WriteContents.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/WriteContents.java index d83d5c8fd..7b68feb3d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/WriteContents.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/WriteContents.java @@ -19,8 +19,8 @@ package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; public interface WriteContents { - void writeContents( OutputStream os ) ; + void writeContents(OutputStream os); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/Writeable.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/Writeable.java index 85defdbb3..50df152e8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/Writeable.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/Writeable.java @@ -19,14 +19,17 @@ package com.sun.corba.ee.spi.ior; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; -/** This interface represents an entity that can be written to an OutputStream. +/** + * This interface represents an entity that can be written to an OutputStream. + * * @author Ken Cavanaugh */ -public interface Writeable -{ - /** Write this object directly to the output stream. +public interface Writeable { + /** + * Write this object directly to the output stream. + * * @param arg0 stream to write to */ void write(OutputStream arg0); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/AlternateIIOPAddressComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/AlternateIIOPAddressComponent.java index f633cfea7..fd1d37ab6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/AlternateIIOPAddressComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/AlternateIIOPAddressComponent.java @@ -19,21 +19,20 @@ package com.sun.corba.ee.spi.ior.iiop; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.ee.spi.ior.TaggedComponent ; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; +import com.sun.corba.ee.spi.ior.TaggedComponent; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; /** * @author Ken Cavanaugh */ @ManagedData -@Description( "Component containing an alternate IIOP address to use" ) -public interface AlternateIIOPAddressComponent extends TaggedComponent -{ +@Description("Component containing an alternate IIOP address to use") +public interface AlternateIIOPAddressComponent extends TaggedComponent { @ManagedAttribute - @Description( "The Alternate address" ) - public IIOPAddress getAddress() ; + @Description("The Alternate address") + public IIOPAddress getAddress(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/ClusterInstanceInfoComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/ClusterInstanceInfoComponent.java index 4f49f8d17..ec34efd4a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/ClusterInstanceInfoComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/ClusterInstanceInfoComponent.java @@ -22,8 +22,6 @@ import com.sun.corba.ee.spi.ior.TaggedComponent; import com.sun.corba.ee.spi.folb.ClusterInstanceInfo; -public interface ClusterInstanceInfoComponent extends TaggedComponent -{ +public interface ClusterInstanceInfoComponent extends TaggedComponent { public ClusterInstanceInfo getClusterInstanceInfo(); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/CodeSetsComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/CodeSetsComponent.java index c859058a4..8e569bf54 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/CodeSetsComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/CodeSetsComponent.java @@ -19,26 +19,22 @@ package com.sun.corba.ee.spi.ior.iiop; -import com.sun.corba.ee.spi.ior.TaggedComponent ; +import com.sun.corba.ee.spi.ior.TaggedComponent; -import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo ; - -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; /** * @author Ken Cavanaugh */ @ManagedData -@Description( "The character codesets to be used for encoding " - + "strings sent to the object reference represented by " - + "this IOR" ) -public interface CodeSetsComponent extends TaggedComponent -{ +@Description("The character codesets to be used for encoding " + "strings sent to the object reference represented by " + "this IOR") +public interface CodeSetsComponent extends TaggedComponent { @ManagedAttribute - @Description( "The codeset component info" ) + @Description("The codeset component info") // we'll just use toString() to represent this - public CodeSetComponentInfo getCodeSetComponentInfo() ; + public CodeSetComponentInfo getCodeSetComponentInfo(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/GIOPVersion.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/GIOPVersion.java index 82095dda8..cabb109aa 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/GIOPVersion.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/GIOPVersion.java @@ -17,9 +17,9 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior.iiop ; +package com.sun.corba.ee.spi.ior.iiop; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.ior.iiop.IIOPProfile; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.orb.ORBVersion; @@ -28,26 +28,25 @@ import com.sun.corba.ee.impl.misc.ORBUtility; import com.sun.corba.ee.spi.misc.ORBConstants; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; @ManagedData -@Description( "The maximum GIOP version supported by this IOR" ) +@Description("The maximum GIOP version supported by this IOR") public class GIOPVersion { // Static fields - public static final GIOPVersion V1_0 = new GIOPVersion((byte)1, (byte)0); - public static final GIOPVersion V1_1 = new GIOPVersion((byte)1, (byte)1); - public static final GIOPVersion V1_2 = new GIOPVersion((byte)1, (byte)2); - public static final GIOPVersion V1_3 = new GIOPVersion((byte)1, (byte)3); + public static final GIOPVersion V1_0 = new GIOPVersion((byte) 1, (byte) 0); + public static final GIOPVersion V1_1 = new GIOPVersion((byte) 1, (byte) 1); + public static final GIOPVersion V1_2 = new GIOPVersion((byte) 1, (byte) 2); + public static final GIOPVersion V1_3 = new GIOPVersion((byte) 1, (byte) 3); // Major version 13 is used to denote special encodings. // Minor version 00 is unused. // Minor version [01-FF] specifies Java serialization encoding version. - public static final GIOPVersion V13_XX = - new GIOPVersion((byte)13, (byte)ORBConstants.JAVA_ENC_VERSION); + public static final GIOPVersion V13_XX = new GIOPVersion((byte) 13, (byte) ORBConstants.JAVA_ENC_VERSION); public static final GIOPVersion DEFAULT_VERSION = V1_2; @@ -55,8 +54,7 @@ public class GIOPVersion { public static final int VERSION_1_1 = 0x0101; public static final int VERSION_1_2 = 0x0102; public static final int VERSION_1_3 = 0x0103; - public static final int VERSION_13_XX = - (13 << 8) | ORBConstants.JAVA_ENC_VERSION; + public static final int VERSION_13_XX = (13 << 8) | ORBConstants.JAVA_ENC_VERSION; // Instance variables @@ -65,7 +63,8 @@ public class GIOPVersion { // Constructor - public GIOPVersion() {} + public GIOPVersion() { + } public GIOPVersion(byte majorB, byte minorB) { this.major = majorB; @@ -73,45 +72,43 @@ public GIOPVersion(byte majorB, byte minorB) { } public GIOPVersion(int major, int minor) { - this.major = (byte)major; - this.minor = (byte)minor; + this.major = (byte) major; + this.minor = (byte) minor; } // Accessor methods @ManagedAttribute - @Description( "The Major GIOP version (almost always 1)" ) + @Description("The Major GIOP version (almost always 1)") public byte getMajor() { return this.major; } @ManagedAttribute - @Description( "The Minor GIOP version (almost always 0, 1, or 2." - + " This ORB almost always uses 2" ) + @Description("The Minor GIOP version (almost always 0, 1, or 2." + " This ORB almost always uses 2") public byte getMinor() { return this.minor; } // General methods - public boolean equals(GIOPVersion gv){ + public boolean equals(GIOPVersion gv) { if (gv == null) { - return false ; - } + return false; + } - return gv.major == this.major && gv.minor == this.minor ; + return gv.major == this.major && gv.minor == this.minor; } public boolean equals(Object obj) { if (obj != null && (obj instanceof GIOPVersion)) - return equals((GIOPVersion)obj); + return equals((GIOPVersion) obj); else return false; } - public int hashCode() - { - return 37*major + minor ; + public int hashCode() { + return 37 * major + minor; } public boolean lessThan(GIOPVersion gv) { @@ -126,36 +123,32 @@ public boolean lessThan(GIOPVersion gv) { return false; } - public int intValue() - { + public int intValue() { return (major << 8 | minor); } - public String toString() - { + public String toString() { return major + "." + minor; } - public static GIOPVersion getInstance(byte major, byte minor) - { - switch(((major << 8) | minor)) { - case VERSION_1_0: - return GIOPVersion.V1_0; - case VERSION_1_1: - return GIOPVersion.V1_1; - case VERSION_1_2: - return GIOPVersion.V1_2; - case VERSION_1_3: - return GIOPVersion.V1_3; - case VERSION_13_XX: - return GIOPVersion.V13_XX; - default: - return new GIOPVersion(major, minor); + public static GIOPVersion getInstance(byte major, byte minor) { + switch (((major << 8) | minor)) { + case VERSION_1_0: + return GIOPVersion.V1_0; + case VERSION_1_1: + return GIOPVersion.V1_1; + case VERSION_1_2: + return GIOPVersion.V1_2; + case VERSION_1_3: + return GIOPVersion.V1_3; + case VERSION_13_XX: + return GIOPVersion.V13_XX; + default: + return new GIOPVersion(major, minor); } } - public static GIOPVersion parseVersion(String s) - { + public static GIOPVersion parseVersion(String s) { int dotIdx = s.indexOf('.'); if (dotIdx < 1 || dotIdx == s.length() - 1) @@ -164,7 +157,7 @@ public static GIOPVersion parseVersion(String s) int major = Integer.parseInt(s.substring(0, dotIdx)); int minor = Integer.parseInt(s.substring(dotIdx + 1, s.length())); - return GIOPVersion.getInstance((byte)major, (byte)minor); + return GIOPVersion.getInstance((byte) major, (byte) minor); } /** @@ -174,17 +167,16 @@ public static GIOPVersion parseVersion(String s) * @param ior IOR to use * @return smallest(profGIOPVersion, orbGIOPVersion). */ - public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) { + public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior) { GIOPVersion orbVersion = orb.getORBData().getGIOPVersion(); - IIOPProfile prof = ior.getProfile() ; + IIOPProfile prof = ior.getProfile(); GIOPVersion profVersion = prof.getGIOPVersion(); // Check if the profile is from a legacy Sun ORB. ORBVersion targetOrbVersion = prof.getORBVersion(); - if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) && - targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) { + if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) && targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) { // we are dealing with a SUN legacy orb which emits 1.1 IORs, // in spite of being able to handle only GIOP 1.0 messages. return V1_0; @@ -211,8 +203,7 @@ public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) { } } - public boolean supportsIORIIOPProfileComponents() - { + public boolean supportsIORIIOPProfileComponents() { return getMinor() > 0 || getMajor() > 1; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPAddress.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPAddress.java index cf12bf0e4..e55831796 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPAddress.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPAddress.java @@ -19,24 +19,23 @@ package com.sun.corba.ee.spi.ior.iiop; -import com.sun.corba.ee.spi.ior.Writeable ; +import com.sun.corba.ee.spi.ior.Writeable; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; -/** IIOPAddress represents the host and port used to establish a - * TCP connection for an IIOP request. +/** + * IIOPAddress represents the host and port used to establish a TCP connection for an IIOP request. */ @ManagedData -@Description( "An IP address for the IIOP protocol" ) -public interface IIOPAddress extends Writeable -{ +@Description("An IP address for the IIOP protocol") +public interface IIOPAddress extends Writeable { @ManagedAttribute - @Description( "The target host (name or IP address)" ) - public String getHost() ; + @Description("The target host (name or IP address)") + public String getHost(); @ManagedAttribute - @Description( "The target port (0-65535)" ) - public int getPort() ; + @Description("The target port (0-65535)") + public int getPort(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPFactories.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPFactories.java index 443df0f0a..bf4c30679 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPFactories.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPFactories.java @@ -17,204 +17,169 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.ior.iiop ; +package com.sun.corba.ee.spi.ior.iiop; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -import com.sun.corba.ee.spi.ior.Identifiable ; -import com.sun.corba.ee.spi.ior.IdentifiableFactory ; -import com.sun.corba.ee.spi.ior.EncapsulationFactoryBase ; -import com.sun.corba.ee.spi.ior.ObjectId ; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; +import com.sun.corba.ee.spi.ior.Identifiable; +import com.sun.corba.ee.spi.ior.IdentifiableFactory; +import com.sun.corba.ee.spi.ior.EncapsulationFactoryBase; +import com.sun.corba.ee.spi.ior.ObjectId; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; -import com.sun.corba.ee.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; +import com.sun.corba.ee.spi.ior.iiop.IIOPAddress; +import com.sun.corba.ee.spi.ior.iiop.IIOPProfileTemplate; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.folb.ClusterInstanceInfo ; +import com.sun.corba.ee.spi.folb.ClusterInstanceInfo; -import com.sun.corba.ee.impl.encoding.MarshalInputStream ; +import com.sun.corba.ee.impl.encoding.MarshalInputStream; -import com.sun.corba.ee.impl.ior.iiop.IIOPAddressImpl ; -import com.sun.corba.ee.impl.ior.iiop.CodeSetsComponentImpl ; -import com.sun.corba.ee.impl.ior.iiop.AlternateIIOPAddressComponentImpl ; -import com.sun.corba.ee.impl.ior.iiop.JavaCodebaseComponentImpl ; -import com.sun.corba.ee.impl.ior.iiop.MaxStreamFormatVersionComponentImpl ; +import com.sun.corba.ee.impl.ior.iiop.IIOPAddressImpl; +import com.sun.corba.ee.impl.ior.iiop.CodeSetsComponentImpl; +import com.sun.corba.ee.impl.ior.iiop.AlternateIIOPAddressComponentImpl; +import com.sun.corba.ee.impl.ior.iiop.JavaCodebaseComponentImpl; +import com.sun.corba.ee.impl.ior.iiop.MaxStreamFormatVersionComponentImpl; import com.sun.corba.ee.impl.ior.iiop.JavaSerializationComponent; -import com.sun.corba.ee.impl.ior.iiop.ORBTypeComponentImpl ; -import com.sun.corba.ee.impl.ior.iiop.IIOPProfileImpl ; -import com.sun.corba.ee.impl.ior.iiop.IIOPProfileTemplateImpl ; -import com.sun.corba.ee.impl.ior.iiop.RequestPartitioningComponentImpl ; -import com.sun.corba.ee.impl.ior.iiop.LoadBalancingComponentImpl ; -import com.sun.corba.ee.impl.ior.iiop.ClusterInstanceInfoComponentImpl ; +import com.sun.corba.ee.impl.ior.iiop.ORBTypeComponentImpl; +import com.sun.corba.ee.impl.ior.iiop.IIOPProfileImpl; +import com.sun.corba.ee.impl.ior.iiop.IIOPProfileTemplateImpl; +import com.sun.corba.ee.impl.ior.iiop.RequestPartitioningComponentImpl; +import com.sun.corba.ee.impl.ior.iiop.LoadBalancingComponentImpl; +import com.sun.corba.ee.impl.ior.iiop.ClusterInstanceInfoComponentImpl; import com.sun.corba.ee.spi.misc.ORBConstants; import com.sun.corba.ee.spi.misc.ORBConstants; -import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ; -import org.omg.IOP.TAG_CODE_SETS ; -import org.omg.IOP.TAG_JAVA_CODEBASE ; -import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT ; -import org.omg.IOP.TAG_ORB_TYPE ; -import org.omg.IOP.TAG_INTERNET_IOP ; - -/** This class provides all of the factories for the IIOP profiles and - * components. This includes direct construction of profiles and templates, - * as well as constructing factories that can be registered with an - * IdentifiableFactoryFinder. +import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS; +import org.omg.IOP.TAG_CODE_SETS; +import org.omg.IOP.TAG_JAVA_CODEBASE; +import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT; +import org.omg.IOP.TAG_ORB_TYPE; +import org.omg.IOP.TAG_INTERNET_IOP; + +/** + * This class provides all of the factories for the IIOP profiles and components. This includes direct construction of + * profiles and templates, as well as constructing factories that can be registered with an IdentifiableFactoryFinder. */ public abstract class IIOPFactories { - private IIOPFactories() {} + private IIOPFactories() { + } - public static IdentifiableFactory makeRequestPartitioningComponentFactory() - { + public static IdentifiableFactory makeRequestPartitioningComponentFactory() { return new EncapsulationFactoryBase(ORBConstants.TAG_REQUEST_PARTITIONING_ID) { - public Identifiable readContents(InputStream in) - { + public Identifiable readContents(InputStream in) { int threadPoolToUse = in.read_ulong(); - Identifiable comp = - new RequestPartitioningComponentImpl(threadPoolToUse); + Identifiable comp = new RequestPartitioningComponentImpl(threadPoolToUse); return comp; } }; - } + } - public static RequestPartitioningComponent makeRequestPartitioningComponent( - int threadPoolToUse) - { + public static RequestPartitioningComponent makeRequestPartitioningComponent(int threadPoolToUse) { return new RequestPartitioningComponentImpl(threadPoolToUse); } - public static IdentifiableFactory makeLoadBalancingComponentFactory() - { + public static IdentifiableFactory makeLoadBalancingComponentFactory() { return new EncapsulationFactoryBase(ORBConstants.TAG_LOAD_BALANCING_ID) { - public Identifiable readContents(InputStream in) - { + public Identifiable readContents(InputStream in) { int loadBalancingValue = in.read_ulong(); - Identifiable comp = - new LoadBalancingComponentImpl(loadBalancingValue); + Identifiable comp = new LoadBalancingComponentImpl(loadBalancingValue); return comp; } }; - } + } - public static LoadBalancingComponent makeLoadBalancingComponent( - int loadBalancingValue) - { + public static LoadBalancingComponent makeLoadBalancingComponent(int loadBalancingValue) { return new LoadBalancingComponentImpl(loadBalancingValue); } - public static IdentifiableFactory makeClusterInstanceInfoComponentFactory() - { - return new EncapsulationFactoryBase( - ORBConstants.FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID) { + public static IdentifiableFactory makeClusterInstanceInfoComponentFactory() { + return new EncapsulationFactoryBase(ORBConstants.FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID) { - public Identifiable readContents(InputStream in) - { - final ClusterInstanceInfo cinfo = new ClusterInstanceInfo( in ) ; - Identifiable comp = - new ClusterInstanceInfoComponentImpl(cinfo); + public Identifiable readContents(InputStream in) { + final ClusterInstanceInfo cinfo = new ClusterInstanceInfo(in); + Identifiable comp = new ClusterInstanceInfoComponentImpl(cinfo); return comp; } }; - } + } - public static ClusterInstanceInfoComponent makeClusterInstanceInfoComponent( - ClusterInstanceInfo cinfo) - { + public static ClusterInstanceInfoComponent makeClusterInstanceInfoComponent(ClusterInstanceInfo cinfo) { return new ClusterInstanceInfoComponentImpl(cinfo); } - public static IdentifiableFactory makeAlternateIIOPAddressComponentFactory() - { + public static IdentifiableFactory makeAlternateIIOPAddressComponentFactory() { return new EncapsulationFactoryBase(TAG_ALTERNATE_IIOP_ADDRESS.value) { - public Identifiable readContents( InputStream in ) - { - IIOPAddress addr = new IIOPAddressImpl( in ) ; - Identifiable comp = - new AlternateIIOPAddressComponentImpl( addr ) ; - return comp ; + public Identifiable readContents(InputStream in) { + IIOPAddress addr = new IIOPAddressImpl(in); + Identifiable comp = new AlternateIIOPAddressComponentImpl(addr); + return comp; } - } ; - } + }; + } - public static AlternateIIOPAddressComponent makeAlternateIIOPAddressComponent( - IIOPAddress addr ) - { - return new AlternateIIOPAddressComponentImpl( addr ) ; + public static AlternateIIOPAddressComponent makeAlternateIIOPAddressComponent(IIOPAddress addr) { + return new AlternateIIOPAddressComponentImpl(addr); } - public static IdentifiableFactory makeCodeSetsComponentFactory() - { + public static IdentifiableFactory makeCodeSetsComponentFactory() { return new EncapsulationFactoryBase(TAG_CODE_SETS.value) { - public Identifiable readContents( InputStream in ) - { - return new CodeSetsComponentImpl( in ) ; + public Identifiable readContents(InputStream in) { + return new CodeSetsComponentImpl(in); } - } ; + }; } - - public static CodeSetsComponent makeCodeSetsComponent( ORB orb ) - { - return new CodeSetsComponentImpl( orb ) ; + + public static CodeSetsComponent makeCodeSetsComponent(ORB orb) { + return new CodeSetsComponentImpl(orb); } - - public static IdentifiableFactory makeJavaCodebaseComponentFactory() - { + + public static IdentifiableFactory makeJavaCodebaseComponentFactory() { return new EncapsulationFactoryBase(TAG_JAVA_CODEBASE.value) { - public Identifiable readContents( InputStream in ) - { - String url = in.read_string() ; - Identifiable comp = new JavaCodebaseComponentImpl( url ) ; - return comp ; + public Identifiable readContents(InputStream in) { + String url = in.read_string(); + Identifiable comp = new JavaCodebaseComponentImpl(url); + return comp; } - } ; + }; } - public static JavaCodebaseComponent makeJavaCodebaseComponent( - String codebase ) - { - return new JavaCodebaseComponentImpl( codebase ) ; + public static JavaCodebaseComponent makeJavaCodebaseComponent(String codebase) { + return new JavaCodebaseComponentImpl(codebase); } - public static IdentifiableFactory makeORBTypeComponentFactory() - { + public static IdentifiableFactory makeORBTypeComponentFactory() { return new EncapsulationFactoryBase(TAG_ORB_TYPE.value) { - public Identifiable readContents( InputStream in ) - { - int type = in.read_ulong() ; - Identifiable comp = new ORBTypeComponentImpl( type ) ; - return comp ; + public Identifiable readContents(InputStream in) { + int type = in.read_ulong(); + Identifiable comp = new ORBTypeComponentImpl(type); + return comp; } - } ; + }; } - public static ORBTypeComponent makeORBTypeComponent( int type ) - { - return new ORBTypeComponentImpl( type ) ; + public static ORBTypeComponent makeORBTypeComponent(int type) { + return new ORBTypeComponentImpl(type); } - public static IdentifiableFactory makeMaxStreamFormatVersionComponentFactory() - { + public static IdentifiableFactory makeMaxStreamFormatVersionComponentFactory() { return new EncapsulationFactoryBase(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value) { - public Identifiable readContents(InputStream in) - { - byte version = in.read_octet() ; + public Identifiable readContents(InputStream in) { + byte version = in.read_octet(); Identifiable comp = new MaxStreamFormatVersionComponentImpl(version); - return comp ; + return comp; } }; - } + } - public static MaxStreamFormatVersionComponent makeMaxStreamFormatVersionComponent() - { - return new MaxStreamFormatVersionComponentImpl() ; + public static MaxStreamFormatVersionComponent makeMaxStreamFormatVersionComponent() { + return new MaxStreamFormatVersionComponentImpl(); } public static IdentifiableFactory makeJavaSerializationComponentFactory() { - return new EncapsulationFactoryBase( - ORBConstants.TAG_JAVA_SERIALIZATION_ID) { + return new EncapsulationFactoryBase(ORBConstants.TAG_JAVA_SERIALIZATION_ID) { public Identifiable readContents(InputStream in) { byte version = in.read_octet(); Identifiable cmp = new JavaSerializationComponent(version); @@ -227,53 +192,41 @@ public static JavaSerializationComponent makeJavaSerializationComponent() { return JavaSerializationComponent.singleton(); } - public static IdentifiableFactory makeIIOPProfileFactory() - { + public static IdentifiableFactory makeIIOPProfileFactory() { return new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) { - public Identifiable readContents( InputStream in ) - { - Identifiable result = new IIOPProfileImpl( in ) ; - return result ; + public Identifiable readContents(InputStream in) { + Identifiable result = new IIOPProfileImpl(in); + return result; } - } ; + }; } - public static IIOPProfile makeIIOPProfile( ORB orb, ObjectKeyTemplate oktemp, - ObjectId oid, IIOPProfileTemplate ptemp ) - { - return new IIOPProfileImpl( orb, oktemp, oid, ptemp ) ; + public static IIOPProfile makeIIOPProfile(ORB orb, ObjectKeyTemplate oktemp, ObjectId oid, IIOPProfileTemplate ptemp) { + return new IIOPProfileImpl(orb, oktemp, oid, ptemp); } - public static IIOPProfile makeIIOPProfile( ORB orb, - org.omg.IOP.TaggedProfile profile ) - { - return new IIOPProfileImpl( orb, profile ) ; + public static IIOPProfile makeIIOPProfile(ORB orb, org.omg.IOP.TaggedProfile profile) { + return new IIOPProfileImpl(orb, profile); } - public static IdentifiableFactory makeIIOPProfileTemplateFactory() - { + public static IdentifiableFactory makeIIOPProfileTemplateFactory() { return new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) { - public Identifiable readContents( InputStream in ) - { - Identifiable result = new IIOPProfileTemplateImpl( in ) ; - return result ; + public Identifiable readContents(InputStream in) { + Identifiable result = new IIOPProfileTemplateImpl(in); + return result; } - } ; + }; } - public static IIOPProfileTemplate makeIIOPProfileTemplate( ORB orb, - GIOPVersion version, IIOPAddress primary ) - { - return new IIOPProfileTemplateImpl( orb, version, primary ) ; + public static IIOPProfileTemplate makeIIOPProfileTemplate(ORB orb, GIOPVersion version, IIOPAddress primary) { + return new IIOPProfileTemplateImpl(orb, version, primary); } - public static IIOPAddress makeIIOPAddress( String host, int port ) - { - return new IIOPAddressImpl( host, port ) ; + public static IIOPAddress makeIIOPAddress(String host, int port) { + return new IIOPAddressImpl(host, port); } - public static IIOPAddress makeIIOPAddress( InputStream is ) - { - return new IIOPAddressImpl( is ) ; + public static IIOPAddress makeIIOPAddress(InputStream is) { + return new IIOPAddressImpl(is); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPProfile.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPProfile.java index ab285f5ab..58d3b7b3f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPProfile.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPProfile.java @@ -19,49 +19,48 @@ package com.sun.corba.ee.spi.ior.iiop; -import com.sun.corba.ee.spi.ior.TaggedProfile ; +import com.sun.corba.ee.spi.ior.TaggedProfile; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersion ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersion; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.ManagedAttribute ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.ManagedAttribute; -/** IIOPProfile represents an IIOP tagged profile. -* It is essentially composed of an object identifier and -* a template. The template contains all of the -* IIOP specific information in the profile. -* Templates are frequently shared between many different profiles, -* while the object identifiy is unique to each profile. -*/ +/** + * IIOPProfile represents an IIOP tagged profile. It is essentially composed of an object identifier and a template. The + * template contains all of the IIOP specific information in the profile. Templates are frequently shared between many + * different profiles, while the object identifiy is unique to each profile. + */ @ManagedData -@Description( "The IIOPProfile version of a TaggedProfile" ) -public interface IIOPProfile extends TaggedProfile -{ +@Description("The IIOPProfile version of a TaggedProfile") +public interface IIOPProfile extends TaggedProfile { @ManagedAttribute - @Description( "The ORB version in use" ) - ORBVersion getORBVersion() ; + @Description("The ORB version in use") + ORBVersion getORBVersion(); - /** Return the servant for this profile, if it is local - * AND if the OA that implements this objref supports direct access to servants - * outside of an invocation. + /** + * Return the servant for this profile, if it is local AND if the OA that implements this objref supports direct access + * to servants outside of an invocation. * * @return the profile servant */ - java.lang.Object getServant() ; + java.lang.Object getServant(); - /** Return the GIOPVersion of this profile. Caches the result. + /** + * Return the GIOPVersion of this profile. Caches the result. * * @return the GIOPVersion */ - GIOPVersion getGIOPVersion() ; + GIOPVersion getGIOPVersion(); - /** Return the Codebase of this profile. Caches the result. + /** + * Return the Codebase of this profile. Caches the result. * * @return the profile codebase */ - String getCodebase() ; + String getCodebase(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPProfileTemplate.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPProfileTemplate.java index 2e25fa9ea..374e5c2f3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPProfileTemplate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/IIOPProfileTemplate.java @@ -26,32 +26,33 @@ import org.glassfish.gmbal.ManagedData; /** - * IIOPProfileTemplate represents the parts of an IIOPProfile that are independent - * of the object identifier. It is a container of tagged components. + * IIOPProfileTemplate represents the parts of an IIOPProfile that are independent of the object identifier. It is a + * container of tagged components. */ @ManagedData -@Description( "Template for an IIOP profile" ) -public interface IIOPProfileTemplate extends TaggedProfileTemplate -{ - /** Return the GIOP version of this profile. +@Description("Template for an IIOP profile") +public interface IIOPProfileTemplate extends TaggedProfileTemplate { + /** + * Return the GIOP version of this profile. * * @return the GIOP version - */ - public GIOPVersion getGIOPVersion() ; + */ + public GIOPVersion getGIOPVersion(); - /** Return the IIOP address from the IIOP profile. This is called the - * primary address here since other addresses may be contained in - * components. - * - * @return The host and port of the IP address for the primary endpoint of this profile - */ + /** + * Return the IIOP address from the IIOP profile. This is called the primary address here since other addresses may be + * contained in components. + * + * @return The host and port of the IP address for the primary endpoint of this profile + */ @ManagedAttribute - @Description( "The host and port of the IP address for the primary endpoint of this profile" ) - public IIOPAddress getPrimaryAddress() ; + @Description("The host and port of the IP address for the primary endpoint of this profile") + public IIOPAddress getPrimaryAddress(); /** - * Returns the description of a socket to create to access the associated endpoint. Its host and port - * will match the primary address + * Returns the description of a socket to create to access the associated endpoint. Its host and port will match the + * primary address + * * @return a description of a socket. */ SocketInfo getPrimarySocketInfo(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/JavaCodebaseComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/JavaCodebaseComponent.java index 301c8b22e..03bb0614f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/JavaCodebaseComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/JavaCodebaseComponent.java @@ -19,20 +19,19 @@ package com.sun.corba.ee.spi.ior.iiop; -import com.sun.corba.ee.spi.ior.TaggedComponent ; +import com.sun.corba.ee.spi.ior.TaggedComponent; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; /** * @author Ken Cavanaugh */ @ManagedData -@Description( "Component representing Codebase URLs for downloading code" ) -public interface JavaCodebaseComponent extends TaggedComponent -{ +@Description("Component representing Codebase URLs for downloading code") +public interface JavaCodebaseComponent extends TaggedComponent { @ManagedAttribute - @Description( "List of URLs in the codebase" ) - public String getURLs() ; + @Description("List of URLs in the codebase") + public String getURLs(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/LoadBalancingComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/LoadBalancingComponent.java index 178ba74a6..3ff0a6848 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/LoadBalancingComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/LoadBalancingComponent.java @@ -21,8 +21,6 @@ import com.sun.corba.ee.spi.ior.TaggedComponent; -public interface LoadBalancingComponent extends TaggedComponent -{ +public interface LoadBalancingComponent extends TaggedComponent { public int getLoadBalancingValue(); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/MaxStreamFormatVersionComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/MaxStreamFormatVersionComponent.java index d7f7c52f4..13c45c1ec 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/MaxStreamFormatVersionComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/MaxStreamFormatVersionComponent.java @@ -19,21 +19,18 @@ package com.sun.corba.ee.spi.ior.iiop; -import com.sun.corba.ee.spi.ior.TaggedComponent ; +import com.sun.corba.ee.spi.ior.TaggedComponent; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; // Java to IDL ptc 02-01-12 1.4.11 // TAG_RMI_CUSTOM_MAX_STREAM_FORMAT @ManagedData -@Description( "Component representing the maximum RMI-IIOP stream format " - + "version to be used with this IOR" ) -public interface MaxStreamFormatVersionComponent extends TaggedComponent -{ +@Description("Component representing the maximum RMI-IIOP stream format " + "version to be used with this IOR") +public interface MaxStreamFormatVersionComponent extends TaggedComponent { @ManagedAttribute - @Description( "The maximum RMI-IIOP stream format version " - + "(usually 2)" ) - public byte getMaxStreamFormatVersion() ; + @Description("The maximum RMI-IIOP stream format version " + "(usually 2)") + public byte getMaxStreamFormatVersion(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/ORBTypeComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/ORBTypeComponent.java index 54fb4a3d8..8784f46f3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/ORBTypeComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/ORBTypeComponent.java @@ -19,20 +19,19 @@ package com.sun.corba.ee.spi.ior.iiop; -import com.sun.corba.ee.spi.ior.TaggedComponent ; +import com.sun.corba.ee.spi.ior.TaggedComponent; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; /** * @author Ken Cavanaugh */ @ManagedData -@Description( "The ORB type" ) -public interface ORBTypeComponent extends TaggedComponent -{ +@Description("The ORB type") +public interface ORBTypeComponent extends TaggedComponent { @ManagedAttribute - @Description( "The ORB type" ) - public int getORBType() ; + @Description("The ORB type") + public int getORBType(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/RequestPartitioningComponent.java b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/RequestPartitioningComponent.java index a88e38bb5..5a96e20ac 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/RequestPartitioningComponent.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/ior/iiop/RequestPartitioningComponent.java @@ -21,15 +21,14 @@ import com.sun.corba.ee.spi.ior.TaggedComponent; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; @ManagedData -@Description( "Component encoding request paritioning ID" ) -public interface RequestPartitioningComponent extends TaggedComponent -{ +@Description("Component encoding request paritioning ID") +public interface RequestPartitioningComponent extends TaggedComponent { @ManagedAttribute - @Description( "Request paritioning id (0-63); commonly 0" ) + @Description("Request paritioning id (0-63); commonly 0") public int getRequestPartitioningId(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/Connection.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/Connection.java index 93dbf24a9..a88bb5c84 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/Connection.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/Connection.java @@ -23,7 +23,6 @@ * This interface represents the connection on which a request is made. */ -public interface Connection -{ +public interface Connection { public java.net.Socket getSocket(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/GetEndPointInfoAgainException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/GetEndPointInfoAgainException.java index 2c605539b..0413a4400 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/GetEndPointInfoAgainException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/GetEndPointInfoAgainException.java @@ -22,25 +22,20 @@ import com.sun.corba.ee.spi.transport.SocketInfo; /** - * This exception is raised by ORBSocketFactory.createSocket. - * It informs the ORB that it should call - * ORBSocketFactory.getEndPointInfo again with the - * given socketInfo object as an argument (i.e., a cookie). + * This exception is raised by ORBSocketFactory.createSocket. It informs the ORB that it should call + * ORBSocketFactory.getEndPointInfo again with the given socketInfo object as an argument + * (i.e., a cookie). * */ -public class GetEndPointInfoAgainException - extends Exception -{ +public class GetEndPointInfoAgainException extends Exception { private SocketInfo socketInfo; - public GetEndPointInfoAgainException(SocketInfo socketInfo) - { + public GetEndPointInfoAgainException(SocketInfo socketInfo) { this.socketInfo = socketInfo; } - public SocketInfo getEndPointInfo() - { + public SocketInfo getEndPointInfo() { return socketInfo; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/LegacyServerSocketEndPointInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/LegacyServerSocketEndPointInfo.java index c0d0d3f46..10f02d321 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/LegacyServerSocketEndPointInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/LegacyServerSocketEndPointInfo.java @@ -22,19 +22,18 @@ /** * LegacyServerSocketEndPointInfo is an abstraction of a port. */ -public interface LegacyServerSocketEndPointInfo -{ +public interface LegacyServerSocketEndPointInfo { /** * e.g.: "CLEAR_TEXT", "SSL", ... + * * @return type */ public String getType(); - /** - * Get the host name of this end point. Subcontracts must use this - * instead of InetAddress.getHostName() because this would take - * into account the value of the ORBServerHost property. + * Get the host name of this end point. Subcontracts must use this instead of InetAddress.getHostName() because this + * would take into account the value of the ORBServerHost property. + * * @return the host name */ public String getHostName(); @@ -42,11 +41,12 @@ public interface LegacyServerSocketEndPointInfo public int getPort(); /** - * The ORBD's proxy port of this end point. - * Note: Pre-ORT "port-exchange" model. - * @return proxy port + * The ORBD's proxy port of this end point. Note: Pre-ORT "port-exchange" model. + * + * @return proxy port */ public int getLocatorPort(); + public void setLocatorPort(int port); // NAME is used while we still have a "port-exchange" ORBD diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/LegacyServerSocketManager.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/LegacyServerSocketManager.java index baf30716e..d24b4ce03 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/LegacyServerSocketManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/LegacyServerSocketManager.java @@ -22,15 +22,16 @@ /** * @author Harold Carr */ -public interface LegacyServerSocketManager -{ +public interface LegacyServerSocketManager { public int legacyGetTransientServerPort(String type); + public int legacyGetPersistentServerPort(String socketType); + public int legacyGetTransientOrPersistentServerPort(String socketType); public LegacyServerSocketEndPointInfo legacyGetEndpoint(String name); public boolean legacyIsLocalServerPort(int port); } - + // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/ORBSocketFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/ORBSocketFactory.java index 59a4a2ee8..215fa2f34 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/ORBSocketFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/connection/ORBSocketFactory.java @@ -28,116 +28,121 @@ /** * - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

    - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

    + * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. + *

    + * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. + *

    * - * This interface gives one the ability to plug in their own socket - * factory class to an ORB.

    + * This interface gives one the ability to plug in their own socket factory class to an ORB. + *

    * - * Usage:

    + * Usage: + *

    * - * One specifies a class which implements this interface via the + * One specifies a class which implements this interface via the * - * ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY + * ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY * - * property.

    + * property. + *

    * * Example: - + * *

      *   -Dcom.sun.corba.ee.connection.ORBSocketFactoryClass=MySocketFactory
    - * 

    + * + *

    * - * Typically one would use the same socket factory class on both the - * server side and the client side (but this is not required).

    + * Typically one would use the same socket factory class on both the server side and the client side (but this is not + * required). + *

    * - * A ORBSocketFactory class should have a public default - * constructor which is called once per instantiating ORB.init call. - * That ORB then calls the methods of that ORBSocketFactory - * to obtain client and server sockets.

    + * A ORBSocketFactory class should have a public default constructor which is called once per instantiating + * ORB.init call. That ORB then calls the methods of that ORBSocketFactory to obtain client and server + * sockets. + *

    * - * This interface also supports multiple server end points. See the - * documentation on createServerSocket below. + * This interface also supports multiple server end points. See the documentation on createServerSocket + * below. * */ @Deprecated -public interface ORBSocketFactory -{ +public interface ORBSocketFactory { /** - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

    + * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. + *

    * - * A server ORB always creates an "IIOP_CLEAR_TEXT" listening port. - * That port is put into IOP profiles of object references exported - * by an ORB.

    + * A server ORB always creates an "IIOP_CLEAR_TEXT" listening port. That port is put into IOP profiles of object + * references exported by an ORB. + *

    * - * If + * If * - * createServerSocket(String type, int port) + * createServerSocket(String type, int port) * - * is passed IIOP_CLEAR_TEXT as a type - * argument it should then call and return + * is passed IIOP_CLEAR_TEXT as a type argument it should then call and return * - * new java.net.ServerSocket(int port)

    + * new java.net.ServerSocket(int port) + *

    * * If * - * createSocket(SocketInfo socketInfo) + * createSocket(SocketInfo socketInfo) * - * is passed IIOP_CLEAR_TEXT in - * socketInfo.getType() it should - * then call and return + * is passed IIOP_CLEAR_TEXT in socketInfo.getType() it should then call and return * *

    -     *     new java.net.Socket(socketInfo.getHost(),
    -     *                         socketInfo.getPort())
    +     * new java.net.Socket(socketInfo.getHost(), socketInfo.getPort())
          * 
    - * @deprecated + * + * @deprecated */ public static final String IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT"; - /** - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

    + * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. + *

    * - * This method is used by a server side ORB.

    + * This method is used by a server side ORB. + *

    * - * When an ORB needs to create a listen socket on which connection - * requests are accepted it calls + * When an ORB needs to create a listen socket on which connection requests are accepted it calls * - * createServerSocket(String type, int port). + * createServerSocket(String type, int port). * - * The type argument says which type of socket should be created.

    + * The type argument says which type of socket should be created. + *

    * - * The interpretation of the type argument is the responsibility of - * an instance of ORBSocketFactory, except in the case - * of IIOP_CLEAR_TEXT, in which case a standard server - * socket should be created.

    + * The interpretation of the type argument is the responsibility of an instance of ORBSocketFactory, except + * in the case of IIOP_CLEAR_TEXT, in which case a standard server socket should be created. + *

    * * - * Multiple Server Port API:

    + * Multiple Server Port API: + *

    * - * In addition to the IIOP_CLEAR_TEXT listening port, it is possible - * to specify that an ORB listen on additional port of specific types.

    + * In addition to the IIOP_CLEAR_TEXT listening port, it is possible to specify that an ORB listen on additional port of + * specific types. + *

    * - * This API allows one to specify that an ORB should create an X, - * or an X and a Y listen socket.

    + * This API allows one to specify that an ORB should create an X, or an X and a Y listen socket. + *

    * - * If X, to the user, means SSL, then one just plugs in an SSL - * socket factory.

    + * If X, to the user, means SSL, then one just plugs in an SSL socket factory. + *

    * - * Or, another example, if X and Y, to the user, means SSL without - * authentication and SSL with authentication respectively, then they - * plug in a factory which will either create an X or a Y socket - * depending on the type given to + * Or, another example, if X and Y, to the user, means SSL without authentication and SSL with authentication + * respectively, then they plug in a factory which will either create an X or a Y socket depending on the type given to * - * createServerSocket(String type, int port).

    + * createServerSocket(String type, int port). + *

    * - * One specifies multiple listening ports (in addition to the - * default IIOP_CLEAR_TEXT port) using the + * One specifies multiple listening ports (in addition to the default IIOP_CLEAR_TEXT port) using the * - * ORBConstants.LISTEN_SOCKET_PROPERTY + * ORBConstants.LISTEN_SOCKET_PROPERTY * - * property.

    + * property. + *

    * * Example usage: * @@ -145,101 +150,95 @@ public interface ORBSocketFactory * ... \ * -Dcom.sun.corba.ee.connection.ORBSocketFactoryClass=com.my.MySockFact \ * -Dcom.sun.corba.ee.connection.ORBListenSocket=SSL:0,foo:1 \ - * ... + * ... * * - * The meaning of the "type" (SSL and foo above) is controlled - * by the user.

    + * The meaning of the "type" (SSL and foo above) is controlled by the user. + *

    * - * ORBListenSocket is only meaningful for servers.

    + * ORBListenSocket is only meaningful for servers. + *

    * - * The property value is interpreted as follows. For each - * type/number pair:

    + * The property value is interpreted as follows. For each type/number pair: + *

    * - * If number is 0 then use an emphemeral port for the listener of - * the associated type.

    + * If number is 0 then use an emphemeral port for the listener of the associated type. + *

    * - * If number is greater then 0 use that port number.

    + * If number is greater then 0 use that port number. + *

    * - * An ORB creates a listener socket for each type - * specified by the user by calling + * An ORB creates a listener socket for each type specified by the user by calling * - * createServerSocket(String type, int port) + * createServerSocket(String type, int port) * - * with the type specified by the user.

    + * with the type specified by the user. + *

    * - * After an ORB is initialized and the RootPOA has been resolved, - * it is then listening on - * all the end points which were specified. It may be necessary - * to add this additional end point information to object references - * exported by this ORB.

    + * After an ORB is initialized and the RootPOA has been resolved, it is then listening on all the end points which were + * specified. It may be necessary to add this additional end point information to object references exported by this + * ORB. + *

    * - * Each object reference will contain the ORB's default IIOP_CLEAR_TEXT - * end point in its IOP profile. To add additional end point information - * (i.e., an SSL port) to an IOR (i.e., an object reference) one needs - * to intercept IOR creation using - * an PortableInterceptor::IORInterceptor.

    + * Each object reference will contain the ORB's default IIOP_CLEAR_TEXT end point in its IOP profile. To add additional + * end point information (i.e., an SSL port) to an IOR (i.e., an object reference) one needs to intercept IOR creation + * using an PortableInterceptor::IORInterceptor. + *

    * - * Using PortableInterceptors (with a non-standard extension):

    + * Using PortableInterceptors (with a non-standard extension): + *

    * - * Register an IORInterceptor. Inside its - * establish_components operation: + * Register an IORInterceptor. Inside its establish_components operation: * *

          *
          * com.sun.corba.ee.spi.legacy.interceptor.IORInfoExt ext;
    -     * ext = (com.sun.corba.ee.spi.legacy.interceptor.IORInfoExt)info;
    +     * ext = (com.sun.corba.ee.spi.legacy.interceptor.IORInfoExt) info;
          *
          * int port = ext.getServerPort("myType");
          *
          * 
    * - * Once you have the port you may add information to references - * created by the associated adapter by calling + * Once you have the port you may add information to references created by the associated adapter by calling * - * IORInfo::add_ior_component

    + * IORInfo::add_ior_component + *

    * * - * Note: if one is using a POA and the lifespan policy of that - * POA is persistent then the port number returned - * by getServerPort may - * be the corresponding ORBD port, depending on whether the POA/ORBD - * protocol is the present port exchange or if, in the future, - * the protocol is based on object reference template exchange. - * In either - * case, the port returned will be correct for the protocol. - * (In more detail, if the port exchange protocol is used then - * getServerPort will return the ORBD's port since the port - * exchange happens before, at ORB initialization. - * If object reference - * exchange is used then the server's transient port will be returned - * since the templates are exchanged after adding components.)

    + * Note: if one is using a POA and the lifespan policy of that POA is persistent then the port number returned by + * getServerPort may be the corresponding ORBD port, depending on whether the POA/ORBD protocol is + * the present port exchange or if, in the future, the protocol is based on object reference template exchange. In + * either case, the port returned will be correct for the protocol. (In more detail, if the port exchange protocol is + * used then getServerPort will return the ORBD's port since the port exchange happens before, at ORB initialization. If + * object reference exchange is used then the server's transient port will be returned since the templates are exchanged + * after adding components.) + *

    * * - * Persistent object reference support:

    + * Persistent object reference support: + *

    * - * When creating persistent object references with alternate - * type/port info, ones needs to configure the ORBD to also support - * this alternate info. This is done as follows:

    + * When creating persistent object references with alternate type/port info, ones needs to configure the ORBD to also + * support this alternate info. This is done as follows: + *

    * - * - Give the ORBD the same socket factory you gave to the client - * and server.

    + * - Give the ORBD the same socket factory you gave to the client and server. + *

    * - * - specify ORBListenSocket ports of the same types that your - * servers support. You should probably specify explicit port - * numbers for ORBD if you embed these numbers inside IORs.

    + * - specify ORBListenSocket ports of the same types that your servers support. You should probably specify explicit + * port numbers for ORBD if you embed these numbers inside IORs. + *

    * - * Note: when using the port exchange protocol - * the ORBD and servers will exchange port - * numbers for each given type so they know about each other. - * When using object reference template exchange the server's - * transient ports are contained in the template.

    + * Note: when using the port exchange protocol the ORBD and servers will exchange port numbers for each given type so + * they know about each other. When using object reference template exchange the server's transient ports are contained + * in the template. + *

    * * - * - specify your BadServerIdHandler (discussed below) - * using the + * - specify your BadServerIdHandler (discussed below) using the * - * ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY

    + * ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY + *

    * * Example: * @@ -249,21 +248,20 @@ public interface ORBSocketFactory * * * - * The BadServerIdHandler ...

    + * The BadServerIdHandler ... + *

    * - * See com.sun.corba.ee.impl.activation.ServerManagerImpl.handle - * for example code on writing a bad server id handler. NOTE: This - * is an unsupported internal API. It will not exist in future releases. + * See com.sun.corba.ee.impl.activation.ServerManagerImpl.handle for example code on writing a bad server + * id handler. NOTE: This is an unsupported internal API. It will not exist in future releases. *

    * * - * Secure connections to other services:

    + * Secure connections to other services: + *

    * - * If one wants secure connections to other services such as - * Naming then one should configure them with the same + * If one wants secure connections to other services such as Naming then one should configure them with the same * - * SOCKET_FACTORY_CLASS_PROPERTY and - * LISTEN_SOCKET_PROPERTY + * SOCKET_FACTORY_CLASS_PROPERTY and LISTEN_SOCKET_PROPERTY * * as used by other clients and servers in your distributed system. * @@ -271,22 +269,19 @@ public interface ORBSocketFactory * @param port port to create socket on * @return created socket * @throws IOException If a socket could not be created - * @deprecated + * @deprecated */ @Deprecated - public ServerSocket createServerSocket(String type, int port) - throws - IOException; - - + public ServerSocket createServerSocket(String type, int port) throws IOException; /** - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

    + * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. + *

    * - * This method is used by a client side ORB.

    + * This method is used by a client side ORB. + *

    * - * Each time a client invokes on an object reference, the reference's - * associated ORB will call + * Each time a client invokes on an object reference, the reference's associated ORB will call * *

          *    getEndPointInfo(ORB orb, 
    @@ -294,37 +289,36 @@ public ServerSocket createServerSocket(String type, int port)
          *                    SocketInfo socketInfo)
          * 
    * - * NOTE: The type of the ior argument is an internal - * representation for efficiency. If the ORBSocketFactory - * interface ever becomes standardized then the ior will - * most likely change to a standard type (e.g., a stringified ior, - * an org.omg.IOP.IOR, or ...).

    + * NOTE: The type of the ior argument is an internal representation for efficiency. If the + * ORBSocketFactory interface ever becomes standardized then the ior will most likely change + * to a standard type (e.g., a stringified ior, an org.omg.IOP.IOR, or ...). + *

    * - * Typically, this method will look at tagged components in the - * given ior to determine what type of socket to create.

    + * Typically, this method will look at tagged components in the given ior to determine what type of socket + * to create. + *

    * - * Typically, the ior will contain a tagged component - * specifying an alternate port type and number.

    + * Typically, the ior will contain a tagged component specifying an alternate port type and number. + *

    * - * This method should return an SocketInfo object - * containing the type/host/port to be used for the connection. + * This method should return an SocketInfo object containing the type/host/port to be used for the + * connection. * - * If there are no appropriate tagged components then this method - * should return an SocketInfo object with the type - * IIOP_CLEAR_TEXT and host/port from the ior's IOP - * profile.

    + * If there are no appropriate tagged components then this method should return an SocketInfo object with + * the type IIOP_CLEAR_TEXT and host/port from the ior's IOP profile. + *

    * - * If the ORB already has an existing connection to the returned - * type/host/port, then that connection is used. Otherwise the ORB calls + * If the ORB already has an existing connection to the returned type/host/port, then that connection is used. Otherwise + * the ORB calls * - * createSocket(SocketInfo socketInfo)

    + * createSocket(SocketInfo socketInfo) + *

    * - * The orb argument is useful for handling - * the ior argument.

    + * The orb argument is useful for handling the ior argument. + *

    * - * The SocketInfo given to getEndPointInfo - * is either null or an object obtained - * from GetEndPointInfoAgainException + * The SocketInfo given to getEndPointInfo is either null or an object obtained from + * GetEndPointInfoAgainException * * @param orb ORB to use for getting socket * @param ior IOR to look at tagged components of @@ -333,36 +327,32 @@ public ServerSocket createServerSocket(String type, int port) * @deprecated */ @Deprecated - public SocketInfo getEndPointInfo(org.omg.CORBA.ORB orb, - IOR ior, - SocketInfo socketInfo); - + public SocketInfo getEndPointInfo(org.omg.CORBA.ORB orb, IOR ior, SocketInfo socketInfo); /** - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

    + * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. + *

    * - * This method is used by a client side ORB.

    + * This method is used by a client side ORB. + *

    * - * This method should return a client socket of the given - * type/host/port.

    + * This method should return a client socket of the given type/host/port. + *

    * - * Note: the SocketInfo is the same instance as was - * returned by getSocketInfo so extra cookie info may - * be attached.

    + * Note: the SocketInfo is the same instance as was returned by getSocketInfo so extra cookie + * info may be attached. + *

    + * + * If this method throws GetEndPointInfoAgainException then the ORB calls getEndPointInfo again, passing it + * the SocketInfo object contained in the exception. * - * If this method throws GetEndPointInfoAgainException then the - * ORB calls getEndPointInfo again, passing it the - * SocketInfo object contained in the exception. * @param socketInfo socket information - * @throws IOException if an occurred creating the socket + * @throws IOException if an occurred creating the socket * @throws GetEndPointInfoAgainException if endpoint info must be retrieved again * @return client socket - * @deprecated + * @deprecated */ - public Socket createSocket(SocketInfo socketInfo) - throws - IOException, - GetEndPointInfoAgainException; + public Socket createSocket(SocketInfo socketInfo) throws IOException, GetEndPointInfoAgainException; } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/IORInfoExt.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/IORInfoExt.java index 633270e08..064a82acc 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/IORInfoExt.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/IORInfoExt.java @@ -21,11 +21,8 @@ import com.sun.corba.ee.spi.oa.ObjectAdapter; -public interface IORInfoExt -{ - public int getServerPort(String type) - throws - UnknownType; +public interface IORInfoExt { + public int getServerPort(String type) throws UnknownType; public ObjectAdapter getObjectAdapter(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/ORBInitInfoExt.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/ORBInitInfoExt.java index f7c3ffa9a..01fb76219 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/ORBInitInfoExt.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/ORBInitInfoExt.java @@ -19,17 +19,14 @@ package com.sun.corba.ee.spi.legacy.interceptor; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -/** The interface defines an extension to the standard ORBInitInfo - * that gives access to the ORB being initialized. Interceptors run - * as the last stage of initialization of the ORB, so the ORB - * instance returned by getORB is fully initialized. Note that - * this facility eventually shows up post-CORBA 3.0 as a result - * of the resolution of OMG core issue on accessing the ORB from - * local objects. +/** + * The interface defines an extension to the standard ORBInitInfo that gives access to the ORB being initialized. + * Interceptors run as the last stage of initialization of the ORB, so the ORB instance returned by getORB is fully + * initialized. Note that this facility eventually shows up post-CORBA 3.0 as a result of the resolution of OMG core + * issue on accessing the ORB from local objects. */ -public interface ORBInitInfoExt -{ - ORB getORB() ; +public interface ORBInitInfoExt { + ORB getORB(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/RequestInfoExt.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/RequestInfoExt.java index e7cdd5213..c0079c873 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/RequestInfoExt.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/RequestInfoExt.java @@ -22,17 +22,13 @@ import com.sun.corba.ee.spi.legacy.connection.Connection; /** - * This interface is implemented by our implementation of - * PortableInterceptor.ClientRequestInfo and + * This interface is implemented by our implementation of PortableInterceptor.ClientRequestInfo and * PortableInterceptor.ServerRequestInfo. * */ -public interface RequestInfoExt -{ +public interface RequestInfoExt { /** - * @return The connection on which the request is made. - * The return value will be null when a local transport - * is used. + * @return The connection on which the request is made. The return value will be null when a local transport is used. */ public Connection connection(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/ServerRequestInfoExt.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/ServerRequestInfoExt.java index a8da5f2b8..f4b64cb1b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/ServerRequestInfoExt.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/ServerRequestInfoExt.java @@ -19,14 +19,13 @@ package com.sun.corba.ee.spi.legacy.interceptor; -/** This extension is used to provide information about whether or not - * the object to which the incoming request is dispatched is a name service - * or not. This is added to the implementation of the PortableInterceptor - * ServerRequestInfo interface (see impl.interceptors.ServerRequestInfoImpl) - * to provide this extended functionality). +/** + * This extension is used to provide information about whether or not the object to which the incoming request is + * dispatched is a name service or not. This is added to the implementation of the PortableInterceptor ServerRequestInfo + * interface (see impl.interceptors.ServerRequestInfoImpl) to provide this extended functionality). * * @author ken */ public interface ServerRequestInfoExt { - boolean isNameService() ; + boolean isNameService(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/UnknownType.java b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/UnknownType.java index 69308f965..686f8cb7d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/UnknownType.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/legacy/interceptor/UnknownType.java @@ -19,17 +19,12 @@ package com.sun.corba.ee.spi.legacy.interceptor; -public class UnknownType - extends - Exception -{ - public UnknownType() - { +public class UnknownType extends Exception { + public UnknownType() { super(); } - public UnknownType(String msg) - { + public UnknownType(String msg) { super(msg); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CS.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CS.java index c53b6f9a2..901a79fe3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CS.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CS.java @@ -17,30 +17,31 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logex.corba ; +package com.sun.corba.ee.spi.logex.corba; /** * * @author ken */ -import java.lang.annotation.Documented ; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Documented; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; -/** This annotation is applied to a method to indicate what CompletionStatus to use - * for creating a CORBA exception. It is an error to apply this annotation to a method - * that does not return a subclass of SystemException. +/** + * This annotation is applied to a method to indicate what CompletionStatus to use for creating a CORBA exception. It is + * an error to apply this annotation to a method that does not return a subclass of SystemException. */ @Documented -@Target({ElementType.METHOD}) +@Target({ ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) public @interface CS { - /** The CORBA CompletionStatus to be used for this method. - * Can only be used for a method that returns a subclass of SystemException. + /** + * The CORBA CompletionStatus to be used for this method. Can only be used for a method that returns a subclass of + * SystemException. + * * @return {@link CSValue#NO} by default */ - CSValue value() default CSValue.NO ; + CSValue value() default CSValue.NO; } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CSValue.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CSValue.java index 303e73616..d00a709aa 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CSValue.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CSValue.java @@ -17,36 +17,36 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logex.corba ; +package com.sun.corba.ee.spi.logex.corba; -import org.omg.CORBA.CompletionStatus ; +import org.omg.CORBA.CompletionStatus; -/** Enum corresponding to CompletionStatus that can be used in annotations. +/** + * Enum corresponding to CompletionStatus that can be used in annotations. * * @author ken */ public enum CSValue { YES() { @Override - public CompletionStatus getCompletionStatus() { - return CompletionStatus.COMPLETED_YES ; + public CompletionStatus getCompletionStatus() { + return CompletionStatus.COMPLETED_YES; } }, NO { @Override - public CompletionStatus getCompletionStatus() { - return CompletionStatus.COMPLETED_NO ; + public CompletionStatus getCompletionStatus() { + return CompletionStatus.COMPLETED_NO; } }, MAYBE { @Override - public CompletionStatus getCompletionStatus() { - return CompletionStatus.COMPLETED_MAYBE ; + public CompletionStatus getCompletionStatus() { + return CompletionStatus.COMPLETED_MAYBE; } - } ; + }; - public abstract CompletionStatus getCompletionStatus() ; + public abstract CompletionStatus getCompletionStatus(); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CorbaExtension.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CorbaExtension.java index 94502c34a..a5f169631 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CorbaExtension.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/CorbaExtension.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logex.corba ; +package com.sun.corba.ee.spi.logex.corba; import com.sun.corba.ee.spi.logex.stdcorba.StandardLogger; import com.sun.corba.ee.org.omg.CORBA.SUNVMCID; @@ -72,185 +72,163 @@ import org.omg.CORBA.UNKNOWN; public class CorbaExtension extends StandardLogger { - public static final CorbaExtension self = new CorbaExtension() ; - - private CorbaExtension() {} - - public static final int ORBUtilGroup = 0 ; - public static final int ActivationGroup = 1 ; - public static final int NamingGroup = 2 ; - public static final int InterceptorsGroup = 3 ; - public static final int POAGroup = 4 ; - public static final int IORGroup = 5 ; - public static final int UtilGroup = 6 ; - - private static final Class[] SYS_EX_CLASSES = { - UNKNOWN.class, BAD_PARAM.class, NO_MEMORY.class, - IMP_LIMIT.class, COMM_FAILURE.class, INV_OBJREF.class, - NO_PERMISSION.class, INTERNAL.class, MARSHAL.class, - INITIALIZE.class, NO_IMPLEMENT.class, BAD_TYPECODE.class, - BAD_OPERATION.class, NO_RESOURCES.class, NO_RESPONSE.class, - PERSIST_STORE.class, BAD_INV_ORDER.class, TRANSIENT.class, - FREE_MEM.class, INV_IDENT.class, INV_FLAG.class, - INTF_REPOS.class, BAD_CONTEXT.class, OBJ_ADAPTER.class, - DATA_CONVERSION.class, OBJECT_NOT_EXIST.class, TRANSACTION_REQUIRED.class, - TRANSACTION_ROLLEDBACK.class, INVALID_TRANSACTION.class, INV_POLICY.class, - CODESET_INCOMPATIBLE.class, REBIND.class, TIMEOUT.class, - TRANSACTION_UNAVAILABLE.class, BAD_QOS.class, INVALID_ACTIVITY.class, - ACTIVITY_COMPLETED.class, ACTIVITY_REQUIRED.class } ; + public static final CorbaExtension self = new CorbaExtension(); + + private CorbaExtension() { + } + + public static final int ORBUtilGroup = 0; + public static final int ActivationGroup = 1; + public static final int NamingGroup = 2; + public static final int InterceptorsGroup = 3; + public static final int POAGroup = 4; + public static final int IORGroup = 5; + public static final int UtilGroup = 6; + + private static final Class[] SYS_EX_CLASSES = { UNKNOWN.class, BAD_PARAM.class, NO_MEMORY.class, IMP_LIMIT.class, COMM_FAILURE.class, + INV_OBJREF.class, NO_PERMISSION.class, INTERNAL.class, MARSHAL.class, INITIALIZE.class, NO_IMPLEMENT.class, BAD_TYPECODE.class, + BAD_OPERATION.class, NO_RESOURCES.class, NO_RESPONSE.class, PERSIST_STORE.class, BAD_INV_ORDER.class, TRANSIENT.class, + FREE_MEM.class, INV_IDENT.class, INV_FLAG.class, INTF_REPOS.class, BAD_CONTEXT.class, OBJ_ADAPTER.class, DATA_CONVERSION.class, + OBJECT_NOT_EXIST.class, TRANSACTION_REQUIRED.class, TRANSACTION_ROLLEDBACK.class, INVALID_TRANSACTION.class, INV_POLICY.class, + CODESET_INCOMPATIBLE.class, REBIND.class, TIMEOUT.class, TRANSACTION_UNAVAILABLE.class, BAD_QOS.class, INVALID_ACTIVITY.class, + ACTIVITY_COMPLETED.class, ACTIVITY_REQUIRED.class }; @SuppressWarnings("unchecked") - private static final List> SYS_EX_CONSTRUCTORS = - new ArrayList>( - SYS_EX_CLASSES.length) ; + private static final List> SYS_EX_CONSTRUCTORS = new ArrayList>( + SYS_EX_CLASSES.length); static { - Class[] ptypes = { String.class, int.class, - CompletionStatus.class } ; + Class[] ptypes = { String.class, int.class, CompletionStatus.class }; for (Class cls : SYS_EX_CLASSES) { - try { - @SuppressWarnings("unchecked") - final Constructor cons = - (Constructor)cls.getDeclaredConstructor( - ptypes); - SYS_EX_CONSTRUCTORS.add(cons) ; - } catch (Exception ex) { - throw new RuntimeException( - "Cound not find constructor for " + cls, ex ) ; - } - + try { + @SuppressWarnings("unchecked") + final Constructor cons = (Constructor) cls.getDeclaredConstructor(ptypes); + SYS_EX_CONSTRUCTORS.add(cons); + } catch (Exception ex) { + throw new RuntimeException("Cound not find constructor for " + cls, ex); + } } } - private int findClass( Class cls ) { - for (int ctr=0; ctr cls) { + for (int ctr = 0; ctr < SYS_EX_CLASSES.length; ctr++) { + if (cls.equals(SYS_EX_CLASSES[ctr])) { + return ctr; } } - throw new RuntimeException( - cls + " is not a subclass of SystemException" ) ; + throw new RuntimeException(cls + " is not a subclass of SystemException"); } - private ORBException getORBException( Method method) { - final Class cls = method.getDeclaringClass() ; - final ORBException orbex = cls.getAnnotation( ORBException.class ) ; - return orbex ; + private ORBException getORBException(Method method) { + final Class cls = method.getDeclaringClass(); + final ORBException orbex = cls.getAnnotation(ORBException.class); + return orbex; } - private Log getLog( Method method ) { - Log log = method.getAnnotation( Log.class ); + private Log getLog(Method method) { + Log log = method.getAnnotation(Log.class); if (log == null) { - throw new RuntimeException( - "No Log annotation present on " + method ) ; + throw new RuntimeException("No Log annotation present on " + method); } else { - return log ; + return log; } } - private int getExceptionId( Method method ) { - final Class rtype = method.getReturnType() ; - final int exceptionId = findClass( rtype ) ; - return exceptionId ; + private int getExceptionId(Method method) { + final Class rtype = method.getReturnType(); + final int exceptionId = findClass(rtype); + return exceptionId; } - private int getMinorCode( ORBException orbex, Log log ) { - return 200*orbex.group() + log.id() ; + private int getMinorCode(ORBException orbex, Log log) { + return 200 * orbex.group() + log.id(); } - public int getMinorCode( Method method ) { - final ORBException orbex = getORBException( method ) ; - final Log log = getLog( method ) ; - final int minorCode = getMinorCode( orbex, log ) ; - final int base = orbex.omgException() ? - SUNVMCID.value : - OMGVMCID.value ; - return base + minorCode ; + public int getMinorCode(Method method) { + final ORBException orbex = getORBException(method); + final Log log = getLog(method); + final int minorCode = getMinorCode(orbex, log); + final int base = orbex.omgException() ? SUNVMCID.value : OMGVMCID.value; + return base + minorCode; } - public int getMinorCode( Class cls, String methodName ) { - Method method = null ; + public int getMinorCode(Class cls, String methodName) { + Method method = null; for (Method m : cls.getDeclaredMethods()) { - if (methodName.equals( m.getName())) { - method = m ; - break ; + if (methodName.equals(m.getName())) { + method = m; + break; } } if (method == null) { - return -1 ; + return -1; } else { - return getMinorCode( method ) ; + return getMinorCode(method); } } - // Format of result: ExceptionId OmgID MinorCode, where + // Format of result: ExceptionId OmgID MinorCode, where // ExceptionId is the ordinal position of the return type in SYS_EX_Classes, - // padded to 3 places + // padded to 3 places // OmgId is 0 for OMG exceptions, 1 for Old Sun exceptions // MinorCode is 200*groupId + id @Override - public String getLogId( Method method ) { - final ORBException orbex = getORBException( method ) ; - final Log log = getLog( method ) ; - final int minorCode = getMinorCode( orbex, log ) ; - final int exceptionId = getExceptionId( method ) ; + public String getLogId(Method method) { + final ORBException orbex = getORBException(method); + final Log log = getLog(method); + final int minorCode = getMinorCode(orbex, log); + final int exceptionId = getExceptionId(method); - final int omgId = orbex.omgException() ? 0 : 1 ; + final int omgId = orbex.omgException() ? 0 : 1; - final String result = String.format( "%03d%1d%04d", - exceptionId, omgId, minorCode ) ; + final String result = String.format("%03d%1d%04d", exceptionId, omgId, minorCode); - return result ; + return result; } @Override - public Exception makeException( String msg, Method method ) { + public Exception makeException(String msg, Method method) { try { - final ORBException orbex = getORBException( method ) ; - final Log log = getLog( method ) ; - final int minorCode = getMinorCode( orbex, log ) ; - final int exceptionId = getExceptionId(method) ; + final ORBException orbex = getORBException(method); + final Log log = getLog(method); + final int minorCode = getMinorCode(orbex, log); + final int exceptionId = getExceptionId(method); - final Constructor cons = SYS_EX_CONSTRUCTORS.get(exceptionId) ; + final Constructor cons = SYS_EX_CONSTRUCTORS.get(exceptionId); - final CS cs = method.getAnnotation( CS.class ) ; - final CSValue csv = cs == null ? CSValue.NO : cs.value() ; + final CS cs = method.getAnnotation(CS.class); + final CSValue csv = cs == null ? CSValue.NO : cs.value(); - final int base = orbex.omgException() ? - SUNVMCID.value : - OMGVMCID.value ; + final int base = orbex.omgException() ? SUNVMCID.value : OMGVMCID.value; - SystemException result = cons.newInstance(msg, base + minorCode, - csv.getCompletionStatus()) ; + SystemException result = cons.newInstance(msg, base + minorCode, csv.getCompletionStatus()); - return result ; + return result; } catch (Exception exc) { - throw new RuntimeException( exc ) ; + throw new RuntimeException(exc); } } - private static final String CLASS_NAME_SUFFIX = "SystemException" ; + private static final String CLASS_NAME_SUFFIX = "SystemException"; @Override - public String getLoggerName( Class cls ) { - final ExceptionWrapper ew = cls.getAnnotation( - ExceptionWrapper.class ) ; + public String getLoggerName(Class cls) { + final ExceptionWrapper ew = cls.getAnnotation(ExceptionWrapper.class); - String str = ew.loggerName() ; + String str = ew.loggerName(); if (str.length() == 0) { - str = cls.getSimpleName() ; + str = cls.getSimpleName(); if (str.endsWith(CLASS_NAME_SUFFIX)) { - str = str.substring( 0, - str.length() - CLASS_NAME_SUFFIX.length()) ; + str = str.substring(0, str.length() - CLASS_NAME_SUFFIX.length()); } - return StandardLogger.CORBA_LOGGER_PREFIX + "." + str ; + return StandardLogger.CORBA_LOGGER_PREFIX + "." + str; } - return str ; + return str; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/ORBException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/ORBException.java index bc62256c4..8b0f1a7e3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/ORBException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logex/corba/ORBException.java @@ -17,34 +17,37 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logex.corba ; +package com.sun.corba.ee.spi.logex.corba; /** * * @author ken */ -import java.lang.annotation.Documented ; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Documented; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; -/** This annotation is applied to an interface or abstract class that is used - * to define logging and/or constructing CORBA exceptions. +/** + * This annotation is applied to an interface or abstract class that is used to define logging and/or constructing CORBA + * exceptions. */ @Documented -@Target({ElementType.TYPE}) +@Target({ ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface ORBException { - /** Return true if this is an OMG exception with the OMG VMCID, - * false if it is using the old SUN VMCID. + /** + * Return true if this is an OMG exception with the OMG VMCID, false if it is using the old SUN VMCID. + * * @return {@code false} by default */ - boolean omgException() default false ; + boolean omgException() default false; - /** Return the group ID to be used in computing the message ID. + /** + * Return the group ID to be used in computing the message ID. + * * @return The group ID */ - int group() ; + int group(); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/ActivationSystemException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/ActivationSystemException.java index 81ae50b55..6e8e8a503 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/ActivationSystemException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/ActivationSystemException.java @@ -17,10 +17,10 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logging ; +package com.sun.corba.ee.spi.logging; -import com.sun.corba.ee.spi.logex.corba.ORBException ; -import com.sun.corba.ee.spi.logex.corba.CorbaExtension ; +import com.sun.corba.ee.spi.logex.corba.ORBException; +import com.sun.corba.ee.spi.logex.corba.CorbaExtension; import org.glassfish.pfl.basic.logex.Chain; import org.glassfish.pfl.basic.logex.ExceptionWrapper; @@ -33,37 +33,36 @@ import org.omg.CORBA.INTERNAL; import org.omg.CORBA.OBJECT_NOT_EXIST; -@ExceptionWrapper( idPrefix="IOP" ) -@ORBException( omgException=false, group=CorbaExtension.ActivationGroup ) +@ExceptionWrapper(idPrefix = "IOP") +@ORBException(omgException = false, group = CorbaExtension.ActivationGroup) public interface ActivationSystemException { - ActivationSystemException self = WrapperGenerator.makeWrapper( - ActivationSystemException.class, CorbaExtension.self ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Cannot read repository datastore" ) - INITIALIZE cannotReadRepositoryDb( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Cannot add initial naming" ) - INITIALIZE cannotAddInitialNaming( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Cannot write repository datastore" ) - INTERNAL cannotWriteRepositoryDb( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Server not expected to register" ) - INTERNAL serverNotExpectedToRegister( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Unable to start server process" ) - INTERNAL unableToStartProcess( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Server is not running" ) - INTERNAL serverNotRunning( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Error in BadServerIdHandler" ) - OBJECT_NOT_EXIST errorInBadServerIdHandler( @Chain Exception exc ) ; + ActivationSystemException self = WrapperGenerator.makeWrapper(ActivationSystemException.class, CorbaExtension.self); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Cannot read repository datastore") + INITIALIZE cannotReadRepositoryDb(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Cannot add initial naming") + INITIALIZE cannotAddInitialNaming(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Cannot write repository datastore") + INTERNAL cannotWriteRepositoryDb(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Server not expected to register") + INTERNAL serverNotExpectedToRegister(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Unable to start server process") + INTERNAL unableToStartProcess(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Server is not running") + INTERNAL serverNotRunning(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Error in BadServerIdHandler") + OBJECT_NOT_EXIST errorInBadServerIdHandler(@Chain Exception exc); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/IORSystemException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/IORSystemException.java index 2f0090705..8b3b8094b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/IORSystemException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/IORSystemException.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logging ; +package com.sun.corba.ee.spi.logging; import com.sun.corba.ee.spi.ior.ObjectAdapterId; import org.glassfish.pfl.basic.logex.Chain; @@ -27,8 +27,8 @@ import org.glassfish.pfl.basic.logex.Message; import org.glassfish.pfl.basic.logex.WrapperGenerator; -import com.sun.corba.ee.spi.logex.corba.ORBException ; -import com.sun.corba.ee.spi.logex.corba.CorbaExtension ; +import com.sun.corba.ee.spi.logex.corba.ORBException; +import com.sun.corba.ee.spi.logex.corba.CorbaExtension; import java.io.IOException; import org.omg.CORBA.BAD_OPERATION; @@ -38,82 +38,76 @@ import org.omg.CORBA.MARSHAL; import org.omg.CORBA.UNKNOWN; -@ExceptionWrapper( idPrefix="IOP" ) -@ORBException( omgException=false, group=CorbaExtension.IORGroup ) +@ExceptionWrapper(idPrefix = "IOP") +@ORBException(omgException = false, group = CorbaExtension.IORGroup) public interface IORSystemException { - IORSystemException self = WrapperGenerator.makeWrapper( - IORSystemException.class, CorbaExtension.self ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "ObjectReferenceTemplate is not initialized" ) - INTERNAL ortNotInitialized( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Null POA" ) - INTERNAL nullPoa( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Bad magic number {0} in ObjectKeyTemplate" ) - INTERNAL badMagic( int magic ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Error while stringifying an object reference" ) - INTERNAL stringifyWriteError( @Chain IOException exc ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Could not find a TaggedProfileTemplateFactory for id {0}" ) - INTERNAL taggedProfileTemplateFactoryNotFound( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Found a JDK 1.3.1 patch level indicator with value {0} " - + "less than JDK 1.3.1_01 value of 1" ) - INTERNAL invalidJdk131PatchLevel( int arg0 ) ; - - @Log( level=LogLevel.FINE, id=7 ) - @Message( "Exception occurred while looking for ObjectAdapter {0} " - + "in IIOPProfileImpl.getServant" ) - INTERNAL getLocalServantFailure( @Chain Exception exc, - ObjectAdapterId oaid ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Exception occurred while closing an IO stream object" ) - INTERNAL ioexceptionDuringStreamClose( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Adapter ID not available" ) - BAD_OPERATION adapterIdNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Server ID not available" ) - BAD_OPERATION serverIdNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "ORB ID not available" ) - BAD_OPERATION orbIdNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Object adapter ID not available" ) - BAD_OPERATION objectAdapterIdNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Profiles in IOR do not all have the same Object ID, " + - "so conversion to IORTemplateList is impossible" ) - BAD_PARAM badOidInIorTemplateList( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Error in reading IIOP TaggedProfile" ) - BAD_PARAM invalidTaggedProfile( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Attempt to create IIOPAddress with port {0}, which is out of range" ) - BAD_PARAM badIiopAddressPort( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "IOR must have at least one IIOP profile" ) - INV_OBJREF iorMustHaveIiopProfile( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "MARSHAL error while attempting to create an ObjectKeyTemplate " - + "from an input stream") + IORSystemException self = WrapperGenerator.makeWrapper(IORSystemException.class, CorbaExtension.self); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("ObjectReferenceTemplate is not initialized") + INTERNAL ortNotInitialized(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Null POA") + INTERNAL nullPoa(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Bad magic number {0} in ObjectKeyTemplate") + INTERNAL badMagic(int magic); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Error while stringifying an object reference") + INTERNAL stringifyWriteError(@Chain IOException exc); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Could not find a TaggedProfileTemplateFactory for id {0}") + INTERNAL taggedProfileTemplateFactoryNotFound(int arg0); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Found a JDK 1.3.1 patch level indicator with value {0} " + "less than JDK 1.3.1_01 value of 1") + INTERNAL invalidJdk131PatchLevel(int arg0); + + @Log(level = LogLevel.FINE, id = 7) + @Message("Exception occurred while looking for ObjectAdapter {0} " + "in IIOPProfileImpl.getServant") + INTERNAL getLocalServantFailure(@Chain Exception exc, ObjectAdapterId oaid); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Exception occurred while closing an IO stream object") + INTERNAL ioexceptionDuringStreamClose(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Adapter ID not available") + BAD_OPERATION adapterIdNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Server ID not available") + BAD_OPERATION serverIdNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("ORB ID not available") + BAD_OPERATION orbIdNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Object adapter ID not available") + BAD_OPERATION objectAdapterIdNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Profiles in IOR do not all have the same Object ID, " + "so conversion to IORTemplateList is impossible") + BAD_PARAM badOidInIorTemplateList(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Error in reading IIOP TaggedProfile") + BAD_PARAM invalidTaggedProfile(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Attempt to create IIOPAddress with port {0}, which is out of range") + BAD_PARAM badIiopAddressPort(int arg0); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("IOR must have at least one IIOP profile") + INV_OBJREF iorMustHaveIiopProfile(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("MARSHAL error while attempting to create an ObjectKeyTemplate " + "from an input stream") UNKNOWN createMarshalError(@Chain MARSHAL mexc); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/InterceptorsSystemException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/InterceptorsSystemException.java index 7d6c46b08..1b813a6ff 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/InterceptorsSystemException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/InterceptorsSystemException.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logging ; +package com.sun.corba.ee.spi.logging; import com.sun.corba.ee.spi.oa.ObjectAdapter; import org.glassfish.pfl.basic.logex.Chain; @@ -29,8 +29,8 @@ import com.sun.corba.ee.spi.logex.corba.CS; import com.sun.corba.ee.spi.logex.corba.CSValue; -import com.sun.corba.ee.spi.logex.corba.ORBException ; -import com.sun.corba.ee.spi.logex.corba.CorbaExtension ; +import com.sun.corba.ee.spi.logex.corba.ORBException; +import com.sun.corba.ee.spi.logex.corba.CorbaExtension; import java.util.List; import org.omg.CORBA.BAD_INV_ORDER; @@ -42,161 +42,150 @@ import org.omg.CORBA.UNKNOWN; import org.omg.PortableInterceptor.ObjectReferenceTemplate; -@ExceptionWrapper( idPrefix="IOP" ) -@ORBException( omgException=false, group=CorbaExtension.InterceptorsGroup ) +@ExceptionWrapper(idPrefix = "IOP") +@ORBException(omgException = false, group = CorbaExtension.InterceptorsGroup) public interface InterceptorsSystemException { - InterceptorsSystemException self = WrapperGenerator.makeWrapper( - InterceptorsSystemException.class, CorbaExtension.self ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Interceptor type {0} is out of range" ) - BAD_PARAM typeOutOfRange( int type ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Interceptor's name is null: use empty string for " - + "anonymous interceptors" ) - BAD_PARAM nameNull( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "resolve_initial_reference is invalid during pre_init" ) - BAD_INV_ORDER rirInvalidPreInit( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Expected state {0}, but current state is {1}" ) - BAD_INV_ORDER badState1( int arg0, int arg1 ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Expected state {0} or {1}, but current state is {2}" ) - BAD_INV_ORDER badState2( int arg0, int arg1, int arg2 ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "IOException during cancel request" ) - @CS( CSValue.MAYBE ) - COMM_FAILURE ioexceptionDuringCancelRequest( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Exception was null" ) - INTERNAL exceptionWasNull( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Object has no delegate" ) - INTERNAL objectHasNoDelegate( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Delegate was not a ClientRequestDispatcher" ) - INTERNAL delegateNotClientsub( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Object is not an ObjectImpl" ) - INTERNAL objectNotObjectimpl( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Assertion failed: Interceptor set exception to UserException or " - + "ApplicationException" ) - INTERNAL exceptionInvalid( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Assertion failed: Reply status is initialized but not " - + "SYSTEM_EXCEPTION or LOCATION_FORWARD" ) - INTERNAL replyStatusNotInit( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Exception in arguments" ) - INTERNAL exceptionInArguments( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Exception in exceptions" ) - INTERNAL exceptionInExceptions( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "Exception in contexts" ) - INTERNAL exceptionInContexts( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "Another exception was null" ) - INTERNAL exceptionWasNull2( ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "Servant invalid" ) - INTERNAL servantInvalid( ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "Can't pop only PICurrent" ) - INTERNAL cantPopOnlyPicurrent( ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Can't pop another PICurrent" ) - INTERNAL cantPopOnlyCurrent2( ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "DSI result is null" ) - INTERNAL piDsiResultIsNull( ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "DII result is null" ) - INTERNAL piDiiResultIsNull( ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "Exception is unavailable" ) - INTERNAL exceptionUnavailable( ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "Assertion failed: client request info stack is null" ) - INTERNAL clientInfoStackNull( ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "Assertion failed: Server request info stack is null" ) - INTERNAL serverInfoStackNull( ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "Mark and reset failed" ) - INTERNAL markAndResetFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "currentIndex > tableContainer.size(): {0} > {1}" ) - INTERNAL slotTableInvariant( int arg0, int arg1 ) ; - - @Log( level=LogLevel.WARNING, id=21 ) - @Message( "InterceptorList is locked" ) - INTERNAL interceptorListLocked( ) ; - - @Log( level=LogLevel.WARNING, id=22 ) - @Message( "Invariant: sorted size + unsorted size == total size was violated" ) - INTERNAL sortSizeMismatch( ) ; - - @Log( level=LogLevel.FINE, id=23 ) - @Message( "Ignored exception in establish_components method for " - + "ObjectAdapter {0} (as per specification)" ) - INTERNAL ignoredExceptionInEstablishComponents( @Chain Exception exc, - ObjectAdapter oa ) ; - - @Log( level=LogLevel.FINE, id=24 ) - @Message( "Exception in components_established method for ObjectAdapter {0}" ) - INTERNAL exceptionInComponentsEstablished( @Chain Exception exc, - ObjectAdapter oa ) ; - - @Log( level=LogLevel.FINE, id=25 ) - @Message( "Ignored exception in adapter_manager_state_changed method for " - + "managerId {0} and newState {1} (as per specification)" ) - INTERNAL ignoredExceptionInAdapterManagerStateChanged( @Chain Exception exc, - int managerId, short newState ) ; - - @Log( level=LogLevel.FINE, id=26 ) - @Message( "Ignored exception in adapter_state_changed method for " + - "templates {0} and newState {1} (as per specification)" ) - INTERNAL ignoredExceptionInAdapterStateChanged( @Chain Exception exc, - List templates, short newState ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Policies not implemented" ) - NO_IMPLEMENT piOrbNotPolicyBased( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "ORBInitInfo object is only valid during ORB_init" ) - OBJECT_NOT_EXIST orbinitinfoInvalid( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "Unknown request invocation error" ) - @CS( CSValue.MAYBE ) - UNKNOWN unknownRequestInvoke( ) ; + InterceptorsSystemException self = WrapperGenerator.makeWrapper(InterceptorsSystemException.class, CorbaExtension.self); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Interceptor type {0} is out of range") + BAD_PARAM typeOutOfRange(int type); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Interceptor's name is null: use empty string for " + "anonymous interceptors") + BAD_PARAM nameNull(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("resolve_initial_reference is invalid during pre_init") + BAD_INV_ORDER rirInvalidPreInit(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Expected state {0}, but current state is {1}") + BAD_INV_ORDER badState1(int arg0, int arg1); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Expected state {0} or {1}, but current state is {2}") + BAD_INV_ORDER badState2(int arg0, int arg1, int arg2); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("IOException during cancel request") + @CS(CSValue.MAYBE) + COMM_FAILURE ioexceptionDuringCancelRequest(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Exception was null") + INTERNAL exceptionWasNull(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Object has no delegate") + INTERNAL objectHasNoDelegate(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Delegate was not a ClientRequestDispatcher") + INTERNAL delegateNotClientsub(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Object is not an ObjectImpl") + INTERNAL objectNotObjectimpl(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Assertion failed: Interceptor set exception to UserException or " + "ApplicationException") + INTERNAL exceptionInvalid(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Assertion failed: Reply status is initialized but not " + "SYSTEM_EXCEPTION or LOCATION_FORWARD") + INTERNAL replyStatusNotInit(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Exception in arguments") + INTERNAL exceptionInArguments(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Exception in exceptions") + INTERNAL exceptionInExceptions(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("Exception in contexts") + INTERNAL exceptionInContexts(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("Another exception was null") + INTERNAL exceptionWasNull2(); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("Servant invalid") + INTERNAL servantInvalid(); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("Can't pop only PICurrent") + INTERNAL cantPopOnlyPicurrent(); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Can't pop another PICurrent") + INTERNAL cantPopOnlyCurrent2(); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("DSI result is null") + INTERNAL piDsiResultIsNull(); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("DII result is null") + INTERNAL piDiiResultIsNull(); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("Exception is unavailable") + INTERNAL exceptionUnavailable(); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("Assertion failed: client request info stack is null") + INTERNAL clientInfoStackNull(); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("Assertion failed: Server request info stack is null") + INTERNAL serverInfoStackNull(); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("Mark and reset failed") + INTERNAL markAndResetFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("currentIndex > tableContainer.size(): {0} > {1}") + INTERNAL slotTableInvariant(int arg0, int arg1); + + @Log(level = LogLevel.WARNING, id = 21) + @Message("InterceptorList is locked") + INTERNAL interceptorListLocked(); + + @Log(level = LogLevel.WARNING, id = 22) + @Message("Invariant: sorted size + unsorted size == total size was violated") + INTERNAL sortSizeMismatch(); + + @Log(level = LogLevel.FINE, id = 23) + @Message("Ignored exception in establish_components method for " + "ObjectAdapter {0} (as per specification)") + INTERNAL ignoredExceptionInEstablishComponents(@Chain Exception exc, ObjectAdapter oa); + + @Log(level = LogLevel.FINE, id = 24) + @Message("Exception in components_established method for ObjectAdapter {0}") + INTERNAL exceptionInComponentsEstablished(@Chain Exception exc, ObjectAdapter oa); + + @Log(level = LogLevel.FINE, id = 25) + @Message("Ignored exception in adapter_manager_state_changed method for " + "managerId {0} and newState {1} (as per specification)") + INTERNAL ignoredExceptionInAdapterManagerStateChanged(@Chain Exception exc, int managerId, short newState); + + @Log(level = LogLevel.FINE, id = 26) + @Message("Ignored exception in adapter_state_changed method for " + "templates {0} and newState {1} (as per specification)") + INTERNAL ignoredExceptionInAdapterStateChanged(@Chain Exception exc, List templates, short newState); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Policies not implemented") + NO_IMPLEMENT piOrbNotPolicyBased(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("ORBInitInfo object is only valid during ORB_init") + OBJECT_NOT_EXIST orbinitinfoInvalid(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("Unknown request invocation error") + @CS(CSValue.MAYBE) + UNKNOWN unknownRequestInvoke(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/NamingSystemException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/NamingSystemException.java index 6a4b41a03..aaec7592b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/NamingSystemException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/NamingSystemException.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logging ; +package com.sun.corba.ee.spi.logging; import org.glassfish.pfl.basic.logex.Chain; import org.glassfish.pfl.basic.logex.ExceptionWrapper; @@ -28,8 +28,8 @@ import com.sun.corba.ee.spi.logex.corba.CS; import com.sun.corba.ee.spi.logex.corba.CSValue; -import com.sun.corba.ee.spi.logex.corba.ORBException ; -import com.sun.corba.ee.spi.logex.corba.CorbaExtension ; +import com.sun.corba.ee.spi.logex.corba.ORBException; +import com.sun.corba.ee.spi.logex.corba.CorbaExtension; import org.omg.CORBA.BAD_PARAM; import org.omg.CORBA.INITIALIZE; @@ -37,120 +37,113 @@ import org.omg.CORBA.SystemException; import org.omg.CORBA.UNKNOWN; -@ExceptionWrapper( idPrefix="IOP" ) -@ORBException( omgException=false, group=CorbaExtension.NamingGroup ) +@ExceptionWrapper(idPrefix = "IOP") +@ORBException(omgException = false, group = CorbaExtension.NamingGroup) public interface NamingSystemException { - NamingSystemException self = WrapperGenerator.makeWrapper( - NamingSystemException.class, CorbaExtension.self ) ; - - @Log( level=LogLevel.WARNING, id=0 ) - @Message( "Port 0 is not a valid port in the transient name server" ) - BAD_PARAM transientNameServerBadPort( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "A null hostname is not a valid hostname in the " - + "transient name server" ) - BAD_PARAM transientNameServerBadHost( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Object is null" ) - BAD_PARAM objectIsNull() ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Bad host address in -ORBInitDef" ) - BAD_PARAM insBadAddress( ) ; - - @Log( level=LogLevel.WARNING, id=0 ) - @Message( "Updated context failed for bind" ) - UNKNOWN bindUpdateContextFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "bind failure" ) - UNKNOWN bindFailure( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Resolve conversion failed" ) - @CS( CSValue.MAYBE ) - UNKNOWN resolveConversionFailure( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Resolve failure" ) - @CS( CSValue.MAYBE ) - UNKNOWN resolveFailure( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Unbind failure" ) - @CS( CSValue.MAYBE ) - UNKNOWN unbindFailure( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=50 ) - @Message( "SystemException in transient name service while initializing" ) - INITIALIZE transNsCannotCreateInitialNcSys( @Chain SystemException exc ) ; - - @Log( level=LogLevel.WARNING, id=51 ) - @Message( "Java exception in transient name service while initializing" ) - INITIALIZE transNsCannotCreateInitialNc( @Chain Exception exc ) ; - - String namingCtxRebindAlreadyBound = - "Unexpected AlreadyBound exception in rebind" ; - - @Log( level=LogLevel.WARNING, id=0 ) - @Message( namingCtxRebindAlreadyBound ) - INTERNAL namingCtxRebindAlreadyBound( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=0 ) - @Message( namingCtxRebindAlreadyBound ) - INTERNAL namingCtxRebindAlreadyBound() ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Unexpected AlreadyBound exception in rebind_context" ) - INTERNAL namingCtxRebindctxAlreadyBound( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Bad binding type in internal binding implementation" ) - INTERNAL namingCtxBadBindingtype( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Object reference that is not CosNaming::NamingContext " - + "bound as a context" ) - INTERNAL namingCtxResolveCannotNarrowToCtx( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Error in creating POA for BindingIterator" ) - INTERNAL namingCtxBindingIteratorCreate( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=100 ) - @Message( "Bind implementation encountered a previous bind" ) - INTERNAL transNcBindAlreadyBound( ) ; - - @Log( level=LogLevel.WARNING, id=101 ) - @Message( "list operation caught an unexpected Java exception while " - + "creating list iterator" ) - INTERNAL transNcListGotExc( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=102 ) - @Message( "new_context operation caught an unexpected Java exception " - + "creating the NewContext servant" ) - INTERNAL transNcNewctxGotExc( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=103 ) - @Message( "Destroy operation caught a Java exception while " - + "disconnecting from ORB" ) - INTERNAL transNcDestroyGotExc( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=105 ) - @Message( "Stringified object reference with unknown protocol specified" ) - INTERNAL insBadSchemeName( ) ; - - @Log( level=LogLevel.WARNING, id=107 ) - @Message( "Malformed URL in -ORBInitDef" ) - INTERNAL insBadSchemeSpecificPart( ) ; - - @Log( level=LogLevel.WARNING, id=108 ) - @Message( "Malformed URL in -ORBInitDef" ) - INTERNAL insOther( ) ; - - @Log( level=LogLevel.WARNING, id=109 ) - @Message( "Initial port value {0} is not a valid number" ) + NamingSystemException self = WrapperGenerator.makeWrapper(NamingSystemException.class, CorbaExtension.self); + + @Log(level = LogLevel.WARNING, id = 0) + @Message("Port 0 is not a valid port in the transient name server") + BAD_PARAM transientNameServerBadPort(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("A null hostname is not a valid hostname in the " + "transient name server") + BAD_PARAM transientNameServerBadHost(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Object is null") + BAD_PARAM objectIsNull(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Bad host address in -ORBInitDef") + BAD_PARAM insBadAddress(); + + @Log(level = LogLevel.WARNING, id = 0) + @Message("Updated context failed for bind") + UNKNOWN bindUpdateContextFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("bind failure") + UNKNOWN bindFailure(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Resolve conversion failed") + @CS(CSValue.MAYBE) + UNKNOWN resolveConversionFailure(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Resolve failure") + @CS(CSValue.MAYBE) + UNKNOWN resolveFailure(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Unbind failure") + @CS(CSValue.MAYBE) + UNKNOWN unbindFailure(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 50) + @Message("SystemException in transient name service while initializing") + INITIALIZE transNsCannotCreateInitialNcSys(@Chain SystemException exc); + + @Log(level = LogLevel.WARNING, id = 51) + @Message("Java exception in transient name service while initializing") + INITIALIZE transNsCannotCreateInitialNc(@Chain Exception exc); + + String namingCtxRebindAlreadyBound = "Unexpected AlreadyBound exception in rebind"; + + @Log(level = LogLevel.WARNING, id = 0) + @Message(namingCtxRebindAlreadyBound) + INTERNAL namingCtxRebindAlreadyBound(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 0) + @Message(namingCtxRebindAlreadyBound) + INTERNAL namingCtxRebindAlreadyBound(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Unexpected AlreadyBound exception in rebind_context") + INTERNAL namingCtxRebindctxAlreadyBound(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Bad binding type in internal binding implementation") + INTERNAL namingCtxBadBindingtype(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Object reference that is not CosNaming::NamingContext " + "bound as a context") + INTERNAL namingCtxResolveCannotNarrowToCtx(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Error in creating POA for BindingIterator") + INTERNAL namingCtxBindingIteratorCreate(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 100) + @Message("Bind implementation encountered a previous bind") + INTERNAL transNcBindAlreadyBound(); + + @Log(level = LogLevel.WARNING, id = 101) + @Message("list operation caught an unexpected Java exception while " + "creating list iterator") + INTERNAL transNcListGotExc(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 102) + @Message("new_context operation caught an unexpected Java exception " + "creating the NewContext servant") + INTERNAL transNcNewctxGotExc(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 103) + @Message("Destroy operation caught a Java exception while " + "disconnecting from ORB") + INTERNAL transNcDestroyGotExc(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 105) + @Message("Stringified object reference with unknown protocol specified") + INTERNAL insBadSchemeName(); + + @Log(level = LogLevel.WARNING, id = 107) + @Message("Malformed URL in -ORBInitDef") + INTERNAL insBadSchemeSpecificPart(); + + @Log(level = LogLevel.WARNING, id = 108) + @Message("Malformed URL in -ORBInitDef") + INTERNAL insOther(); + + @Log(level = LogLevel.WARNING, id = 109) + @Message("Initial port value {0} is not a valid number") INTERNAL badInitialPortValue(String ips, @Chain NumberFormatException e); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/OMGSystemException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/OMGSystemException.java index 1c82d0f75..111c382f2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/OMGSystemException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/OMGSystemException.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logging ; +package com.sun.corba.ee.spi.logging; import com.sun.corba.ee.spi.ior.ObjectAdapterId; import org.glassfish.pfl.basic.logex.Chain; @@ -29,8 +29,8 @@ import com.sun.corba.ee.spi.logex.corba.CS; import com.sun.corba.ee.spi.logex.corba.CSValue; -import com.sun.corba.ee.spi.logex.corba.ORBException ; -import com.sun.corba.ee.spi.logex.corba.CorbaExtension ; +import com.sun.corba.ee.spi.logex.corba.ORBException; +import com.sun.corba.ee.spi.logex.corba.CorbaExtension; import org.omg.CORBA.BAD_CONTEXT; import org.omg.CORBA.BAD_INV_ORDER; @@ -53,624 +53,587 @@ import org.omg.CORBA.TRANSIENT; import org.omg.CORBA.UNKNOWN; -@ExceptionWrapper( idPrefix="IOP" ) -@ORBException( omgException=true, group=0 ) +@ExceptionWrapper(idPrefix = "IOP") +@ORBException(omgException = true, group = 0) public interface OMGSystemException { - OMGSystemException self = WrapperGenerator.makeWrapper( - OMGSystemException.class, CorbaExtension.self ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "IDL context not found" ) - BAD_CONTEXT idlContextNotFound( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "No matching IDL context property" ) - BAD_CONTEXT noMatchingIdlContext( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Dependency exists in IFR preventing destruction of this object" ) - BAD_INV_ORDER depPreventDestruction( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Attempt to destroy indestructible objects in IFR" ) - BAD_INV_ORDER destroyIndestructible( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Operation would deadlock" ) - BAD_INV_ORDER shutdownWaitForCompletionDeadlock( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "ORB has shutdown" ) - BAD_INV_ORDER badOperationAfterShutdown( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Attempt to invoke send or invoke operation of the same " - + "Request object more than once " ) - BAD_INV_ORDER badInvoke( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Attempt to set a servant manager after one has already been set" ) - BAD_INV_ORDER badSetServantManager( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "ServerRequest::arguments called more than once or after a call " - + "to ServerRequest::set_exception" ) - BAD_INV_ORDER badArgumentsCall( ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "ServerRequest::ctx called more than once or before " - + "ServerRequest::arguments or after ServerRequest::ctx, " - + "ServerRequest::set_result or ServerRequest::set_exception" ) - BAD_INV_ORDER badCtxCall( ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "ServerRequest::set_result called more than once or before " - + "ServerRequest::arguments or after ServerRequest::set_result or " - + "ServerRequest::set_exception" ) - BAD_INV_ORDER badResultCall( ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "Attempt to send a DII request after it was sent previously" ) - BAD_INV_ORDER badSend( ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "Attempt to poll a DII request or to retrieve its result " - + "before the request was sent" ) - BAD_INV_ORDER badPollBefore( ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "Attempt to poll a DII request or to retrieve its result after " - + "the result was retrieved previously" ) - BAD_INV_ORDER badPollAfter( ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Attempt to poll a synchronous DII request or to retrieve results " - + "from a synchronous DII request" ) - BAD_INV_ORDER badPollSync( ) ; - - @Log( level=LogLevel.FINE, id=14 ) - @Message( "Invalid call to forward_reference() when reply status is not " - + "LOCATION_FORWARD" ) - BAD_INV_ORDER invalidPiCall1( ) ; - - @Log( level=LogLevel.FINE, id=14 ) - @Message( "Cannot access this attribute or method at this point" ) - BAD_INV_ORDER invalidPiCall2( ) ; - - @Log( level=LogLevel.FINE, id=14 ) - @Message( "Cannot call set_slot from within an ORBInitializer" ) - BAD_INV_ORDER invalidPiCall3( ) ; - - @Log( level=LogLevel.FINE, id=14 ) - @Message( "Cannot call get_slot from within an ORBInitializer" ) - BAD_INV_ORDER invalidPiCall4( ) ; - - @Log( level=LogLevel.FINE, id=15 ) - @Message( "Service context add failed in portable interceptor because " - + "a service context with id {0} already exists" ) - BAD_INV_ORDER serviceContextAddFailed( int id ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "Registration of PolicyFactory failed because a factory already " - + "exists for the given PolicyType {0}" ) - BAD_INV_ORDER policyFactoryRegFailed( int type ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "POA cannot create POAs while undergoing destruction" ) - BAD_INV_ORDER createPoaDestroy( ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "Attempt to reassign priority" ) - BAD_INV_ORDER priorityReassign( ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "An OTS/XA integration xa_start() call returned XAER_OUTSIDE" ) - BAD_INV_ORDER xaStartOutsize( ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "An OTS/XA integration xa_ call returned XAER_PROTO" ) - BAD_INV_ORDER xaStartProto( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "ServantManager returned wrong servant type" ) - BAD_OPERATION badServantManagerType( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Operation or attribute not known to target object " ) - BAD_OPERATION operationUnknownToTarget( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Failure to register, unregister or lookup value factory" ) - BAD_PARAM unableRegisterValueFactory( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "RID already defined in IFR" ) - BAD_PARAM ridAlreadyDefined( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Name already used in the context in IFR " ) - BAD_PARAM nameUsedIfr( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Target is not a valid container" ) - BAD_PARAM targetNotContainer( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Name clash in inherited context" ) - BAD_PARAM nameClash( ) ; - - int NOT_SERIALIZABLE = CorbaExtension.self.getMinorCode( - OMGSystemException.class, "notSerializable" ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Class {0} is not Serializable" ) - @CS( CSValue.MAYBE ) - BAD_PARAM notSerializable( String arg0 ) ; - - @Log( level=LogLevel.FINE, id=7 ) - @Message( "string_to_object conversion failed due to bad scheme name {0}" ) - BAD_PARAM soBadSchemeName( String arg0 ) ; - - String soBadAddress = "string_to_object conversion failed due to " - + "bad address in name {0}" ; - - @Log( level=LogLevel.FINE, id=8 ) - @Message( soBadAddress ) - BAD_PARAM soBadAddress( @Chain Throwable exc, String arg0 ) ; - - @Log( level=LogLevel.FINE, id=8 ) - @Message( soBadAddress ) - BAD_PARAM soBadAddress( String arg0 ) ; - - @Log( level=LogLevel.FINE, id=9 ) - @Message( "string_to_object conversion failed due to bad schema specific " - + "part in name {0}" ) - BAD_PARAM soBadSchemaSpecific( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "string_to_object conversion failed due to non specific reason" ) - BAD_PARAM soNonSpecific( ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "Attempt to derive abstract interface from non-abstract base " - + "interface in the Interface Repository" ) - BAD_PARAM irDeriveAbsIntBase( ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "Attempt to let a ValueDef support more than one non-abstract " - + "interface in the Interface Repository" ) - BAD_PARAM irValueSupport( ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Attempt to use an incomplete TypeCode as a parameter" ) - BAD_PARAM incompleteTypecode( ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "Invalid object id passed to POA::create_reference_by_id " ) - BAD_PARAM invalidObjectId( ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "Bad name argument in TypeCode operation" ) - BAD_PARAM typecodeBadName( ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "Bad RepositoryId argument in TypeCode operation" ) - BAD_PARAM typecodeBadRepid( ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "Invalid member name in TypeCode operation " ) - BAD_PARAM typecodeInvMember( ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "Duplicate label value in create_union_tc " ) - BAD_PARAM tcUnionDupLabel( ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "Incompatible TypeCode of label and discriminator in " - + "create_union_tc " ) - BAD_PARAM tcUnionIncompatible( ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "Supplied discriminator type illegitimate in create_union_tc " ) - BAD_PARAM tcUnionBadDisc( ) ; - - @Log( level=LogLevel.WARNING, id=21 ) - @Message( "Any passed to ServerRequest::set_exception does not contain " - + "an exception " ) - BAD_PARAM setExceptionBadAny( ) ; - - @Log( level=LogLevel.WARNING, id=22 ) - @Message( "Unlisted user exception passed to ServerRequest::set_exception " ) - BAD_PARAM setExceptionUnlisted( ) ; - - @Log( level=LogLevel.WARNING, id=23 ) - @Message( "wchar transmission code set not in service context" ) - BAD_PARAM noClientWcharCodesetCtx( ) ; - - @Log( level=LogLevel.WARNING, id=24 ) - @Message( "Service context is not in OMG-defined range" ) - BAD_PARAM illegalServiceContext( ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "Enum value out of range" ) - BAD_PARAM enumOutOfRange( ) ; - - @Log( level=LogLevel.FINE, id=26 ) - @Message( "Invalid service context Id in portable interceptor" ) - BAD_PARAM invalidServiceContextId( ) ; - - @Log( level=LogLevel.WARNING, id=27 ) - @Message( "Attempt to call register_initial_reference with a null Object" ) - BAD_PARAM rirWithNullObject( ) ; - - @Log( level=LogLevel.FINE, id=28 ) - @Message( "Invalid component Id {0} in portable interceptor" ) - BAD_PARAM invalidComponentId( int arg0 ) ; - - int INVALID_PROFILE_ID = CorbaExtension.self.getMinorCode( - OMGSystemException.class, "invalidProfileId" ) ; - - @Log( level=LogLevel.WARNING, id=29 ) - @Message( "Profile ID does not define a known profile or it is impossible " - + "to add components to that profile" ) - BAD_PARAM invalidProfileId( ) ; - - @Log( level=LogLevel.WARNING, id=30 ) - @Message( "Two or more Policy objects with the same PolicyType value " - + "supplied to Object::set_policy_overrides or " - + "PolicyManager::set_policy_overrides" ) - BAD_PARAM policyTypeDuplicate( ) ; - - @Log( level=LogLevel.WARNING, id=31 ) - @Message( "Attempt to define a oneway operation with non-void result, " - + "out or inout parameters or user exceptions" ) - BAD_PARAM badOnewayDefinition( ) ; - - @Log( level=LogLevel.WARNING, id=32 ) - @Message( "DII asked to create request for an implicit operation" ) - BAD_PARAM diiForImplicitOperation( ) ; - - @Log( level=LogLevel.WARNING, id=33 ) - @Message( "An OTS/XA integration xa_ call returned XAER_INVAL" ) - BAD_PARAM xaCallInval( ) ; - - @Log( level=LogLevel.WARNING, id=34 ) - @Message( "Union branch modifier method called with " - + "bad case label discriminator" ) - BAD_PARAM unionBadDiscriminator( ) ; - - @Log( level=LogLevel.WARNING, id=35 ) - @Message( "Illegal IDL context property name" ) - BAD_PARAM ctxIllegalPropertyName( ) ; - - @Log( level=LogLevel.WARNING, id=36 ) - @Message( "Illegal IDL property search string" ) - BAD_PARAM ctxIllegalSearchString( ) ; - - @Log( level=LogLevel.WARNING, id=37 ) - @Message( "Illegal IDL context name" ) - BAD_PARAM ctxIllegalName( ) ; - - @Log( level=LogLevel.WARNING, id=38 ) - @Message( "Non-empty IDL context" ) - BAD_PARAM ctxNonEmpty( ) ; - - @Log( level=LogLevel.WARNING, id=39 ) - @Message( "Unsupported RMI/IDL custom value type stream format {0}" ) - BAD_PARAM invalidStreamFormatVersion( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=40 ) - @Message( "ORB output stream does not support ValueOutputStream interface" ) - @CS( CSValue.MAYBE ) - BAD_PARAM notAValueoutputstream( ) ; - - @Log( level=LogLevel.WARNING, id=41 ) - @Message( "ORB input stream does not support ValueInputStream interface" ) - BAD_PARAM notAValueinputstream( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Attempt to marshal incomplete TypeCode" ) - BAD_TYPECODE marshallIncompleteTypecode( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Member type code illegitimate in TypeCode operation" ) - BAD_TYPECODE badMemberTypecode( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Illegal parameter type" ) - BAD_TYPECODE illegalParameter( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Character does not map to negotiated transmission code set" ) - DATA_CONVERSION charNotInCodeset( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Failure of PriorityMapping object" ) - DATA_CONVERSION priorityMapFailre( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Unable to use any profile in IOR" ) - IMP_LIMIT noUsableProfile( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Priority range too restricted for ORB" ) - INITIALIZE priorityRangeRestrict( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "wchar Code Set support not specified" ) - INV_OBJREF noServerWcharCodesetCmp( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Codeset component required for type using wchar or wstring data" ) - INV_OBJREF codesetComponentRequired( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Unable to reconcile IOR specified policy with " - + "effective policy override" ) - INV_POLICY iorPolicyReconcileError( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Invalid PolicyType" ) - INV_POLICY policyUnknown( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "No PolicyFactory has been registered for the given PolicyType" ) - INV_POLICY noPolicyFactory( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "An OTS/XA integration xa_ call returned XAER_RMERR" ) - INTERNAL xaRmerr( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "An OTS/XA integration xa_ call returned XAER_RMFAIL" ) - INTERNAL xaRmfail( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Interface Repository not available" ) - INTF_REPOS noIr( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "No entry for requested interface in Interface Repository" ) - INTF_REPOS noInterfaceInIr( ) ; - - String unableLocateValueFactory = "Unable to locate value factory" ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( unableLocateValueFactory ) - @CS( CSValue.MAYBE ) - MARSHAL unableLocateValueFactory( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( unableLocateValueFactory ) - @CS( CSValue.MAYBE ) - MARSHAL unableLocateValueFactory( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "ServerRequest::set_result called before ServerRequest::ctx " - + "when the operation IDL contains a context clause " ) - MARSHAL setResultBeforeCtx( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "NVList passed to ServerRequest::arguments does not describe " - + "all parameters passed by client" ) - MARSHAL badNvlist( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Attempt to marshal Local object" ) - MARSHAL notAnObjectImpl( @Chain BAD_PARAM exception ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "wchar or wstring data erroneously sent by client over " - + "GIOP 1.0 connection " ) - MARSHAL wcharBadGiopVersionSent( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "wchar or wstring data erroneously returned by server over " - + "GIOP 1.0 connection " ) - MARSHAL wcharBadGiopVersionReturned( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Unsupported RMI/IDL custom value type stream format" ) - @CS( CSValue.MAYBE ) - MARSHAL unsupportedFormatVersion( ) ; - - int RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE = - CorbaExtension.self.getMinorCode( OMGSystemException.class, - "rmiiiopOptionalDataIncompatible1" ) ; - - @Log( level=LogLevel.FINE, id=8 ) - @Message( "No optional data available" ) - MARSHAL rmiiiopOptionalDataIncompatible1( ) ; - - @Log( level=LogLevel.FINE, id=8 ) - @Message( "Not enough space left in current chunk" ) - MARSHAL rmiiiopOptionalDataIncompatible2( ) ; - - @Log( level=LogLevel.FINE, id=8 ) - @Message( "Not enough optional data available" ) - MARSHAL rmiiiopOptionalDataIncompatible3( ) ; - - String missingLocalValueImpl = "Missing local value implementation" ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( missingLocalValueImpl ) - @CS( CSValue.MAYBE ) - NO_IMPLEMENT missingLocalValueImpl( @Chain Throwable exc ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( missingLocalValueImpl ) - @CS( CSValue.MAYBE ) - NO_IMPLEMENT missingLocalValueImpl() ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Incompatible value implementation version" ) - @CS( CSValue.MAYBE ) - NO_IMPLEMENT incompatibleValueImpl( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Unable to use any profile in IOR" ) - NO_IMPLEMENT noUsableProfile2( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Attempt to use DII on Local object" ) - NO_IMPLEMENT diiLocalObject( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Biomolecular Sequence Analysis iterator cannot be reset" ) - NO_IMPLEMENT bioReset( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Biomolecular Sequence Analysis metadata is not available as XML" ) - NO_IMPLEMENT bioMetaNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Genomic Maps iterator cannot be reset" ) - NO_IMPLEMENT bioGenomicNoIterator( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "The portable Java bindings do not support arguments()" ) - NO_RESOURCES piOperationNotSupported1( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "The portable Java bindings do not support exceptions()" ) - NO_RESOURCES piOperationNotSupported2( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "The portable Java bindings do not support contexts()" ) - NO_RESOURCES piOperationNotSupported3( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "The portable Java bindings do not support operation_context()" ) - NO_RESOURCES piOperationNotSupported4( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "The portable Java bindings do not support result()" ) - NO_RESOURCES piOperationNotSupported5( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "The object ID was never set" ) - NO_RESOURCES piOperationNotSupported6( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "The ObjectKeyTemplate was never set" ) - NO_RESOURCES piOperationNotSupported7( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "ServerRequest::arguments() was never called" ) - NO_RESOURCES piOperationNotSupported8( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "No connection for request's priority" ) - NO_RESOURCES noConnectionPriority( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "An OTS/XA integration xa_ call returned XAER_RB" ) - TRANSACTION_ROLLEDBACK xaRb( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "An OTS/XA integration xa_ call returned XAER_NOTA" ) - TRANSACTION_ROLLEDBACK xaNota( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "OTS/XA integration end() was called with success set to TRUE " - + "while transaction rollback was deferred" ) - TRANSACTION_ROLLEDBACK xaEndTrueRollbackDeferred( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Request discarded because of resource exhaustion in POA or " - + "because POA is in DISCARDING state" ) - TRANSIENT poaRequestDiscard( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "No usable profile in IOR" ) - TRANSIENT noUsableProfile3( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Request cancelled" ) - TRANSIENT requestCancelled( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "POA destroyed" ) - TRANSIENT poaDestroyed( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Attempt to pass an unactivated (unregistered) value as an " - + "object reference" ) - OBJECT_NOT_EXIST unregisteredValueAsObjref( ) ; - - String noObjectAdaptor = "Failed to create or locate Object Adaptor" ; - - @Log( level=LogLevel.FINE, id=2 ) - @Message( noObjectAdaptor ) - OBJECT_NOT_EXIST noObjectAdaptor( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=2 ) - @Message( noObjectAdaptor ) - OBJECT_NOT_EXIST noObjectAdaptor() ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Biomolecular Sequence Analysis Service is no longer available" ) - OBJECT_NOT_EXIST bioNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Object Adapter Inactive" ) - OBJECT_NOT_EXIST objectAdapterInactive( ) ; - - String adapterActivatorException = "System exception in " - + "POA::unknown_adapter for POA {0} with parent POA {1}" ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( adapterActivatorException ) - OBJ_ADAPTER adapterActivatorException( @Chain Exception exc, String arg0, - ObjectAdapterId arg1 ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( adapterActivatorException ) - OBJ_ADAPTER adapterActivatorException( String arg0, ObjectAdapterId arg1 ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Incorrect servant type returned by servant manager " ) - OBJ_ADAPTER badServantType( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "No default servant available [POA policy]" ) - OBJ_ADAPTER noDefaultServant( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "No servant manager available [POA Policy]" ) - OBJ_ADAPTER noServantManager( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Violation of POA policy by ServantActivator::incarnate" ) - OBJ_ADAPTER badPolicyIncarnate( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Exception in " - + "PortableInterceptor::IORInterceptor.components_established" ) - OBJ_ADAPTER piExcCompEstablished( ) ; - - @Log( level=LogLevel.FINE, id=7 ) - @Message( "Null servant returned by servant manager" ) - OBJ_ADAPTER nullServantReturned( ) ; - - String unknownUserException = - "Unlisted user exception received by client " ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( unknownUserException ) - @CS( CSValue.MAYBE ) - UNKNOWN unknownUserException( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( unknownUserException ) - @CS( CSValue.MAYBE ) - UNKNOWN unknownUserException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Non-standard System Exception not supported" ) - UNKNOWN unsupportedSystemException( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "An unknown user exception received by a portable interceptor" ) - UNKNOWN piUnknownUserException( ) ; + OMGSystemException self = WrapperGenerator.makeWrapper(OMGSystemException.class, CorbaExtension.self); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("IDL context not found") + BAD_CONTEXT idlContextNotFound(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("No matching IDL context property") + BAD_CONTEXT noMatchingIdlContext(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Dependency exists in IFR preventing destruction of this object") + BAD_INV_ORDER depPreventDestruction(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Attempt to destroy indestructible objects in IFR") + BAD_INV_ORDER destroyIndestructible(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Operation would deadlock") + BAD_INV_ORDER shutdownWaitForCompletionDeadlock(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("ORB has shutdown") + BAD_INV_ORDER badOperationAfterShutdown(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Attempt to invoke send or invoke operation of the same " + "Request object more than once ") + BAD_INV_ORDER badInvoke(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Attempt to set a servant manager after one has already been set") + BAD_INV_ORDER badSetServantManager(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("ServerRequest::arguments called more than once or after a call " + "to ServerRequest::set_exception") + BAD_INV_ORDER badArgumentsCall(); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("ServerRequest::ctx called more than once or before " + "ServerRequest::arguments or after ServerRequest::ctx, " + + "ServerRequest::set_result or ServerRequest::set_exception") + BAD_INV_ORDER badCtxCall(); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("ServerRequest::set_result called more than once or before " + + "ServerRequest::arguments or after ServerRequest::set_result or " + "ServerRequest::set_exception") + BAD_INV_ORDER badResultCall(); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("Attempt to send a DII request after it was sent previously") + BAD_INV_ORDER badSend(); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("Attempt to poll a DII request or to retrieve its result " + "before the request was sent") + BAD_INV_ORDER badPollBefore(); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("Attempt to poll a DII request or to retrieve its result after " + "the result was retrieved previously") + BAD_INV_ORDER badPollAfter(); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Attempt to poll a synchronous DII request or to retrieve results " + "from a synchronous DII request") + BAD_INV_ORDER badPollSync(); + + @Log(level = LogLevel.FINE, id = 14) + @Message("Invalid call to forward_reference() when reply status is not " + "LOCATION_FORWARD") + BAD_INV_ORDER invalidPiCall1(); + + @Log(level = LogLevel.FINE, id = 14) + @Message("Cannot access this attribute or method at this point") + BAD_INV_ORDER invalidPiCall2(); + + @Log(level = LogLevel.FINE, id = 14) + @Message("Cannot call set_slot from within an ORBInitializer") + BAD_INV_ORDER invalidPiCall3(); + + @Log(level = LogLevel.FINE, id = 14) + @Message("Cannot call get_slot from within an ORBInitializer") + BAD_INV_ORDER invalidPiCall4(); + + @Log(level = LogLevel.FINE, id = 15) + @Message("Service context add failed in portable interceptor because " + "a service context with id {0} already exists") + BAD_INV_ORDER serviceContextAddFailed(int id); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("Registration of PolicyFactory failed because a factory already " + "exists for the given PolicyType {0}") + BAD_INV_ORDER policyFactoryRegFailed(int type); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("POA cannot create POAs while undergoing destruction") + BAD_INV_ORDER createPoaDestroy(); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("Attempt to reassign priority") + BAD_INV_ORDER priorityReassign(); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("An OTS/XA integration xa_start() call returned XAER_OUTSIDE") + BAD_INV_ORDER xaStartOutsize(); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("An OTS/XA integration xa_ call returned XAER_PROTO") + BAD_INV_ORDER xaStartProto(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("ServantManager returned wrong servant type") + BAD_OPERATION badServantManagerType(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Operation or attribute not known to target object ") + BAD_OPERATION operationUnknownToTarget(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Failure to register, unregister or lookup value factory") + BAD_PARAM unableRegisterValueFactory(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("RID already defined in IFR") + BAD_PARAM ridAlreadyDefined(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Name already used in the context in IFR ") + BAD_PARAM nameUsedIfr(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Target is not a valid container") + BAD_PARAM targetNotContainer(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Name clash in inherited context") + BAD_PARAM nameClash(); + + int NOT_SERIALIZABLE = CorbaExtension.self.getMinorCode(OMGSystemException.class, "notSerializable"); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Class {0} is not Serializable") + @CS(CSValue.MAYBE) + BAD_PARAM notSerializable(String arg0); + + @Log(level = LogLevel.FINE, id = 7) + @Message("string_to_object conversion failed due to bad scheme name {0}") + BAD_PARAM soBadSchemeName(String arg0); + + String soBadAddress = "string_to_object conversion failed due to " + "bad address in name {0}"; + + @Log(level = LogLevel.FINE, id = 8) + @Message(soBadAddress) + BAD_PARAM soBadAddress(@Chain Throwable exc, String arg0); + + @Log(level = LogLevel.FINE, id = 8) + @Message(soBadAddress) + BAD_PARAM soBadAddress(String arg0); + + @Log(level = LogLevel.FINE, id = 9) + @Message("string_to_object conversion failed due to bad schema specific " + "part in name {0}") + BAD_PARAM soBadSchemaSpecific(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("string_to_object conversion failed due to non specific reason") + BAD_PARAM soNonSpecific(); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("Attempt to derive abstract interface from non-abstract base " + "interface in the Interface Repository") + BAD_PARAM irDeriveAbsIntBase(); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("Attempt to let a ValueDef support more than one non-abstract " + "interface in the Interface Repository") + BAD_PARAM irValueSupport(); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Attempt to use an incomplete TypeCode as a parameter") + BAD_PARAM incompleteTypecode(); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("Invalid object id passed to POA::create_reference_by_id ") + BAD_PARAM invalidObjectId(); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("Bad name argument in TypeCode operation") + BAD_PARAM typecodeBadName(); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("Bad RepositoryId argument in TypeCode operation") + BAD_PARAM typecodeBadRepid(); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("Invalid member name in TypeCode operation ") + BAD_PARAM typecodeInvMember(); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("Duplicate label value in create_union_tc ") + BAD_PARAM tcUnionDupLabel(); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("Incompatible TypeCode of label and discriminator in " + "create_union_tc ") + BAD_PARAM tcUnionIncompatible(); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("Supplied discriminator type illegitimate in create_union_tc ") + BAD_PARAM tcUnionBadDisc(); + + @Log(level = LogLevel.WARNING, id = 21) + @Message("Any passed to ServerRequest::set_exception does not contain " + "an exception ") + BAD_PARAM setExceptionBadAny(); + + @Log(level = LogLevel.WARNING, id = 22) + @Message("Unlisted user exception passed to ServerRequest::set_exception ") + BAD_PARAM setExceptionUnlisted(); + + @Log(level = LogLevel.WARNING, id = 23) + @Message("wchar transmission code set not in service context") + BAD_PARAM noClientWcharCodesetCtx(); + + @Log(level = LogLevel.WARNING, id = 24) + @Message("Service context is not in OMG-defined range") + BAD_PARAM illegalServiceContext(); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("Enum value out of range") + BAD_PARAM enumOutOfRange(); + + @Log(level = LogLevel.FINE, id = 26) + @Message("Invalid service context Id in portable interceptor") + BAD_PARAM invalidServiceContextId(); + + @Log(level = LogLevel.WARNING, id = 27) + @Message("Attempt to call register_initial_reference with a null Object") + BAD_PARAM rirWithNullObject(); + + @Log(level = LogLevel.FINE, id = 28) + @Message("Invalid component Id {0} in portable interceptor") + BAD_PARAM invalidComponentId(int arg0); + + int INVALID_PROFILE_ID = CorbaExtension.self.getMinorCode(OMGSystemException.class, "invalidProfileId"); + + @Log(level = LogLevel.WARNING, id = 29) + @Message("Profile ID does not define a known profile or it is impossible " + "to add components to that profile") + BAD_PARAM invalidProfileId(); + + @Log(level = LogLevel.WARNING, id = 30) + @Message("Two or more Policy objects with the same PolicyType value " + "supplied to Object::set_policy_overrides or " + + "PolicyManager::set_policy_overrides") + BAD_PARAM policyTypeDuplicate(); + + @Log(level = LogLevel.WARNING, id = 31) + @Message("Attempt to define a oneway operation with non-void result, " + "out or inout parameters or user exceptions") + BAD_PARAM badOnewayDefinition(); + + @Log(level = LogLevel.WARNING, id = 32) + @Message("DII asked to create request for an implicit operation") + BAD_PARAM diiForImplicitOperation(); + + @Log(level = LogLevel.WARNING, id = 33) + @Message("An OTS/XA integration xa_ call returned XAER_INVAL") + BAD_PARAM xaCallInval(); + + @Log(level = LogLevel.WARNING, id = 34) + @Message("Union branch modifier method called with " + "bad case label discriminator") + BAD_PARAM unionBadDiscriminator(); + + @Log(level = LogLevel.WARNING, id = 35) + @Message("Illegal IDL context property name") + BAD_PARAM ctxIllegalPropertyName(); + + @Log(level = LogLevel.WARNING, id = 36) + @Message("Illegal IDL property search string") + BAD_PARAM ctxIllegalSearchString(); + + @Log(level = LogLevel.WARNING, id = 37) + @Message("Illegal IDL context name") + BAD_PARAM ctxIllegalName(); + + @Log(level = LogLevel.WARNING, id = 38) + @Message("Non-empty IDL context") + BAD_PARAM ctxNonEmpty(); + + @Log(level = LogLevel.WARNING, id = 39) + @Message("Unsupported RMI/IDL custom value type stream format {0}") + BAD_PARAM invalidStreamFormatVersion(int arg0); + + @Log(level = LogLevel.WARNING, id = 40) + @Message("ORB output stream does not support ValueOutputStream interface") + @CS(CSValue.MAYBE) + BAD_PARAM notAValueoutputstream(); + + @Log(level = LogLevel.WARNING, id = 41) + @Message("ORB input stream does not support ValueInputStream interface") + BAD_PARAM notAValueinputstream(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Attempt to marshal incomplete TypeCode") + BAD_TYPECODE marshallIncompleteTypecode(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Member type code illegitimate in TypeCode operation") + BAD_TYPECODE badMemberTypecode(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Illegal parameter type") + BAD_TYPECODE illegalParameter(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Character does not map to negotiated transmission code set") + DATA_CONVERSION charNotInCodeset(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Failure of PriorityMapping object") + DATA_CONVERSION priorityMapFailre(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Unable to use any profile in IOR") + IMP_LIMIT noUsableProfile(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Priority range too restricted for ORB") + INITIALIZE priorityRangeRestrict(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("wchar Code Set support not specified") + INV_OBJREF noServerWcharCodesetCmp(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Codeset component required for type using wchar or wstring data") + INV_OBJREF codesetComponentRequired(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Unable to reconcile IOR specified policy with " + "effective policy override") + INV_POLICY iorPolicyReconcileError(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Invalid PolicyType") + INV_POLICY policyUnknown(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("No PolicyFactory has been registered for the given PolicyType") + INV_POLICY noPolicyFactory(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("An OTS/XA integration xa_ call returned XAER_RMERR") + INTERNAL xaRmerr(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("An OTS/XA integration xa_ call returned XAER_RMFAIL") + INTERNAL xaRmfail(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Interface Repository not available") + INTF_REPOS noIr(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("No entry for requested interface in Interface Repository") + INTF_REPOS noInterfaceInIr(); + + String unableLocateValueFactory = "Unable to locate value factory"; + + @Log(level = LogLevel.FINE, id = 1) + @Message(unableLocateValueFactory) + @CS(CSValue.MAYBE) + MARSHAL unableLocateValueFactory(); + + @Log(level = LogLevel.FINE, id = 1) + @Message(unableLocateValueFactory) + @CS(CSValue.MAYBE) + MARSHAL unableLocateValueFactory(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("ServerRequest::set_result called before ServerRequest::ctx " + "when the operation IDL contains a context clause ") + MARSHAL setResultBeforeCtx(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("NVList passed to ServerRequest::arguments does not describe " + "all parameters passed by client") + MARSHAL badNvlist(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Attempt to marshal Local object") + MARSHAL notAnObjectImpl(@Chain BAD_PARAM exception); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("wchar or wstring data erroneously sent by client over " + "GIOP 1.0 connection ") + MARSHAL wcharBadGiopVersionSent(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("wchar or wstring data erroneously returned by server over " + "GIOP 1.0 connection ") + MARSHAL wcharBadGiopVersionReturned(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Unsupported RMI/IDL custom value type stream format") + @CS(CSValue.MAYBE) + MARSHAL unsupportedFormatVersion(); + + int RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE = CorbaExtension.self.getMinorCode(OMGSystemException.class, "rmiiiopOptionalDataIncompatible1"); + + @Log(level = LogLevel.FINE, id = 8) + @Message("No optional data available") + MARSHAL rmiiiopOptionalDataIncompatible1(); + + @Log(level = LogLevel.FINE, id = 8) + @Message("Not enough space left in current chunk") + MARSHAL rmiiiopOptionalDataIncompatible2(); + + @Log(level = LogLevel.FINE, id = 8) + @Message("Not enough optional data available") + MARSHAL rmiiiopOptionalDataIncompatible3(); + + String missingLocalValueImpl = "Missing local value implementation"; + + @Log(level = LogLevel.WARNING, id = 1) + @Message(missingLocalValueImpl) + @CS(CSValue.MAYBE) + NO_IMPLEMENT missingLocalValueImpl(@Chain Throwable exc); + + @Log(level = LogLevel.WARNING, id = 1) + @Message(missingLocalValueImpl) + @CS(CSValue.MAYBE) + NO_IMPLEMENT missingLocalValueImpl(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Incompatible value implementation version") + @CS(CSValue.MAYBE) + NO_IMPLEMENT incompatibleValueImpl(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Unable to use any profile in IOR") + NO_IMPLEMENT noUsableProfile2(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Attempt to use DII on Local object") + NO_IMPLEMENT diiLocalObject(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Biomolecular Sequence Analysis iterator cannot be reset") + NO_IMPLEMENT bioReset(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Biomolecular Sequence Analysis metadata is not available as XML") + NO_IMPLEMENT bioMetaNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Genomic Maps iterator cannot be reset") + NO_IMPLEMENT bioGenomicNoIterator(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("The portable Java bindings do not support arguments()") + NO_RESOURCES piOperationNotSupported1(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("The portable Java bindings do not support exceptions()") + NO_RESOURCES piOperationNotSupported2(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("The portable Java bindings do not support contexts()") + NO_RESOURCES piOperationNotSupported3(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("The portable Java bindings do not support operation_context()") + NO_RESOURCES piOperationNotSupported4(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("The portable Java bindings do not support result()") + NO_RESOURCES piOperationNotSupported5(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("The object ID was never set") + NO_RESOURCES piOperationNotSupported6(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("The ObjectKeyTemplate was never set") + NO_RESOURCES piOperationNotSupported7(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("ServerRequest::arguments() was never called") + NO_RESOURCES piOperationNotSupported8(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("No connection for request's priority") + NO_RESOURCES noConnectionPriority(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("An OTS/XA integration xa_ call returned XAER_RB") + TRANSACTION_ROLLEDBACK xaRb(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("An OTS/XA integration xa_ call returned XAER_NOTA") + TRANSACTION_ROLLEDBACK xaNota(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("OTS/XA integration end() was called with success set to TRUE " + "while transaction rollback was deferred") + TRANSACTION_ROLLEDBACK xaEndTrueRollbackDeferred(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Request discarded because of resource exhaustion in POA or " + "because POA is in DISCARDING state") + TRANSIENT poaRequestDiscard(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("No usable profile in IOR") + TRANSIENT noUsableProfile3(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Request cancelled") + TRANSIENT requestCancelled(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("POA destroyed") + TRANSIENT poaDestroyed(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Attempt to pass an unactivated (unregistered) value as an " + "object reference") + OBJECT_NOT_EXIST unregisteredValueAsObjref(); + + String noObjectAdaptor = "Failed to create or locate Object Adaptor"; + + @Log(level = LogLevel.FINE, id = 2) + @Message(noObjectAdaptor) + OBJECT_NOT_EXIST noObjectAdaptor(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 2) + @Message(noObjectAdaptor) + OBJECT_NOT_EXIST noObjectAdaptor(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Biomolecular Sequence Analysis Service is no longer available") + OBJECT_NOT_EXIST bioNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Object Adapter Inactive") + OBJECT_NOT_EXIST objectAdapterInactive(); + + String adapterActivatorException = "System exception in " + "POA::unknown_adapter for POA {0} with parent POA {1}"; + + @Log(level = LogLevel.WARNING, id = 1) + @Message(adapterActivatorException) + OBJ_ADAPTER adapterActivatorException(@Chain Exception exc, String arg0, ObjectAdapterId arg1); + + @Log(level = LogLevel.WARNING, id = 1) + @Message(adapterActivatorException) + OBJ_ADAPTER adapterActivatorException(String arg0, ObjectAdapterId arg1); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Incorrect servant type returned by servant manager ") + OBJ_ADAPTER badServantType(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("No default servant available [POA policy]") + OBJ_ADAPTER noDefaultServant(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("No servant manager available [POA Policy]") + OBJ_ADAPTER noServantManager(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Violation of POA policy by ServantActivator::incarnate") + OBJ_ADAPTER badPolicyIncarnate(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Exception in " + "PortableInterceptor::IORInterceptor.components_established") + OBJ_ADAPTER piExcCompEstablished(); + + @Log(level = LogLevel.FINE, id = 7) + @Message("Null servant returned by servant manager") + OBJ_ADAPTER nullServantReturned(); + + String unknownUserException = "Unlisted user exception received by client "; + + @Log(level = LogLevel.FINE, id = 1) + @Message(unknownUserException) + @CS(CSValue.MAYBE) + UNKNOWN unknownUserException(); + + @Log(level = LogLevel.FINE, id = 1) + @Message(unknownUserException) + @CS(CSValue.MAYBE) + UNKNOWN unknownUserException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Non-standard System Exception not supported") + UNKNOWN unsupportedSystemException(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("An unknown user exception received by a portable interceptor") + UNKNOWN piUnknownUserException(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/ORBUtilSystemException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/ORBUtilSystemException.java index e89d8a5db..c179889f5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/ORBUtilSystemException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/ORBUtilSystemException.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logging ; +package com.sun.corba.ee.spi.logging; import com.sun.corba.ee.impl.encoding.OSFCodeSetRegistry; @@ -34,8 +34,8 @@ import com.sun.corba.ee.spi.logex.corba.CS; import com.sun.corba.ee.spi.logex.corba.CSValue; -import com.sun.corba.ee.spi.logex.corba.ORBException ; -import com.sun.corba.ee.spi.logex.corba.CorbaExtension ; +import com.sun.corba.ee.spi.logex.corba.ORBException; +import com.sun.corba.ee.spi.logex.corba.CorbaExtension; import com.sun.corba.ee.spi.transport.Connection; import com.sun.corba.ee.spi.transport.EventHandler; @@ -76,1898 +76,1765 @@ import org.omg.CORBA.portable.RemarshalException; -@ExceptionWrapper( idPrefix="IOP" ) -@ORBException( omgException=false, group=CorbaExtension.ORBUtilGroup ) +@ExceptionWrapper(idPrefix = "IOP") +@ORBException(omgException = false, group = CorbaExtension.ORBUtilGroup) public interface ORBUtilSystemException { - ORBUtilSystemException self = WrapperGenerator.makeWrapper( - ORBUtilSystemException.class, CorbaExtension.self ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Adapter ID not available" ) - BAD_OPERATION adapterIdNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Server ID not available" ) - BAD_OPERATION serverIdNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "ORB ID not available" ) - BAD_OPERATION orbIdNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Object adapter ID not available" ) - BAD_OPERATION objectAdapterIdNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Error connecting servant" ) - BAD_OPERATION connectingServant( @Chain RemoteException exc ) ; - - @Log( level=LogLevel.FINE, id=6 ) - @Message( "Expected typecode kind {0} but got typecode kind {1}" ) - BAD_OPERATION extractWrongType( String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Expected typecode kind to be one of {0} but got " - + "typecode kind {1}" ) - BAD_OPERATION extractWrongTypeList( List opList, String tcName ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "String length of {0} exceeds bounded string length of {1}" ) - BAD_OPERATION badStringBounds( int len, int boundedLen ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "Tried to insert an object of an incompatible type into an Any " - + "for an object reference" ) - BAD_OPERATION insertObjectIncompatible( ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "insert_Object call failed on an Any" ) - BAD_OPERATION insertObjectFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "extract_Object call failed on an Any" ) - BAD_OPERATION extractObjectIncompatible( ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Fixed type does not match typecode" ) - BAD_OPERATION fixedNotMatch( ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "Tried to insert Fixed type for non-Fixed typecode" ) - BAD_OPERATION fixedBadTypecode( @Chain BadKind bk ) ; - - @Log( level=LogLevel.WARNING, id=23 ) - @Message( "set_exception(Any) called with null args for DSI ServerRequest" ) - BAD_OPERATION setExceptionCalledNullArgs( ) ; - - @Log( level=LogLevel.WARNING, id=24 ) - @Message( "set_exception(Any) called with a bad (non-exception) type" ) - BAD_OPERATION setExceptionCalledBadType( ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "ctx() called out of order for DSI ServerRequest" ) - BAD_OPERATION contextCalledOutOfOrder( ) ; - - @Log( level=LogLevel.WARNING, id=26 ) - @Message( "ORB configurator class {0} could not be instantiated" ) - BAD_OPERATION badOrbConfigurator( @Chain Exception exc, String name ) ; - - @Log( level=LogLevel.WARNING, id=26 ) - @Message( "ORB configurator class {0} could not be instantiated" ) - BAD_OPERATION badOrbConfigurator( String name ) ; - - @Log( level=LogLevel.WARNING, id=27 ) - @Message( "Error in running ORB configurator" ) - BAD_OPERATION orbConfiguratorError( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=28 ) - @Message( "This ORB instance has been destroyed, so no operations can be " - + "performed on it" ) - BAD_OPERATION orbDestroyed( ) ; - - @Log( level=LogLevel.WARNING, id=29 ) - @Message( "Negative bound for string TypeCode is illegal" ) - BAD_OPERATION negativeBounds( ) ; - - @Log( level=LogLevel.WARNING, id=30 ) - @Message( "Called typecode extract on an uninitialized typecode" ) - BAD_OPERATION extractNotInitialized( ) ; - - @Log( level=LogLevel.WARNING, id=31 ) - @Message( "extract_Object failed on an uninitialized Any" ) - BAD_OPERATION extractObjectFailed( @Chain Exception exc ) ; - - int METHOD_NOT_FOUND_IN_TIE = CorbaExtension.self.getMinorCode( - ORBUtilSystemException.class, "methodNotFoundInTie" ) ; - - @Log( level=LogLevel.FINE, id=32 ) - @Message( "Could not find method named {0} in class {1} in reflective Tie" ) - BAD_OPERATION methodNotFoundInTie( String arg0, String arg1 ) ; - - @Log( level=LogLevel.FINE, id=33 ) - @Message( "ClassNotFoundException while attempting to load preferred " - + "stub named {0}" ) - @CS( CSValue.MAYBE ) - BAD_OPERATION classNotFound1( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.FINE, id=34 ) - @Message( "ClassNotFoundException while attempting to load alternate " - + "stub named {0}" ) - @CS( CSValue.MAYBE ) - BAD_OPERATION classNotFound2( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.FINE, id=35 ) - @Message( "ClassNotFoundException while attempting to load interface {0}" ) - @CS( CSValue.MAYBE ) - BAD_OPERATION classNotFound3( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=36 ) - @Message( "POA ServantNotActive exception while trying get an " - + "org.omg.CORBA.Portable.Delegate for an org.omg.PortableServer.Servant" ) - BAD_OPERATION getDelegateServantNotActive( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=37 ) - @Message( "POA WrongPolicy exception while trying get an " - + "org.omg.CORBA.Portable.Delegate for an org.omg.PortableServer.Servant" ) - BAD_OPERATION getDelegateWrongPolicy( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=38 ) - @Message( "Call to StubAdapter.setDelegate did not pass a stub" ) - BAD_OPERATION setDelegateRequiresStub( ) ; - - @Log( level=LogLevel.WARNING, id=39 ) - @Message( "Call to StubAdapter.getDelegate did not pass a stub" ) - BAD_OPERATION getDelegateRequiresStub( ) ; - - @Log( level=LogLevel.WARNING, id=40 ) - @Message( "Call to StubAdapter.getTypeIds did not pass a stub" ) - BAD_OPERATION getTypeIdsRequiresStub( ) ; - - @Log( level=LogLevel.WARNING, id=41 ) - @Message( "Call to StubAdapter.getORB did not pass a stub" ) - BAD_OPERATION getOrbRequiresStub( ) ; - - @Log( level=LogLevel.WARNING, id=42 ) - @Message( "Call to StubAdapter.connect did not pass a stub" ) - BAD_OPERATION connectRequiresStub( ) ; - - @Log( level=LogLevel.WARNING, id=43 ) - @Message( "Call to StubAdapter.isLocal did not pass a stub" ) - BAD_OPERATION isLocalRequiresStub( ) ; - - @Log( level=LogLevel.WARNING, id=44 ) - @Message( "Call to StubAdapter.request did not pass a stub" ) - BAD_OPERATION requestRequiresStub( ) ; - - @Log( level=LogLevel.WARNING, id=45 ) - @Message( "Call to StubAdapter.activateTie did not pass a valid Tie" ) - BAD_OPERATION badActivateTieCall( ) ; - - @Log( level=LogLevel.WARNING, id=46 ) - @Message( "Bad operation from _invoke: {0}" ) - BAD_OPERATION badOperationFromInvoke( @Chain Exception exc, String arg0 ) ; - - String couldNotAccessStubDelegate = "Could not access StubDelegateImpl" ; - - @Log( level=LogLevel.WARNING, id=47 ) - @Message( couldNotAccessStubDelegate ) - BAD_OPERATION couldNotAccessStubDelegate( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=47 ) - @Message( couldNotAccessStubDelegate ) - BAD_OPERATION couldNotAccessStubDelegate( ) ; - - @Log( level=LogLevel.WARNING, id=48 ) - @Message( "Could not load interface {0} for creating stub" ) - BAD_OPERATION couldNotLoadInterface( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=49 ) - @Message( "Could not activate POA from foreign ORB due to " - + "AdapterInactive exception in StubAdapter" ) - BAD_OPERATION adapterInactiveInActivateServant( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=50 ) - @Message( "Could not instantiate stub class {0} for dynamic RMI-IIOP" ) - BAD_OPERATION couldNotInstantiateStubClass( @Chain Exception exc, - String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=51 ) - @Message( "String expected in OperationFactory.getString()" ) - BAD_OPERATION stringExpectedInOperation( ) ; - - @Log( level=LogLevel.WARNING, id=52 ) - @Message( "Object[] expected" ) - BAD_OPERATION objectArrayExpected( ) ; - - @Log( level=LogLevel.WARNING, id=53 ) - @Message( "Pair expected" ) - BAD_OPERATION pairStringStringExpected( ) ; - - @Log( level=LogLevel.WARNING, id=54 ) - @Message( "Error while attempting to load class {0}" ) - BAD_OPERATION classActionException( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=55 ) - @Message( "Bad URL {0} in URLAction" ) - BAD_OPERATION badUrlInAction( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=56 ) - @Message( "Property value {0} is not in the range {1} to {2}" ) - BAD_OPERATION valueNotInRange( int arg0, int arg1, int arg2 ) ; - - @Log( level=LogLevel.WARNING, id=57 ) - @Message( "Number of token ({0}) and number of actions ({1}) don't match" ) - BAD_OPERATION numTokensActionsDontMatch( int arg0, int arg1 ) ; - - @Log( level=LogLevel.WARNING, id=58 ) - @Message( "Could not find constructor (String) in class {0}" ) - BAD_OPERATION exceptionInConvertActionConstructor( @Chain Exception exc, - String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=59 ) - @Message( "Exception in ConvertAction operation" ) - BAD_OPERATION exceptionInConvertAction( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=60 ) - @Message( "Useless exception on call to Closeable.close()" ) - BAD_OPERATION ioExceptionOnClose( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=63 ) - @Message( "Class {0} could not be loaded by bundle {1}" ) - BAD_OPERATION bundleCouldNotLoadClass( @Chain Exception exc, - String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=75 ) - @Message( "Exception while handling event on {0}" ) - BAD_OPERATION exceptionInSelector( @Chain Throwable t, EventHandler arg0 ) ; - - @Log( level=LogLevel.FINE, id=76 ) - @Message( "Ignoring cancelled SelectionKey {0}: key will be removed " - + "from Selector" ) - BAD_OPERATION canceledSelectionKey( SelectionKey arg0 ) ; - - @Log( level=LogLevel.FINE, id=77 ) - @Message( "The OSGi PackageAdmin service is not available" ) - BAD_OPERATION packageAdminServiceNotAvailable( ) ; - - @Log( level=LogLevel.WARNING, id=78 ) - @Message( "The ORBImpl.set_parameters method was called more than once" ) - BAD_OPERATION setParameterCalledAgain( ) ; - - @Log( level=LogLevel.WARNING, id=81 ) - @Message( "Could not make an instance of Class {0}" ) - BAD_OPERATION couldNotMakeInstance( @Chain Exception ex, Class arg0 ) ; - - @Log( level=LogLevel.WARNING, id=82 ) - @Message( "Exception in createCopy`") - BAD_OPERATION exceptionInCreateCopy( @Chain Exception exc); - - @Message( "Exception in reset method in ClientGroupManager") - @Log( level=LogLevel.FINE, id=83 ) + ORBUtilSystemException self = WrapperGenerator.makeWrapper(ORBUtilSystemException.class, CorbaExtension.self); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Adapter ID not available") + BAD_OPERATION adapterIdNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Server ID not available") + BAD_OPERATION serverIdNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("ORB ID not available") + BAD_OPERATION orbIdNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Object adapter ID not available") + BAD_OPERATION objectAdapterIdNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Error connecting servant") + BAD_OPERATION connectingServant(@Chain RemoteException exc); + + @Log(level = LogLevel.FINE, id = 6) + @Message("Expected typecode kind {0} but got typecode kind {1}") + BAD_OPERATION extractWrongType(String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Expected typecode kind to be one of {0} but got " + "typecode kind {1}") + BAD_OPERATION extractWrongTypeList(List opList, String tcName); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("String length of {0} exceeds bounded string length of {1}") + BAD_OPERATION badStringBounds(int len, int boundedLen); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("Tried to insert an object of an incompatible type into an Any " + "for an object reference") + BAD_OPERATION insertObjectIncompatible(); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("insert_Object call failed on an Any") + BAD_OPERATION insertObjectFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("extract_Object call failed on an Any") + BAD_OPERATION extractObjectIncompatible(); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Fixed type does not match typecode") + BAD_OPERATION fixedNotMatch(); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("Tried to insert Fixed type for non-Fixed typecode") + BAD_OPERATION fixedBadTypecode(@Chain BadKind bk); + + @Log(level = LogLevel.WARNING, id = 23) + @Message("set_exception(Any) called with null args for DSI ServerRequest") + BAD_OPERATION setExceptionCalledNullArgs(); + + @Log(level = LogLevel.WARNING, id = 24) + @Message("set_exception(Any) called with a bad (non-exception) type") + BAD_OPERATION setExceptionCalledBadType(); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("ctx() called out of order for DSI ServerRequest") + BAD_OPERATION contextCalledOutOfOrder(); + + @Log(level = LogLevel.WARNING, id = 26) + @Message("ORB configurator class {0} could not be instantiated") + BAD_OPERATION badOrbConfigurator(@Chain Exception exc, String name); + + @Log(level = LogLevel.WARNING, id = 26) + @Message("ORB configurator class {0} could not be instantiated") + BAD_OPERATION badOrbConfigurator(String name); + + @Log(level = LogLevel.WARNING, id = 27) + @Message("Error in running ORB configurator") + BAD_OPERATION orbConfiguratorError(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 28) + @Message("This ORB instance has been destroyed, so no operations can be " + "performed on it") + BAD_OPERATION orbDestroyed(); + + @Log(level = LogLevel.WARNING, id = 29) + @Message("Negative bound for string TypeCode is illegal") + BAD_OPERATION negativeBounds(); + + @Log(level = LogLevel.WARNING, id = 30) + @Message("Called typecode extract on an uninitialized typecode") + BAD_OPERATION extractNotInitialized(); + + @Log(level = LogLevel.WARNING, id = 31) + @Message("extract_Object failed on an uninitialized Any") + BAD_OPERATION extractObjectFailed(@Chain Exception exc); + + int METHOD_NOT_FOUND_IN_TIE = CorbaExtension.self.getMinorCode(ORBUtilSystemException.class, "methodNotFoundInTie"); + + @Log(level = LogLevel.FINE, id = 32) + @Message("Could not find method named {0} in class {1} in reflective Tie") + BAD_OPERATION methodNotFoundInTie(String arg0, String arg1); + + @Log(level = LogLevel.FINE, id = 33) + @Message("ClassNotFoundException while attempting to load preferred " + "stub named {0}") + @CS(CSValue.MAYBE) + BAD_OPERATION classNotFound1(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.FINE, id = 34) + @Message("ClassNotFoundException while attempting to load alternate " + "stub named {0}") + @CS(CSValue.MAYBE) + BAD_OPERATION classNotFound2(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.FINE, id = 35) + @Message("ClassNotFoundException while attempting to load interface {0}") + @CS(CSValue.MAYBE) + BAD_OPERATION classNotFound3(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 36) + @Message("POA ServantNotActive exception while trying get an " + + "org.omg.CORBA.Portable.Delegate for an org.omg.PortableServer.Servant") + BAD_OPERATION getDelegateServantNotActive(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 37) + @Message("POA WrongPolicy exception while trying get an " + "org.omg.CORBA.Portable.Delegate for an org.omg.PortableServer.Servant") + BAD_OPERATION getDelegateWrongPolicy(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 38) + @Message("Call to StubAdapter.setDelegate did not pass a stub") + BAD_OPERATION setDelegateRequiresStub(); + + @Log(level = LogLevel.WARNING, id = 39) + @Message("Call to StubAdapter.getDelegate did not pass a stub") + BAD_OPERATION getDelegateRequiresStub(); + + @Log(level = LogLevel.WARNING, id = 40) + @Message("Call to StubAdapter.getTypeIds did not pass a stub") + BAD_OPERATION getTypeIdsRequiresStub(); + + @Log(level = LogLevel.WARNING, id = 41) + @Message("Call to StubAdapter.getORB did not pass a stub") + BAD_OPERATION getOrbRequiresStub(); + + @Log(level = LogLevel.WARNING, id = 42) + @Message("Call to StubAdapter.connect did not pass a stub") + BAD_OPERATION connectRequiresStub(); + + @Log(level = LogLevel.WARNING, id = 43) + @Message("Call to StubAdapter.isLocal did not pass a stub") + BAD_OPERATION isLocalRequiresStub(); + + @Log(level = LogLevel.WARNING, id = 44) + @Message("Call to StubAdapter.request did not pass a stub") + BAD_OPERATION requestRequiresStub(); + + @Log(level = LogLevel.WARNING, id = 45) + @Message("Call to StubAdapter.activateTie did not pass a valid Tie") + BAD_OPERATION badActivateTieCall(); + + @Log(level = LogLevel.WARNING, id = 46) + @Message("Bad operation from _invoke: {0}") + BAD_OPERATION badOperationFromInvoke(@Chain Exception exc, String arg0); + + String couldNotAccessStubDelegate = "Could not access StubDelegateImpl"; + + @Log(level = LogLevel.WARNING, id = 47) + @Message(couldNotAccessStubDelegate) + BAD_OPERATION couldNotAccessStubDelegate(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 47) + @Message(couldNotAccessStubDelegate) + BAD_OPERATION couldNotAccessStubDelegate(); + + @Log(level = LogLevel.WARNING, id = 48) + @Message("Could not load interface {0} for creating stub") + BAD_OPERATION couldNotLoadInterface(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 49) + @Message("Could not activate POA from foreign ORB due to " + "AdapterInactive exception in StubAdapter") + BAD_OPERATION adapterInactiveInActivateServant(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 50) + @Message("Could not instantiate stub class {0} for dynamic RMI-IIOP") + BAD_OPERATION couldNotInstantiateStubClass(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 51) + @Message("String expected in OperationFactory.getString()") + BAD_OPERATION stringExpectedInOperation(); + + @Log(level = LogLevel.WARNING, id = 52) + @Message("Object[] expected") + BAD_OPERATION objectArrayExpected(); + + @Log(level = LogLevel.WARNING, id = 53) + @Message("Pair expected") + BAD_OPERATION pairStringStringExpected(); + + @Log(level = LogLevel.WARNING, id = 54) + @Message("Error while attempting to load class {0}") + BAD_OPERATION classActionException(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 55) + @Message("Bad URL {0} in URLAction") + BAD_OPERATION badUrlInAction(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 56) + @Message("Property value {0} is not in the range {1} to {2}") + BAD_OPERATION valueNotInRange(int arg0, int arg1, int arg2); + + @Log(level = LogLevel.WARNING, id = 57) + @Message("Number of token ({0}) and number of actions ({1}) don't match") + BAD_OPERATION numTokensActionsDontMatch(int arg0, int arg1); + + @Log(level = LogLevel.WARNING, id = 58) + @Message("Could not find constructor (String) in class {0}") + BAD_OPERATION exceptionInConvertActionConstructor(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 59) + @Message("Exception in ConvertAction operation") + BAD_OPERATION exceptionInConvertAction(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 60) + @Message("Useless exception on call to Closeable.close()") + BAD_OPERATION ioExceptionOnClose(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 63) + @Message("Class {0} could not be loaded by bundle {1}") + BAD_OPERATION bundleCouldNotLoadClass(@Chain Exception exc, String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 75) + @Message("Exception while handling event on {0}") + BAD_OPERATION exceptionInSelector(@Chain Throwable t, EventHandler arg0); + + @Log(level = LogLevel.FINE, id = 76) + @Message("Ignoring cancelled SelectionKey {0}: key will be removed " + "from Selector") + BAD_OPERATION canceledSelectionKey(SelectionKey arg0); + + @Log(level = LogLevel.FINE, id = 77) + @Message("The OSGi PackageAdmin service is not available") + BAD_OPERATION packageAdminServiceNotAvailable(); + + @Log(level = LogLevel.WARNING, id = 78) + @Message("The ORBImpl.set_parameters method was called more than once") + BAD_OPERATION setParameterCalledAgain(); + + @Log(level = LogLevel.WARNING, id = 81) + @Message("Could not make an instance of Class {0}") + BAD_OPERATION couldNotMakeInstance(@Chain Exception ex, Class arg0); + + @Log(level = LogLevel.WARNING, id = 82) + @Message("Exception in createCopy`") + BAD_OPERATION exceptionInCreateCopy(@Chain Exception exc); + + @Message("Exception in reset method in ClientGroupManager") + @Log(level = LogLevel.FINE, id = 83) BAD_OPERATION exceptionInReset(@Chain Throwable t); - @Message( "No IORUpdate service context present in ClientGroupManager") - @Log( level=LogLevel.FINE, id=84 ) + @Message("No IORUpdate service context present in ClientGroupManager") + @Log(level = LogLevel.FINE, id = 84) BAD_OPERATION noIORUpdateServicateContext(@Chain BAD_PARAM e); - @Message( "Exception in next method in ClientGroupManager") - @Log( level=LogLevel.FINE, id=85 ) + @Message("Exception in next method in ClientGroupManager") + @Log(level = LogLevel.FINE, id = 85) BAD_OPERATION exceptionInNext(@Chain Throwable t); - @Message( "Could not bind initial GIS to name service") - @Log( level=LogLevel.FINE, id=86 ) + @Message("Could not bind initial GIS to name service") + @Log(level = LogLevel.FINE, id = 86) BAD_OPERATION bindNameException(@Chain Exception e); - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Null parameter" ) - @CS( CSValue.MAYBE ) - BAD_PARAM nullParam( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Null parameter" ) - @CS( CSValue.NO ) - BAD_PARAM nullParamNoComplete( ) ; - - @Log( level=LogLevel.FINE, id=2 ) - @Message( "Unable to find value factory" ) - BAD_PARAM unableFindValueFactory( @Chain MARSHAL exc ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Abstract interface derived from non-abstract interface" ) - BAD_PARAM abstractFromNonAbstract( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Error in reading IIOP TaggedProfile" ) - BAD_PARAM invalidTaggedProfile( ) ; - - @Log( level=LogLevel.FINE, id=5 ) - @Message( "Object reference came from foreign ORB" ) - BAD_PARAM objrefFromForeignOrb( ) ; - - int LOCAL_OBJECT_NOT_ALLOWED = CorbaExtension.self.getMinorCode( - ORBUtilSystemException.class, "localObjectNotAllowed" ) ; - - @Log( level=LogLevel.FINE, id=6 ) - @Message( "Local object not allowed" ) - BAD_PARAM localObjectNotAllowed( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "null object reference" ) - BAD_PARAM nullObjectReference( ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Could not load class {0}" ) - BAD_PARAM couldNotLoadClass( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "Malformed URL {0}" ) - BAD_PARAM badUrl( String arg0 ) ; - - String fieldNotFound = "Field {0} not found in parser data object" ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( fieldNotFound ) - BAD_PARAM fieldNotFound( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( fieldNotFound ) - BAD_PARAM fieldNotFound( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "Error in setting field {0} to value {1} in parser data object" ) - BAD_PARAM errorSettingField( @Chain Throwable exc, String arg0, - Object arg1 ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "Bounds error occurred in DII request" ) - BAD_PARAM boundsErrorInDiiRequest( @Chain Bounds b ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Initialization error for persistent server" ) - @CS( CSValue.MAYBE) - BAD_PARAM persistentServerInitError( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "Could not create array for field {0} with " - + "component type {1} and size {2}" ) - BAD_PARAM couldNotCreateArray( @Chain Throwable exc, String arg0, - Class arg1, int arg2 ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "Could not set array for field {0} at index {1} " - + "with component type {2} and size {3} to value {4}" ) - BAD_PARAM couldNotSetArray( @Chain Throwable thr, String arg0, int arg1, - Class arg2, int arg3, Object arg4 ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "Illegal bootstrap operation {0}" ) - BAD_PARAM illegalBootstrapOperation( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "Runtime Exception during bootstrap operation" ) - BAD_PARAM bootstrapRuntimeException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "Exception during bootstrap operation" ) - BAD_PARAM bootstrapException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "Expected a string, but argument was not of String type" ) - BAD_PARAM stringExpected( ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "{0} does not represent a valid kind of typecode" ) - BAD_PARAM invalidTypecodeKind( @Chain Throwable t, int kind ) ; - - @Log( level=LogLevel.WARNING, id=21 ) - @Message( "cannot have a SocketFactory and a ContactInfoList at the " - + "same time" ) - BAD_PARAM socketFactoryAndContactInfoListAtSameTime( ) ; - - @Log( level=LogLevel.WARNING, id=22 ) - @Message( "cannot have Acceptors and a legacy SocketFactory at the " - + "same time" ) - BAD_PARAM acceptorsAndLegacySocketFactoryAtSameTime( ) ; - - @Log( level=LogLevel.WARNING, id=23 ) - @Message( "Reflective POA Servant requires an instance of " - + "org.omg.CORBA_2_3.ORB" ) - BAD_PARAM badOrbForServant( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=24 ) - @Message( "Request partitioning value specified, {0}, " - + "is outside supported range, {1} - {2}" ) - BAD_PARAM invalidRequestPartitioningPolicyValue( int arg0, int arg1, - int arg2 ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "Could not set request partitioning component value to {0}, " - + "valid values are {1} - {2}" ) - BAD_PARAM invalidRequestPartitioningComponentValue( int arg0, - int arg1, int arg2 ) ; - - @Log( level=LogLevel.WARNING, id=26 ) - @Message( "Invalid request partitioning id {0}, " - + "valid values are {1} - {2}" ) - BAD_PARAM invalidRequestPartitioningId( int arg0, int arg1, int arg2 ) ; - - @Log( level=LogLevel.FINE, id=27 ) - @Message( "ORBDynamicStubFactoryFactoryClass property had value {0}, " - + "which could not be loaded by the ORB ClassLoader" ) - BAD_PARAM errorInSettingDynamicStubFactoryFactory( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=28 ) - @Message( "An attempt was made to register a ServiceContext.Factory with an " - + "ID that is already registered" ) - BAD_PARAM registerDuplicateServiceContext( ) ; - - @Log( level=LogLevel.WARNING, id=29 ) - @Message( "CORBA object is not an ObjectImpl in ORB.getIOR" ) - BAD_PARAM notAnObjectImpl( ) ; - - String badTimeoutStringData = "{0} is not a valid positive decimal " - + "integer for {1}" ; - - @Log( level=LogLevel.WARNING, id=30 ) - @Message( badTimeoutStringData ) - BAD_PARAM badTimeoutStringData( @Chain Exception exc, String arg0, - String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=30 ) - @Message( badTimeoutStringData ) - BAD_PARAM badTimeoutStringData( String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=31 ) - @Message( "Timeout data must be 3 or 4 positive decimal " - + "integers separated by :" ) - BAD_PARAM badTimeoutDataLength( ) ; - - @Log( level=LogLevel.WARNING, id=32 ) - @Message( "Load balancing value specified, {0}, is outside " - + "supported range, {1} - {2}" ) - BAD_PARAM invalidLoadBalancingPolicyValue( int arg0, int arg1, int arg2 ) ; - - @Log( level=LogLevel.WARNING, id=33 ) - @Message( "Could not set load balancing component value to {0}, " - + "valid values are {1} - {2}" ) - BAD_PARAM invalidLoadBalancingComponentValue( int arg0, int arg1, int arg2 ) ; - - @Log( level=LogLevel.WARNING, id=34 ) - @Message( "Invalid request partitioning id {0}, valid values are {1} - {2}" ) - BAD_PARAM invalidLoadBalancingId( String arg0, String arg1, String arg2 ) ; - - @Log( level=LogLevel.FINE, id=35 ) - @Message( "CodeBase unavailable on connection {0}" ) - BAD_PARAM codeBaseUnavailable( Connection conn ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "DSI method not called" ) - @CS( CSValue.MAYBE ) - BAD_INV_ORDER dsimethodNotcalled( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "arguments(NVList) called more than once for DSI ServerRequest" ) - BAD_INV_ORDER argumentsCalledMultiple( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "arguments(NVList) called after exceptions set for " - + "DSI ServerRequest" ) - BAD_INV_ORDER argumentsCalledAfterException( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "arguments(NVList) called with null args for DSI ServerRequest" ) - BAD_INV_ORDER argumentsCalledNullArgs( ) ; - - @Log( level=LogLevel.FINE, id=5 ) - @Message( "arguments(NVList) not called for DSI ServerRequest" ) - BAD_INV_ORDER argumentsNotCalled( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "set_result(Any) called more than once for DSI ServerRequest" ) - BAD_INV_ORDER setResultCalledMultiple( ) ; - - @Log( level=LogLevel.FINE, id=7 ) - @Message( "set_result(Any) called exception was set for DSI ServerRequest" ) - BAD_INV_ORDER setResultAfterException( ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "set_result(Any) called with null args for DSI ServerRequest" ) - BAD_INV_ORDER setResultCalledNullArgs( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Foreign to native typecode conversion constructor should not be " - + "called with native typecode" ) - BAD_TYPECODE badRemoteTypecode( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Invoked operation on unresolved recursive TypeCode" ) - BAD_TYPECODE unresolvedRecursiveTypecode( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "Connection failure: socketType: {0}; hostname: {1}; port: {2}" ) - COMM_FAILURE connectFailure( @Chain Throwable t, String arg0, - String arg1, String arg2 ) ; - - String writeErrorSend = "Write error sent" ; - - @Log( level=LogLevel.FINE, id=3 ) - @Message( writeErrorSend ) - @CS( CSValue.MAYBE ) - COMM_FAILURE writeErrorSend( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=3 ) - @Message( writeErrorSend ) - COMM_FAILURE writeErrorSend() ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Get properties error" ) - COMM_FAILURE getPropertiesError( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Bootstrap server is not available" ) - COMM_FAILURE bootstrapServerNotAvail( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Invocation error" ) - COMM_FAILURE invokeError( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "DefaultSocketFactory.createServerSocket only handles " - + "IIOP_CLEAR_TEXT, given {0}" ) - COMM_FAILURE defaultCreateServerSocketGivenNonIiopClearText( String arg0 ) ; - - @Log( level=LogLevel.FINE, id=8 ) - @Message( "Connection abort" ) - COMM_FAILURE connectionAbort( @Chain Throwable thr ) ; - - int CONNECTION_REBIND = CorbaExtension.self.getMinorCode( - ORBUtilSystemException.class, "connectionRebind" ) ; - - String connectionRebind = "Connection rebind" ; - - @Log( level=LogLevel.FINE, id=9 ) - @Message( "Connection rebind" ) - COMM_FAILURE connectionRebind( @Chain Throwable thr ) ; - - @Log( level=LogLevel.FINE, id=9 ) - @Message( "Connection rebind" ) - @CS( CSValue.MAYBE ) - COMM_FAILURE connectionRebindMaybe( @Chain Throwable thr ) ; - - @Log( level=LogLevel.FINE, id=9 ) - @Message( "Connection rebind" ) - COMM_FAILURE connectionRebind( ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "Received a GIOP MessageError, indicating header corruption or " - + "version mismatch" ) - COMM_FAILURE recvMsgError( ) ; - - @Log( level=LogLevel.FINE, id=11 ) - @Message( "IOException received when reading from connection {0}" ) - COMM_FAILURE ioexceptionWhenReadingConnection( @Chain Exception exc, - Connection arg0 ) ; - - @Log( level=LogLevel.FINE, id=12 ) - @Message( "SelectionKey invalid on channel, {0}" ) - COMM_FAILURE selectionKeyInvalid( String arg0 ) ; - - @Log( level=LogLevel.FINE, id=13 ) - @Message( "Unexpected {0} in accept" ) - COMM_FAILURE exceptionInAccept( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.FINE, id=14 ) - @Message( "Unexpected exception, has permissions {0}" ) - COMM_FAILURE securityExceptionInAccept( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "Read of full message failed : bytes requested = {0} " - + "bytes read = {1} max wait time = {2} total time spent waiting = {3}" ) - COMM_FAILURE transportReadTimeoutExceeded( int arg0, int arg1, - int arg2, int arg3 ) ; - - @Log( level=LogLevel.SEVERE, id=16 ) - @Message( "Unable to create IIOP listener on the specified " - + "host {0} and port {1}" ) - COMM_FAILURE createListenerFailed( @Chain Throwable thr, String host, int port ) ; - - @Log( level=LogLevel.FINE, id=17 ) - @Message( "Throwable received in ReadBits" ) - COMM_FAILURE throwableInReadBits( @Chain Throwable exc ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "IOException in accept" ) - COMM_FAILURE oexceptionInAccept( ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "Communications timeout waiting for response. " - + "Exceeded {0} milliseconds" ) - @CS( CSValue.MAYBE ) - COMM_FAILURE communicationsTimeoutWaitingForResponse( long arg0 ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "Communications retry timeout. Exceeded {0} milliseconds" ) - COMM_FAILURE communicationsRetryTimeout( @Chain Exception exc, long arg0 ) ; - - @Log( level=LogLevel.FINE, id=21 ) - @Message( "Ignoring exception while waiting for retry" ) - COMM_FAILURE ignoringExceptionWhileWaitingForRetry( ) ; - - @Log( level=LogLevel.SEVERE, id=22 ) - @Message( "Invalid request for a temporary write selector object for use " - + "on a blocking connection: {0}." ) - COMM_FAILURE temporaryWriteSelectorWithBlockingConnection( - Connection arg0 ) ; - - @Log( level=LogLevel.SEVERE, id=23 ) - @Message( "Invalid request for a temporary read selector object for use " - + "on a blocking connection: {0}." ) - COMM_FAILURE temporaryReadSelectorWithBlockingConnection( - Connection arg0 ) ; - - @Log( level=LogLevel.SEVERE, id=24 ) - @Message( "TemporarySelector's Selector, {0} .select(timeout) must called " - + "with timeout value greater than 0, " - + "called with a timeout value of, {1}." ) - COMM_FAILURE temporarySelectorSelectTimeoutLessThanOne( Selector arg0, - long arg1 ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "Write of message exceeded TCP timeout : max wait time = {0} ms, " - + "total time spent blocked, waiting to write = {1} ms." ) - COMM_FAILURE transportWriteTimeoutExceeded( int arg0, int arg1 ) ; - - @Log( level=LogLevel.SEVERE, id=26 ) - @Message( "Unexpected exception when reading with a temporary selector: " - + "bytes read = {0}, bytes requested = {1}, " - + "time spent waiting = {2} ms, max time to wait = {3}." ) - COMM_FAILURE exceptionWhenReadingWithTemporarySelector( @Chain Exception exc, - int arg0, int arg1, int arg2, int arg3 ) ; - - @Log( level=LogLevel.SEVERE, id=27 ) - @Message( "Unexpected exception when writing with a temporary selector: " - + "bytes written = {0}, total bytes requested to write = {1}, " - + "time spent waiting = {2} ms, max time to wait = {3}." ) - COMM_FAILURE exceptionWhenWritingWithTemporarySelector( @Chain Exception exc, - int arg0, int arg1, int arg2, int arg3 ) ; - - @Log( level=LogLevel.FINE, id=28 ) - @Message( "Throwable received in doOptimizedReadStrategy" ) - COMM_FAILURE throwableInDoOptimizedReadStrategy( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=29 ) - @Message( "Blocking read failed, expected to read additional bytes: " - + "max wait time = {0}ms total time spent waiting = {1}ms" ) - COMM_FAILURE blockingReadTimeout( long arg0, long arg1 ) ; - - @Log( level=LogLevel.FINE, id=30 ) - @Message( "Exception in a blocking read on connection {0} with a " - + "temporary selector" ) - COMM_FAILURE exceptionBlockingReadWithTemporarySelector( @Chain Exception exc, - Connection arg0 ) ; - - @Log( level=LogLevel.SEVERE, id=31 ) - @Message( "Invalid operation, attempting a non-blocking read on blocking " - + "connection, {0}" ) - COMM_FAILURE nonBlockingReadOnBlockingSocketChannel( Connection arg0 ) ; - - @Log( level=LogLevel.FINE, id=32 ) - @Message( "Unexpected exception when canceling SelectionKey and " - + "flushing temporary Selector" ) - COMM_FAILURE unexpectedExceptionCancelAndFlushTempSelector( - @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=33 ) - @Message( "Ignoring request to read a message which exceeds read size " - + "threshold of {0} bytes, requested size was {1}. " - + "Use ORB property -D{2}=<# of bytes> to set threshold higher." ) - COMM_FAILURE maximumReadByteBufferSizeExceeded( int arg0, - int arg1, String arg2 ) ; - - @Log( level=LogLevel.FINE, id=34 ) - @Message( "Received {0}, in a blocking read on connection, {1}, " - + "because an 'end of stream' was detected" ) - COMM_FAILURE blockingReadEndOfStream( @Chain Exception exc, String arg0, - String arg1 ) ; - - @Log( level=LogLevel.FINE, id=35 ) - @Message( "Received {0}, in a non-blocking read on connection, {1}, " - + "because an 'end of stream' was detected" ) - COMM_FAILURE nonblockingReadEndOfStream( String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=36 ) - @Message( "IOException in accept" ) - COMM_FAILURE ioexceptionInAccept( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=36 ) - @Message( "IOException in accept" ) - COMM_FAILURE ioexceptionInAcceptFine( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=37 ) - @Message( "Timeout while reading data in buffer manager" ) - COMM_FAILURE bufferReadManagerTimeout( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "A character did not map to the transmission code set" ) - DATA_CONVERSION badStringifiedIorLen( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Bad stringified IOR" ) - DATA_CONVERSION badStringifiedIor( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Unable to perform resolve_initial_references due to bad host or " - + "port configuration" ) - DATA_CONVERSION badModifier( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Codesets incompatible" ) - DATA_CONVERSION codesetIncompatible( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Illegal hexadecimal digit" ) - DATA_CONVERSION badHexDigit( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Invalid unicode pair detected during code set conversion" ) - DATA_CONVERSION badUnicodePair( @Chain MalformedInputException exc ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Tried to convert bytes to a single java char, " - + "but conversion yielded more than one Java char (Surrogate pair?)" ) - DATA_CONVERSION btcResultMoreThanOneChar( ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Client sent code set service context that we do not support" ) - DATA_CONVERSION badCodesetsFromClient( ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "Char to byte conversion for a CORBA char resulted in more than " - + "one byte" ) - @CS( CSValue.MAYBE ) - DATA_CONVERSION invalidSingleCharCtb( ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "Character to byte conversion did not exactly double number of " - + "chars (GIOP 1.1 only)" ) - @CS( CSValue.MAYBE ) - DATA_CONVERSION badGiop11Ctb( ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "Tried to insert a sequence of length {0} into a " - + "bounded sequence of maximum length {1} in an Any" ) - DATA_CONVERSION badSequenceBounds( int len, int maxLen ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Class {0} is not a subtype of ORBSocketFactory" ) - DATA_CONVERSION illegalSocketFactoryType( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "{0} is not a valid custom socket factory" ) - DATA_CONVERSION badCustomSocketFactory( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "Fragment size {0} is too small: it must be at least {1}" ) - DATA_CONVERSION fragmentSizeMinimum( int arg0, int arg1 ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "Illegal value for fragment size ({0}): must be divisible by {1}" ) - DATA_CONVERSION fragmentSizeDiv( int arg0, int arg1 ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "Could not instantiate ORBInitializer {0}" ) - DATA_CONVERSION orbInitializerFailure( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "orb initializer class {0} is not a subtype of ORBInitializer" ) - DATA_CONVERSION orbInitializerType( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "Bad syntax for ORBInitialReference" ) - DATA_CONVERSION orbInitialreferenceSyntax( ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "Could not instantiate Acceptor {0}" ) - DATA_CONVERSION acceptorInstantiationFailure( @Chain Exception exc, - String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=21 ) - @Message( "Acceptor class {0} is not a subtype of Acceptor" ) - DATA_CONVERSION acceptorInstantiationTypeFailure( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=22 ) - @Message( "Class {0} is not a subtype of CorbaContactInfoListFactory" ) - DATA_CONVERSION illegalContactInfoListFactoryType( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=23 ) - @Message( "{0} is not a valid CorbaContactInfoListFactory" ) - DATA_CONVERSION badContactInfoListFactory( @Chain Exception exc, - String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=24 ) - @Message( "Class {0} is not a subtype of IORToSocketInfo" ) - DATA_CONVERSION illegalIorToSocketInfoType( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "{0} is not a valid custom IORToSocketInfo" ) - DATA_CONVERSION badCustomIorToSocketInfo( @Chain Exception exc, - String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=26 ) - @Message( "Class {0} is not a subtype of IIOPPrimaryToContactInfo" ) - DATA_CONVERSION illegalIiopPrimaryToContactInfoType( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=27 ) - @Message( "{0} is not a valid custom IIOPPrimaryToContactInfo" ) - DATA_CONVERSION badCustomIiopPrimaryToContactInfo( @Chain Exception exc, - String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Bad corbaloc: URL" ) - INV_OBJREF badCorbalocString( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "No profile in IOR" ) - INV_OBJREF noProfilePresent( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Cannot create ORB ID datastore" ) - INITIALIZE cannotCreateOrbidDb( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Cannot read ORB ID datastore" ) - INITIALIZE cannotReadOrbidDb( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Cannot write ORB ID datastore" ) - INITIALIZE cannotWriteOrbidDb( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "legacyGetServerPort called before endpoints initialized" ) - INITIALIZE getServerPortCalledBeforeEndpointsInitialized( ) ; - - @Log( level=LogLevel.FINE, id=5 ) - @Message( "Persistent server port is not set" ) - @CS( CSValue.MAYBE ) - INITIALIZE persistentServerportNotSet( ) ; - - @Log( level=LogLevel.FINE, id=6 ) - @Message( "Persistent server ID is not set" ) - @CS( CSValue.MAYBE ) - INITIALIZE persistentServeridNotSet( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Exception occurred while running a user configurator" ) - INITIALIZE userConfiguratorException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Non-existent ORB ID" ) - INTERNAL nonExistentOrbid( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "No server request dispatcher" ) - INTERNAL noServerSubcontract( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "server request dispatcher template size error" ) - INTERNAL serverScTempSize( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "No client request dispatcher class" ) - INTERNAL noClientScClass( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "No IIOP profile in server request dispatcher" ) - INTERNAL serverScNoIiopProfile( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "getSystemException returned null" ) - INTERNAL getSystemExReturnedNull( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "The repository ID of a user exception had a bad length" ) - INTERNAL peekstringFailed( ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Unable to determine local hostname from " - + "InetAddress.getLocalHost().getHostName()" ) - INTERNAL getLocalHostFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "Bad locate request status in IIOP locate reply" ) - INTERNAL badLocateRequestStatus( ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "Error while stringifying an object reference" ) - INTERNAL stringifyWriteError( ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "IIOP message with bad GIOP 1.0 message type" ) - INTERNAL badGiopRequestType( ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Error in unmarshalling user exception" ) - INTERNAL errorUnmarshalingUserexc( ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "Overflow in RequestDispatcherRegistry" ) - INTERNAL requestdispatcherregistryError( ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "Error in processing a LocationForward" ) - INTERNAL locationforwardError( ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "Wrong client request dispatcher" ) - INTERNAL wrongClientsc( ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "Bad servant in read_Object" ) - INTERNAL badServantReadObject( ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "multiple IIOP profiles not supported" ) - INTERNAL multIiopProfNotSupported( ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "Error in GIOP magic" ) - @CS( CSValue.MAYBE ) - INTERNAL giopMagicError( ) ; - - @Log( level=LogLevel.WARNING, id=21 ) - @Message( "Error in GIOP version" ) - @CS( CSValue.MAYBE ) - INTERNAL giopVersionError( ) ; - - @Log( level=LogLevel.WARNING, id=22 ) - @Message( "Illegal reply status in GIOP reply message" ) - @CS( CSValue.MAYBE ) - INTERNAL illegalReplyStatus( ) ; - - @Log( level=LogLevel.WARNING, id=23 ) - @Message( "Illegal GIOP message type" ) - INTERNAL illegalGiopMsgType( ) ; - - @Log( level=LogLevel.WARNING, id=24 ) - @Message( "Fragmentation not allowed for this message type" ) - @CS( CSValue.MAYBE ) - INTERNAL fragmentationDisallowed( ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "Bad status in the IIOP reply message" ) - INTERNAL badReplystatus( ) ; - - @Log( level=LogLevel.WARNING, id=26 ) - @Message( "character to byte converter failure" ) - INTERNAL ctbConverterFailure( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=27 ) - @Message( "byte to character converter failure" ) - INTERNAL btcConverterFailure( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=28 ) - @Message( "Unsupported wchar encoding: ORB only supports fixed width " - + "UTF-16 encoding" ) - INTERNAL wcharArrayUnsupportedEncoding( ) ; - - @Log( level=LogLevel.WARNING, id=29 ) - @Message( "Illegal target address disposition value" ) - @CS( CSValue.MAYBE ) - INTERNAL illegalTargetAddressDisposition( ) ; - - @Log( level=LogLevel.WARNING, id=30 ) - @Message( "No reply while attempting to get addressing disposition" ) - INTERNAL nullReplyInGetAddrDisposition( ) ; - - @Log( level=LogLevel.WARNING, id=31 ) - @Message( "Invalid GIOP target addressing preference" ) - INTERNAL orbTargetAddrPreferenceInExtractObjectkeyInvalid( ) ; - - @Log( level=LogLevel.WARNING, id=32 ) - @Message( "Invalid isStreamed TCKind {0}" ) - @CS( CSValue.MAYBE ) - INTERNAL invalidIsstreamedTckind( int kind ) ; - - @Log( level=LogLevel.WARNING, id=33 ) - @Message( "Found a JDK 1.3.1 patch level indicator with value less than " - + "JDK 1.3.1_01 value of 1" ) - INTERNAL invalidJdk131PatchLevel( ) ; - - @Log( level=LogLevel.WARNING, id=34 ) - @Message( "Error unmarshalling service context data" ) - @CS( CSValue.MAYBE ) - INTERNAL svcctxUnmarshalError( ) ; - - @Log( level=LogLevel.WARNING, id=35 ) - @Message( "null IOR" ) - INTERNAL nullIor( ) ; - - @Log( level=LogLevel.WARNING, id=36 ) - @Message( "Unsupported GIOP version {0}" ) - INTERNAL unsupportedGiopVersion( GIOPVersion arg0 ) ; - - @Log( level=LogLevel.WARNING, id=37 ) - @Message( "Application exception in special method: should not happen" ) - INTERNAL applicationExceptionInSpecialMethod( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=38 ) - @Message( "Assertion failed: statement not reachable (1)" ) - INTERNAL statementNotReachable1( ) ; - - @Log( level=LogLevel.WARNING, id=39 ) - @Message( "Assertion failed: statement not reachable (2)" ) - INTERNAL statementNotReachable2( ) ; - - @Log( level=LogLevel.WARNING, id=40 ) - @Message( "Assertion failed: statement not reachable (3)" ) - INTERNAL statementNotReachable3( ) ; - - @Log( level=LogLevel.FINE, id=41 ) - @Message( "Assertion failed: statement not reachable (4)" ) - INTERNAL statementNotReachable4( ) ; - - @Log( level=LogLevel.WARNING, id=42 ) - @Message( "Assertion failed: statement not reachable (5)" ) - INTERNAL statementNotReachable5( ) ; - - @Log( level=LogLevel.WARNING, id=43 ) - @Message( "Assertion failed: statement not reachable (6)" ) - INTERNAL statementNotReachable6( ) ; - - @Log( level=LogLevel.WARNING, id=44 ) - @Message( "Unexpected exception while unmarshalling DII user exception" ) - INTERNAL unexpectedDiiException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=45 ) - @Message( "This method should never be called" ) - INTERNAL methodShouldNotBeCalled( ) ; - - @Log( level=LogLevel.WARNING, id=46 ) - @Message( "We do not support cancel request for GIOP 1.1" ) - INTERNAL cancelNotSupported( ) ; - - @Log( level=LogLevel.WARNING, id=47 ) - @Message( "Empty stack exception while calling runServantPostInvoke" ) - INTERNAL emptyStackRunServantPostInvoke( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=48 ) - @Message( "Bad exception typecode" ) - INTERNAL problemWithExceptionTypecode( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=49 ) - @Message( "Illegal Subcontract id {0}" ) - INTERNAL illegalSubcontractId( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=50 ) - @Message( "Bad system exception in locate reply" ) - INTERNAL badSystemExceptionInLocateReply( ) ; - - @Log( level=LogLevel.WARNING, id=51 ) - @Message( "Bad system exception in reply" ) - @CS( CSValue.MAYBE ) - INTERNAL badSystemExceptionInReply( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=52 ) - @Message( "Bad CompletionStatus {0} in locate reply" ) - @CS( CSValue.MAYBE ) - INTERNAL badCompletionStatusInLocateReply( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=53 ) - @Message( "Bad CompletionStatus {0} in reply" ) - @CS( CSValue.MAYBE ) - INTERNAL badCompletionStatusInReply( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=54 ) - @Message( "The BadKind exception should never occur here" ) - INTERNAL badkindCannotOccur( @Chain BadKind bk ) ; - - @Log( level=LogLevel.WARNING, id=54 ) - @Message( "The BadKind exception should never occur here" ) - INTERNAL badkindCannotOccur( ) ; - - @Log( level=LogLevel.WARNING, id=55 ) - @Message( "Could not resolve alias typecode" ) - INTERNAL errorResolvingAlias( ) ; - - @Log( level=LogLevel.WARNING, id=56 ) - @Message( "The long double type is not supported in Java" ) - INTERNAL tkLongDoubleNotSupported( ) ; - - @Log( level=LogLevel.WARNING, id=57 ) - @Message( "Illegal typecode kind" ) - INTERNAL typecodeNotSupported( ) ; - - String boundsCannotOccur = - "Bounds exception cannot occur in this context" ; - - @Log( level=LogLevel.WARNING, id=59 ) - @Message( boundsCannotOccur ) - INTERNAL boundsCannotOccur( @Chain Bounds bd ) ; - - @Log( level=LogLevel.WARNING, id=59 ) - @Message( boundsCannotOccur ) - INTERNAL boundsCannotOccur( @Chain org.omg.CORBA.TypeCodePackage.Bounds bd ) ; - - @Log( level=LogLevel.WARNING, id=61 ) - @Message( "Number of invocations is already zero, but another invocation " - + "has completed" ) - @CS( CSValue.YES ) - INTERNAL numInvocationsAlreadyZero( ) ; - - @Log( level=LogLevel.WARNING, id=62 ) - @Message( "Error in constructing instance of bad server ID handler" ) - INTERNAL errorInitBadserveridhandler( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=63 ) - @Message( "No TOAFactory is available" ) - INTERNAL noToa( ) ; - - @Log( level=LogLevel.WARNING, id=64 ) - @Message( "No POAFactory is available" ) - INTERNAL noPoa( ) ; - - @Log( level=LogLevel.WARNING, id=65 ) - @Message( "Invocation info stack is unexpectedly empty" ) - INTERNAL invocationInfoStackEmpty( ) ; - - @Log( level=LogLevel.WARNING, id=66 ) - @Message( "Empty or null code set string" ) - INTERNAL badCodeSetString( ) ; - - @Log( level=LogLevel.WARNING, id=67 ) - @Message( "Unknown native codeset: {0}" ) - INTERNAL unknownNativeCodeset( int codeset ) ; - - @Log( level=LogLevel.WARNING, id=68 ) - @Message( "Unknown conversion codeset: {0}" ) - INTERNAL unknownConversionCodeSet( int codeset ) ; - - @Log( level=LogLevel.WARNING, id=69 ) - @Message( "Invalid codeset number" ) - INTERNAL invalidCodeSetNumber( @Chain NumberFormatException exc ) ; - - @Log( level=LogLevel.WARNING, id=70 ) - @Message( "Invalid codeset string {0}" ) - INTERNAL invalidCodeSetString( @Chain NoSuchElementException exc, - String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=71 ) - @Message( "Invalid CTB converter {0}" ) - INTERNAL invalidCtbConverterName( Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=72 ) - @Message( "Invalid BTC converter {0}" ) - INTERNAL invalidBtcConverterName( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=73 ) - @Message( "Could not duplicate CDRInputStream" ) - INTERNAL couldNotDuplicateCdrInputStream( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=74 ) - @Message( "BootstrapResolver caught an unexpected ApplicationException" ) - INTERNAL bootstrapApplicationException( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=75 ) - @Message( "Old entry in serialization indirection table has a " - + "different value than the value being added with the same key" ) - INTERNAL duplicateIndirectionOffset( ) ; - - @Log( level=LogLevel.WARNING, id=76 ) - @Message( "GIOP Cancel request contained a bad request ID: the request " - + "ID did not match the request that was to be cancelled" ) - INTERNAL badMessageTypeForCancel( ) ; - - @Log( level=LogLevel.WARNING, id=77 ) - @Message( "Duplicate ExceptionDetailMessage" ) - INTERNAL duplicateExceptionDetailMessage( ) ; - - @Log( level=LogLevel.WARNING, id=78 ) - @Message( "Bad ExceptionDetailMessage ServiceContext type" ) - INTERNAL badExceptionDetailMessageServiceContextType( ) ; - - @Log( level=LogLevel.WARNING, id=79 ) - @Message( "unexpected direct ByteBuffer with non-channel socket" ) - INTERNAL unexpectedDirectByteBufferWithNonChannelSocket( ) ; - - @Log( level=LogLevel.WARNING, id=80 ) - @Message( "unexpected non-direct ByteBuffer with channel socket" ) - INTERNAL unexpectedNonDirectByteBufferWithChannelSocket( ) ; - - @Log( level=LogLevel.WARNING, id=82 ) - @Message( "There should be at least one CorbaContactInfo to try (and fail) " - + "so this error should not be seen." ) - INTERNAL invalidContactInfoListIteratorFailureException( ) ; - - @Log( level=LogLevel.WARNING, id=83 ) - @Message( "Remarshal with nowhere to go" ) - INTERNAL remarshalWithNowhereToGo( ) ; - - @Log( level=LogLevel.WARNING, id=84 ) - @Message( "Exception when sending close connection" ) - INTERNAL exceptionWhenSendingCloseConnection( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=85 ) - @Message( "A reflective tie got an error while invoking method {0} on " - + "class {1}" ) - INTERNAL invocationErrorInReflectiveTie( @Chain Exception exc, - String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=86 ) - @Message( "Could not find or invoke write method on exception " - + "Helper class {0}" ) - INTERNAL badHelperWriteMethod( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=87 ) - @Message( "Could not find or invoke read method on exception " - + "Helper class {0}" ) - INTERNAL badHelperReadMethod( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=88 ) - @Message( "Could not find or invoke id method on exception " - + "Helper class {0}" ) - INTERNAL badHelperIdMethod( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=89 ) - @Message( "Tried to write exception of type {0} that was not declared on " - + "method" ) - INTERNAL writeUndeclaredException( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=90 ) - @Message( "Tried to read undeclared exception with ID {0}" ) - INTERNAL readUndeclaredException( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=91 ) - @Message( "Unable to setSocketFactoryORB" ) - INTERNAL unableToSetSocketFactoryOrb( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=92 ) - @Message( "Unexpected exception occurred where no exception should occur" ) - INTERNAL unexpectedException( @Chain Throwable exc ) ; - - @Log( level=LogLevel.WARNING, id=93 ) - @Message( "No invocation handler available for {0}" ) - INTERNAL noInvocationHandler( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=94 ) - @Message( "{0}: invalid buffer manager strategy for Java serialization" ) - INTERNAL invalidBuffMgrStrategy( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=95 ) - @Message( "Java stream initialization failed" ) - INTERNAL javaStreamInitFailed( ) ; - - @Log( level=LogLevel.WARNING, id=96 ) - @Message( "An ORBVersionServiceContext was already in the " - + "service context list" ) - INTERNAL duplicateOrbVersionServiceContext( ) ; - - @Log( level=LogLevel.WARNING, id=97 ) - @Message( "A SendingContextServiceContext was already in the " - + "service context list" ) - INTERNAL duplicateSendingContextServiceContext( ) ; - - @Log( level=LogLevel.WARNING, id=98 ) - @Message( "No such threadpool or queue {0}" ) - INTERNAL noSuchThreadpoolOrQueue( @Chain Throwable thr, int arg0 ) ; - - @Log( level=LogLevel.FINE, id=99 ) - @Message( "Successfully created IIOP listener on the specified host/port: " - + "{0}/{1}" ) - INTERNAL infoCreateListenerSucceeded( String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=100 ) - @Message( "Exception occurred while closing an IO stream object" ) - INTERNAL ioexceptionDuringStreamClose( @Chain Exception exc ) ; - - @Log( level=LogLevel.SEVERE, id=101 ) - @Message( "Invalid Java serialization version {0}" ) - INTERNAL invalidJavaSerializationVersion( JavaSerializationComponent arg0 ) ; - - @Log( level=LogLevel.WARNING, id=102 ) - @Message( "Object in ServiceContext map was not of the correct type" ) - INTERNAL errorInServiceContextMap( ) ; - - @Log( level=LogLevel.WARNING, id=103 ) - @Message( "The ContactInfoList in a CorbaClientDelegate is NOT a " - + "CorbaContactInfoList" ) - INTERNAL badTypeInDelegate( ) ; - - @Log( level=LogLevel.WARNING, id=117 ) - @Message( "Ignoring parsed fragment message because there is no " - + "fragment queue found for request id {0}." ) - INTERNAL noFragmentQueueForRequestId( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=118 ) - @Message( "Ignoring unexpected InterruptedException while waiting for " - + "next fragment in " - + "CorbaMessageMediatorImpl.resumeOptimizedReadProcessing." ) - INTERNAL resumeOptimizedReadThreadInterrupted( @Chain Exception exc ) ; - - @Log( level=LogLevel.SEVERE, id=119 ) - @Message( "Not allowed to get the integer value for an undefined " - + "CorbaRequestId." ) - INTERNAL undefinedCorbaRequestIdNotAllowed( ) ; - - @Log( level=LogLevel.WARNING, id=120 ) - @Message( "Illegal call to getKey in CacheTable: this instance has no " - + "reverse map" ) - INTERNAL getKeyInvalidInCacheTable( ) ; - - @Log( level=LogLevel.WARNING, id=121 ) - @Message( "TimerManager not initialized: error in constructing TypeCodeImpl" ) - INTERNAL timerManagerNotInitialized( ) ; - - @Log( level=LogLevel.WARNING, id=122 ) - @Message( "TimingPoints instance is null in TypeCodeImpl constructor" ) - INTERNAL timingPointsAreNull( ) ; - - @Log( level=LogLevel.SEVERE, id=123 ) - @Message( "Error in connection event handler caused event loss: may result " - + "in client-side deadlock" ) - INTERNAL lostConnectionEvent( ) ; - - @Log( level=LogLevel.WARNING, id=124 ) - @Message( "SharedCDRContactInfoImpl does not support SocketInfo calls" ) - INTERNAL undefinedSocketinfoOperation( ) ; - - @Log( level=LogLevel.WARNING, id=125 ) - @Message( "Duplicate request ids in response waiting room: " - + "over wrote old one: {0}, with new one: {1}" ) - INTERNAL duplicateRequestIdsInResponseWaitingRoom( String arg0, String arg1 ) ; - - @Log( level=LogLevel.FINE, id=132 ) - @Message( "Exception occurred in reader thread" ) - INTERNAL exceptionInReaderThread( @Chain Throwable thr ) ; - - @Log( level=LogLevel.FINE, id=133 ) - @Message( "Exception occurred in listener thread" ) - INTERNAL exceptionInListenerThread( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=134 ) - @Message( "Exception occurred in handleRequest for a Request message" ) - INTERNAL exceptionInHandleRequestForRequest( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=135 ) - @Message( "Exception occurred in handleRequest for a LocateRequest message" ) - INTERNAL exceptionInHandleRequestForLocateRequest( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=136 ) - @Message( "Could not set ORBData.orbInitializers") + @Log(level = LogLevel.WARNING, id = 1) + @Message("Null parameter") + @CS(CSValue.MAYBE) + BAD_PARAM nullParam(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Null parameter") + @CS(CSValue.NO) + BAD_PARAM nullParamNoComplete(); + + @Log(level = LogLevel.FINE, id = 2) + @Message("Unable to find value factory") + BAD_PARAM unableFindValueFactory(@Chain MARSHAL exc); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Abstract interface derived from non-abstract interface") + BAD_PARAM abstractFromNonAbstract(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Error in reading IIOP TaggedProfile") + BAD_PARAM invalidTaggedProfile(); + + @Log(level = LogLevel.FINE, id = 5) + @Message("Object reference came from foreign ORB") + BAD_PARAM objrefFromForeignOrb(); + + int LOCAL_OBJECT_NOT_ALLOWED = CorbaExtension.self.getMinorCode(ORBUtilSystemException.class, "localObjectNotAllowed"); + + @Log(level = LogLevel.FINE, id = 6) + @Message("Local object not allowed") + BAD_PARAM localObjectNotAllowed(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("null object reference") + BAD_PARAM nullObjectReference(); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Could not load class {0}") + BAD_PARAM couldNotLoadClass(String arg0); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("Malformed URL {0}") + BAD_PARAM badUrl(String arg0); + + String fieldNotFound = "Field {0} not found in parser data object"; + + @Log(level = LogLevel.WARNING, id = 10) + @Message(fieldNotFound) + BAD_PARAM fieldNotFound(String arg0); + + @Log(level = LogLevel.WARNING, id = 10) + @Message(fieldNotFound) + BAD_PARAM fieldNotFound(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("Error in setting field {0} to value {1} in parser data object") + BAD_PARAM errorSettingField(@Chain Throwable exc, String arg0, Object arg1); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("Bounds error occurred in DII request") + BAD_PARAM boundsErrorInDiiRequest(@Chain Bounds b); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Initialization error for persistent server") + @CS(CSValue.MAYBE) + BAD_PARAM persistentServerInitError(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("Could not create array for field {0} with " + "component type {1} and size {2}") + BAD_PARAM couldNotCreateArray(@Chain Throwable exc, String arg0, Class arg1, int arg2); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("Could not set array for field {0} at index {1} " + "with component type {2} and size {3} to value {4}") + BAD_PARAM couldNotSetArray(@Chain Throwable thr, String arg0, int arg1, Class arg2, int arg3, Object arg4); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("Illegal bootstrap operation {0}") + BAD_PARAM illegalBootstrapOperation(String arg0); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("Runtime Exception during bootstrap operation") + BAD_PARAM bootstrapRuntimeException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("Exception during bootstrap operation") + BAD_PARAM bootstrapException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("Expected a string, but argument was not of String type") + BAD_PARAM stringExpected(); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("{0} does not represent a valid kind of typecode") + BAD_PARAM invalidTypecodeKind(@Chain Throwable t, int kind); + + @Log(level = LogLevel.WARNING, id = 21) + @Message("cannot have a SocketFactory and a ContactInfoList at the " + "same time") + BAD_PARAM socketFactoryAndContactInfoListAtSameTime(); + + @Log(level = LogLevel.WARNING, id = 22) + @Message("cannot have Acceptors and a legacy SocketFactory at the " + "same time") + BAD_PARAM acceptorsAndLegacySocketFactoryAtSameTime(); + + @Log(level = LogLevel.WARNING, id = 23) + @Message("Reflective POA Servant requires an instance of " + "org.omg.CORBA_2_3.ORB") + BAD_PARAM badOrbForServant(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 24) + @Message("Request partitioning value specified, {0}, " + "is outside supported range, {1} - {2}") + BAD_PARAM invalidRequestPartitioningPolicyValue(int arg0, int arg1, int arg2); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("Could not set request partitioning component value to {0}, " + "valid values are {1} - {2}") + BAD_PARAM invalidRequestPartitioningComponentValue(int arg0, int arg1, int arg2); + + @Log(level = LogLevel.WARNING, id = 26) + @Message("Invalid request partitioning id {0}, " + "valid values are {1} - {2}") + BAD_PARAM invalidRequestPartitioningId(int arg0, int arg1, int arg2); + + @Log(level = LogLevel.FINE, id = 27) + @Message("ORBDynamicStubFactoryFactoryClass property had value {0}, " + "which could not be loaded by the ORB ClassLoader") + BAD_PARAM errorInSettingDynamicStubFactoryFactory(String arg0); + + @Log(level = LogLevel.WARNING, id = 28) + @Message("An attempt was made to register a ServiceContext.Factory with an " + "ID that is already registered") + BAD_PARAM registerDuplicateServiceContext(); + + @Log(level = LogLevel.WARNING, id = 29) + @Message("CORBA object is not an ObjectImpl in ORB.getIOR") + BAD_PARAM notAnObjectImpl(); + + String badTimeoutStringData = "{0} is not a valid positive decimal " + "integer for {1}"; + + @Log(level = LogLevel.WARNING, id = 30) + @Message(badTimeoutStringData) + BAD_PARAM badTimeoutStringData(@Chain Exception exc, String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 30) + @Message(badTimeoutStringData) + BAD_PARAM badTimeoutStringData(String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 31) + @Message("Timeout data must be 3 or 4 positive decimal " + "integers separated by :") + BAD_PARAM badTimeoutDataLength(); + + @Log(level = LogLevel.WARNING, id = 32) + @Message("Load balancing value specified, {0}, is outside " + "supported range, {1} - {2}") + BAD_PARAM invalidLoadBalancingPolicyValue(int arg0, int arg1, int arg2); + + @Log(level = LogLevel.WARNING, id = 33) + @Message("Could not set load balancing component value to {0}, " + "valid values are {1} - {2}") + BAD_PARAM invalidLoadBalancingComponentValue(int arg0, int arg1, int arg2); + + @Log(level = LogLevel.WARNING, id = 34) + @Message("Invalid request partitioning id {0}, valid values are {1} - {2}") + BAD_PARAM invalidLoadBalancingId(String arg0, String arg1, String arg2); + + @Log(level = LogLevel.FINE, id = 35) + @Message("CodeBase unavailable on connection {0}") + BAD_PARAM codeBaseUnavailable(Connection conn); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("DSI method not called") + @CS(CSValue.MAYBE) + BAD_INV_ORDER dsimethodNotcalled(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("arguments(NVList) called more than once for DSI ServerRequest") + BAD_INV_ORDER argumentsCalledMultiple(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("arguments(NVList) called after exceptions set for " + "DSI ServerRequest") + BAD_INV_ORDER argumentsCalledAfterException(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("arguments(NVList) called with null args for DSI ServerRequest") + BAD_INV_ORDER argumentsCalledNullArgs(); + + @Log(level = LogLevel.FINE, id = 5) + @Message("arguments(NVList) not called for DSI ServerRequest") + BAD_INV_ORDER argumentsNotCalled(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("set_result(Any) called more than once for DSI ServerRequest") + BAD_INV_ORDER setResultCalledMultiple(); + + @Log(level = LogLevel.FINE, id = 7) + @Message("set_result(Any) called exception was set for DSI ServerRequest") + BAD_INV_ORDER setResultAfterException(); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("set_result(Any) called with null args for DSI ServerRequest") + BAD_INV_ORDER setResultCalledNullArgs(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Foreign to native typecode conversion constructor should not be " + "called with native typecode") + BAD_TYPECODE badRemoteTypecode(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Invoked operation on unresolved recursive TypeCode") + BAD_TYPECODE unresolvedRecursiveTypecode(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("Connection failure: socketType: {0}; hostname: {1}; port: {2}") + COMM_FAILURE connectFailure(@Chain Throwable t, String arg0, String arg1, String arg2); + + String writeErrorSend = "Write error sent"; + + @Log(level = LogLevel.FINE, id = 3) + @Message(writeErrorSend) + @CS(CSValue.MAYBE) + COMM_FAILURE writeErrorSend(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 3) + @Message(writeErrorSend) + COMM_FAILURE writeErrorSend(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Get properties error") + COMM_FAILURE getPropertiesError(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Bootstrap server is not available") + COMM_FAILURE bootstrapServerNotAvail(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Invocation error") + COMM_FAILURE invokeError(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("DefaultSocketFactory.createServerSocket only handles " + "IIOP_CLEAR_TEXT, given {0}") + COMM_FAILURE defaultCreateServerSocketGivenNonIiopClearText(String arg0); + + @Log(level = LogLevel.FINE, id = 8) + @Message("Connection abort") + COMM_FAILURE connectionAbort(@Chain Throwable thr); + + int CONNECTION_REBIND = CorbaExtension.self.getMinorCode(ORBUtilSystemException.class, "connectionRebind"); + + String connectionRebind = "Connection rebind"; + + @Log(level = LogLevel.FINE, id = 9) + @Message("Connection rebind") + COMM_FAILURE connectionRebind(@Chain Throwable thr); + + @Log(level = LogLevel.FINE, id = 9) + @Message("Connection rebind") + @CS(CSValue.MAYBE) + COMM_FAILURE connectionRebindMaybe(@Chain Throwable thr); + + @Log(level = LogLevel.FINE, id = 9) + @Message("Connection rebind") + COMM_FAILURE connectionRebind(); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("Received a GIOP MessageError, indicating header corruption or " + "version mismatch") + COMM_FAILURE recvMsgError(); + + @Log(level = LogLevel.FINE, id = 11) + @Message("IOException received when reading from connection {0}") + COMM_FAILURE ioexceptionWhenReadingConnection(@Chain Exception exc, Connection arg0); + + @Log(level = LogLevel.FINE, id = 12) + @Message("SelectionKey invalid on channel, {0}") + COMM_FAILURE selectionKeyInvalid(String arg0); + + @Log(level = LogLevel.FINE, id = 13) + @Message("Unexpected {0} in accept") + COMM_FAILURE exceptionInAccept(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.FINE, id = 14) + @Message("Unexpected exception, has permissions {0}") + COMM_FAILURE securityExceptionInAccept(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("Read of full message failed : bytes requested = {0} " + "bytes read = {1} max wait time = {2} total time spent waiting = {3}") + COMM_FAILURE transportReadTimeoutExceeded(int arg0, int arg1, int arg2, int arg3); + + @Log(level = LogLevel.SEVERE, id = 16) + @Message("Unable to create IIOP listener on the specified " + "host {0} and port {1}") + COMM_FAILURE createListenerFailed(@Chain Throwable thr, String host, int port); + + @Log(level = LogLevel.FINE, id = 17) + @Message("Throwable received in ReadBits") + COMM_FAILURE throwableInReadBits(@Chain Throwable exc); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("IOException in accept") + COMM_FAILURE oexceptionInAccept(); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("Communications timeout waiting for response. " + "Exceeded {0} milliseconds") + @CS(CSValue.MAYBE) + COMM_FAILURE communicationsTimeoutWaitingForResponse(long arg0); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("Communications retry timeout. Exceeded {0} milliseconds") + COMM_FAILURE communicationsRetryTimeout(@Chain Exception exc, long arg0); + + @Log(level = LogLevel.FINE, id = 21) + @Message("Ignoring exception while waiting for retry") + COMM_FAILURE ignoringExceptionWhileWaitingForRetry(); + + @Log(level = LogLevel.SEVERE, id = 22) + @Message("Invalid request for a temporary write selector object for use " + "on a blocking connection: {0}.") + COMM_FAILURE temporaryWriteSelectorWithBlockingConnection(Connection arg0); + + @Log(level = LogLevel.SEVERE, id = 23) + @Message("Invalid request for a temporary read selector object for use " + "on a blocking connection: {0}.") + COMM_FAILURE temporaryReadSelectorWithBlockingConnection(Connection arg0); + + @Log(level = LogLevel.SEVERE, id = 24) + @Message("TemporarySelector's Selector, {0} .select(timeout) must called " + "with timeout value greater than 0, " + + "called with a timeout value of, {1}.") + COMM_FAILURE temporarySelectorSelectTimeoutLessThanOne(Selector arg0, long arg1); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("Write of message exceeded TCP timeout : max wait time = {0} ms, " + "total time spent blocked, waiting to write = {1} ms.") + COMM_FAILURE transportWriteTimeoutExceeded(int arg0, int arg1); + + @Log(level = LogLevel.SEVERE, id = 26) + @Message("Unexpected exception when reading with a temporary selector: " + "bytes read = {0}, bytes requested = {1}, " + + "time spent waiting = {2} ms, max time to wait = {3}.") + COMM_FAILURE exceptionWhenReadingWithTemporarySelector(@Chain Exception exc, int arg0, int arg1, int arg2, int arg3); + + @Log(level = LogLevel.SEVERE, id = 27) + @Message("Unexpected exception when writing with a temporary selector: " + + "bytes written = {0}, total bytes requested to write = {1}, " + "time spent waiting = {2} ms, max time to wait = {3}.") + COMM_FAILURE exceptionWhenWritingWithTemporarySelector(@Chain Exception exc, int arg0, int arg1, int arg2, int arg3); + + @Log(level = LogLevel.FINE, id = 28) + @Message("Throwable received in doOptimizedReadStrategy") + COMM_FAILURE throwableInDoOptimizedReadStrategy(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 29) + @Message("Blocking read failed, expected to read additional bytes: " + "max wait time = {0}ms total time spent waiting = {1}ms") + COMM_FAILURE blockingReadTimeout(long arg0, long arg1); + + @Log(level = LogLevel.FINE, id = 30) + @Message("Exception in a blocking read on connection {0} with a " + "temporary selector") + COMM_FAILURE exceptionBlockingReadWithTemporarySelector(@Chain Exception exc, Connection arg0); + + @Log(level = LogLevel.SEVERE, id = 31) + @Message("Invalid operation, attempting a non-blocking read on blocking " + "connection, {0}") + COMM_FAILURE nonBlockingReadOnBlockingSocketChannel(Connection arg0); + + @Log(level = LogLevel.FINE, id = 32) + @Message("Unexpected exception when canceling SelectionKey and " + "flushing temporary Selector") + COMM_FAILURE unexpectedExceptionCancelAndFlushTempSelector(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 33) + @Message("Ignoring request to read a message which exceeds read size " + "threshold of {0} bytes, requested size was {1}. " + + "Use ORB property -D{2}=<# of bytes> to set threshold higher.") + COMM_FAILURE maximumReadByteBufferSizeExceeded(int arg0, int arg1, String arg2); + + @Log(level = LogLevel.FINE, id = 34) + @Message("Received {0}, in a blocking read on connection, {1}, " + "because an 'end of stream' was detected") + COMM_FAILURE blockingReadEndOfStream(@Chain Exception exc, String arg0, String arg1); + + @Log(level = LogLevel.FINE, id = 35) + @Message("Received {0}, in a non-blocking read on connection, {1}, " + "because an 'end of stream' was detected") + COMM_FAILURE nonblockingReadEndOfStream(String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 36) + @Message("IOException in accept") + COMM_FAILURE ioexceptionInAccept(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 36) + @Message("IOException in accept") + COMM_FAILURE ioexceptionInAcceptFine(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 37) + @Message("Timeout while reading data in buffer manager") + COMM_FAILURE bufferReadManagerTimeout(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("A character did not map to the transmission code set") + DATA_CONVERSION badStringifiedIorLen(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Bad stringified IOR") + DATA_CONVERSION badStringifiedIor(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Unable to perform resolve_initial_references due to bad host or " + "port configuration") + DATA_CONVERSION badModifier(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Codesets incompatible") + DATA_CONVERSION codesetIncompatible(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Illegal hexadecimal digit") + DATA_CONVERSION badHexDigit(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Invalid unicode pair detected during code set conversion") + DATA_CONVERSION badUnicodePair(@Chain MalformedInputException exc); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Tried to convert bytes to a single java char, " + "but conversion yielded more than one Java char (Surrogate pair?)") + DATA_CONVERSION btcResultMoreThanOneChar(); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Client sent code set service context that we do not support") + DATA_CONVERSION badCodesetsFromClient(); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("Char to byte conversion for a CORBA char resulted in more than " + "one byte") + @CS(CSValue.MAYBE) + DATA_CONVERSION invalidSingleCharCtb(); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("Character to byte conversion did not exactly double number of " + "chars (GIOP 1.1 only)") + @CS(CSValue.MAYBE) + DATA_CONVERSION badGiop11Ctb(); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("Tried to insert a sequence of length {0} into a " + "bounded sequence of maximum length {1} in an Any") + DATA_CONVERSION badSequenceBounds(int len, int maxLen); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Class {0} is not a subtype of ORBSocketFactory") + DATA_CONVERSION illegalSocketFactoryType(String arg0); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("{0} is not a valid custom socket factory") + DATA_CONVERSION badCustomSocketFactory(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("Fragment size {0} is too small: it must be at least {1}") + DATA_CONVERSION fragmentSizeMinimum(int arg0, int arg1); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("Illegal value for fragment size ({0}): must be divisible by {1}") + DATA_CONVERSION fragmentSizeDiv(int arg0, int arg1); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("Could not instantiate ORBInitializer {0}") + DATA_CONVERSION orbInitializerFailure(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("orb initializer class {0} is not a subtype of ORBInitializer") + DATA_CONVERSION orbInitializerType(String arg0); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("Bad syntax for ORBInitialReference") + DATA_CONVERSION orbInitialreferenceSyntax(); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("Could not instantiate Acceptor {0}") + DATA_CONVERSION acceptorInstantiationFailure(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 21) + @Message("Acceptor class {0} is not a subtype of Acceptor") + DATA_CONVERSION acceptorInstantiationTypeFailure(String arg0); + + @Log(level = LogLevel.WARNING, id = 22) + @Message("Class {0} is not a subtype of CorbaContactInfoListFactory") + DATA_CONVERSION illegalContactInfoListFactoryType(String arg0); + + @Log(level = LogLevel.WARNING, id = 23) + @Message("{0} is not a valid CorbaContactInfoListFactory") + DATA_CONVERSION badContactInfoListFactory(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 24) + @Message("Class {0} is not a subtype of IORToSocketInfo") + DATA_CONVERSION illegalIorToSocketInfoType(String arg0); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("{0} is not a valid custom IORToSocketInfo") + DATA_CONVERSION badCustomIorToSocketInfo(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 26) + @Message("Class {0} is not a subtype of IIOPPrimaryToContactInfo") + DATA_CONVERSION illegalIiopPrimaryToContactInfoType(String arg0); + + @Log(level = LogLevel.WARNING, id = 27) + @Message("{0} is not a valid custom IIOPPrimaryToContactInfo") + DATA_CONVERSION badCustomIiopPrimaryToContactInfo(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Bad corbaloc: URL") + INV_OBJREF badCorbalocString(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("No profile in IOR") + INV_OBJREF noProfilePresent(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Cannot create ORB ID datastore") + INITIALIZE cannotCreateOrbidDb(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Cannot read ORB ID datastore") + INITIALIZE cannotReadOrbidDb(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Cannot write ORB ID datastore") + INITIALIZE cannotWriteOrbidDb(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("legacyGetServerPort called before endpoints initialized") + INITIALIZE getServerPortCalledBeforeEndpointsInitialized(); + + @Log(level = LogLevel.FINE, id = 5) + @Message("Persistent server port is not set") + @CS(CSValue.MAYBE) + INITIALIZE persistentServerportNotSet(); + + @Log(level = LogLevel.FINE, id = 6) + @Message("Persistent server ID is not set") + @CS(CSValue.MAYBE) + INITIALIZE persistentServeridNotSet(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Exception occurred while running a user configurator") + INITIALIZE userConfiguratorException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Non-existent ORB ID") + INTERNAL nonExistentOrbid(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("No server request dispatcher") + INTERNAL noServerSubcontract(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("server request dispatcher template size error") + INTERNAL serverScTempSize(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("No client request dispatcher class") + INTERNAL noClientScClass(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("No IIOP profile in server request dispatcher") + INTERNAL serverScNoIiopProfile(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("getSystemException returned null") + INTERNAL getSystemExReturnedNull(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("The repository ID of a user exception had a bad length") + INTERNAL peekstringFailed(); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Unable to determine local hostname from " + "InetAddress.getLocalHost().getHostName()") + INTERNAL getLocalHostFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("Bad locate request status in IIOP locate reply") + INTERNAL badLocateRequestStatus(); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("Error while stringifying an object reference") + INTERNAL stringifyWriteError(); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("IIOP message with bad GIOP 1.0 message type") + INTERNAL badGiopRequestType(); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Error in unmarshalling user exception") + INTERNAL errorUnmarshalingUserexc(); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("Overflow in RequestDispatcherRegistry") + INTERNAL requestdispatcherregistryError(); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("Error in processing a LocationForward") + INTERNAL locationforwardError(); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("Wrong client request dispatcher") + INTERNAL wrongClientsc(); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("Bad servant in read_Object") + INTERNAL badServantReadObject(); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("multiple IIOP profiles not supported") + INTERNAL multIiopProfNotSupported(); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("Error in GIOP magic") + @CS(CSValue.MAYBE) + INTERNAL giopMagicError(); + + @Log(level = LogLevel.WARNING, id = 21) + @Message("Error in GIOP version") + @CS(CSValue.MAYBE) + INTERNAL giopVersionError(); + + @Log(level = LogLevel.WARNING, id = 22) + @Message("Illegal reply status in GIOP reply message") + @CS(CSValue.MAYBE) + INTERNAL illegalReplyStatus(); + + @Log(level = LogLevel.WARNING, id = 23) + @Message("Illegal GIOP message type") + INTERNAL illegalGiopMsgType(); + + @Log(level = LogLevel.WARNING, id = 24) + @Message("Fragmentation not allowed for this message type") + @CS(CSValue.MAYBE) + INTERNAL fragmentationDisallowed(); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("Bad status in the IIOP reply message") + INTERNAL badReplystatus(); + + @Log(level = LogLevel.WARNING, id = 26) + @Message("character to byte converter failure") + INTERNAL ctbConverterFailure(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 27) + @Message("byte to character converter failure") + INTERNAL btcConverterFailure(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 28) + @Message("Unsupported wchar encoding: ORB only supports fixed width " + "UTF-16 encoding") + INTERNAL wcharArrayUnsupportedEncoding(); + + @Log(level = LogLevel.WARNING, id = 29) + @Message("Illegal target address disposition value") + @CS(CSValue.MAYBE) + INTERNAL illegalTargetAddressDisposition(); + + @Log(level = LogLevel.WARNING, id = 30) + @Message("No reply while attempting to get addressing disposition") + INTERNAL nullReplyInGetAddrDisposition(); + + @Log(level = LogLevel.WARNING, id = 31) + @Message("Invalid GIOP target addressing preference") + INTERNAL orbTargetAddrPreferenceInExtractObjectkeyInvalid(); + + @Log(level = LogLevel.WARNING, id = 32) + @Message("Invalid isStreamed TCKind {0}") + @CS(CSValue.MAYBE) + INTERNAL invalidIsstreamedTckind(int kind); + + @Log(level = LogLevel.WARNING, id = 33) + @Message("Found a JDK 1.3.1 patch level indicator with value less than " + "JDK 1.3.1_01 value of 1") + INTERNAL invalidJdk131PatchLevel(); + + @Log(level = LogLevel.WARNING, id = 34) + @Message("Error unmarshalling service context data") + @CS(CSValue.MAYBE) + INTERNAL svcctxUnmarshalError(); + + @Log(level = LogLevel.WARNING, id = 35) + @Message("null IOR") + INTERNAL nullIor(); + + @Log(level = LogLevel.WARNING, id = 36) + @Message("Unsupported GIOP version {0}") + INTERNAL unsupportedGiopVersion(GIOPVersion arg0); + + @Log(level = LogLevel.WARNING, id = 37) + @Message("Application exception in special method: should not happen") + INTERNAL applicationExceptionInSpecialMethod(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 38) + @Message("Assertion failed: statement not reachable (1)") + INTERNAL statementNotReachable1(); + + @Log(level = LogLevel.WARNING, id = 39) + @Message("Assertion failed: statement not reachable (2)") + INTERNAL statementNotReachable2(); + + @Log(level = LogLevel.WARNING, id = 40) + @Message("Assertion failed: statement not reachable (3)") + INTERNAL statementNotReachable3(); + + @Log(level = LogLevel.FINE, id = 41) + @Message("Assertion failed: statement not reachable (4)") + INTERNAL statementNotReachable4(); + + @Log(level = LogLevel.WARNING, id = 42) + @Message("Assertion failed: statement not reachable (5)") + INTERNAL statementNotReachable5(); + + @Log(level = LogLevel.WARNING, id = 43) + @Message("Assertion failed: statement not reachable (6)") + INTERNAL statementNotReachable6(); + + @Log(level = LogLevel.WARNING, id = 44) + @Message("Unexpected exception while unmarshalling DII user exception") + INTERNAL unexpectedDiiException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 45) + @Message("This method should never be called") + INTERNAL methodShouldNotBeCalled(); + + @Log(level = LogLevel.WARNING, id = 46) + @Message("We do not support cancel request for GIOP 1.1") + INTERNAL cancelNotSupported(); + + @Log(level = LogLevel.WARNING, id = 47) + @Message("Empty stack exception while calling runServantPostInvoke") + INTERNAL emptyStackRunServantPostInvoke(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 48) + @Message("Bad exception typecode") + INTERNAL problemWithExceptionTypecode(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 49) + @Message("Illegal Subcontract id {0}") + INTERNAL illegalSubcontractId(String arg0); + + @Log(level = LogLevel.WARNING, id = 50) + @Message("Bad system exception in locate reply") + INTERNAL badSystemExceptionInLocateReply(); + + @Log(level = LogLevel.WARNING, id = 51) + @Message("Bad system exception in reply") + @CS(CSValue.MAYBE) + INTERNAL badSystemExceptionInReply(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 52) + @Message("Bad CompletionStatus {0} in locate reply") + @CS(CSValue.MAYBE) + INTERNAL badCompletionStatusInLocateReply(int arg0); + + @Log(level = LogLevel.WARNING, id = 53) + @Message("Bad CompletionStatus {0} in reply") + @CS(CSValue.MAYBE) + INTERNAL badCompletionStatusInReply(int arg0); + + @Log(level = LogLevel.WARNING, id = 54) + @Message("The BadKind exception should never occur here") + INTERNAL badkindCannotOccur(@Chain BadKind bk); + + @Log(level = LogLevel.WARNING, id = 54) + @Message("The BadKind exception should never occur here") + INTERNAL badkindCannotOccur(); + + @Log(level = LogLevel.WARNING, id = 55) + @Message("Could not resolve alias typecode") + INTERNAL errorResolvingAlias(); + + @Log(level = LogLevel.WARNING, id = 56) + @Message("The long double type is not supported in Java") + INTERNAL tkLongDoubleNotSupported(); + + @Log(level = LogLevel.WARNING, id = 57) + @Message("Illegal typecode kind") + INTERNAL typecodeNotSupported(); + + String boundsCannotOccur = "Bounds exception cannot occur in this context"; + + @Log(level = LogLevel.WARNING, id = 59) + @Message(boundsCannotOccur) + INTERNAL boundsCannotOccur(@Chain Bounds bd); + + @Log(level = LogLevel.WARNING, id = 59) + @Message(boundsCannotOccur) + INTERNAL boundsCannotOccur(@Chain org.omg.CORBA.TypeCodePackage.Bounds bd); + + @Log(level = LogLevel.WARNING, id = 61) + @Message("Number of invocations is already zero, but another invocation " + "has completed") + @CS(CSValue.YES) + INTERNAL numInvocationsAlreadyZero(); + + @Log(level = LogLevel.WARNING, id = 62) + @Message("Error in constructing instance of bad server ID handler") + INTERNAL errorInitBadserveridhandler(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 63) + @Message("No TOAFactory is available") + INTERNAL noToa(); + + @Log(level = LogLevel.WARNING, id = 64) + @Message("No POAFactory is available") + INTERNAL noPoa(); + + @Log(level = LogLevel.WARNING, id = 65) + @Message("Invocation info stack is unexpectedly empty") + INTERNAL invocationInfoStackEmpty(); + + @Log(level = LogLevel.WARNING, id = 66) + @Message("Empty or null code set string") + INTERNAL badCodeSetString(); + + @Log(level = LogLevel.WARNING, id = 67) + @Message("Unknown native codeset: {0}") + INTERNAL unknownNativeCodeset(int codeset); + + @Log(level = LogLevel.WARNING, id = 68) + @Message("Unknown conversion codeset: {0}") + INTERNAL unknownConversionCodeSet(int codeset); + + @Log(level = LogLevel.WARNING, id = 69) + @Message("Invalid codeset number") + INTERNAL invalidCodeSetNumber(@Chain NumberFormatException exc); + + @Log(level = LogLevel.WARNING, id = 70) + @Message("Invalid codeset string {0}") + INTERNAL invalidCodeSetString(@Chain NoSuchElementException exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 71) + @Message("Invalid CTB converter {0}") + INTERNAL invalidCtbConverterName(Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 72) + @Message("Invalid BTC converter {0}") + INTERNAL invalidBtcConverterName(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 73) + @Message("Could not duplicate CDRInputStream") + INTERNAL couldNotDuplicateCdrInputStream(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 74) + @Message("BootstrapResolver caught an unexpected ApplicationException") + INTERNAL bootstrapApplicationException(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 75) + @Message("Old entry in serialization indirection table has a " + "different value than the value being added with the same key") + INTERNAL duplicateIndirectionOffset(); + + @Log(level = LogLevel.WARNING, id = 76) + @Message("GIOP Cancel request contained a bad request ID: the request " + "ID did not match the request that was to be cancelled") + INTERNAL badMessageTypeForCancel(); + + @Log(level = LogLevel.WARNING, id = 77) + @Message("Duplicate ExceptionDetailMessage") + INTERNAL duplicateExceptionDetailMessage(); + + @Log(level = LogLevel.WARNING, id = 78) + @Message("Bad ExceptionDetailMessage ServiceContext type") + INTERNAL badExceptionDetailMessageServiceContextType(); + + @Log(level = LogLevel.WARNING, id = 79) + @Message("unexpected direct ByteBuffer with non-channel socket") + INTERNAL unexpectedDirectByteBufferWithNonChannelSocket(); + + @Log(level = LogLevel.WARNING, id = 80) + @Message("unexpected non-direct ByteBuffer with channel socket") + INTERNAL unexpectedNonDirectByteBufferWithChannelSocket(); + + @Log(level = LogLevel.WARNING, id = 82) + @Message("There should be at least one CorbaContactInfo to try (and fail) " + "so this error should not be seen.") + INTERNAL invalidContactInfoListIteratorFailureException(); + + @Log(level = LogLevel.WARNING, id = 83) + @Message("Remarshal with nowhere to go") + INTERNAL remarshalWithNowhereToGo(); + + @Log(level = LogLevel.WARNING, id = 84) + @Message("Exception when sending close connection") + INTERNAL exceptionWhenSendingCloseConnection(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 85) + @Message("A reflective tie got an error while invoking method {0} on " + "class {1}") + INTERNAL invocationErrorInReflectiveTie(@Chain Exception exc, String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 86) + @Message("Could not find or invoke write method on exception " + "Helper class {0}") + INTERNAL badHelperWriteMethod(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 87) + @Message("Could not find or invoke read method on exception " + "Helper class {0}") + INTERNAL badHelperReadMethod(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 88) + @Message("Could not find or invoke id method on exception " + "Helper class {0}") + INTERNAL badHelperIdMethod(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 89) + @Message("Tried to write exception of type {0} that was not declared on " + "method") + INTERNAL writeUndeclaredException(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 90) + @Message("Tried to read undeclared exception with ID {0}") + INTERNAL readUndeclaredException(String arg0); + + @Log(level = LogLevel.WARNING, id = 91) + @Message("Unable to setSocketFactoryORB") + INTERNAL unableToSetSocketFactoryOrb(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 92) + @Message("Unexpected exception occurred where no exception should occur") + INTERNAL unexpectedException(@Chain Throwable exc); + + @Log(level = LogLevel.WARNING, id = 93) + @Message("No invocation handler available for {0}") + INTERNAL noInvocationHandler(String arg0); + + @Log(level = LogLevel.WARNING, id = 94) + @Message("{0}: invalid buffer manager strategy for Java serialization") + INTERNAL invalidBuffMgrStrategy(String arg0); + + @Log(level = LogLevel.WARNING, id = 95) + @Message("Java stream initialization failed") + INTERNAL javaStreamInitFailed(); + + @Log(level = LogLevel.WARNING, id = 96) + @Message("An ORBVersionServiceContext was already in the " + "service context list") + INTERNAL duplicateOrbVersionServiceContext(); + + @Log(level = LogLevel.WARNING, id = 97) + @Message("A SendingContextServiceContext was already in the " + "service context list") + INTERNAL duplicateSendingContextServiceContext(); + + @Log(level = LogLevel.WARNING, id = 98) + @Message("No such threadpool or queue {0}") + INTERNAL noSuchThreadpoolOrQueue(@Chain Throwable thr, int arg0); + + @Log(level = LogLevel.FINE, id = 99) + @Message("Successfully created IIOP listener on the specified host/port: " + "{0}/{1}") + INTERNAL infoCreateListenerSucceeded(String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 100) + @Message("Exception occurred while closing an IO stream object") + INTERNAL ioexceptionDuringStreamClose(@Chain Exception exc); + + @Log(level = LogLevel.SEVERE, id = 101) + @Message("Invalid Java serialization version {0}") + INTERNAL invalidJavaSerializationVersion(JavaSerializationComponent arg0); + + @Log(level = LogLevel.WARNING, id = 102) + @Message("Object in ServiceContext map was not of the correct type") + INTERNAL errorInServiceContextMap(); + + @Log(level = LogLevel.WARNING, id = 103) + @Message("The ContactInfoList in a CorbaClientDelegate is NOT a " + "CorbaContactInfoList") + INTERNAL badTypeInDelegate(); + + @Log(level = LogLevel.WARNING, id = 117) + @Message("Ignoring parsed fragment message because there is no " + "fragment queue found for request id {0}.") + INTERNAL noFragmentQueueForRequestId(String arg0); + + @Log(level = LogLevel.WARNING, id = 118) + @Message("Ignoring unexpected InterruptedException while waiting for " + "next fragment in " + + "CorbaMessageMediatorImpl.resumeOptimizedReadProcessing.") + INTERNAL resumeOptimizedReadThreadInterrupted(@Chain Exception exc); + + @Log(level = LogLevel.SEVERE, id = 119) + @Message("Not allowed to get the integer value for an undefined " + "CorbaRequestId.") + INTERNAL undefinedCorbaRequestIdNotAllowed(); + + @Log(level = LogLevel.WARNING, id = 120) + @Message("Illegal call to getKey in CacheTable: this instance has no " + "reverse map") + INTERNAL getKeyInvalidInCacheTable(); + + @Log(level = LogLevel.WARNING, id = 121) + @Message("TimerManager not initialized: error in constructing TypeCodeImpl") + INTERNAL timerManagerNotInitialized(); + + @Log(level = LogLevel.WARNING, id = 122) + @Message("TimingPoints instance is null in TypeCodeImpl constructor") + INTERNAL timingPointsAreNull(); + + @Log(level = LogLevel.SEVERE, id = 123) + @Message("Error in connection event handler caused event loss: may result " + "in client-side deadlock") + INTERNAL lostConnectionEvent(); + + @Log(level = LogLevel.WARNING, id = 124) + @Message("SharedCDRContactInfoImpl does not support SocketInfo calls") + INTERNAL undefinedSocketinfoOperation(); + + @Log(level = LogLevel.WARNING, id = 125) + @Message("Duplicate request ids in response waiting room: " + "over wrote old one: {0}, with new one: {1}") + INTERNAL duplicateRequestIdsInResponseWaitingRoom(String arg0, String arg1); + + @Log(level = LogLevel.FINE, id = 132) + @Message("Exception occurred in reader thread") + INTERNAL exceptionInReaderThread(@Chain Throwable thr); + + @Log(level = LogLevel.FINE, id = 133) + @Message("Exception occurred in listener thread") + INTERNAL exceptionInListenerThread(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 134) + @Message("Exception occurred in handleRequest for a Request message") + INTERNAL exceptionInHandleRequestForRequest(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 135) + @Message("Exception occurred in handleRequest for a LocateRequest message") + INTERNAL exceptionInHandleRequestForLocateRequest(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 136) + @Message("Could not set ORBData.orbInitializers") INTERNAL couldNotSetOrbInitializer(@Chain Exception exc); - @Log( id=137 ) - @Message( "Connection {0} not null in createMessageMediator" ) - INTERNAL connectionNotNullInCreateMessageMediator( - Connection connection); - - @Log( level=LogLevel.FINE, id=138 ) - @Message( "Old typeId {0} is not the same as the new typeId {1} in " - + "setEffectiveTargetIOR" ) - INTERNAL changedTypeIdOnSetEffectiveTargetIOR( String oldTypeId, - String newTypeId ); - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Data read past end of chunk without closing the chunk" ) - MARSHAL chunkOverflow( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Grow buffer strategy called underflow handler" ) - MARSHAL unexpectedEof( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Error in reading marshalled object" ) - MARSHAL readObjectException( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Character not IOS Latin-1 compliant in marshalling" ) - MARSHAL characterOutofrange( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Exception thrown during result() on ServerRequest" ) - @CS( CSValue.MAYBE ) - MARSHAL dsiResultException( Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "grow() called on IIOPInputStream" ) - MARSHAL iiopinputstreamGrow( ) ; - - @Log( level=LogLevel.FINE, id=7 ) - @Message( "Underflow in BufferManagerReadStream after last fragment in " - + "message" ) - MARSHAL endOfStream( ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Invalid ObjectKey in request header" ) - MARSHAL invalidObjectKey() ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Invalid ObjectKey in request header" ) - MARSHAL invalidObjectKey( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "Unable to locate value class for repository ID {0} " - + "because codebase URL {1} is malformed" ) - @CS( CSValue.MAYBE ) - MARSHAL malformedUrl( @Chain MalformedURLException exc, - String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "Error from readValue on ValueHandler in CDRInputStream" ) - @CS( CSValue.MAYBE ) - MARSHAL valuehandlerReadError( @Chain Error err ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "Exception from readValue on ValueHandler in CDRInputStream" ) - @CS( CSValue.MAYBE ) - MARSHAL valuehandlerReadException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "Bad kind in isCustomType in CDRInputStream" ) - MARSHAL badKind( BadKind bk ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Could not find class {0} in CDRInputStream.readClass" ) - @CS( CSValue.MAYBE ) - MARSHAL cnfeReadClass( @Chain ClassNotFoundException exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "Bad repository ID indirection at index {0}" ) - @CS( CSValue.MAYBE ) - MARSHAL badRepIdIndirection( int index ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "Bad codebase string indirection at index {0}" ) - @CS( CSValue.MAYBE ) - MARSHAL badCodebaseIndirection( int index ) ; - - String unknownCodeSet = "Unknown code set {0} specified by client ORB as a " - + "negotiated code set" ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( unknownCodeSet ) - MARSHAL unknownCodeset( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( unknownCodeSet ) - MARSHAL unknownCodeset( OSFCodeSetRegistry.Entry arg0 ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "Attempt to marshal wide character or string data in GIOP 1.0" ) - @CS( CSValue.MAYBE ) - MARSHAL wcharDataInGiop10( ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "String or wstring with a negative length {0}" ) - @CS( CSValue.MAYBE ) - MARSHAL negativeStringLength( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "CDRInputStream.read_value(null) called, but no repository ID " - + "information on the wire" ) - @CS( CSValue.MAYBE ) - MARSHAL expectedTypeNullAndNoRepId( ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "CDRInputStream.read_value() called, but no repository ID " - + "information on the wire" ) - MARSHAL readValueAndNoRepId( ) ; - - @Log( level=LogLevel.WARNING, id=22 ) - @Message( "Received end tag {0}, which is less than the expected value {1}" ) - @CS( CSValue.MAYBE ) - MARSHAL unexpectedEnclosingValuetype( int endTag, int expected ) ; - - @Log( level=LogLevel.WARNING, id=23 ) - @Message( "Read non-negative end tag {0} at offset {1} (end tags should " - + "always be negative)" ) - @CS( CSValue.MAYBE ) - MARSHAL positiveEndTag( int endTag, int offset ) ; - - @Log( level=LogLevel.WARNING, id=24 ) - @Message( "Out call descriptor is missing" ) - @CS( CSValue.MAYBE ) - MARSHAL nullOutCall( ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "write_Object called with a local object" ) - @CS( CSValue.MAYBE ) - MARSHAL writeLocalObject( ) ; - - @Log( level=LogLevel.WARNING, id=26 ) - @Message( "Tried to insert non-ObjectImpl {0} into an Any via insert_Object" ) - @CS( CSValue.MAYBE ) - MARSHAL badInsertobjParam( String name ) ; - - @Log( level=LogLevel.WARNING, id=27 ) - @Message( "Codebase present in RMI-IIOP stream format version 1 optional " - + "data valuetype header" ) - @CS( CSValue.MAYBE ) - MARSHAL customWrapperWithCodebase( ) ; - - @Log( level=LogLevel.WARNING, id=28 ) - @Message( "Indirection present in RMI-IIOP stream format version 2 optional " - + "data valuetype header" ) - @CS( CSValue.MAYBE ) - MARSHAL customWrapperIndirection( ) ; - - @Log( level=LogLevel.WARNING, id=29 ) - @Message( "0 or more than one repository ID found reading the optional data " - + "valuetype header" ) - @CS( CSValue.MAYBE ) - MARSHAL customWrapperNotSingleRepid( ) ; - - @Log( level=LogLevel.WARNING, id=30 ) - @Message( "Bad valuetag {0} found while reading repository IDs" ) - @CS( CSValue.MAYBE ) - MARSHAL badValueTag( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=31 ) - @Message( "Bad typecode found for custom valuetype" ) - @CS( CSValue.MAYBE ) - MARSHAL badTypecodeForCustomValue( @Chain BadKind bk ) ; - - @Log( level=LogLevel.WARNING, id=32 ) - @Message( "An error occurred using reflection to invoke IDL Helper " - + "write method" ) - @CS( CSValue.MAYBE ) - MARSHAL errorInvokingHelperWrite( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=33 ) - @Message( "A bad digit was found while marshalling an IDL fixed type" ) - @CS( CSValue.MAYBE ) - MARSHAL badDigitInFixed( ) ; - - @Log( level=LogLevel.WARNING, id=34 ) - @Message( "Referenced type of indirect type not marshaled" ) - @CS( CSValue.MAYBE ) - MARSHAL refTypeIndirType( ) ; - - @Log( level=LogLevel.WARNING, id=35 ) - @Message( "Request message reserved bytes has invalid length" ) + @Log(id = 137) + @Message("Connection {0} not null in createMessageMediator") + INTERNAL connectionNotNullInCreateMessageMediator(Connection connection); + + @Log(level = LogLevel.FINE, id = 138) + @Message("Old typeId {0} is not the same as the new typeId {1} in " + "setEffectiveTargetIOR") + INTERNAL changedTypeIdOnSetEffectiveTargetIOR(String oldTypeId, String newTypeId); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Data read past end of chunk without closing the chunk") + MARSHAL chunkOverflow(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Grow buffer strategy called underflow handler") + MARSHAL unexpectedEof(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Error in reading marshalled object") + MARSHAL readObjectException(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Character not IOS Latin-1 compliant in marshalling") + MARSHAL characterOutofrange(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Exception thrown during result() on ServerRequest") + @CS(CSValue.MAYBE) + MARSHAL dsiResultException(Exception exc); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("grow() called on IIOPInputStream") + MARSHAL iiopinputstreamGrow(); + + @Log(level = LogLevel.FINE, id = 7) + @Message("Underflow in BufferManagerReadStream after last fragment in " + "message") + MARSHAL endOfStream(); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Invalid ObjectKey in request header") + MARSHAL invalidObjectKey(); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Invalid ObjectKey in request header") + MARSHAL invalidObjectKey(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("Unable to locate value class for repository ID {0} " + "because codebase URL {1} is malformed") + @CS(CSValue.MAYBE) + MARSHAL malformedUrl(@Chain MalformedURLException exc, String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("Error from readValue on ValueHandler in CDRInputStream") + @CS(CSValue.MAYBE) + MARSHAL valuehandlerReadError(@Chain Error err); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("Exception from readValue on ValueHandler in CDRInputStream") + @CS(CSValue.MAYBE) + MARSHAL valuehandlerReadException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("Bad kind in isCustomType in CDRInputStream") + MARSHAL badKind(BadKind bk); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Could not find class {0} in CDRInputStream.readClass") + @CS(CSValue.MAYBE) + MARSHAL cnfeReadClass(@Chain ClassNotFoundException exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("Bad repository ID indirection at index {0}") @CS(CSValue.MAYBE) - MARSHAL badReservedLength( ) ; - - @Log( level=LogLevel.WARNING, id=36 ) - @Message( "A null object is not allowed here" ) - MARSHAL nullNotAllowed( ) ; - - @Log( level=LogLevel.WARNING, id=38 ) - @Message( "Error in typecode union discriminator" ) - MARSHAL unionDiscriminatorError( ) ; - - @Log( level=LogLevel.WARNING, id=39 ) - @Message( "Cannot marshal a native TypeCode" ) - MARSHAL cannotMarshalNative( ) ; - - @Log( level=LogLevel.WARNING, id=40 ) - @Message( "Cannot marshal an invalid TypeCode kind" ) - MARSHAL cannotMarshalBadTckind( ) ; - - @Log( level=LogLevel.WARNING, id=41 ) - @Message( "Invalid indirection value {0} (>-4): probable stream corruption" ) - MARSHAL invalidIndirection( int arg0 ) ; - - @Log( level=LogLevel.FINE, id=42 ) - @Message( "No type found at indirection {0}: probably stream corruption" ) - MARSHAL indirectionNotFound( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=43 ) - @Message( "Recursive TypeCode not supported by InputStream subtype" ) - MARSHAL recursiveTypecodeError( ) ; - - @Log( level=LogLevel.WARNING, id=44 ) - @Message( "TypeCode is of wrong kind to be simple" ) - MARSHAL invalidSimpleTypecode( ) ; - - @Log( level=LogLevel.WARNING, id=45 ) - @Message( "TypeCode is of wrong kind to be complex" ) - MARSHAL invalidComplexTypecode( ) ; - - @Log( level=LogLevel.WARNING, id=46 ) - @Message( "Cannot marshal typecode of invalid kind" ) - MARSHAL invalidTypecodeKindMarshal( ) ; - - @Log( level=LogLevel.WARNING, id=47 ) - @Message( "Default union branch not expected" ) - MARSHAL unexpectedUnionDefault( ) ; - - @Log( level=LogLevel.WARNING, id=48 ) - @Message( "Illegal discriminator type in union" ) - MARSHAL illegalUnionDiscriminatorType( ) ; - - @Log( level=LogLevel.WARNING, id=49 ) - @Message( "Could not skip over {0} bytes at offset {1}" ) - @CS( CSValue.MAYBE ) - MARSHAL couldNotSkipBytes( int len, int offset ) ; - - @Log( level=LogLevel.WARNING, id=50 ) - @Message( "Incorrect chunk length {0} at offset {1}" ) - MARSHAL badChunkLength( int len, int offset ) ; - - @Log( level=LogLevel.WARNING, id=51 ) - @Message( "Unable to locate array of repository IDs from indirection {0}" ) - MARSHAL unableToLocateRepIdArray( int indir ) ; - - @Log( level=LogLevel.WARNING, id=52 ) - @Message( "Fixed of length {0} in buffer of length {1}" ) - MARSHAL badFixed( short flen, int blen ) ; - - @Log( level=LogLevel.WARNING, id=53 ) - @Message( "Failed to load stub for {0} with class {1}" ) - MARSHAL readObjectLoadClassFailure( String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=54 ) - @Message( "Could not instantiate Helper class {0}" ) - MARSHAL couldNotInstantiateHelper( @Chain InstantiationException exc, - Class arg0 ) ; - - @Log( level=LogLevel.WARNING, id=55 ) - @Message( "Bad ObjectAdapterId for TOA" ) - MARSHAL badToaOaid( ) ; - - @Log( level=LogLevel.WARNING, id=56 ) - @Message( "Could not invoke helper read method for helper {0}" ) - MARSHAL couldNotInvokeHelperReadMethod( @Chain Exception exc, - Class arg0 ) ; - - @Log( level=LogLevel.WARNING, id=57 ) - @Message( "Could not load class {0}" ) - @CS( CSValue.MAYBE ) - MARSHAL couldNotFindClass( String clasName ) ; - - @Log( level=LogLevel.FINE, id=58 ) - @Message( "Error in arguments(NVList) for DSI ServerRequest" ) - MARSHAL badArgumentsNvlist( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=59 ) - @Message( "Could not create stub" ) - MARSHAL stubCreateError( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=60 ) - @Message( "Java serialization exception during {0} operation" ) - MARSHAL javaSerializationException( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=61 ) - @Message( "Could not read exception from UEInfoServiceContext" ) - @CS( CSValue.MAYBE ) - MARSHAL couldNotReadInfo( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=62 ) - @Message( "Could not find enum class {0} while reading an enum" ) - MARSHAL enumClassNotFound( @Chain ClassNotFoundException ex, - String arg0 ) ; - - String proxyClassNotFound = "Could not find Proxy class for " - + "interfaces {0} while reading a proxy" ; - - @Log( level=LogLevel.WARNING, id=63 ) - @Message( proxyClassNotFound ) - MARSHAL proxyClassNotFound( @Chain ClassNotFoundException exc, - List interfaceNames ) ; - - @Log( level=LogLevel.WARNING, id=63 ) - @Message( proxyClassNotFound ) - MARSHAL proxyClassNotFound( @Chain ClassNotFoundException exc, - String interfaceNames ) ; - - @Log( level=LogLevel.WARNING, id=64 ) - @Message( "Unable to load proxy class for interfaces {0} because " - + "codebase URL {1} is malformed" ) - MARSHAL malformedProxyUrl( @Chain MalformedURLException exc, - List interfaceNames, String url ) ; - - @Log( level=LogLevel.WARNING, id=65 ) - @Message( "Unable to create proxy instance because the interface list " - + "specified is empty" ) - MARSHAL emptyProxyInterfaceList( @Chain NullPointerException exc ) ; - - @Log( level=LogLevel.WARNING, id=66 ) - @Message( "Unable to create proxy instance because " - + "Proxy.getProxyClass(..) called with violated restrictions." ) - MARSHAL proxyWithIllegalArgs( @Chain IllegalArgumentException exc ) ; - - @Log( level=LogLevel.WARNING, id=67 ) - @Message( "An instance of class {0} could not be marshalled: the class is " - + "not an instance of java.io.Serializable" ) - MARSHAL objectNotSerializable( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=68 ) - @Message( "Could not unmarshal enum with cls {0}, value {1} using EnumDesc" ) - MARSHAL couldNotUnmarshalEnum( String cls, Serializable value ) ; - - @Log( level=LogLevel.WARNING, id=69 ) - @Message( "Expected String value for enum class {0}, but got value {1}" ) - MARSHAL enumValueNotString( Class cls, Serializable value ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "feature not implemented" ) - NO_IMPLEMENT genericNoImpl( ) ; - - @Log( level=LogLevel.FINE, id=2 ) - @Message( "IDL request context is not implemented" ) - NO_IMPLEMENT contextNotImplemented( ) ; - - @Log( level=LogLevel.FINE, id=3 ) - @Message( "getInterface() is not implemented" ) - NO_IMPLEMENT getinterfaceNotImplemented( ) ; - - @Log( level=LogLevel.FINE, id=4 ) - @Message( "send deferred is not implemented" ) - NO_IMPLEMENT sendDeferredNotimplemented( ) ; - - @Log( level=LogLevel.FINE, id=5 ) - @Message( "IDL type long double is not supported in Java" ) - @CS( CSValue.MAYBE ) - NO_IMPLEMENT longDoubleNotImplemented( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "getAcceptedSocket is not supported for a CorbaAcceptorLazyImpl" ) - NO_IMPLEMENT notSupportedOnLazyAcceptor( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "No server request dispatcher found when dispatching request " - + "to object adapter" ) - OBJ_ADAPTER noServerScInDispatch( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Error in connecting servant to ORB" ) - OBJ_ADAPTER orbConnectError( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=3 ) - @Message( "StubAdapter.getDelegate failed to activate a Servant" ) - OBJ_ADAPTER adapterInactiveInActivation( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Locate response indicated that the object was unknown" ) - OBJECT_NOT_EXIST locateUnknownObject( ) ; - - int BAD_SERVER_ID = CorbaExtension.self.getMinorCode( - ORBUtilSystemException.class, "badServerId" ) ; - - @Log( level=LogLevel.FINE, id=2 ) - @Message( "The server ID in the target object key does not match the " - + "server key expected by the server" ) - OBJECT_NOT_EXIST badServerId( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "No skeleton found in the server that matches the target " - + "object key" ) - OBJECT_NOT_EXIST badSkeleton( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Servant not found" ) - OBJECT_NOT_EXIST servantNotFound( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "No object adapter factory" ) - OBJECT_NOT_EXIST noObjectAdapterFactory( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Bad adapter ID" ) - OBJECT_NOT_EXIST badAdapterId( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Dynamic Any was destroyed: all operations are invalid" ) - OBJECT_NOT_EXIST dynAnyDestroyed( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "Sleep was interrupted in TCP timeouts" ) - TIMEOUT interruptedExceptionInTimeout( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "Request cancelled by exception" ) - TRANSIENT requestCanceled( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Unknown user exception while unmarshalling" ) - @CS( CSValue.MAYBE ) - UNKNOWN unknownCorbaExc( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Unknown user exception thrown by the server - " - + "exception: {0}; message: {1}" ) - @CS( CSValue.MAYBE ) - UNKNOWN runtimeexception( @Chain Throwable exc, String arg0, String arg1 ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Error while marshalling SystemException after DSI-based " - + "invocation" ) + MARSHAL badRepIdIndirection(int index); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("Bad codebase string indirection at index {0}") + @CS(CSValue.MAYBE) + MARSHAL badCodebaseIndirection(int index); + + String unknownCodeSet = "Unknown code set {0} specified by client ORB as a " + "negotiated code set"; + + @Log(level = LogLevel.WARNING, id = 16) + @Message(unknownCodeSet) + MARSHAL unknownCodeset(int arg0); + + @Log(level = LogLevel.WARNING, id = 16) + @Message(unknownCodeSet) + MARSHAL unknownCodeset(OSFCodeSetRegistry.Entry arg0); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("Attempt to marshal wide character or string data in GIOP 1.0") + @CS(CSValue.MAYBE) + MARSHAL wcharDataInGiop10(); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("String or wstring with a negative length {0}") + @CS(CSValue.MAYBE) + MARSHAL negativeStringLength(int arg0); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("CDRInputStream.read_value(null) called, but no repository ID " + "information on the wire") + @CS(CSValue.MAYBE) + MARSHAL expectedTypeNullAndNoRepId(); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("CDRInputStream.read_value() called, but no repository ID " + "information on the wire") + MARSHAL readValueAndNoRepId(); + + @Log(level = LogLevel.WARNING, id = 22) + @Message("Received end tag {0}, which is less than the expected value {1}") + @CS(CSValue.MAYBE) + MARSHAL unexpectedEnclosingValuetype(int endTag, int expected); + + @Log(level = LogLevel.WARNING, id = 23) + @Message("Read non-negative end tag {0} at offset {1} (end tags should " + "always be negative)") + @CS(CSValue.MAYBE) + MARSHAL positiveEndTag(int endTag, int offset); + + @Log(level = LogLevel.WARNING, id = 24) + @Message("Out call descriptor is missing") + @CS(CSValue.MAYBE) + MARSHAL nullOutCall(); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("write_Object called with a local object") + @CS(CSValue.MAYBE) + MARSHAL writeLocalObject(); + + @Log(level = LogLevel.WARNING, id = 26) + @Message("Tried to insert non-ObjectImpl {0} into an Any via insert_Object") @CS(CSValue.MAYBE) - UNKNOWN unknownDsiSysex( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Error while unmarshalling SystemException" ) + MARSHAL badInsertobjParam(String name); + + @Log(level = LogLevel.WARNING, id = 27) + @Message("Codebase present in RMI-IIOP stream format version 1 optional " + "data valuetype header") + @CS(CSValue.MAYBE) + MARSHAL customWrapperWithCodebase(); + + @Log(level = LogLevel.WARNING, id = 28) + @Message("Indirection present in RMI-IIOP stream format version 2 optional " + "data valuetype header") @CS(CSValue.MAYBE) - UNKNOWN unknownSysex( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "InterfaceDef object of wrong type returned by server" ) + MARSHAL customWrapperIndirection(); + + @Log(level = LogLevel.WARNING, id = 29) + @Message("0 or more than one repository ID found reading the optional data " + "valuetype header") @CS(CSValue.MAYBE) - UNKNOWN wrongInterfaceDef( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "org.omg.CORBA._InterfaceDefStub class not available" ) - UNKNOWN noInterfaceDefStub( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=7 ) - @Message( "UnknownException in dispatch" ) - @CS( CSValue.MAYBE ) - UNKNOWN unknownExceptionInDispatch( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=8 ) - @Message( "MARSHAL exception while trying to get value factory") + MARSHAL customWrapperNotSingleRepid(); + + @Log(level = LogLevel.WARNING, id = 30) + @Message("Bad valuetag {0} found while reading repository IDs") + @CS(CSValue.MAYBE) + MARSHAL badValueTag(String arg0); + + @Log(level = LogLevel.WARNING, id = 31) + @Message("Bad typecode found for custom valuetype") + @CS(CSValue.MAYBE) + MARSHAL badTypecodeForCustomValue(@Chain BadKind bk); + + @Log(level = LogLevel.WARNING, id = 32) + @Message("An error occurred using reflection to invoke IDL Helper " + "write method") + @CS(CSValue.MAYBE) + MARSHAL errorInvokingHelperWrite(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 33) + @Message("A bad digit was found while marshalling an IDL fixed type") + @CS(CSValue.MAYBE) + MARSHAL badDigitInFixed(); + + @Log(level = LogLevel.WARNING, id = 34) + @Message("Referenced type of indirect type not marshaled") + @CS(CSValue.MAYBE) + MARSHAL refTypeIndirType(); + + @Log(level = LogLevel.WARNING, id = 35) + @Message("Request message reserved bytes has invalid length") + @CS(CSValue.MAYBE) + MARSHAL badReservedLength(); + + @Log(level = LogLevel.WARNING, id = 36) + @Message("A null object is not allowed here") + MARSHAL nullNotAllowed(); + + @Log(level = LogLevel.WARNING, id = 38) + @Message("Error in typecode union discriminator") + MARSHAL unionDiscriminatorError(); + + @Log(level = LogLevel.WARNING, id = 39) + @Message("Cannot marshal a native TypeCode") + MARSHAL cannotMarshalNative(); + + @Log(level = LogLevel.WARNING, id = 40) + @Message("Cannot marshal an invalid TypeCode kind") + MARSHAL cannotMarshalBadTckind(); + + @Log(level = LogLevel.WARNING, id = 41) + @Message("Invalid indirection value {0} (>-4): probable stream corruption") + MARSHAL invalidIndirection(int arg0); + + @Log(level = LogLevel.FINE, id = 42) + @Message("No type found at indirection {0}: probably stream corruption") + MARSHAL indirectionNotFound(int arg0); + + @Log(level = LogLevel.WARNING, id = 43) + @Message("Recursive TypeCode not supported by InputStream subtype") + MARSHAL recursiveTypecodeError(); + + @Log(level = LogLevel.WARNING, id = 44) + @Message("TypeCode is of wrong kind to be simple") + MARSHAL invalidSimpleTypecode(); + + @Log(level = LogLevel.WARNING, id = 45) + @Message("TypeCode is of wrong kind to be complex") + MARSHAL invalidComplexTypecode(); + + @Log(level = LogLevel.WARNING, id = 46) + @Message("Cannot marshal typecode of invalid kind") + MARSHAL invalidTypecodeKindMarshal(); + + @Log(level = LogLevel.WARNING, id = 47) + @Message("Default union branch not expected") + MARSHAL unexpectedUnionDefault(); + + @Log(level = LogLevel.WARNING, id = 48) + @Message("Illegal discriminator type in union") + MARSHAL illegalUnionDiscriminatorType(); + + @Log(level = LogLevel.WARNING, id = 49) + @Message("Could not skip over {0} bytes at offset {1}") + @CS(CSValue.MAYBE) + MARSHAL couldNotSkipBytes(int len, int offset); + + @Log(level = LogLevel.WARNING, id = 50) + @Message("Incorrect chunk length {0} at offset {1}") + MARSHAL badChunkLength(int len, int offset); + + @Log(level = LogLevel.WARNING, id = 51) + @Message("Unable to locate array of repository IDs from indirection {0}") + MARSHAL unableToLocateRepIdArray(int indir); + + @Log(level = LogLevel.WARNING, id = 52) + @Message("Fixed of length {0} in buffer of length {1}") + MARSHAL badFixed(short flen, int blen); + + @Log(level = LogLevel.WARNING, id = 53) + @Message("Failed to load stub for {0} with class {1}") + MARSHAL readObjectLoadClassFailure(String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 54) + @Message("Could not instantiate Helper class {0}") + MARSHAL couldNotInstantiateHelper(@Chain InstantiationException exc, Class arg0); + + @Log(level = LogLevel.WARNING, id = 55) + @Message("Bad ObjectAdapterId for TOA") + MARSHAL badToaOaid(); + + @Log(level = LogLevel.WARNING, id = 56) + @Message("Could not invoke helper read method for helper {0}") + MARSHAL couldNotInvokeHelperReadMethod(@Chain Exception exc, Class arg0); + + @Log(level = LogLevel.WARNING, id = 57) + @Message("Could not load class {0}") + @CS(CSValue.MAYBE) + MARSHAL couldNotFindClass(String clasName); + + @Log(level = LogLevel.FINE, id = 58) + @Message("Error in arguments(NVList) for DSI ServerRequest") + MARSHAL badArgumentsNvlist(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 59) + @Message("Could not create stub") + MARSHAL stubCreateError(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 60) + @Message("Java serialization exception during {0} operation") + MARSHAL javaSerializationException(String arg0); + + @Log(level = LogLevel.WARNING, id = 61) + @Message("Could not read exception from UEInfoServiceContext") + @CS(CSValue.MAYBE) + MARSHAL couldNotReadInfo(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 62) + @Message("Could not find enum class {0} while reading an enum") + MARSHAL enumClassNotFound(@Chain ClassNotFoundException ex, String arg0); + + String proxyClassNotFound = "Could not find Proxy class for " + "interfaces {0} while reading a proxy"; + + @Log(level = LogLevel.WARNING, id = 63) + @Message(proxyClassNotFound) + MARSHAL proxyClassNotFound(@Chain ClassNotFoundException exc, List interfaceNames); + + @Log(level = LogLevel.WARNING, id = 63) + @Message(proxyClassNotFound) + MARSHAL proxyClassNotFound(@Chain ClassNotFoundException exc, String interfaceNames); + + @Log(level = LogLevel.WARNING, id = 64) + @Message("Unable to load proxy class for interfaces {0} because " + "codebase URL {1} is malformed") + MARSHAL malformedProxyUrl(@Chain MalformedURLException exc, List interfaceNames, String url); + + @Log(level = LogLevel.WARNING, id = 65) + @Message("Unable to create proxy instance because the interface list " + "specified is empty") + MARSHAL emptyProxyInterfaceList(@Chain NullPointerException exc); + + @Log(level = LogLevel.WARNING, id = 66) + @Message("Unable to create proxy instance because " + "Proxy.getProxyClass(..) called with violated restrictions.") + MARSHAL proxyWithIllegalArgs(@Chain IllegalArgumentException exc); + + @Log(level = LogLevel.WARNING, id = 67) + @Message("An instance of class {0} could not be marshalled: the class is " + "not an instance of java.io.Serializable") + MARSHAL objectNotSerializable(String arg0); + + @Log(level = LogLevel.WARNING, id = 68) + @Message("Could not unmarshal enum with cls {0}, value {1} using EnumDesc") + MARSHAL couldNotUnmarshalEnum(String cls, Serializable value); + + @Log(level = LogLevel.WARNING, id = 69) + @Message("Expected String value for enum class {0}, but got value {1}") + MARSHAL enumValueNotString(Class cls, Serializable value); + + @Log(level = LogLevel.FINE, id = 1) + @Message("feature not implemented") + NO_IMPLEMENT genericNoImpl(); + + @Log(level = LogLevel.FINE, id = 2) + @Message("IDL request context is not implemented") + NO_IMPLEMENT contextNotImplemented(); + + @Log(level = LogLevel.FINE, id = 3) + @Message("getInterface() is not implemented") + NO_IMPLEMENT getinterfaceNotImplemented(); + + @Log(level = LogLevel.FINE, id = 4) + @Message("send deferred is not implemented") + NO_IMPLEMENT sendDeferredNotimplemented(); + + @Log(level = LogLevel.FINE, id = 5) + @Message("IDL type long double is not supported in Java") + @CS(CSValue.MAYBE) + NO_IMPLEMENT longDoubleNotImplemented(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("getAcceptedSocket is not supported for a CorbaAcceptorLazyImpl") + NO_IMPLEMENT notSupportedOnLazyAcceptor(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("No server request dispatcher found when dispatching request " + "to object adapter") + OBJ_ADAPTER noServerScInDispatch(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Error in connecting servant to ORB") + OBJ_ADAPTER orbConnectError(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 3) + @Message("StubAdapter.getDelegate failed to activate a Servant") + OBJ_ADAPTER adapterInactiveInActivation(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Locate response indicated that the object was unknown") + OBJECT_NOT_EXIST locateUnknownObject(); + + int BAD_SERVER_ID = CorbaExtension.self.getMinorCode(ORBUtilSystemException.class, "badServerId"); + + @Log(level = LogLevel.FINE, id = 2) + @Message("The server ID in the target object key does not match the " + "server key expected by the server") + OBJECT_NOT_EXIST badServerId(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("No skeleton found in the server that matches the target " + "object key") + OBJECT_NOT_EXIST badSkeleton(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Servant not found") + OBJECT_NOT_EXIST servantNotFound(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("No object adapter factory") + OBJECT_NOT_EXIST noObjectAdapterFactory(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Bad adapter ID") + OBJECT_NOT_EXIST badAdapterId(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Dynamic Any was destroyed: all operations are invalid") + OBJECT_NOT_EXIST dynAnyDestroyed(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("Sleep was interrupted in TCP timeouts") + TIMEOUT interruptedExceptionInTimeout(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("Request cancelled by exception") + TRANSIENT requestCanceled(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Unknown user exception while unmarshalling") + @CS(CSValue.MAYBE) + UNKNOWN unknownCorbaExc(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Unknown user exception thrown by the server - " + "exception: {0}; message: {1}") + @CS(CSValue.MAYBE) + UNKNOWN runtimeexception(@Chain Throwable exc, String arg0, String arg1); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Error while marshalling SystemException after DSI-based " + "invocation") + @CS(CSValue.MAYBE) + UNKNOWN unknownDsiSysex(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Error while unmarshalling SystemException") + @CS(CSValue.MAYBE) + UNKNOWN unknownSysex(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("InterfaceDef object of wrong type returned by server") + @CS(CSValue.MAYBE) + UNKNOWN wrongInterfaceDef(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("org.omg.CORBA._InterfaceDefStub class not available") + UNKNOWN noInterfaceDefStub(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 7) + @Message("UnknownException in dispatch") + @CS(CSValue.MAYBE) + UNKNOWN unknownExceptionInDispatch(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 8) + @Message("MARSHAL exception while trying to get value factory") UNKNOWN marshalErrorInReadIDLValue(@Chain MARSHAL marshal); - @Message( "Exception in post_init in VirtualAddressAgentImpl") - @Log( level=LogLevel.FINE, id=9 ) - UNKNOWN vaaErrorInPostInit( @Chain Exception exc); + @Message("Exception in post_init in VirtualAddressAgentImpl") + @Log(level = LogLevel.FINE, id = 9) + UNKNOWN vaaErrorInPostInit(@Chain Exception exc); - @Message( "Could not set tcpNoDelay on socket") - @Log( level=LogLevel.FINE, id=10 ) + @Message("Could not set tcpNoDelay on socket") + @Log(level = LogLevel.FINE, id = 10) UNKNOWN couldNotSetTcpNoDelay(@Chain Exception e); - @Message( "Exception in purgeCalls") - @Log( level=LogLevel.FINE, id=11 ) + @Message("Exception in purgeCalls") + @Log(level = LogLevel.FINE, id = 11) UNKNOWN exceptionInPurgeCalls(@Chain Exception ex); - @Message( "Exception while closing socket") - @Log( level=LogLevel.FINE, id=12 ) + @Message("Exception while closing socket") + @Log(level = LogLevel.FINE, id = 12) UNKNOWN exceptionOnClose(IOException e); - @Message( "Interrupted while waiting in writeLock on OPENING state") - @Log( level=LogLevel.FINE, id=13 ) + @Message("Interrupted while waiting in writeLock on OPENING state") + @Log(level = LogLevel.FINE, id = 13) UNKNOWN openingWaitInterrupted(InterruptedException ie); - @Message( "Interrupted while waiting in writeLock on ESTABLISHED state") - @Log( level=LogLevel.FINE, id=14 ) + @Message("Interrupted while waiting in writeLock on ESTABLISHED state") + @Log(level = LogLevel.FINE, id = 14) UNKNOWN establishedWaitInterrupted(InterruptedException ie); - @Message( "Exception while creating Typecode from native representation") - @Log( level=LogLevel.FINE, id=15 ) + @Message("Exception while creating Typecode from native representation") + @Log(level = LogLevel.FINE, id = 15) UNKNOWN exceptionOnCreatingTypecode(@Chain Exception e); - @Message( "Exception in Typecode equals") - @Log( level=LogLevel.FINE, id=16 ) + @Message("Exception in Typecode equals") + @Log(level = LogLevel.FINE, id = 16) UNKNOWN exceptionInTypecodeEquals(@Chain Exception e); - @Message( "Remarshal exception in bootstrap resolver") - @Log( level=LogLevel.FINE, id=17 ) + @Message("Remarshal exception in bootstrap resolver") + @Log(level = LogLevel.FINE, id = 17) UNKNOWN bootstrapRemarshalException(@Chain RemarshalException e); - @Message( "Could not initialize initial GIS") - @Log( level=LogLevel.FINE, id=18 ) + @Message("Could not initialize initial GIS") + @Log(level = LogLevel.FINE, id = 18) UNKNOWN couldNotInitializeInitialGIS(@Chain Exception exc); - @Log( level=LogLevel.FINE, id=19 ) - @Message( "No CSIv2TaggedComponentHandler available from initial references") + @Log(level = LogLevel.FINE, id = 19) + @Message("No CSIv2TaggedComponentHandler available from initial references") UNKNOWN noCSIV2Handler(@Chain InvalidName e); - @Log( level=LogLevel.FINE, id=20 ) - @Message( "Error in ServerGroupManager") + @Log(level = LogLevel.FINE, id = 20) + @Message("Error in ServerGroupManager") UNKNOWN serverGroupManagerException(@Chain Exception e); - @Log( level=LogLevel.FINE, id=21 ) - @Message( "ThreadStateValidator {0} threw an exception") + @Log(level = LogLevel.FINE, id = 21) + @Message("ThreadStateValidator {0} threw an exception") UNKNOWN threadStateValidatorException(Runnable run, @Chain Throwable thr); - @Log( level=LogLevel.FINE, id=22 ) - @Message( "Bad GIOP 1.1 cancel request received") + @Log(level = LogLevel.FINE, id = 22) + @Message("Bad GIOP 1.1 cancel request received") UNKNOWN bad1_1CancelRequestReceived(); - @Log( level=LogLevel.FINE, id=23 ) - @Message( "Cancel request with id 0 received") + @Log(level = LogLevel.FINE, id = 23) + @Message("Cancel request with id 0 received") UNKNOWN cancelRequestWithId0(); - @Log( level=LogLevel.FINE, id=24 ) - @Message( "Bad cancel request received") + @Log(level = LogLevel.FINE, id = 24) + @Message("Bad cancel request received") UNKNOWN badCancelRequest(); - @Log( level=LogLevel.FINE, id=25 ) - @Message( "Class {0} not found in remote codebase {1}") + @Log(level = LogLevel.FINE, id = 25) + @Message("Class {0} not found in remote codebase {1}") UNKNOWN classNotFoundInCodebase(String className, String remoteCodebase); - @Log( level=LogLevel.FINE, id=26 ) - @Message( "Class {0} not found in JDKClassLoader") - UNKNOWN classNotFoundInJDKClassLoader(String className, - @Chain ClassNotFoundException e); + @Log(level = LogLevel.FINE, id = 26) + @Message("Class {0} not found in JDKClassLoader") + UNKNOWN classNotFoundInJDKClassLoader(String className, @Chain ClassNotFoundException e); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/POASystemException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/POASystemException.java index 9413a2098..744be0350 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/POASystemException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/POASystemException.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logging ; +package com.sun.corba.ee.spi.logging; import org.glassfish.pfl.basic.logex.Chain; import org.glassfish.pfl.basic.logex.ExceptionWrapper; @@ -28,8 +28,8 @@ import com.sun.corba.ee.spi.logex.corba.CS; import com.sun.corba.ee.spi.logex.corba.CSValue; -import com.sun.corba.ee.spi.logex.corba.ORBException ; -import com.sun.corba.ee.spi.logex.corba.CorbaExtension ; +import com.sun.corba.ee.spi.logex.corba.ORBException; +import com.sun.corba.ee.spi.logex.corba.CorbaExtension; import org.omg.CORBA.BAD_INV_ORDER; import org.omg.CORBA.BAD_OPERATION; @@ -42,398 +42,386 @@ import org.omg.CORBA.TRANSIENT; import org.omg.CORBA.UNKNOWN; -@ExceptionWrapper( idPrefix="IOP" ) -@ORBException( omgException=false, group=CorbaExtension.POAGroup ) +@ExceptionWrapper(idPrefix = "IOP") +@ORBException(omgException = false, group = CorbaExtension.POAGroup) public interface POASystemException { - POASystemException self = WrapperGenerator.makeWrapper( - POASystemException.class, CorbaExtension.self ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Servant Manager already set" ) - BAD_INV_ORDER servantManagerAlreadySet( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Request to wait for POA destruction while servicing request " - + "would deadlock" ) - BAD_INV_ORDER destroyDeadlock( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Bad operation on servant ORB???" ) - BAD_OPERATION servantOrb( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Bad Servant???" ) - BAD_OPERATION badServant( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Illegal Forward Request???" ) - BAD_OPERATION illegalForwardRequest( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "setDaemon() failed in creating destroy thread" ) - BAD_OPERATION couldNotSetDaemon( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Bad transaction context" ) - BAD_PARAM badTransactionContext( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Bad repository id" ) - BAD_PARAM badRepositoryId( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Null repository id" ) - BAD_PARAM nullRepositoryId( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "invoke setup???" ) - INTERNAL invokesetup( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "bad local reply status???" ) - INTERNAL badLocalreplystatus( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "persistent serverport error???" ) - INTERNAL persistentServerportError() ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "servant dispatch???" ) - INTERNAL servantDispatch( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "wrong client request dispatcher???" ) - INTERNAL wrongClientsc( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "can't clone template???" ) - INTERNAL cantCloneTemplate( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "POACurrent stack is unbalanced" ) - INTERNAL poacurrentUnbalancedStack( @Chain Exception ex ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Null field in POACurrent" ) - @CS( CSValue.MAYBE ) - INTERNAL poacurrentNullField( ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "POA internalGetServant error" ) - INTERNAL poaInternalGetServantError( ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "First Object Adapter name is {0}, should be RootPOA" ) - INTERNAL makeFactoryNotPoa( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "Duplicate ORB version service context" ) - INTERNAL duplicateOrbVersionSc( ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "preinvoke clone error" ) - INTERNAL preinvokeCloneError( ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "preinvoke POA destroyed" ) - INTERNAL preinvokePoaDestroyed( ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "Bad dispatch policy for RETAIN policy in " - + "POAPolicyMediatorFactory" ) - INTERNAL pmfCreateRetain( ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "Bad dispatch policy for NON_RETAIN policy in " - + "POAPolicyMediatorFactory" ) - INTERNAL pmfCreateNonRetain( ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "Inconsistent policy in PolicyMediator" ) - INTERNAL policyMediatorBadPolicyInFactory( ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "ObjectAlreadyActive in servantToId" ) - INTERNAL servantToIdOaa( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "ServantAlreadyActive in servantToId" ) - INTERNAL servantToIdSaa(@Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "WrongPolicy in servantToId" ) - INTERNAL servantToIdWp( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "Can't resolve root POA" ) - INTERNAL cantResolveRootPoa( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=21 ) - @Message( "Call made to local client request dispatcher with non-local " - + "servant" ) - INTERNAL servantMustBeLocal( ) ; - - @Log( level=LogLevel.WARNING, id=22 ) - @Message( "IOR does not have any profiles" ) - INTERNAL noProfilesInIor( ) ; - - @Log( level=LogLevel.WARNING, id=23 ) - @Message( "Tried to decrement AOMEntry counter that is already 0" ) - INTERNAL aomEntryDecZero( ) ; - - @Log( level=LogLevel.WARNING, id=24 ) - @Message( "Tried to add a POA to an inactive POAManager" ) - @CS( CSValue.MAYBE ) - INTERNAL addPoaInactive( ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "POA tried to make an illegal state transition" ) - INTERNAL illegalPoaStateTrans( ) ; - - @Log( level=LogLevel.WARNING, id=26 ) - @Message( "Unexpected exception in POA {0}" ) - INTERNAL unexpectedException( @Chain Throwable thr, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=27 ) - @Message( "Exception occurred in RMORBInitializer.post_init" ) - INTERNAL rfmPostInitException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=28 ) - @Message( "Exception occurred in ReferenceManagerConfigurator.configure" ) - INTERNAL rfmConfigureException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=29 ) - @Message( "RFM was inactive on state change" ) - INTERNAL rfmManagerInactive( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=30 ) - @Message( "Suspend condition wait was unexpectedly interrupted" ) - INTERNAL rfmSuspendConditionWaitInterrupted( ) ; - - @Log( level=LogLevel.SEVERE, id=31) - @Message( "Some locks not released in find_POA: " - + "readLocked={0}, writeLocked={1}, childReadLocked={2}") - INTERNAL findPOALocksNotReleased(boolean readLocked, boolean writeLocked, - boolean childReadLocked); - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Single thread policy is not supported" ) - NO_IMPLEMENT singleThreadNotSupported( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "This method is not implemented" ) - NO_IMPLEMENT methodNotImplemented( ) ; - - String poaLookupError = "Error in find_POA" ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( poaLookupError ) - OBJ_ADAPTER poaLookupError( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( poaLookupError ) - OBJ_ADAPTER poaLookupError() ; - - @Log( level=LogLevel.FINE, id=2 ) - @Message( "POA is inactive" ) - OBJ_ADAPTER poaInactive( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "POA has no servant manager" ) - OBJ_ADAPTER poaNoServantManager( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "POA has no default servant" ) - OBJ_ADAPTER poaNoDefaultServant( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "POA servant is not unique" ) - OBJ_ADAPTER poaServantNotUnique( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Bad policy in POA" ) - OBJ_ADAPTER poaWrongPolicy( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Another error in find_POA" ) - OBJ_ADAPTER findpoaError( ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "POA ServantActivator lookup failed" ) - OBJ_ADAPTER poaServantActivatorLookupFailed( @Chain Throwable exc ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "POA has bad servant manager" ) - OBJ_ADAPTER poaBadServantManager( ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "POA ServantLocator lookup failed" ) - OBJ_ADAPTER poaServantLocatorLookupFailed( ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "Unknown policy passed to POA" ) - OBJ_ADAPTER poaUnknownPolicy( ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "POA not found" ) - OBJ_ADAPTER poaNotFound( ) ; - - @Log( level=LogLevel.WARNING, id=14 ) - @Message( "Error in servant lookup" ) - OBJ_ADAPTER servantLookup( ) ; - - @Log( level=LogLevel.WARNING, id=15 ) - @Message( "Error in local servant lookup" ) - OBJ_ADAPTER localServantLookup( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "Bad type for servant manager" ) - OBJ_ADAPTER servantManagerBadType( ) ; - - @Log( level=LogLevel.WARNING, id=17 ) - @Message( "Servant's _default_POA must be an instance of POAImpl" ) - OBJ_ADAPTER defaultPoaNotPoaimpl( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=18 ) - @Message( "Wrong POA policies for _this_object called outside of an " - + "invocation context" ) - OBJ_ADAPTER wrongPoliciesForThisObject( ) ; - - @Log( level=LogLevel.WARNING, id=19 ) - @Message( "ServantNotActive exception in _this_object" ) - OBJ_ADAPTER thisObjectServantNotActive( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=20 ) - @Message( "WrongPolicy exception in _this_object" ) - OBJ_ADAPTER thisObjectWrongPolicy( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=21 ) - @Message( "Operation called outside of invocation context" ) - OBJ_ADAPTER noContext( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=22 ) - @Message( "ServantActivator.incarnate() returned a null Servant" ) - OBJ_ADAPTER incarnateReturnedNull( ) ; - - @Log( level=LogLevel.WARNING, id=23 ) - @Message( "ReferenceFactoryManager caught exception in " - + "AdapterActivator.unknown_adaptor" ) - OBJ_ADAPTER rfmAdapterActivatorFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=24 ) - @Message( "ReferenceFactoryManager is not active" ) - OBJ_ADAPTER rfmNotActive( ) ; - - @Log( level=LogLevel.WARNING, id=25 ) - @Message( "ReferenceFactoryManager is already active" ) - OBJ_ADAPTER rfmAlreadyActive( ) ; - - @Log( level=LogLevel.WARNING, id=26 ) - @Message( "ReferenceFactoryManager activate method failed" ) - OBJ_ADAPTER rfmActivateFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=27 ) - @Message( "ReferenceFactoryManager restart called with a null argument" ) - OBJ_ADAPTER rfmNullArgRestart( ) ; - - @Log( level=LogLevel.WARNING, id=28 ) - @Message( "ReferenceFactoryManager restart failed" ) - OBJ_ADAPTER rfmRestartFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=29 ) - @Message( "ReferenceFactoryManager createReference failed" ) - OBJ_ADAPTER rfmCreateReferenceFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=30 ) - @Message( "ReferenceFactoryManager destroy failed" ) - OBJ_ADAPTER rfmDestroyFailed( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=31 ) - @Message( "Illegal use of ReferenceFactoryManager parent POA detected" ) - OBJ_ADAPTER rfmIllegalParentPoaUsage( ) ; - - @Log( level=LogLevel.WARNING, id=32 ) - @Message( "Illegal use of ReferenceFactoryManager parent POA detected" ) - OBJ_ADAPTER rfmIllegalPoaManagerUsage( ) ; - - @Log( level=LogLevel.WARNING, id=33 ) - @Message( "Method {0} can only be called when RFM is suspended" ) - OBJ_ADAPTER rfmMethodRequiresSuspendedState( String arg0 ) ; - - int JTS_INIT_ERROR = CorbaExtension.self.getMinorCode( - POASystemException.class, "jtsInitError" ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "JTS initialization error" ) - INITIALIZE jtsInitError( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Persistent server ID is not set" ) - INITIALIZE persistentServeridNotSet( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Persistent server port is not set" ) - INITIALIZE persistentServerportNotSet( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Error in ORBD" ) - INITIALIZE orbdError( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Error in bootstrap" ) - INITIALIZE bootstrapError( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "POAManager is in discarding state" ) - TRANSIENT poaDiscarding( ) ; - - @Log( level=LogLevel.FINE, id=2 ) - @Message( "Thread is active in another POAManager: holding on a different " - + "POAManager might cause a deadlock" ) - TRANSIENT poaManagerMightDeadlock( ) ; - - @Log( level=LogLevel.FINE, id=3 ) - @Message( "Thread is active in a POAManager: cannot perform operation in " - + "RFM without risking a deadlock" ) - TRANSIENT rfmMightDeadlock( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Error in OTS hook" ) - UNKNOWN otshookexception( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Unknown server exception" ) - UNKNOWN unknownServerException( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Unknown server application exception" ) - UNKNOWN unknownServerappException( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Unknown local invocation error" ) - UNKNOWN unknownLocalinvocationError( ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "AdapterActivator does not exist" ) - OBJECT_NOT_EXIST adapterActivatorNonexistent( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "AdapterActivator failed" ) - OBJECT_NOT_EXIST adapterActivatorFailed( ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Bad skeleton" ) - OBJECT_NOT_EXIST badSkeleton( ) ; - - @Log( level=LogLevel.FINE, id=4 ) - @Message( "Null servant" ) - OBJECT_NOT_EXIST nullServant( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "POA has been destroyed" ) - OBJECT_NOT_EXIST adapterDestroyed( ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "waitGuard was interrupted" ) + POASystemException self = WrapperGenerator.makeWrapper(POASystemException.class, CorbaExtension.self); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Servant Manager already set") + BAD_INV_ORDER servantManagerAlreadySet(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Request to wait for POA destruction while servicing request " + "would deadlock") + BAD_INV_ORDER destroyDeadlock(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Bad operation on servant ORB???") + BAD_OPERATION servantOrb(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Bad Servant???") + BAD_OPERATION badServant(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Illegal Forward Request???") + BAD_OPERATION illegalForwardRequest(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("setDaemon() failed in creating destroy thread") + BAD_OPERATION couldNotSetDaemon(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Bad transaction context") + BAD_PARAM badTransactionContext(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Bad repository id") + BAD_PARAM badRepositoryId(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Null repository id") + BAD_PARAM nullRepositoryId(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("invoke setup???") + INTERNAL invokesetup(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("bad local reply status???") + INTERNAL badLocalreplystatus(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("persistent serverport error???") + INTERNAL persistentServerportError(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("servant dispatch???") + INTERNAL servantDispatch(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("wrong client request dispatcher???") + INTERNAL wrongClientsc(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("can't clone template???") + INTERNAL cantCloneTemplate(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("POACurrent stack is unbalanced") + INTERNAL poacurrentUnbalancedStack(@Chain Exception ex); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Null field in POACurrent") + @CS(CSValue.MAYBE) + INTERNAL poacurrentNullField(); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("POA internalGetServant error") + INTERNAL poaInternalGetServantError(); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("First Object Adapter name is {0}, should be RootPOA") + INTERNAL makeFactoryNotPoa(String arg0); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("Duplicate ORB version service context") + INTERNAL duplicateOrbVersionSc(); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("preinvoke clone error") + INTERNAL preinvokeCloneError(); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("preinvoke POA destroyed") + INTERNAL preinvokePoaDestroyed(); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("Bad dispatch policy for RETAIN policy in " + "POAPolicyMediatorFactory") + INTERNAL pmfCreateRetain(); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("Bad dispatch policy for NON_RETAIN policy in " + "POAPolicyMediatorFactory") + INTERNAL pmfCreateNonRetain(); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("Inconsistent policy in PolicyMediator") + INTERNAL policyMediatorBadPolicyInFactory(); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("ObjectAlreadyActive in servantToId") + INTERNAL servantToIdOaa(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("ServantAlreadyActive in servantToId") + INTERNAL servantToIdSaa(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("WrongPolicy in servantToId") + INTERNAL servantToIdWp(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("Can't resolve root POA") + INTERNAL cantResolveRootPoa(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 21) + @Message("Call made to local client request dispatcher with non-local " + "servant") + INTERNAL servantMustBeLocal(); + + @Log(level = LogLevel.WARNING, id = 22) + @Message("IOR does not have any profiles") + INTERNAL noProfilesInIor(); + + @Log(level = LogLevel.WARNING, id = 23) + @Message("Tried to decrement AOMEntry counter that is already 0") + INTERNAL aomEntryDecZero(); + + @Log(level = LogLevel.WARNING, id = 24) + @Message("Tried to add a POA to an inactive POAManager") + @CS(CSValue.MAYBE) + INTERNAL addPoaInactive(); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("POA tried to make an illegal state transition") + INTERNAL illegalPoaStateTrans(); + + @Log(level = LogLevel.WARNING, id = 26) + @Message("Unexpected exception in POA {0}") + INTERNAL unexpectedException(@Chain Throwable thr, String arg0); + + @Log(level = LogLevel.WARNING, id = 27) + @Message("Exception occurred in RMORBInitializer.post_init") + INTERNAL rfmPostInitException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 28) + @Message("Exception occurred in ReferenceManagerConfigurator.configure") + INTERNAL rfmConfigureException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 29) + @Message("RFM was inactive on state change") + INTERNAL rfmManagerInactive(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 30) + @Message("Suspend condition wait was unexpectedly interrupted") + INTERNAL rfmSuspendConditionWaitInterrupted(); + + @Log(level = LogLevel.SEVERE, id = 31) + @Message("Some locks not released in find_POA: " + "readLocked={0}, writeLocked={1}, childReadLocked={2}") + INTERNAL findPOALocksNotReleased(boolean readLocked, boolean writeLocked, boolean childReadLocked); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Single thread policy is not supported") + NO_IMPLEMENT singleThreadNotSupported(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("This method is not implemented") + NO_IMPLEMENT methodNotImplemented(); + + String poaLookupError = "Error in find_POA"; + + @Log(level = LogLevel.WARNING, id = 1) + @Message(poaLookupError) + OBJ_ADAPTER poaLookupError(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 1) + @Message(poaLookupError) + OBJ_ADAPTER poaLookupError(); + + @Log(level = LogLevel.FINE, id = 2) + @Message("POA is inactive") + OBJ_ADAPTER poaInactive(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("POA has no servant manager") + OBJ_ADAPTER poaNoServantManager(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("POA has no default servant") + OBJ_ADAPTER poaNoDefaultServant(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("POA servant is not unique") + OBJ_ADAPTER poaServantNotUnique(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Bad policy in POA") + OBJ_ADAPTER poaWrongPolicy(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Another error in find_POA") + OBJ_ADAPTER findpoaError(); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("POA ServantActivator lookup failed") + OBJ_ADAPTER poaServantActivatorLookupFailed(@Chain Throwable exc); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("POA has bad servant manager") + OBJ_ADAPTER poaBadServantManager(); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("POA ServantLocator lookup failed") + OBJ_ADAPTER poaServantLocatorLookupFailed(); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("Unknown policy passed to POA") + OBJ_ADAPTER poaUnknownPolicy(); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("POA not found") + OBJ_ADAPTER poaNotFound(); + + @Log(level = LogLevel.WARNING, id = 14) + @Message("Error in servant lookup") + OBJ_ADAPTER servantLookup(); + + @Log(level = LogLevel.WARNING, id = 15) + @Message("Error in local servant lookup") + OBJ_ADAPTER localServantLookup(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("Bad type for servant manager") + OBJ_ADAPTER servantManagerBadType(); + + @Log(level = LogLevel.WARNING, id = 17) + @Message("Servant's _default_POA must be an instance of POAImpl") + OBJ_ADAPTER defaultPoaNotPoaimpl(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 18) + @Message("Wrong POA policies for _this_object called outside of an " + "invocation context") + OBJ_ADAPTER wrongPoliciesForThisObject(); + + @Log(level = LogLevel.WARNING, id = 19) + @Message("ServantNotActive exception in _this_object") + OBJ_ADAPTER thisObjectServantNotActive(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 20) + @Message("WrongPolicy exception in _this_object") + OBJ_ADAPTER thisObjectWrongPolicy(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 21) + @Message("Operation called outside of invocation context") + OBJ_ADAPTER noContext(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 22) + @Message("ServantActivator.incarnate() returned a null Servant") + OBJ_ADAPTER incarnateReturnedNull(); + + @Log(level = LogLevel.WARNING, id = 23) + @Message("ReferenceFactoryManager caught exception in " + "AdapterActivator.unknown_adaptor") + OBJ_ADAPTER rfmAdapterActivatorFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 24) + @Message("ReferenceFactoryManager is not active") + OBJ_ADAPTER rfmNotActive(); + + @Log(level = LogLevel.WARNING, id = 25) + @Message("ReferenceFactoryManager is already active") + OBJ_ADAPTER rfmAlreadyActive(); + + @Log(level = LogLevel.WARNING, id = 26) + @Message("ReferenceFactoryManager activate method failed") + OBJ_ADAPTER rfmActivateFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 27) + @Message("ReferenceFactoryManager restart called with a null argument") + OBJ_ADAPTER rfmNullArgRestart(); + + @Log(level = LogLevel.WARNING, id = 28) + @Message("ReferenceFactoryManager restart failed") + OBJ_ADAPTER rfmRestartFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 29) + @Message("ReferenceFactoryManager createReference failed") + OBJ_ADAPTER rfmCreateReferenceFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 30) + @Message("ReferenceFactoryManager destroy failed") + OBJ_ADAPTER rfmDestroyFailed(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 31) + @Message("Illegal use of ReferenceFactoryManager parent POA detected") + OBJ_ADAPTER rfmIllegalParentPoaUsage(); + + @Log(level = LogLevel.WARNING, id = 32) + @Message("Illegal use of ReferenceFactoryManager parent POA detected") + OBJ_ADAPTER rfmIllegalPoaManagerUsage(); + + @Log(level = LogLevel.WARNING, id = 33) + @Message("Method {0} can only be called when RFM is suspended") + OBJ_ADAPTER rfmMethodRequiresSuspendedState(String arg0); + + int JTS_INIT_ERROR = CorbaExtension.self.getMinorCode(POASystemException.class, "jtsInitError"); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("JTS initialization error") + INITIALIZE jtsInitError(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Persistent server ID is not set") + INITIALIZE persistentServeridNotSet(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Persistent server port is not set") + INITIALIZE persistentServerportNotSet(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Error in ORBD") + INITIALIZE orbdError(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Error in bootstrap") + INITIALIZE bootstrapError(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("POAManager is in discarding state") + TRANSIENT poaDiscarding(); + + @Log(level = LogLevel.FINE, id = 2) + @Message("Thread is active in another POAManager: holding on a different " + "POAManager might cause a deadlock") + TRANSIENT poaManagerMightDeadlock(); + + @Log(level = LogLevel.FINE, id = 3) + @Message("Thread is active in a POAManager: cannot perform operation in " + "RFM without risking a deadlock") + TRANSIENT rfmMightDeadlock(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Error in OTS hook") + UNKNOWN otshookexception(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Unknown server exception") + UNKNOWN unknownServerException(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Unknown server application exception") + UNKNOWN unknownServerappException(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Unknown local invocation error") + UNKNOWN unknownLocalinvocationError(); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("AdapterActivator does not exist") + OBJECT_NOT_EXIST adapterActivatorNonexistent(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("AdapterActivator failed") + OBJECT_NOT_EXIST adapterActivatorFailed(); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Bad skeleton") + OBJECT_NOT_EXIST badSkeleton(); + + @Log(level = LogLevel.FINE, id = 4) + @Message("Null servant") + OBJECT_NOT_EXIST nullServant(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("POA has been destroyed") + OBJECT_NOT_EXIST adapterDestroyed(); + + @Log(level = LogLevel.FINE, id = 1) + @Message("waitGuard was interrupted") UNKNOWN waitGuardInterrupted(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/UtilSystemException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/UtilSystemException.java index dace42957..4ccd005b3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/logging/UtilSystemException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/logging/UtilSystemException.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.logging ; +package com.sun.corba.ee.spi.logging; import org.glassfish.pfl.basic.logex.Chain; import org.glassfish.pfl.basic.logex.ExceptionWrapper; @@ -28,8 +28,8 @@ import com.sun.corba.ee.spi.logex.corba.CS; import com.sun.corba.ee.spi.logex.corba.CSValue; -import com.sun.corba.ee.spi.logex.corba.ORBException ; -import com.sun.corba.ee.spi.logex.corba.CorbaExtension ; +import com.sun.corba.ee.spi.logex.corba.ORBException; +import com.sun.corba.ee.spi.logex.corba.CorbaExtension; import java.io.IOException; import org.omg.CORBA.BAD_OPERATION; @@ -41,184 +41,169 @@ import org.omg.CORBA.SystemException; import org.omg.CORBA.UNKNOWN; -@ExceptionWrapper( idPrefix="IOP" ) -@ORBException( omgException=false, group=CorbaExtension.UtilGroup ) +@ExceptionWrapper(idPrefix = "IOP") +@ORBException(omgException = false, group = CorbaExtension.UtilGroup) public interface UtilSystemException { - UtilSystemException self = WrapperGenerator.makeWrapper( - UtilSystemException.class, CorbaExtension.self ) ; - - @Log( level=LogLevel.FINE, id=1 ) - @Message( "StubFactory failed on makeStub call" ) - BAD_OPERATION stubFactoryCouldNotMakeStub( @Chain Throwable exc ) ; - - @Log( level=LogLevel.FINE, id=2 ) - @Message( "Error in making stub given RepositoryId" ) - BAD_OPERATION errorInMakeStubFromRepositoryId( @Chain Throwable thr ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Failure in making stub given RepositoryId" ) - BAD_OPERATION failureInMakeStubFromRepositoryId( @Chain Throwable thr ) ; - - @Log( level=LogLevel.FINE, id=4 ) - @Message( "ClassCastException in loadStub" ) - BAD_OPERATION classCastExceptionInLoadStub( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Exception in loadStub" ) - BAD_OPERATION exceptionInLoadStub( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Unable to make stub from any of the repository IDs of the " - + "interface" ) - BAD_OPERATION couldNotMakeStubFromRepositoryId( ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "An IOException occurred while creating an IIOPOutputStream" ) - BAD_OPERATION exceptionInCreateIiopOutputStream( @Chain IOException exc ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "An IOException occurred while creating an IIOPInputStream" ) - BAD_OPERATION exceptionInCreateIiopInputStream( @Chain IOException exc ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "Only one call to the Util constructor is allowed; " - + "normally Util.getInstance should be called" ) - BAD_OPERATION onlyOneCallToConstructorAllowed( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Error in loadStubAndUpdateCache caused by _this_object" ) - BAD_PARAM noPoa( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=3 ) - @Message( "Tried to connect already connected Stub Delegate to a " - + "different ORB" ) - BAD_PARAM connectWrongOrb( ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Tried to connect unconnected Stub Delegate but no Tie was found" ) - BAD_PARAM connectNoTie( ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Tried to connect unconnected stub with Tie in a different ORB" ) - BAD_PARAM connectTieWrongOrb( ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Tried to connect unconnected stub to unconnected Tie" ) - BAD_PARAM connectTieNoServant( ) ; - - @Log( level=LogLevel.FINE, id=7 ) - @Message( "Failed to load Tie of class {0}" ) - BAD_PARAM loadTieFailed( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Bad hex digit in string_to_object" ) - DATA_CONVERSION badHexDigit( ) ; - - String unableLocateValueHelper = "Could not locate value helper" ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( unableLocateValueHelper ) - @CS( CSValue.MAYBE ) - MARSHAL unableLocateValueHelper( ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( unableLocateValueHelper ) - @CS( CSValue.MAYBE ) - MARSHAL unableLocateValueHelper( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Invalid indirection {0}" ) - MARSHAL invalidIndirection( @Chain IOException exc, int indir ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "{0} did not originate from a connected object" ) - INV_OBJREF objectNotConnected( @Chain Exception exc, String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Could not load stub for class {0}" ) - INV_OBJREF couldNotLoadStub( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Class {0} not exported, or else is actually a JRMP stub" ) - INV_OBJREF objectNotExported( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Error in setting object field {0} in {1} to {2}" ) - INTERNAL errorSetObjectField( @Chain Exception exc, - String fname, Object obj, Object value ) ; - - @Log( level=LogLevel.WARNING, id=2 ) - @Message( "Error in setting boolean field {0} in {1} to {2}" ) - INTERNAL errorSetBooleanField( @Chain Exception exc, - String fname, Object obj, boolean value ) ; - - @Log( level=LogLevel.WARNING, id=3 ) - @Message( "Error in setting byte field {0} in {1} to {2}" ) - INTERNAL errorSetByteField( @Chain Exception exc, - String fname, Object obj, byte value ) ; - - @Log( level=LogLevel.WARNING, id=4 ) - @Message( "Error in setting char field {0} in {1} to {2}" ) - INTERNAL errorSetCharField( @Chain Exception exc, - String fname, Object obj, char value ) ; - - @Log( level=LogLevel.WARNING, id=5 ) - @Message( "Error in setting short field {0} in {1} to {2}" ) - INTERNAL errorSetShortField( @Chain Exception exc, - String fname, Object obj, short value ) ; - - @Log( level=LogLevel.WARNING, id=6 ) - @Message( "Error in setting int field {0} in {1} to {2}" ) - INTERNAL errorSetIntField( @Chain Exception exc, - String fname, Object obj, int value ) ; - - @Log( level=LogLevel.WARNING, id=7 ) - @Message( "Error in setting long field {0} in {1} to {2}" ) - INTERNAL errorSetLongField( @Chain Exception exc, - String fname, Object obj, long value ) ; - - @Log( level=LogLevel.WARNING, id=8 ) - @Message( "Error in setting float field {0} in {1} to {2}" ) - INTERNAL errorSetFloatField( @Chain Exception exc, - String fname, Object obj, float value ) ; - - @Log( level=LogLevel.WARNING, id=9 ) - @Message( "Error in setting double field {0} in {1} to {2}" ) - INTERNAL errorSetDoubleField( @Chain Exception exc, - String arg0, Object obj, double value ) ; - - @Log( level=LogLevel.WARNING, id=10 ) - @Message( "IllegalAccessException while trying to write to field {0}" ) - INTERNAL illegalFieldAccess( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=11 ) - @Message( "State should be saved and reset first" ) - INTERNAL badBeginUnmarshalCustomValue( ) ; - - @Log( level=LogLevel.WARNING, id=12 ) - @Message( "Failure while loading specific Java remote exception class: {0}" ) - INTERNAL classNotFound( String arg0 ) ; - - @Log( level=LogLevel.WARNING, id=13 ) - @Message( "Could not find the expected Value Handler implementation " - + "in the JDK: Wrong JDK Version?" ) - INTERNAL couldNotFindJdkValueHandler( @Chain Exception exc ) ; - - @Log( level=LogLevel.FINE, id=14 ) - @Message( " Bad Operation or Bad Invocation Order : The Servant has not " - + "been associated with an ORB instance" ) - INTERNAL handleSystemException( @Chain SystemException exc ) ; - - @Log( level=LogLevel.INFO, id=15 ) - @Message( "This is a test exception with number {0}" ) - INTERNAL testException( int arg0 ) ; - - @Log( level=LogLevel.WARNING, id=16 ) - @Message( "This is another test exception with no parameters" ) - @CS( CSValue.MAYBE ) - INTERNAL simpleTestException( @Chain Exception exc ) ; - - @Log( level=LogLevel.WARNING, id=1 ) - @Message( "Unknown System Exception" ) - UNKNOWN unknownSysex( ) ; + UtilSystemException self = WrapperGenerator.makeWrapper(UtilSystemException.class, CorbaExtension.self); + + @Log(level = LogLevel.FINE, id = 1) + @Message("StubFactory failed on makeStub call") + BAD_OPERATION stubFactoryCouldNotMakeStub(@Chain Throwable exc); + + @Log(level = LogLevel.FINE, id = 2) + @Message("Error in making stub given RepositoryId") + BAD_OPERATION errorInMakeStubFromRepositoryId(@Chain Throwable thr); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Failure in making stub given RepositoryId") + BAD_OPERATION failureInMakeStubFromRepositoryId(@Chain Throwable thr); + + @Log(level = LogLevel.FINE, id = 4) + @Message("ClassCastException in loadStub") + BAD_OPERATION classCastExceptionInLoadStub(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Exception in loadStub") + BAD_OPERATION exceptionInLoadStub(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Unable to make stub from any of the repository IDs of the " + "interface") + BAD_OPERATION couldNotMakeStubFromRepositoryId(); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("An IOException occurred while creating an IIOPOutputStream") + BAD_OPERATION exceptionInCreateIiopOutputStream(@Chain IOException exc); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("An IOException occurred while creating an IIOPInputStream") + BAD_OPERATION exceptionInCreateIiopInputStream(@Chain IOException exc); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("Only one call to the Util constructor is allowed; " + "normally Util.getInstance should be called") + BAD_OPERATION onlyOneCallToConstructorAllowed(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Error in loadStubAndUpdateCache caused by _this_object") + BAD_PARAM noPoa(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 3) + @Message("Tried to connect already connected Stub Delegate to a " + "different ORB") + BAD_PARAM connectWrongOrb(); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Tried to connect unconnected Stub Delegate but no Tie was found") + BAD_PARAM connectNoTie(); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Tried to connect unconnected stub with Tie in a different ORB") + BAD_PARAM connectTieWrongOrb(); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Tried to connect unconnected stub to unconnected Tie") + BAD_PARAM connectTieNoServant(); + + @Log(level = LogLevel.FINE, id = 7) + @Message("Failed to load Tie of class {0}") + BAD_PARAM loadTieFailed(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Bad hex digit in string_to_object") + DATA_CONVERSION badHexDigit(); + + String unableLocateValueHelper = "Could not locate value helper"; + + @Log(level = LogLevel.WARNING, id = 2) + @Message(unableLocateValueHelper) + @CS(CSValue.MAYBE) + MARSHAL unableLocateValueHelper(); + + @Log(level = LogLevel.WARNING, id = 2) + @Message(unableLocateValueHelper) + @CS(CSValue.MAYBE) + MARSHAL unableLocateValueHelper(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Invalid indirection {0}") + MARSHAL invalidIndirection(@Chain IOException exc, int indir); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("{0} did not originate from a connected object") + INV_OBJREF objectNotConnected(@Chain Exception exc, String arg0); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Could not load stub for class {0}") + INV_OBJREF couldNotLoadStub(String arg0); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Class {0} not exported, or else is actually a JRMP stub") + INV_OBJREF objectNotExported(String arg0); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Error in setting object field {0} in {1} to {2}") + INTERNAL errorSetObjectField(@Chain Exception exc, String fname, Object obj, Object value); + + @Log(level = LogLevel.WARNING, id = 2) + @Message("Error in setting boolean field {0} in {1} to {2}") + INTERNAL errorSetBooleanField(@Chain Exception exc, String fname, Object obj, boolean value); + + @Log(level = LogLevel.WARNING, id = 3) + @Message("Error in setting byte field {0} in {1} to {2}") + INTERNAL errorSetByteField(@Chain Exception exc, String fname, Object obj, byte value); + + @Log(level = LogLevel.WARNING, id = 4) + @Message("Error in setting char field {0} in {1} to {2}") + INTERNAL errorSetCharField(@Chain Exception exc, String fname, Object obj, char value); + + @Log(level = LogLevel.WARNING, id = 5) + @Message("Error in setting short field {0} in {1} to {2}") + INTERNAL errorSetShortField(@Chain Exception exc, String fname, Object obj, short value); + + @Log(level = LogLevel.WARNING, id = 6) + @Message("Error in setting int field {0} in {1} to {2}") + INTERNAL errorSetIntField(@Chain Exception exc, String fname, Object obj, int value); + + @Log(level = LogLevel.WARNING, id = 7) + @Message("Error in setting long field {0} in {1} to {2}") + INTERNAL errorSetLongField(@Chain Exception exc, String fname, Object obj, long value); + + @Log(level = LogLevel.WARNING, id = 8) + @Message("Error in setting float field {0} in {1} to {2}") + INTERNAL errorSetFloatField(@Chain Exception exc, String fname, Object obj, float value); + + @Log(level = LogLevel.WARNING, id = 9) + @Message("Error in setting double field {0} in {1} to {2}") + INTERNAL errorSetDoubleField(@Chain Exception exc, String arg0, Object obj, double value); + + @Log(level = LogLevel.WARNING, id = 10) + @Message("IllegalAccessException while trying to write to field {0}") + INTERNAL illegalFieldAccess(String arg0); + + @Log(level = LogLevel.WARNING, id = 11) + @Message("State should be saved and reset first") + INTERNAL badBeginUnmarshalCustomValue(); + + @Log(level = LogLevel.WARNING, id = 12) + @Message("Failure while loading specific Java remote exception class: {0}") + INTERNAL classNotFound(String arg0); + + @Log(level = LogLevel.WARNING, id = 13) + @Message("Could not find the expected Value Handler implementation " + "in the JDK: Wrong JDK Version?") + INTERNAL couldNotFindJdkValueHandler(@Chain Exception exc); + + @Log(level = LogLevel.FINE, id = 14) + @Message(" Bad Operation or Bad Invocation Order : The Servant has not " + "been associated with an ORB instance") + INTERNAL handleSystemException(@Chain SystemException exc); + + @Log(level = LogLevel.INFO, id = 15) + @Message("This is a test exception with number {0}") + INTERNAL testException(int arg0); + + @Log(level = LogLevel.WARNING, id = 16) + @Message("This is another test exception with no parameters") + @CS(CSValue.MAYBE) + INTERNAL simpleTestException(@Chain Exception exc); + + @Log(level = LogLevel.WARNING, id = 1) + @Message("Unknown System Exception") + UNKNOWN unknownSysex(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/misc/ORBClassLoader.java b/orbmain/src/main/java/com/sun/corba/ee/spi/misc/ORBClassLoader.java index 6a98f9815..b78c8c374 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/misc/ORBClassLoader.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/misc/ORBClassLoader.java @@ -17,29 +17,23 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.misc ; +package com.sun.corba.ee.spi.misc; /** - * Based on feedback from bug report 4452016, all class loading - * in the ORB is isolated here. It is acceptable to use - * Class.forName only when one is certain that the desired class - * should come from the core JDK. + * Based on feedback from bug report 4452016, all class loading in the ORB is isolated here. It is acceptable to use + * Class.forName only when one is certain that the desired class should come from the core JDK. *

    - * Note that this class must not depend on generated log wrappers! + * Note that this class must not depend on generated log wrappers! */ -public class ORBClassLoader -{ - public static Class loadClass(String className) - throws ClassNotFoundException - { +public class ORBClassLoader { + public static Class loadClass(String className) throws ClassNotFoundException { return getClassLoader().loadClass(className); } - public static ClassLoader getClassLoader() - { - ClassLoader ccl = Thread.currentThread().getContextClassLoader() ; + public static ClassLoader getClassLoader() { + ClassLoader ccl = Thread.currentThread().getContextClassLoader(); if (ccl != null) - return ccl; + return ccl; else return ClassLoader.getSystemClassLoader(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/misc/ORBConstants.java b/orbmain/src/main/java/com/sun/corba/ee/spi/misc/ORBConstants.java index d35b3a7f8..8a9b22dd2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/misc/ORBConstants.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/misc/ORBConstants.java @@ -19,44 +19,37 @@ package com.sun.corba.ee.spi.misc; -import com.sun.corba.ee.org.omg.CORBA.SUNVMCID ; +import com.sun.corba.ee.org.omg.CORBA.SUNVMCID; public class ORBConstants { - private ORBConstants() {} - - public static final String STRINGIFY_PREFIX = "IOR:" ; - - /* TAGS - tag-request@omg.org - FAQ on tags and tag allocation: http://doc.omg.org/ptc/99-02-01. - http://doc.omg.org/standard-tags - http://doc.omg.org/vendor-tags - - Last update: 19th August 2003 (ptc/03-08-14) - - // Legacy - 1 profile tag 0x4f4e4300 ("ONC\x00") - 1 profile tag 0x4e454f00 ("NEO\x00") - 1 profile tag 0x434f4f4c ("COOL") - 16 service tags 0x4e454f00 - 0x4e454f0f ("NEO\x00" - "NEO\x0f") - - // Current - 16 VMCID 0x5355xxxx ("SU\x00\x00" - "SU\xff\xff") - 16 profile tags 0x53554e00 - 0x53554e0f ("SUN\x00" - "SUN\x0f") - 16 ORB Type IDs 0x53554e00 - 0x53554e0f ("SUN\x00" - "SUN\x0f") - 64 service tags 0x53554e00 - 0x53554e3f ("SUN\x00" - "SUN\x3f") - 64 component tags 0x53554e00 - 0x53554e3f ("SUN\x00" - "SUN\x3f") - */ + private ORBConstants() { + } - // All NEO service contexts must be in the range + public static final String STRINGIFY_PREFIX = "IOR:"; + + /* + * TAGS tag-request@omg.org FAQ on tags and tag allocation: http://doc.omg.org/ptc/99-02-01. + * http://doc.omg.org/standard-tags http://doc.omg.org/vendor-tags + * + * Last update: 19th August 2003 (ptc/03-08-14) + * + * // Legacy 1 profile tag 0x4f4e4300 ("ONC\x00") 1 profile tag 0x4e454f00 ("NEO\x00") 1 profile tag 0x434f4f4c ("COOL") + * 16 service tags 0x4e454f00 - 0x4e454f0f ("NEO\x00" - "NEO\x0f") + * + * // Current 16 VMCID 0x5355xxxx ("SU\x00\x00" - "SU\xff\xff") 16 profile tags 0x53554e00 - 0x53554e0f ("SUN\x00" - + * "SUN\x0f") 16 ORB Type IDs 0x53554e00 - 0x53554e0f ("SUN\x00" - "SUN\x0f") 64 service tags 0x53554e00 - 0x53554e3f + * ("SUN\x00" - "SUN\x3f") 64 component tags 0x53554e00 - 0x53554e3f ("SUN\x00" - "SUN\x3f") + */ + + // All NEO service contexts must be in the range // NEO_FIRST_SERVICE_CONTEXT to // NEO_FIRST_SERVICE_CONTEXT + NUM_NEO_SERVICE_CONTEXTS - 1 - public static final int NEO_FIRST_SERVICE_CONTEXT = 0x4e454f00 ; - public static final int NUM_NEO_SERVICE_CONTEXTS = 15 ; - public static final int TAG_ORB_VERSION = NEO_FIRST_SERVICE_CONTEXT ; + public static final int NEO_FIRST_SERVICE_CONTEXT = 0x4e454f00; + public static final int NUM_NEO_SERVICE_CONTEXTS = 15; + public static final int TAG_ORB_VERSION = NEO_FIRST_SERVICE_CONTEXT; public static final int SUN_TAGGED_COMPONENT_ID_BASE = 0x53554e00; - public static final int SUN_SERVICE_CONTEXT_ID_BASE = 0x53554e00; + public static final int SUN_SERVICE_CONTEXT_ID_BASE = 0x53554e00; //////////////////////////////////////////////////// // @@ -64,24 +57,18 @@ private ORBConstants() {} // // Used by AS 7 for IIOP failover. - public static final int TAG_CONTAINER_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 0; + public static final int TAG_CONTAINER_ID = SUN_TAGGED_COMPONENT_ID_BASE + 0; // Used by AS 8.1 for Request Partioning - public static final int TAG_REQUEST_PARTITIONING_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 1; + public static final int TAG_REQUEST_PARTITIONING_ID = SUN_TAGGED_COMPONENT_ID_BASE + 1; // TaggedComponentId for Java serialization tagged component. - public static final int TAG_JAVA_SERIALIZATION_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 2; + public static final int TAG_JAVA_SERIALIZATION_ID = SUN_TAGGED_COMPONENT_ID_BASE + 2; // Introduced in AS 9.0 - public static final int FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 3; + public static final int FOLB_MEMBER_ADDRESSES_TAGGED_COMPONENT_ID = SUN_TAGGED_COMPONENT_ID_BASE + 3; // Introduced in AS 9.0 - public static final int FOLB_MEMBERSHIP_LABEL_TAGGED_COMPONENT_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 4; + public static final int FOLB_MEMBERSHIP_LABEL_TAGGED_COMPONENT_ID = SUN_TAGGED_COMPONENT_ID_BASE + 4; // Introduced in GFv2.1 - public static final int TAG_LOAD_BALANCING_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 5; + public static final int TAG_LOAD_BALANCING_ID = SUN_TAGGED_COMPONENT_ID_BASE + 5; //////////////////////////////////////////////////// // @@ -89,117 +76,106 @@ private ORBConstants() {} // // Used by AS 7 for IIOP failover. - public static final int CONTAINER_ID_SERVICE_CONTEXT = - SUN_SERVICE_CONTEXT_ID_BASE + 0; + public static final int CONTAINER_ID_SERVICE_CONTEXT = SUN_SERVICE_CONTEXT_ID_BASE + 0; // Introduced in AS 9. - public static final int FOLB_MEMBERSHIP_LABEL_SERVICE_CONTEXT_ID = - SUN_SERVICE_CONTEXT_ID_BASE + 1; + public static final int FOLB_MEMBERSHIP_LABEL_SERVICE_CONTEXT_ID = SUN_SERVICE_CONTEXT_ID_BASE + 1; // Introduced in AS 9. - public static final int FOLB_IOR_UPDATE_SERVICE_CONTEXT_ID = - SUN_SERVICE_CONTEXT_ID_BASE + 2; - + public static final int FOLB_IOR_UPDATE_SERVICE_CONTEXT_ID = SUN_SERVICE_CONTEXT_ID_BASE + 2; //////////////////////////////////////////////////// // // All Sun policies are allocated using the SUNVMCID, which is also - // used for minor codes. This allows 12 bits of offset, so + // used for minor codes. This allows 12 bits of offset, so // the largest legal Sun policy is SUNVMCID.value + 4095. - public static final int SERVANT_CACHING_POLICY = SUNVMCID.value + 0 ; - public static final int ZERO_PORT_POLICY = SUNVMCID.value + 1 ; - public static final int COPY_OBJECT_POLICY = SUNVMCID.value + 2 ; - public static final int REQUEST_PARTITIONING_POLICY = SUNVMCID.value + 3 ; - public static final int REFERENCE_MANAGER_POLICY = SUNVMCID.value + 4 ; - public static final int LOAD_BALANCING_POLICY = SUNVMCID.value + 5 ; + public static final int SERVANT_CACHING_POLICY = SUNVMCID.value + 0; + public static final int ZERO_PORT_POLICY = SUNVMCID.value + 1; + public static final int COPY_OBJECT_POLICY = SUNVMCID.value + 2; + public static final int REQUEST_PARTITIONING_POLICY = SUNVMCID.value + 3; + public static final int REFERENCE_MANAGER_POLICY = SUNVMCID.value + 4; + public static final int LOAD_BALANCING_POLICY = SUNVMCID.value + 5; // These are the subcontract IDs for various qualities of // service/implementation. // Persistent SCIDs have the second bit as 1. // SCIDs less than FIRST_POA_SCID are JavaIDL SCIDs. - public static final int TOA_SCID = 2 ; + public static final int TOA_SCID = 2; - public static final int DEFAULT_SCID = TOA_SCID ; + public static final int DEFAULT_SCID = TOA_SCID; public static final int FIRST_POA_SCID = 32; public static final int MAX_POA_SCID = 63; - public static final int TRANSIENT_SCID = FIRST_POA_SCID ; - public static final int PERSISTENT_SCID = makePersistent( TRANSIENT_SCID ) ; - public static final int SC_TRANSIENT_SCID = FIRST_POA_SCID + 4 ; - public static final int SC_PERSISTENT_SCID = makePersistent( SC_TRANSIENT_SCID ) ; - public static final int IISC_TRANSIENT_SCID = FIRST_POA_SCID + 8 ; - public static final int IISC_PERSISTENT_SCID = makePersistent( IISC_TRANSIENT_SCID ) ; - public static final int MINSC_TRANSIENT_SCID = FIRST_POA_SCID + 12 ; - public static final int MINSC_PERSISTENT_SCID = makePersistent( MINSC_TRANSIENT_SCID ) ; - - public static boolean isTransient( int scid ) - { - return (scid & 2) == 0 ; + public static final int TRANSIENT_SCID = FIRST_POA_SCID; + public static final int PERSISTENT_SCID = makePersistent(TRANSIENT_SCID); + public static final int SC_TRANSIENT_SCID = FIRST_POA_SCID + 4; + public static final int SC_PERSISTENT_SCID = makePersistent(SC_TRANSIENT_SCID); + public static final int IISC_TRANSIENT_SCID = FIRST_POA_SCID + 8; + public static final int IISC_PERSISTENT_SCID = makePersistent(IISC_TRANSIENT_SCID); + public static final int MINSC_TRANSIENT_SCID = FIRST_POA_SCID + 12; + public static final int MINSC_PERSISTENT_SCID = makePersistent(MINSC_TRANSIENT_SCID); + + public static boolean isTransient(int scid) { + return (scid & 2) == 0; } - public static int makePersistent( int scid ) - { - return scid | 2 ; + public static int makePersistent(int scid) { + return scid | 2; } // Constants for ORB properties ************************************************************** // All ORB properties must follow the following rules: // 1. Property names must start with either - // CORBA_PREFIX or SUN_PREFIX. + // CORBA_PREFIX or SUN_PREFIX. // 2. Property names must have unique suffixes after the last ".". - // 3. Property names must have "ORB" as the first 3 letters - // in their suffix. + // 3. Property names must have "ORB" as the first 3 letters + // in their suffix. // 4. proprietary property names should have a subsystem - // where appropriate after the prefix. + // where appropriate after the prefix. // org.omg.CORBA properties must be defined by OMG standards // The well known org.omg.CORBA.ORBClass and // org.omg.CORBA.ORBSingletonClass are not included here // since they occur in org.omg.CORBA.ORB. - public static final String CORBA_PREFIX = "org.omg.CORBA." ; + public static final String CORBA_PREFIX = "org.omg.CORBA."; - public static final String INITIAL_HOST_PROPERTY = - CORBA_PREFIX + "ORBInitialHost" ; - public static final String INITIAL_PORT_PROPERTY = - CORBA_PREFIX + "ORBInitialPort" ; - public static final String INITIAL_SERVICES_PROPERTY = - CORBA_PREFIX + "ORBInitialServices" ; - public static final String DEFAULT_INIT_REF_PROPERTY = - CORBA_PREFIX + "ORBDefaultInitRef" ; - public static final String ORB_INIT_REF_PROPERTY = - CORBA_PREFIX + "ORBInitRef" ; + public static final String INITIAL_HOST_PROPERTY = CORBA_PREFIX + "ORBInitialHost"; + public static final String INITIAL_PORT_PROPERTY = CORBA_PREFIX + "ORBInitialPort"; + public static final String INITIAL_SERVICES_PROPERTY = CORBA_PREFIX + "ORBInitialServices"; + public static final String DEFAULT_INIT_REF_PROPERTY = CORBA_PREFIX + "ORBDefaultInitRef"; + public static final String ORB_INIT_REF_PROPERTY = CORBA_PREFIX + "ORBInitRef"; // All of our proprietary properties must start with com.sun.corba.ee - public static final String SUN_PREFIX = "com.sun.corba.ee." ; + public static final String SUN_PREFIX = "com.sun.corba.ee."; // special property (system only) for enabling OSGIListener debug - public static final String DEBUG_OSGI_LISTENER = SUN_PREFIX + "ORBDebugOSGIListener" ; + public static final String DEBUG_OSGI_LISTENER = SUN_PREFIX + "ORBDebugOSGIListener"; // general properties - public static final String ALLOW_LOCAL_OPTIMIZATION = SUN_PREFIX + "ORBAllowLocalOptimization" ; - public static final String SERVER_PORT_PROPERTY = SUN_PREFIX + "ORBServerPort" ; - public static final String SERVER_HOST_PROPERTY = SUN_PREFIX + "ORBServerHost" ; - public static final String ORB_ID_PROPERTY = CORBA_PREFIX + "ORBId" ; + public static final String ALLOW_LOCAL_OPTIMIZATION = SUN_PREFIX + "ORBAllowLocalOptimization"; + public static final String SERVER_PORT_PROPERTY = SUN_PREFIX + "ORBServerPort"; + public static final String SERVER_HOST_PROPERTY = SUN_PREFIX + "ORBServerHost"; + public static final String ORB_ID_PROPERTY = CORBA_PREFIX + "ORBId"; // This property is provided for backward compatibility reasons - public static final String OLD_ORB_ID_PROPERTY = SUN_PREFIX + "ORBid" ; - public static final String ORB_SERVER_ID_PROPERTY = CORBA_PREFIX + "ORBServerId" ; - public static final String DEBUG_PROPERTY = SUN_PREFIX + "ORBDebug" ; - public static final String INIT_DEBUG_PROPERTY = SUN_PREFIX + "ORBInitDebug" ; + public static final String OLD_ORB_ID_PROPERTY = SUN_PREFIX + "ORBid"; + public static final String ORB_SERVER_ID_PROPERTY = CORBA_PREFIX + "ORBServerId"; + public static final String DEBUG_PROPERTY = SUN_PREFIX + "ORBDebug"; + public static final String INIT_DEBUG_PROPERTY = SUN_PREFIX + "ORBInitDebug"; // Property for setting use of repository Ids during serialization. public static final String USE_REP_ID = SUN_PREFIX + "ORBUseRepId"; // giop related properties - default settings in decimal form - public static final String GIOP_VERSION = SUN_PREFIX + "giop.ORBGIOPVersion" ; - public static final String GIOP_FRAGMENT_SIZE = SUN_PREFIX + "giop.ORBFragmentSize" ; - public static final String GIOP_BUFFER_SIZE = SUN_PREFIX + "giop.ORBBufferSize" ; - public static final String GIOP_11_BUFFMGR = SUN_PREFIX + "giop.ORBGIOP11BuffMgr"; - public static final String GIOP_12_BUFFMGR = SUN_PREFIX + "giop.ORBGIOP12BuffMgr"; - public static final String GIOP_TARGET_ADDRESSING = SUN_PREFIX + "giop.ORBTargetAddressing"; + public static final String GIOP_VERSION = SUN_PREFIX + "giop.ORBGIOPVersion"; + public static final String GIOP_FRAGMENT_SIZE = SUN_PREFIX + "giop.ORBFragmentSize"; + public static final String GIOP_BUFFER_SIZE = SUN_PREFIX + "giop.ORBBufferSize"; + public static final String GIOP_11_BUFFMGR = SUN_PREFIX + "giop.ORBGIOP11BuffMgr"; + public static final String GIOP_12_BUFFMGR = SUN_PREFIX + "giop.ORBGIOP12BuffMgr"; + public static final String GIOP_TARGET_ADDRESSING = SUN_PREFIX + "giop.ORBTargetAddressing"; public static final int GIOP_DEFAULT_FRAGMENT_SIZE = 4096; public static final int GIOP_DEFAULT_BUFFER_SIZE = 4096; - public static final int DEFAULT_GIOP_11_BUFFMGR = 0; //Growing - public static final int DEFAULT_GIOP_12_BUFFMGR = 2; //Streaming + public static final int DEFAULT_GIOP_11_BUFFMGR = 0; // Growing + public static final int DEFAULT_GIOP_12_BUFFMGR = 2; // Streaming public static final short ADDR_DISP_OBJKEY = 0; // object key used for target addressing public static final short ADDR_DISP_PROFILE = 1; // iop profile used for target addressing public static final short ADDR_DISP_IOR = 2; // ior used for target addressing @@ -210,65 +186,51 @@ public static int makePersistent( int scid ) // LocateReply message bodies must begin on 8 byte boundaries. public static final int GIOP_12_MSG_BODY_ALIGNMENT = 8; - // The GIOP 1.2 fragments must be divisible by 8. We generalize this + // The GIOP 1.2 fragments must be divisible by 8. We generalize this // to GIOP 1.1 fragments, as well. public static final int GIOP_FRAGMENT_DIVISOR = 8; public static final int GIOP_FRAGMENT_MINIMUM_SIZE = 32; - public static final String ENV_IS_SERVER_PROPERTY = - SUN_PREFIX + "ORBEnvironmentIsGlassFishServer" ; + public static final String ENV_IS_SERVER_PROPERTY = SUN_PREFIX + "ORBEnvironmentIsGlassFishServer"; // connection management properties - public static final String HIGH_WATER_MARK_PROPERTY = - SUN_PREFIX + "connection.ORBHighWaterMark" ; - public static final String LOW_WATER_MARK_PROPERTY = - SUN_PREFIX + "connection.ORBLowWaterMark" ; - public static final String NUMBER_TO_RECLAIM_PROPERTY = - SUN_PREFIX + "connection.ORBNumberToReclaim" ; + public static final String HIGH_WATER_MARK_PROPERTY = SUN_PREFIX + "connection.ORBHighWaterMark"; + public static final String LOW_WATER_MARK_PROPERTY = SUN_PREFIX + "connection.ORBLowWaterMark"; + public static final String NUMBER_TO_RECLAIM_PROPERTY = SUN_PREFIX + "connection.ORBNumberToReclaim"; - public static final String ACCEPTOR_CLASS_PREFIX_PROPERTY = - SUN_PREFIX + "transport.ORBAcceptor"; + public static final String ACCEPTOR_CLASS_PREFIX_PROPERTY = SUN_PREFIX + "transport.ORBAcceptor"; - public static final String CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY = - SUN_PREFIX + "transport.ORBContactInfoList"; + public static final String CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY = SUN_PREFIX + "transport.ORBContactInfoList"; // Legacy: - public static final String LEGACY_SOCKET_FACTORY_CLASS_PROPERTY = - SUN_PREFIX + "legacy.connection.ORBSocketFactoryClass" ; + public static final String LEGACY_SOCKET_FACTORY_CLASS_PROPERTY = SUN_PREFIX + "legacy.connection.ORBSocketFactoryClass"; - - public static final String SOCKET_FACTORY_CLASS_PROPERTY = - SUN_PREFIX + "transport.ORBSocketFactoryClass" ; - public static final String LISTEN_SOCKET_PROPERTY = - SUN_PREFIX + "transport.ORBListenSocket"; - public static final String IOR_TO_SOCKET_INFO_CLASS_PROPERTY = - SUN_PREFIX + "transport.ORBIORToSocketInfoClass"; - public static final String IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY = - SUN_PREFIX + "transport.ORBIIOPPrimaryToContactInfoClass"; + public static final String SOCKET_FACTORY_CLASS_PROPERTY = SUN_PREFIX + "transport.ORBSocketFactoryClass"; + public static final String LISTEN_SOCKET_PROPERTY = SUN_PREFIX + "transport.ORBListenSocket"; + public static final String IOR_TO_SOCKET_INFO_CLASS_PROPERTY = SUN_PREFIX + "transport.ORBIORToSocketInfoClass"; + public static final String IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY = SUN_PREFIX + "transport.ORBIIOPPrimaryToContactInfoClass"; // Request partitioning maximum and minimum thread pool id constants. - public static final int REQUEST_PARTITIONING_MIN_THREAD_POOL_ID = 0; + public static final int REQUEST_PARTITIONING_MIN_THREAD_POOL_ID = 0; public static final int REQUEST_PARTITIONING_MAX_THREAD_POOL_ID = 63; // Load balancing polices: integer to avoid issues with Enum encoding - public static final int FIRST_LOAD_BALANCING_VALUE = 0 ; - public static final int NO_LOAD_BALANCING = FIRST_LOAD_BALANCING_VALUE + 0 ; - public static final int PER_REQUEST_LOAD_BALANCING = FIRST_LOAD_BALANCING_VALUE + 1 ; - public static final int LAST_LOAD_BALANCING_VALUE = PER_REQUEST_LOAD_BALANCING ; + public static final int FIRST_LOAD_BALANCING_VALUE = 0; + public static final int NO_LOAD_BALANCING = FIRST_LOAD_BALANCING_VALUE + 0; + public static final int PER_REQUEST_LOAD_BALANCING = FIRST_LOAD_BALANCING_VALUE + 1; + public static final int LAST_LOAD_BALANCING_VALUE = PER_REQUEST_LOAD_BALANCING; // transport read tcp timeout property, colon separated property // with syntax // where the last parameter is optional and defaults to INTEGER.MAX_VALUE. - public static final String TRANSPORT_TCP_TIMEOUTS_PROPERTY = - SUN_PREFIX + "transport.ORBTCPTimeouts"; + public static final String TRANSPORT_TCP_TIMEOUTS_PROPERTY = SUN_PREFIX + "transport.ORBTCPTimeouts"; // Same syntax as TRANSPORT_TCP_TIMEOUTS_PROPERTY - public static final String TRANSPORT_TCP_CONNECT_TIMEOUTS_PROPERTY = - SUN_PREFIX + "transport.ORBTCPConnectTimeouts" ; + public static final String TRANSPORT_TCP_CONNECT_TIMEOUTS_PROPERTY = SUN_PREFIX + "transport.ORBTCPConnectTimeouts"; - // initial time to wait in milliseconds in a temporary - // Selector.select(long wait) if a transport tcp read + // initial time to wait in milliseconds in a temporary + // Selector.select(long wait) if a transport tcp read // or write returns 0 bytes public static final int TRANSPORT_TCP_INITIAL_TIME_TO_WAIT = 2000; @@ -283,7 +245,7 @@ public static int makePersistent( int scid ) // initial time to wait in milliseconds after an attempt to connect // fails. - public static final int TRANSPORT_TCP_CONNECT_INITIAL_TIME_TO_WAIT = 250 ; + public static final int TRANSPORT_TCP_CONNECT_INITIAL_TIME_TO_WAIT = 250; // max time to spend in cumulative waits in milliseconds // if a transport tcp read or write returns 0 bytes @@ -295,251 +257,214 @@ public static int makePersistent( int scid ) public static final int TRANSPORT_TCP_CONNECT_BACKOFF_FACTOR = 100; // Maximum time to wait before retrying to connect. - public static final int TRANSPORT_TCP_CONNECT_MAX_SINGLE_WAIT = 5000 ; + public static final int TRANSPORT_TCP_CONNECT_MAX_SINGLE_WAIT = 5000; - public static final String USE_NIO_SELECT_TO_WAIT_PROPERTY = - SUN_PREFIX + "transport.ORBUseNIOSelectToWait"; + public static final String USE_NIO_SELECT_TO_WAIT_PROPERTY = SUN_PREFIX + "transport.ORBUseNIOSelectToWait"; // "Socket" | "SocketChannel" // Note: Connections accepted by SocketChannel will be SocketChannel. - public static final String ACCEPTOR_SOCKET_TYPE_PROPERTY = - SUN_PREFIX + "transport.ORBAcceptorSocketType"; + public static final String ACCEPTOR_SOCKET_TYPE_PROPERTY = SUN_PREFIX + "transport.ORBAcceptorSocketType"; // Applicable if using SocketChannel and using select thread. - public static final String ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY = - SUN_PREFIX + "transport.ORBAcceptorSocketUseWorkerThreadForEvent"; + public static final String ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY = SUN_PREFIX + + "transport.ORBAcceptorSocketUseWorkerThreadForEvent"; // Applicable on client-side. "Socket" | "SocketChannel" - public static final String CONNECTION_SOCKET_TYPE_PROPERTY = - SUN_PREFIX + "transport.ORBConnectionSocketType"; + public static final String CONNECTION_SOCKET_TYPE_PROPERTY = SUN_PREFIX + "transport.ORBConnectionSocketType"; // Applicable if using SocketChannel and using select thread - public static final String CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY = - SUN_PREFIX + "transport.ORBConnectionSocketUseWorkerThreadForEvent"; + public static final String CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY = SUN_PREFIX + + "transport.ORBConnectionSocketUseWorkerThreadForEvent"; - // Used to disable the use of direct byte buffers. This enables much easier - // debugging, because the contents of a direct byte buffer cannot be + // Used to disable the use of direct byte buffers. This enables much easier + // debugging, because the contents of a direct byte buffer cannot be // viewed in most (all?) debuggers. - public static final String DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY = - SUN_PREFIX + "transport.ORBDisableDirectByteBufferUse" ; + public static final String DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY = SUN_PREFIX + "transport.ORBDisableDirectByteBufferUse"; // The default ByteBuffer size used to read data into when using the // optimized read strategy which is used when USE_NIO_SELECT_TO_WAIT_PROPERTY // is true, (default). public static final int DEFAULT_READ_BYTE_BUFFER_SIZE = 64000; - + // Property name to change the DEFAULT_READ_BYTE_BUFFER_SIZE value. - public static final String READ_BYTE_BUFFER_SIZE_PROPERTY = - SUN_PREFIX + "transport.ORBReadByteBufferSize"; + public static final String READ_BYTE_BUFFER_SIZE_PROPERTY = SUN_PREFIX + "transport.ORBReadByteBufferSize"; // The default pooled DirectByteBuffer slab size. - public static final int DEFAULT_POOLED_DIRECT_BYTE_BUFFER_SLAB_SIZE = - 4000000; // 4 megabytes + public static final int DEFAULT_POOLED_DIRECT_BYTE_BUFFER_SLAB_SIZE = 4000000; // 4 megabytes // The property name to set the size of the pooled DirectByteBuffer // slab size. - public static final String POOLED_DIRECT_BYTE_BUFFER_SLAB_SIZE_PROPERTY = - SUN_PREFIX + "transport.ORBPooledDirectByteBufferSlabSize"; + public static final String POOLED_DIRECT_BYTE_BUFFER_SLAB_SIZE_PROPERTY = SUN_PREFIX + "transport.ORBPooledDirectByteBufferSlabSize"; // Maximum read ByteBuffer size threshhold for which a single message will // be read. public static final int MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD = 256000; // 256 kbytes // Property to override the default MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD - public static final String MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD_PROPERTY = - SUN_PREFIX + "transport.ORBMaximumReadByteBufferSize"; + public static final String MAX_READ_BYTE_BUFFER_SIZE_THRESHOLD_PROPERTY = SUN_PREFIX + "transport.ORBMaximumReadByteBufferSize"; // A property that can tell the optimized read implementation to always // enter a blocking read before returning control the Selector Thread. - public static final String ALWAYS_ENTER_BLOCKING_READ_PROPERTY = - SUN_PREFIX + "transport.ORBOptimizedReadAlwaysEnterBlockingRead"; + public static final String ALWAYS_ENTER_BLOCKING_READ_PROPERTY = SUN_PREFIX + "transport.ORBOptimizedReadAlwaysEnterBlockingRead"; // A property that can tell the optimized read implementation to read // until zero bytes are read by the non-blocking read. - public static final String NON_BLOCKING_READ_CHECK_MESSAGE_PARSER_PROPERTY = - SUN_PREFIX + "transport.ORBNonBlockingReadCheckMessageParser"; + public static final String NON_BLOCKING_READ_CHECK_MESSAGE_PARSER_PROPERTY = SUN_PREFIX + + "transport.ORBNonBlockingReadCheckMessageParser"; // A property that can tell the optimized read implementation to be more // patient about expecting additional data to arrive. - public static final String BLOCKING_READ_CHECK_MESSAGE_PARSER_PROPERTY = - SUN_PREFIX + "transport.ORBBlockingReadCheckMessageParser"; + public static final String BLOCKING_READ_CHECK_MESSAGE_PARSER_PROPERTY = SUN_PREFIX + "transport.ORBBlockingReadCheckMessageParser"; - public static final String SOCKET = "Socket"; + public static final String SOCKET = "Socket"; public static final String SOCKETCHANNEL = "SocketChannel"; - public static final String WAIT_FOR_RESPONSE_TIMEOUT = - SUN_PREFIX + "transport.ORBWaitForResponseTimeout"; + public static final String WAIT_FOR_RESPONSE_TIMEOUT = SUN_PREFIX + "transport.ORBWaitForResponseTimeout"; - public static final String NO_DEFAULT_ACCEPTORS = - SUN_PREFIX + "transport.ORBNoDefaultAcceptors" ; + public static final String NO_DEFAULT_ACCEPTORS = SUN_PREFIX + "transport.ORBNoDefaultAcceptors"; - public static final String REGISTER_MBEANS = - SUN_PREFIX + "ORBRegisterMBeans" ; + public static final String REGISTER_MBEANS = SUN_PREFIX + "ORBRegisterMBeans"; - public static final int DEFAULT_FRAGMENT_READ_TIMEOUT = 18000 ; + public static final int DEFAULT_FRAGMENT_READ_TIMEOUT = 18000; - public static final String FRAGMENT_READ_TIMEOUT = - SUN_PREFIX + "ORBFragmentReadTimeout" ; + public static final String FRAGMENT_READ_TIMEOUT = SUN_PREFIX + "ORBFragmentReadTimeout"; // POA related policies - public static final String PERSISTENT_SERVER_PORT_PROPERTY = - SUN_PREFIX + "POA.ORBPersistentServerPort" ; - public static final String BAD_SERVER_ID_HANDLER_CLASS_PROPERTY = - SUN_PREFIX + "POA.ORBBadServerIdHandlerClass" ; - public static final String ACTIVATED_PROPERTY = - SUN_PREFIX + "POA.ORBActivated" ; - public static final String SERVER_NAME_PROPERTY = - SUN_PREFIX + "POA.ORBServerName" ; + public static final String PERSISTENT_SERVER_PORT_PROPERTY = SUN_PREFIX + "POA.ORBPersistentServerPort"; + public static final String BAD_SERVER_ID_HANDLER_CLASS_PROPERTY = SUN_PREFIX + "POA.ORBBadServerIdHandlerClass"; + public static final String ACTIVATED_PROPERTY = SUN_PREFIX + "POA.ORBActivated"; + public static final String SERVER_NAME_PROPERTY = SUN_PREFIX + "POA.ORBServerName"; // Server Properties; e.g. when properties passed to ORB activated // servers - public static final String SERVER_DEF_VERIFY_PROPERTY = - SUN_PREFIX + "activation.ORBServerVerify" ; + public static final String SERVER_DEF_VERIFY_PROPERTY = SUN_PREFIX + "activation.ORBServerVerify"; - public static final String JTS_CLASS_PROPERTY = - SUN_PREFIX + "CosTransactions.ORBJTSClass" ; + public static final String JTS_CLASS_PROPERTY = SUN_PREFIX + "CosTransactions.ORBJTSClass"; // Property for enabling ORB's use of Java serialization. - public static final String ENABLE_JAVA_SERIALIZATION_PROPERTY = - SUN_PREFIX + "encoding.ORBEnableJavaSerialization"; + public static final String ENABLE_JAVA_SERIALIZATION_PROPERTY = SUN_PREFIX + "encoding.ORBEnableJavaSerialization"; // Constants for ORB prefixes ************************************************************** - public static final String PI_ORB_INITIALIZER_CLASS_PREFIX = - "org.omg.PortableInterceptor.ORBInitializerClass."; + public static final String PI_ORB_INITIALIZER_CLASS_PREFIX = "org.omg.PortableInterceptor.ORBInitializerClass."; - public static final String USER_CONFIGURATOR_PREFIX = - SUN_PREFIX + "ORBUserConfigurators." ; + public static final String USER_CONFIGURATOR_PREFIX = SUN_PREFIX + "ORBUserConfigurators."; - public static final String RFM_PROPERTY = USER_CONFIGURATOR_PREFIX - + "com.sun.corba.ee.impl.oa.rfm.ReferenceManagerConfigurator" ; + public static final String RFM_PROPERTY = USER_CONFIGURATOR_PREFIX + "com.sun.corba.ee.impl.oa.rfm.ReferenceManagerConfigurator"; - public static final String USE_DYNAMIC_STUB_PROPERTY = - SUN_PREFIX + "ORBUseDynamicStub" ; + public static final String USE_DYNAMIC_STUB_PROPERTY = SUN_PREFIX + "ORBUseDynamicStub"; + + public static final String DEBUG_DYNAMIC_STUB = SUN_PREFIX + "ORBDebugStubGeneration"; - public static final String DEBUG_DYNAMIC_STUB = - SUN_PREFIX + "ORBDebugStubGeneration" ; - // Not available through ORBData: used only in test.Test // and in the optional ClassCopierOrdinaryImpl class. - public static final String USE_CODEGEN_REFLECTIVE_COPYOBJECT = - SUN_PREFIX + "ORBUseCodegenReflectiveCopyobject" ; + public static final String USE_CODEGEN_REFLECTIVE_COPYOBJECT = SUN_PREFIX + "ORBUseCodegenReflectiveCopyobject"; + + public static final String DYNAMIC_STUB_FACTORY_FACTORY_CLASS = SUN_PREFIX + "ORBDynamicStubFactoryFactoryClass"; - public static final String DYNAMIC_STUB_FACTORY_FACTORY_CLASS = - SUN_PREFIX + "ORBDynamicStubFactoryFactoryClass" ; - // Constants for NameService properties ************************************ - public static final int DEFAULT_INITIAL_PORT = 900; + public static final int DEFAULT_INITIAL_PORT = 900; public static final String DEFAULT_INS_HOST = "localhost"; - public static final int DEFAULT_INS_PORT = 2809; + public static final int DEFAULT_INS_PORT = 2809; - public static final int DEFAULT_INS_GIOP_MAJOR_VERSION = 1; + public static final int DEFAULT_INS_GIOP_MAJOR_VERSION = 1; // http://www.omg.org/cgi-bin/doc?ptc/00-08-07 [ Section 13.6.7.3 ] // defines the default GIOP minor version to be 0. - public static final int DEFAULT_INS_GIOP_MINOR_VERSION = 0; - + public static final int DEFAULT_INS_GIOP_MINOR_VERSION = 0; // Constants for INS properties ******************************************** // GIOP Version number for validation of INS URL format addresses - public static final int MAJORNUMBER_SUPPORTED = 1; - public static final int MINORNUMBERMAX = 2; + public static final int MAJORNUMBER_SUPPORTED = 1; + public static final int MINORNUMBERMAX = 2; // Subcontract's differentiation using the TRANSIENT and PERSISTENT // Name Service Property. - public static final int TRANSIENT = 1; - public static final int PERSISTENT = 2; + public static final int TRANSIENT = 1; + public static final int PERSISTENT = 2; // Constants for ORBD properties **************************************************************** // Used to disable ORBD, which is the normal case when the ORBFactory is used to create an ORB. - public static final String DISABLE_ORBD_INIT_PROPERTY = SUN_PREFIX + "activation.ORBDisableORBD" ; + public static final String DISABLE_ORBD_INIT_PROPERTY = SUN_PREFIX + "activation.ORBDisableORBD"; // These properties are never passed on ORB init: they are only passed to ORBD. - public static final String DB_DIR_PROPERTY = SUN_PREFIX + "activation.DbDir" ; - public static final String DB_PROPERTY = SUN_PREFIX + "activation.db" ; - public static final String ORBD_PORT_PROPERTY = SUN_PREFIX + "activation.Port" ; - public static final String SERVER_POLLING_TIME = SUN_PREFIX + "activation.ServerPollingTime"; - public static final String SERVER_STARTUP_DELAY = SUN_PREFIX + "activation.ServerStartupDelay"; + public static final String DB_DIR_PROPERTY = SUN_PREFIX + "activation.DbDir"; + public static final String DB_PROPERTY = SUN_PREFIX + "activation.db"; + public static final String ORBD_PORT_PROPERTY = SUN_PREFIX + "activation.Port"; + public static final String SERVER_POLLING_TIME = SUN_PREFIX + "activation.ServerPollingTime"; + public static final String SERVER_STARTUP_DELAY = SUN_PREFIX + "activation.ServerStartupDelay"; - public static final int DEFAULT_ACTIVATION_PORT = 1049 ; + public static final int DEFAULT_ACTIVATION_PORT = 1049; // If RI is starting the NameService then they would indicate that by // passing the RI flag. That would start a Persistent Port to listen to // INS request. - public static final int RI_NAMESERVICE_PORT = 1050; - - public static final int DEFAULT_SERVER_POLLING_TIME = 1000; + public static final int RI_NAMESERVICE_PORT = 1050; - public static final int DEFAULT_SERVER_STARTUP_DELAY = 1000; + public static final int DEFAULT_SERVER_POLLING_TIME = 1000; + public static final int DEFAULT_SERVER_STARTUP_DELAY = 1000; - //***************** Constants for Logging **************** + // ***************** Constants for Logging **************** - public static final String LOG_LEVEL_PROPERTY = SUN_PREFIX + "ORBLogLevel"; + public static final String LOG_LEVEL_PROPERTY = SUN_PREFIX + "ORBLogLevel"; - public static final String LOG_RESOURCE_FILE = - "com.sun.corba.ee.impl.logging.LogStrings"; + public static final String LOG_RESOURCE_FILE = "com.sun.corba.ee.impl.logging.LogStrings"; - public static final String SHOW_INFO_MESSAGES - = SUN_PREFIX + "ORBShowInfoMessages"; + public static final String SHOW_INFO_MESSAGES = SUN_PREFIX + "ORBShowInfoMessages"; - public static final String GET_SERVICE_CONTEXT_RETURNS_NULL - = SUN_PREFIX + "ORBGetServiceContextReturnsNull"; + public static final String GET_SERVICE_CONTEXT_RETURNS_NULL = SUN_PREFIX + "ORBGetServiceContextReturnsNull"; // Constants for initial references ************************************************************* - public static final String TRANSIENT_NAME_SERVICE_NAME = "TNameService" ; - public static final String PERSISTENT_NAME_SERVICE_NAME = "NameService" ; + public static final String TRANSIENT_NAME_SERVICE_NAME = "TNameService"; + public static final String PERSISTENT_NAME_SERVICE_NAME = "NameService"; // A large Number to make sure that other ServerIds doesn't collide // with NameServer Persistent Server Id - public static final String NAME_SERVICE_SERVER_ID = "1000000" ; - - public static final String ROOT_POA_NAME = "RootPOA" ; - public static final String POA_CURRENT_NAME = "POACurrent" ; - public static final String SERVER_ACTIVATOR_NAME = "ServerActivator" ; - public static final String SERVER_LOCATOR_NAME = "ServerLocator" ; - public static final String SERVER_REPOSITORY_NAME = "ServerRepository" ; - public static final String INITIAL_NAME_SERVICE_NAME= "InitialNameService" ; - public static final String TRANSACTION_CURRENT_NAME = "TransactionCurrent" ; - public static final String DYN_ANY_FACTORY_NAME = "DynAnyFactory" ; - public static final String REFERENCE_FACTORY_MANAGER= "ReferenceFactoryManager" ; + public static final String NAME_SERVICE_SERVER_ID = "1000000"; + + public static final String ROOT_POA_NAME = "RootPOA"; + public static final String POA_CURRENT_NAME = "POACurrent"; + public static final String SERVER_ACTIVATOR_NAME = "ServerActivator"; + public static final String SERVER_LOCATOR_NAME = "ServerLocator"; + public static final String SERVER_REPOSITORY_NAME = "ServerRepository"; + public static final String INITIAL_NAME_SERVICE_NAME = "InitialNameService"; + public static final String TRANSACTION_CURRENT_NAME = "TransactionCurrent"; + public static final String DYN_ANY_FACTORY_NAME = "DynAnyFactory"; + public static final String REFERENCE_FACTORY_MANAGER = "ReferenceFactoryManager"; // New for Portable Interceptors - public static final String PI_CURRENT_NAME = "PICurrent" ; - public static final String CODEC_FACTORY_NAME = "CodecFactory" ; - - public static final String FOLB_CLIENT_GROUP_INFO_SERVICE = - "FolbClientGroupInfoService"; + public static final String PI_CURRENT_NAME = "PICurrent"; + public static final String CODEC_FACTORY_NAME = "CodecFactory"; - public static final String FOLB_SERVER_GROUP_INFO_SERVICE = - "FolbServerGroupInfoService"; + public static final String FOLB_CLIENT_GROUP_INFO_SERVICE = "FolbClientGroupInfoService"; - public static final String CSI_V2_SSL_TAGGED_COMPONENT_HANDLER = - "CSIv2SSLTaggedComponentHandler"; + public static final String FOLB_SERVER_GROUP_INFO_SERVICE = "FolbServerGroupInfoService"; + public static final String CSI_V2_SSL_TAGGED_COMPONENT_HANDLER = "CSIv2SSLTaggedComponentHandler"; // Constants for ORBD DB *********************************************************************** - public static final String DEFAULT_DB_DIR = "orb.db" ; - public static final String DEFAULT_DB_NAME = "db" ; - public static final String INITIAL_ORB_DB = "initial.db" ; - public static final String SERVER_LOG_DIR = "logs" ; - public static final String ORBID_DIR_BASE = "orbids" ; - public static final String ORBID_DB_FILE_NAME = "orbids.db" ; + public static final String DEFAULT_DB_DIR = "orb.db"; + public static final String DEFAULT_DB_NAME = "db"; + public static final String INITIAL_ORB_DB = "initial.db"; + public static final String SERVER_LOG_DIR = "logs"; + public static final String ORBID_DIR_BASE = "orbids"; + public static final String ORBID_DB_FILE_NAME = "orbids.db"; // Constants for minor code bases ************************************************************** - // This is the value that pre-Merlin Sun ORBs incorrectly used. We preserve this + // This is the value that pre-Merlin Sun ORBs incorrectly used. We preserve this // here for backwards compatibility, but note that the current ORB must never // create a BAD_PARAM system exception with this minor code. - public static final int LEGACY_SUN_NOT_SERIALIZABLE = SUNVMCID.value + 1 ; + public static final int LEGACY_SUN_NOT_SERIALIZABLE = SUNVMCID.value + 1; // Code Set related ******************************************************* @@ -548,10 +473,9 @@ public static int makePersistent( int scid ) // those of a first request with other large service contexts. // public static final boolean DEFAULT_ALWAYS_SEND_CODESET_CTX = true; - public static final String ALWAYS_SEND_CODESET_CTX_PROPERTY - = SUN_PREFIX + "codeset.AlwaysSendCodeSetCtx"; + public static final String ALWAYS_SEND_CODESET_CTX_PROPERTY = SUN_PREFIX + "codeset.AlwaysSendCodeSetCtx"; - // Use byte order markers in streams when applicable? This won't apply to + // Use byte order markers in streams when applicable? This won't apply to // GIOP 1.1 due to limitations in the CDR encoding. public static final boolean DEFAULT_USE_BYTE_ORDER_MARKERS = true; public static final String USE_BOMS = SUN_PREFIX + "codeset.UseByteOrderMarkers"; @@ -561,8 +485,8 @@ public static int makePersistent( int scid ) public static final String USE_BOMS_IN_ENCAPS = SUN_PREFIX + "codeset.UseByteOrderMarkersInEncaps"; // The CHAR_CODESETS and WCHAR_CODESETS allow the user to override the default - // connection code sets. The value should be a comma separated list of OSF - // registry numbers. The first number in the list will be the native code + // connection code sets. The value should be a comma separated list of OSF + // registry numbers. The first number in the list will be the native code // set. // // Number can be specified as hex if preceded by 0x, otherwise they are @@ -572,50 +496,47 @@ public static int makePersistent( int scid ) // // char/string: // - // ISO8859-1 (Latin-1) 0x00010001 - // ISO646 (ASCII) 0x00010020 - // UTF-8 0x05010001 + // ISO8859-1 (Latin-1) 0x00010001 + // ISO646 (ASCII) 0x00010020 + // UTF-8 0x05010001 // // wchar/string: // - // UTF-16 0x00010109 - // UCS-2 0x00010100 - // UTF-8 0x05010001 + // UTF-16 0x00010109 + // UCS-2 0x00010100 + // UTF-8 0x05010001 // - // Note: The ORB will let you assign any of the above values to + // Note: The ORB will let you assign any of the above values to // either of the following properties, but the above assignments // are the only ones that won't get you into trouble. public static final String CHAR_CODESETS = SUN_PREFIX + "codeset.charsets"; public static final String WCHAR_CODESETS = SUN_PREFIX + "codeset.wcharsets"; // Constants to make stream format version code easier to read - public static final byte STREAM_FORMAT_VERSION_1 = (byte)1; - public static final byte STREAM_FORMAT_VERSION_2 = (byte)2; + public static final byte STREAM_FORMAT_VERSION_1 = (byte) 1; + public static final byte STREAM_FORMAT_VERSION_2 = (byte) 2; // Constants used for denoting different serialization encodings. public static final byte CDR_ENC_VERSION = (byte) 0; - public static final byte JAVA_ENC_VERSION = (byte) 1; + public static final byte JAVA_ENC_VERSION = (byte) 1; // property to check if the current ORB was created from within the app server public static final String APPSERVER_MODE = SUN_PREFIX + "ORBAppServerMode"; // name for looking up the remote object for getting initial clister instance info - public static final String INITIAL_GROUP_INFO_SERVICE = "INITIAL_GIS" ; + public static final String INITIAL_GROUP_INFO_SERVICE = "INITIAL_GIS"; - // Enable the use of internal timing points. This slows the ORB down slightly, + // Enable the use of internal timing points. This slows the ORB down slightly, // even if none of the individual timing points are themselves enabled. - public static final String TIMING_POINTS_ENABLED = SUN_PREFIX - + "ORBEnableTimingPoints" ; + public static final String TIMING_POINTS_ENABLED = SUN_PREFIX + "ORBEnableTimingPoints"; - // Enable the use of the EnumDesc class for marshaling enums. Really only + // Enable the use of the EnumDesc class for marshaling enums. Really only // present for testing. - public static final String USE_ENUM_DESC = SUN_PREFIX - + "ORBUseEnumDesc" ; + public static final String USE_ENUM_DESC = SUN_PREFIX + "ORBUseEnumDesc"; // Specify an AMXv3-compliant ObjectName (as a string) for the parent of the // ORB's gmbal root. - public static final String GMBAL_ROOT_PARENT_NAME = SUN_PREFIX - + "ORBGmbalRootParentName" ; + public static final String GMBAL_ROOT_PARENT_NAME = SUN_PREFIX + "ORBGmbalRootParentName"; } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/NullServant.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/NullServant.java index c5ca1d084..799a4e7f9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/NullServant.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/NullServant.java @@ -17,24 +17,21 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.oa ; +package com.sun.corba.ee.spi.oa; -import org.omg.CORBA.SystemException ; +import org.omg.CORBA.SystemException; -/** NullServant is used to represent a null servant returned - * OAInvocationInfo after a - * ObjectAdapter.getInvocationServant( OAInvocationInfo ) call. - * If the getInvocationServant call could not locate a servant - * for the ObjectId in the OAInvocationInfo, getServantContainer - * will contain a NullServant. Later stages of the request - * dispatch may choose either to throw the exception or perform - * some other action in response to the NullServant result. +/** + * NullServant is used to represent a null servant returned OAInvocationInfo after a ObjectAdapter.getInvocationServant( + * OAInvocationInfo ) call. If the getInvocationServant call could not locate a servant for the ObjectId in the + * OAInvocationInfo, getServantContainer will contain a NullServant. Later stages of the request dispatch may choose + * either to throw the exception or perform some other action in response to the NullServant result. */ -public interface NullServant -{ - /** Obtain the exception that is associated with this - * NullServant instance. +public interface NullServant { + /** + * Obtain the exception that is associated with this NullServant instance. + * * @return the associated exception */ - SystemException getException() ; + SystemException getException(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OADefault.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OADefault.java index a3e4297b6..9d2c22eae 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OADefault.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OADefault.java @@ -17,28 +17,26 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.oa ; +package com.sun.corba.ee.spi.oa; -import com.sun.corba.ee.impl.oa.poa.POAFactory ; -import com.sun.corba.ee.impl.oa.toa.TOAFactory ; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.impl.oa.poa.POAFactory; +import com.sun.corba.ee.impl.oa.toa.TOAFactory; +import com.sun.corba.ee.spi.orb.ORB; -/** OADefault provides methods to create the standard ObjectAdapterFactory - * instances for this version of the ORB. These methods are generally - * used in ORBConfigurator instances to construct an ORB instance. +/** + * OADefault provides methods to create the standard ObjectAdapterFactory instances for this version of the ORB. These + * methods are generally used in ORBConfigurator instances to construct an ORB instance. */ public class OADefault { - public static ObjectAdapterFactory makePOAFactory( ORB orb ) - { - ObjectAdapterFactory oaf = new POAFactory() ; - oaf.init( orb ) ; - return oaf ; + public static ObjectAdapterFactory makePOAFactory(ORB orb) { + ObjectAdapterFactory oaf = new POAFactory(); + oaf.init(orb); + return oaf; } - public static ObjectAdapterFactory makeTOAFactory( ORB orb ) - { - ObjectAdapterFactory oaf = new TOAFactory() ; - oaf.init( orb ) ; - return oaf ; + public static ObjectAdapterFactory makeTOAFactory(ORB orb) { + ObjectAdapterFactory oaf = new TOAFactory(); + oaf.init(orb); + return oaf; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OADestroyed.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OADestroyed.java index 06d1392b6..13e8d80a0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OADestroyed.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OADestroyed.java @@ -19,8 +19,9 @@ package com.sun.corba.ee.spi.oa; -/** This exception is thrown when an operation on an ObjectAdapter - * fails because the ObjectAdapter was destroyed during the operation. +/** + * This exception is thrown when an operation on an ObjectAdapter fails because the ObjectAdapter was destroyed during + * the operation. */ public class OADestroyed extends java.lang.Exception { } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OAInvocationInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OAInvocationInfo.java index da9efd706..4d1de8b05 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OAInvocationInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/OAInvocationInfo.java @@ -19,82 +19,96 @@ package com.sun.corba.ee.spi.oa; -import javax.rmi.CORBA.Tie ; +import javax.rmi.CORBA.Tie; import org.glassfish.pfl.dynamic.copyobject.spi.ObjectCopierFactory; import org.omg.CORBA.portable.ServantObject; import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; - -/** This class is a holder for the information required to implement POACurrent. -* It is also used for the ServantObject that is returned by _servant_preinvoke calls. -* This allows us to avoid allocating an extra object on each collocated invocation. -*/ +/** + * This class is a holder for the information required to implement POACurrent. It is also used for the ServantObject + * that is returned by _servant_preinvoke calls. This allows us to avoid allocating an extra object on each collocated + * invocation. + */ public class OAInvocationInfo extends ServantObject { // This is the container object for the servant. // In the RMI-IIOP case, it is the RMI-IIOP Tie, and the servant is the // target of the Tie. // In all other cases, it is the same as the Servant. - private java.lang.Object servantContainer ; + private java.lang.Object servantContainer; // These fields are to support standard OMG APIs. - private ObjectAdapter oa; - private byte[] oid; + private ObjectAdapter oa; + private byte[] oid; // These fields are to support the Object adapter implementation. - private CookieHolder cookieHolder; - private String operation; + private CookieHolder cookieHolder; + private String operation; // This is the copier to be used by javax.rmi.CORBA.Util.copyObject(s) // For the current request. - private ObjectCopierFactory factory ; + private ObjectCopierFactory factory; - public OAInvocationInfo(ObjectAdapter oa, byte[] id ) - { + public OAInvocationInfo(ObjectAdapter oa, byte[] id) { this.oa = oa; - this.oid = id; + this.oid = id; } // Copy constructor of sorts; used in local optimization path - public OAInvocationInfo( OAInvocationInfo info, String operation ) - { - this.servant = info.servant ; - this.servantContainer = info.servantContainer ; - this.cookieHolder = info.cookieHolder ; - this.oa = info.oa; - this.oid = info.oid; - this.factory = info.factory ; - - this.operation = operation; + public OAInvocationInfo(OAInvocationInfo info, String operation) { + this.servant = info.servant; + this.servantContainer = info.servantContainer; + this.cookieHolder = info.cookieHolder; + this.oa = info.oa; + this.oid = info.oid; + this.factory = info.factory; + + this.operation = operation; + } + + // getters + public ObjectAdapter oa() { + return oa; } - //getters - public ObjectAdapter oa() { return oa ; } - public byte[] id() { return oid ; } - public Object getServantContainer() { return servantContainer ; } + public byte[] id() { + return oid; + } + + public Object getServantContainer() { + return servantContainer; + } - // Create CookieHolder on demand. This is only called by a single + // Create CookieHolder on demand. This is only called by a single // thread, so no synchronization is needed. - public CookieHolder getCookieHolder() - { + public CookieHolder getCookieHolder() { if (cookieHolder == null) - cookieHolder = new CookieHolder() ; + cookieHolder = new CookieHolder(); - return cookieHolder; + return cookieHolder; } - public String getOperation() { return operation; } - public ObjectCopierFactory getCopierFactory() { return factory; } + public String getOperation() { + return operation; + } + + public ObjectCopierFactory getCopierFactory() { + return factory; + } - //setters - public void setOperation( String operation ) { this.operation = operation ; } - public void setCopierFactory( ObjectCopierFactory factory ) { this.factory = factory ; } + // setters + public void setOperation(String operation) { + this.operation = operation; + } + + public void setCopierFactory(ObjectCopierFactory factory) { + this.factory = factory; + } - public void setServant(Object servant) - { - servantContainer = servant ; + public void setServant(Object servant) { + servantContainer = servant; if (servant instanceof Tie) - this.servant = ((Tie)servant).getTarget() ; + this.servant = ((Tie) servant).getTarget(); else - this.servant = servant; + this.servant = servant; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapter.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapter.java index 9ce3e928f..7ee3e7ece 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapter.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapter.java @@ -17,257 +17,262 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.oa ; +package com.sun.corba.ee.spi.oa; -import org.omg.CORBA.Policy ; +import org.omg.CORBA.Policy; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceFactory ; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; +import org.omg.PortableInterceptor.ObjectReferenceFactory; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.IORTemplate ; +import com.sun.corba.ee.spi.ior.IORTemplate; import org.glassfish.gmbal.Description; import org.glassfish.gmbal.ManagedAttribute; import org.glassfish.gmbal.ManagedObject; // REVISIT: What should the order be? enter/push...pop/exit? -/** ObjectAdapter represents the abstract model of an object -* adapter that was introduced by ORT. This means that all -* object adapters must: -*

      -*
    • Have an ORB
    • -*
    • Have a name
    • -*
    • Have an adapter manager (represented by an ID)
    • -*
    • Have an adapter template
    • -*
    • Support getting and setting their ObjectReferenceFactory
    • -*
    • Provide access to their current state
    • -*
    • Support adding components to their profiles expressed in the adapter template
    • -*
    -* Other requirements: -*
      -*
    • All object adapters must invoke ORB.AdapterCreated when they are created. -*
    • -*
    • All adapter managers must invoke ORB.AdapterManagerStateChanged when -* their state changes, mapping the internal state to an ORT state.
    • -*
    • AdapterStateChanged must be invoked (from somewhere) whenever -* an adapter state changes that is not due to an adapter manager state change.
    • -*
    -*

    -* Object adapters must also provide mechanisms for: -*

      -*
    • Managing object reference lifecycle
    • -*
    • Controlling how servants are associated with object references
    • -*
    • Manage the state of the adapter, if the adapter desires to implement such mechanisms
    • -*
    -* Such mechanisms are all object adapter specific, and so we do not attempt to -* create general APIs for these functions here. The object adapter itself -* must provide these APIs directly to the user, and they do not affect the rest of the -* ORB. This interface basically makes it possible to plug any object adapter into the -* ORB and have the OA work propertly with portable interceptors, and also have requests -* dispatched properly to the object adapter. -*

    -* The basic function of an ObjectAdapter is to map object IDs to servants and to support -* the dispatch operation of the subcontract, which dispatches requests to servants. -* This is the purpose of the getInvocationServant method. In addition, ObjectAdapters must be -* able to change state gracefully in the presence of executing methods. This -* requires the use of the enter/exit methods. Finally, ObjectAdapters often -* require access to information about requests. This is accomodated through the -* OAInvocationInfo class and the thread local stack maintained by push/pop/peekInvocationInfo -* on the ORB. -*

    -* To be useful, this dispatch cycle must be extremely efficient. There are several -* scenarios that matter: -*

      -*
    1. A remote invocation, where the dispatch is handled in the server subcontract.
    2. -*
    3. A local invocation, where the dispatch is handled in the client subcontract.
    4. -*
    5. A cached local invocation, where the servant is cached when the IOR is established -* for the client subcontract, and the dispatch is handled in the client subcontract -* to the cached subcontract.
    6. -*
    -*

    -* Each of these 3 cases is handled a bit differently. On each request, assume as known -* ObjectId and ObjectAdapterId, which can be obtained from the object key. -* The ObjectAdaptorFactory is available in the subcontract registry, where it is -* registered under the subcontract ID. The Subcontract ID is also available in the -* object key. -*

      -*
    1. The remote pattern: -*
        -*
      1. oa = oaf.find( oaid )
      2. -*
      3. oa.enter()
      4. -*
      5. info = oa.makeInvocationInfo( oid )
      6. -*
      7. info.setOperation( operation )
      8. -*
      9. push info
      10. -*
      11. oa.getInvocationServant( info )
      12. -*
      13. sreq.setExecuteReturnServantInResponseConstructor( true )
      14. -*
      15. dispatch to servant
      16. -*
      17. oa.returnServant()
      18. -*
      19. oa.exit()
      20. -*
      21. pop info
      22. -*
      -*
      • -* REVISIT: Is this the required order for exit/pop? Can they be nested instead? -* Note that getInvocationServant and returnServant may throw exceptions. In such cases, -* returnServant, exit, and pop must be called in the correct order. -*
    2. -*
    3. The local pattern: -*
        -*
      1. oa = oaf.find( oaid )
      2. -*
      3. oa.enter()
      4. -*
      5. info = oa.makeInvocationInfo( oid )
      6. -*
      7. info.setOperation( operation )
      8. -*
      9. push info
      10. -*
      11. oa.getInvocationServant( info )
      12. -*
      13. dispatch to servant
      14. -*
      15. oa.returnServant()
      16. -*
      17. oa.exit()
      18. -*
      19. pop info
      20. -*
      -*
      • -* This is the same as the remote case, except that setExecuteReturnServantInResponseConstructor -* is not needed (or possible, since there is no server request). -*
    4. -*
    5. The fast local pattern: When delegate is constructed, -* first extract ObjectKey from IOR in delegate, -* then get ObjectId, ObjectAdapterId, and ObjectAdapterFactory (oaf). Then: -*
        -*
      1. oa = oaf.find( oaid )
      2. -*
      3. info = oa.makeInvocationInfo( oid ) (note: no operation!)
      4. -*
      5. push info (needed for the correct functioning of getInvocationServant)
      6. -*
      7. oa.getInvocationServant( info )
      8. -*
      9. pop info -*
      -* The info instance (which includes the Servant) is cached in the client subcontract. -*

      Then, on each invocation:

      -*
        -*
      1. newinfo = copy of info (clone)
      2. -*
      3. info.setOperation( operation )
      4. -*
      5. push newinfo
      6. -*
      7. oa.enter()
      8. -*
      9. dispatch to servant
      10. -*
      11. oa.returnServant()
      12. -*
      13. oa.exit()
      14. -*
      15. pop info
      16. -*
      -*
    6. -*
    -*/ +/** + * ObjectAdapter represents the abstract model of an object adapter that was introduced by ORT. This means that all + * object adapters must: + *
      + *
    • Have an ORB
    • + *
    • Have a name
    • + *
    • Have an adapter manager (represented by an ID)
    • + *
    • Have an adapter template
    • + *
    • Support getting and setting their ObjectReferenceFactory
    • + *
    • Provide access to their current state
    • + *
    • Support adding components to their profiles expressed in the adapter template
    • + *
    + * Other requirements: + *
      + *
    • All object adapters must invoke ORB.AdapterCreated when they are created.
    • + *
    • All adapter managers must invoke ORB.AdapterManagerStateChanged when their state changes, mapping the internal + * state to an ORT state.
    • + *
    • AdapterStateChanged must be invoked (from somewhere) whenever an adapter state changes that is not due to an + * adapter manager state change.
    • + *
    + *

    + * Object adapters must also provide mechanisms for: + *

      + *
    • Managing object reference lifecycle
    • + *
    • Controlling how servants are associated with object references
    • + *
    • Manage the state of the adapter, if the adapter desires to implement such mechanisms
    • + *
    + * Such mechanisms are all object adapter specific, and so we do not attempt to create general APIs for these functions + * here. The object adapter itself must provide these APIs directly to the user, and they do not affect the rest of the + * ORB. This interface basically makes it possible to plug any object adapter into the ORB and have the OA work + * propertly with portable interceptors, and also have requests dispatched properly to the object adapter. + *

    + * The basic function of an ObjectAdapter is to map object IDs to servants and to support the dispatch operation of the + * subcontract, which dispatches requests to servants. This is the purpose of the getInvocationServant method. In + * addition, ObjectAdapters must be able to change state gracefully in the presence of executing methods. This requires + * the use of the enter/exit methods. Finally, ObjectAdapters often require access to information about requests. This + * is accomodated through the OAInvocationInfo class and the thread local stack maintained by + * push/pop/peekInvocationInfo on the ORB. + *

    + * To be useful, this dispatch cycle must be extremely efficient. There are several scenarios that matter: + *

      + *
    1. A remote invocation, where the dispatch is handled in the server subcontract.
    2. + *
    3. A local invocation, where the dispatch is handled in the client subcontract.
    4. + *
    5. A cached local invocation, where the servant is cached when the IOR is established for the client subcontract, + * and the dispatch is handled in the client subcontract to the cached subcontract. + *
    6. + *
    + *

    + * Each of these 3 cases is handled a bit differently. On each request, assume as known ObjectId and ObjectAdapterId, + * which can be obtained from the object key. The ObjectAdaptorFactory is available in the subcontract registry, where + * it is registered under the subcontract ID. The Subcontract ID is also available in the object key. + *

      + *
    1. The remote pattern: + *
        + *
      1. oa = oaf.find( oaid )
      2. + *
      3. oa.enter()
      4. + *
      5. info = oa.makeInvocationInfo( oid )
      6. + *
      7. info.setOperation( operation )
      8. + *
      9. push info
      10. + *
      11. oa.getInvocationServant( info )
      12. + *
      13. sreq.setExecuteReturnServantInResponseConstructor( true )
      14. + *
      15. dispatch to servant
      16. + *
      17. oa.returnServant()
      18. + *
      19. oa.exit()
      20. + *
      21. pop info
      22. + *
      + *
        + *
      • REVISIT: Is this the required order for exit/pop? Can they be nested instead? Note that getInvocationServant and + * returnServant may throw exceptions. In such cases, returnServant, exit, and pop must be called in the correct order. + *
      • + *
      + *
    2. + *
    3. The local pattern: + *
        + *
      1. oa = oaf.find( oaid )
      2. + *
      3. oa.enter()
      4. + *
      5. info = oa.makeInvocationInfo( oid )
      6. + *
      7. info.setOperation( operation )
      8. + *
      9. push info
      10. + *
      11. oa.getInvocationServant( info )
      12. + *
      13. dispatch to servant
      14. + *
      15. oa.returnServant()
      16. + *
      17. oa.exit()
      18. + *
      19. pop info
      20. + *
      + *
        + *
      • This is the same as the remote case, except that setExecuteReturnServantInResponseConstructor is not needed (or + * possible, since there is no server request).
      • + *
      + *
    4. + *
    5. The fast local pattern: When delegate is constructed, first extract ObjectKey from IOR in delegate, then get + * ObjectId, ObjectAdapterId, and ObjectAdapterFactory (oaf). Then: + *
        + *
      1. oa = oaf.find( oaid )
      2. + *
      3. info = oa.makeInvocationInfo( oid ) (note: no operation!)
      4. + *
      5. push info (needed for the correct functioning of getInvocationServant)
      6. + *
      7. oa.getInvocationServant( info )
      8. + *
      9. pop info + *
      + * The info instance (which includes the Servant) is cached in the client subcontract. + *

      + * Then, on each invocation: + *

      + *
        + *
      1. newinfo = copy of info (clone)
      2. + *
      3. info.setOperation( operation )
      4. + *
      5. push newinfo
      6. + *
      7. oa.enter()
      8. + *
      9. dispatch to servant
      10. + *
      11. oa.returnServant()
      12. + *
      13. oa.exit()
      14. + *
      15. pop info
      16. + *
      + *
    6. + *
    + */ @ManagedObject -@Description( "ObjectAdapter used to dispatch requests and manage servants") -public interface ObjectAdapter -{ +@Description("ObjectAdapter used to dispatch requests and manage servants") +public interface ObjectAdapter { //////////////////////////////////////////////////////////////////////////// // Basic methods for supporting interceptors //////////////////////////////////////////////////////////////////////////// - /** Returns the ORB associated with this adapter. + /** + * Returns the ORB associated with this adapter. + * * @return the associated ORB - */ - ORB getORB() ; + */ + ORB getORB(); - Policy getEffectivePolicy( int type ) ; + Policy getEffectivePolicy(int type); - /** Returns the IOR template of this adapter. The profiles - * in this template may be updated only during the AdapterCreated call. - * After that call completes, the IOR template must be made immutable. - * Note that the server ID, ORB ID, and adapter name are all available - * from the IOR template. - * @return IOR template of this adapter - */ + /** + * Returns the IOR template of this adapter. The profiles in this template may be updated only during the AdapterCreated + * call. After that call completes, the IOR template must be made immutable. Note that the server ID, ORB ID, and + * adapter name are all available from the IOR template. + * + * @return IOR template of this adapter + */ @ManagedAttribute - @Description( "The IORTemplate used to create Object References") - IORTemplate getIORTemplate() ; + @Description("The IORTemplate used to create Object References") + IORTemplate getIORTemplate(); //////////////////////////////////////////////////////////////////////////// // Methods needed to support ORT. //////////////////////////////////////////////////////////////////////////// - /** Return the ID of the AdapterManager for this object adapter. + /** + * Return the ID of the AdapterManager for this object adapter. + * * @return the identifier - */ + */ @ManagedAttribute - @Description( "The identifier for the AdapterManager that manages this ObjectAdapter") - int getManagerId() ; + @Description("The identifier for the AdapterManager that manages this ObjectAdapter") + int getManagerId(); - /** Return the current state of this object adapter (see - * {@link org.omg.PortableInterceptor} for states). - * @return the current state of this object adapter - * @see org.omg.PortableInterceptor - */ - short getState() ; + /** + * Return the current state of this object adapter (see {@link org.omg.PortableInterceptor} for states). + * + * @return the current state of this object adapter + * @see org.omg.PortableInterceptor + */ + short getState(); @ManagedAttribute - @Description( "The adapter template" ) - ObjectReferenceTemplate getAdapterTemplate() ; + @Description("The adapter template") + ObjectReferenceTemplate getAdapterTemplate(); @ManagedAttribute - @Description( "The current object reference factory" ) - ObjectReferenceFactory getCurrentFactory() ; + @Description("The current object reference factory") + ObjectReferenceFactory getCurrentFactory(); - /** Change the current factory. This may only be called during the - * AdapterCreated call. - * @param factory replacement factory - */ - void setCurrentFactory( ObjectReferenceFactory factory ) ; + /** + * Change the current factory. This may only be called during the AdapterCreated call. + * + * @param factory replacement factory + */ + void setCurrentFactory(ObjectReferenceFactory factory); //////////////////////////////////////////////////////////////////////////// // Methods required for dispatching to servants //////////////////////////////////////////////////////////////////////////// - /** Get the servant corresponding to the given objectId, if this is supported. - * This method is only used for models where the servant is an ObjectImpl, - * which allows the servant to be used directly as the stub. This allows an object - * reference to be replaced by its servant when it is unmarshalled locally. - * Such objects are not ORB mediated. + /** + * Get the servant corresponding to the given objectId, if this is supported. This method is only used for models where + * the servant is an ObjectImpl, which allows the servant to be used directly as the stub. This allows an object + * reference to be replaced by its servant when it is unmarshalled locally. Such objects are not ORB mediated. + * * @param objectId byte array representing the object ID * @return corresponding servant */ - org.omg.CORBA.Object getLocalServant( byte[] objectId ) ; + org.omg.CORBA.Object getLocalServant(byte[] objectId); - /** Get the servant for the request given by the parameters. - * info must contain a valid objectId in this call. - * The servant is set in the InvocationInfo argument that is passed into - * this call. - * @param info is the InvocationInfo object for the object reference - * @exception com.sun.corba.ee.spi.protocol.ForwardException (a runtime exception) is thrown if the request - * is to be handled by a different object reference. - */ - void getInvocationServant( OAInvocationInfo info ) ; + /** + * Get the servant for the request given by the parameters. info must contain a valid objectId in this call. The servant + * is set in the InvocationInfo argument that is passed into this call. + * + * @param info is the InvocationInfo object for the object reference + * @exception com.sun.corba.ee.spi.protocol.ForwardException (a runtime exception) is thrown if the request is to be + * handled by a different object reference. + */ + void getInvocationServant(OAInvocationInfo info); - /** enter must be called before each request is invoked on a servant. - * @exception OADestroyed is thrown when an OA has been destroyed, which - * requires a retry in the case where an AdapterActivator is present. - */ - void enter( ) throws OADestroyed ; + /** + * enter must be called before each request is invoked on a servant. + * + * @exception OADestroyed is thrown when an OA has been destroyed, which requires a retry in the case where an + * AdapterActivator is present. + */ + void enter() throws OADestroyed; - /** exit must be called after each request has been completed. If enter - * is called and completes normally, there must always be a corresponding exit. - * If enter throw OADestroyed, exit must NOT be called. - */ - void exit( ) ; + /** + * exit must be called after each request has been completed. If enter is called and completes normally, there must + * always be a corresponding exit. If enter throw OADestroyed, exit must NOT be called. + */ + void exit(); - /** Must be called every time getInvocationServant is called after - * the request has completed. + /** + * Must be called every time getInvocationServant is called after the request has completed. */ - public void returnServant() ; + public void returnServant(); - /** Create an instance of InvocationInfo that is appropriate for this - * Object adapter. - * @param objectId ID of object to create - * @return created instance - */ - OAInvocationInfo makeInvocationInfo( byte[] objectId ) ; + /** + * Create an instance of InvocationInfo that is appropriate for this Object adapter. + * + * @param objectId ID of object to create + * @return created instance + */ + OAInvocationInfo makeInvocationInfo(byte[] objectId); - /** Return the most derived interface for the given servant and objectId. + /** + * Return the most derived interface for the given servant and objectId. + * * @param servant servant object * @param objectId byte array forming the objectId * @return list of derived interfaces - */ - String[] getInterfaces( Object servant, byte[] objectId ) ; + */ + String[] getInterfaces(Object servant, byte[] objectId); public boolean isNameService(); - public void setNameService( boolean flag ) ; -} + public void setNameService(boolean flag); +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapterBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapterBase.java index ebce40e1a..a307bcd8a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapterBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapterBase.java @@ -17,21 +17,21 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.oa ; +package com.sun.corba.ee.spi.oa; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceFactory ; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; +import org.omg.PortableInterceptor.ObjectReferenceFactory; -import org.omg.CORBA.Policy ; +import org.omg.CORBA.Policy; -import com.sun.corba.ee.spi.ior.IORFactories ; -import com.sun.corba.ee.spi.ior.IORTemplate ; +import com.sun.corba.ee.spi.ior.IORFactories; +import com.sun.corba.ee.spi.ior.IORTemplate; import com.sun.corba.ee.spi.ior.ObjectAdapterId; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.protocol.PIHandler ; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.protocol.PIHandler; -import com.sun.corba.ee.spi.logging.POASystemException ; +import com.sun.corba.ee.spi.logging.POASystemException; import com.sun.corba.ee.impl.oa.poa.Policies; import org.glassfish.gmbal.Description; import org.glassfish.gmbal.ManagedAttribute; @@ -42,148 +42,137 @@ import org.omg.PortableInterceptor.INACTIVE; import org.omg.PortableInterceptor.NON_EXISTENT; -abstract public class ObjectAdapterBase extends org.omg.CORBA.LocalObject - implements ObjectAdapter -{ - protected static final POASystemException wrapper = - POASystemException.self ; +abstract public class ObjectAdapterBase extends org.omg.CORBA.LocalObject implements ObjectAdapter { + protected static final POASystemException wrapper = POASystemException.self; private ORB orb; // Data related to the construction of object references and // supporting the Object Reference Template. private IORTemplate iortemp; - private byte[] adapterId ; - private ObjectReferenceTemplate adapterTemplate ; - private ObjectReferenceFactory currentFactory ; - private boolean isNameService = false ; - - public ObjectAdapterBase( ORB orb ) { - this.orb = orb ; + private byte[] adapterId; + private ObjectReferenceTemplate adapterTemplate; + private ObjectReferenceFactory currentFactory; + private boolean isNameService = false; + + public ObjectAdapterBase(ORB orb) { + this.orb = orb; } public final POASystemException wrapper() { - return wrapper ; + return wrapper; } /* - * This creates the complete template. - * When it is done, reference creation can proceed. + * This creates the complete template. When it is done, reference creation can proceed. */ - final public void initializeTemplate( ObjectKeyTemplate oktemp, - boolean notifyORB, Policies policies, String codebase, - String objectAdapterManagerId, ObjectAdapterId objectAdapterId) - { - adapterId = oktemp.getAdapterId() ; + final public void initializeTemplate(ObjectKeyTemplate oktemp, boolean notifyORB, Policies policies, String codebase, + String objectAdapterManagerId, ObjectAdapterId objectAdapterId) { + adapterId = oktemp.getAdapterId(); - iortemp = IORFactories.makeIORTemplate(oktemp) ; + iortemp = IORFactories.makeIORTemplate(oktemp); // This calls acceptors which create profiles and may // add tagged components to those profiles. - orb.getCorbaTransportManager().addToIORTemplate( - iortemp, policies, - codebase, objectAdapterManagerId, objectAdapterId); + orb.getCorbaTransportManager().addToIORTemplate(iortemp, policies, codebase, objectAdapterManagerId, objectAdapterId); - adapterTemplate = IORFactories.makeObjectReferenceTemplate( orb, - iortemp ) ; - currentFactory = adapterTemplate ; + adapterTemplate = IORFactories.makeObjectReferenceTemplate(orb, iortemp); + currentFactory = adapterTemplate; if (notifyORB) { - PIHandler pih = orb.getPIHandler() ; + PIHandler pih = orb.getPIHandler(); if (pih != null) { pih.objectAdapterCreated(this); } } - iortemp.makeImmutable() ; + iortemp.makeImmutable(); } - final public org.omg.CORBA.Object makeObject( String repId, byte[] oid ) - { + final public org.omg.CORBA.Object makeObject(String repId, byte[] oid) { if (repId == null) { throw wrapper.nullRepositoryId(); } - return currentFactory.make_object( repId, oid ) ; + return currentFactory.make_object(repId, oid); } - final public byte[] getAdapterId() - { - return adapterId ; + final public byte[] getAdapterId() { + return adapterId; } - final public ORB getORB() - { - return orb ; + final public ORB getORB() { + return orb; } - abstract public Policy getEffectivePolicy( int type ) ; + abstract public Policy getEffectivePolicy(int type); - final public IORTemplate getIORTemplate() - { - return iortemp ; + final public IORTemplate getIORTemplate() { + return iortemp; } - abstract public int getManagerId() ; + abstract public int getManagerId(); - abstract public short getState() ; + abstract public short getState(); - @ManagedAttribute( id="State" ) - @Description( "The current Adapter state") - private String getDisplayState( ) { - final short state = getState() ; + @ManagedAttribute(id = "State") + @Description("The current Adapter state") + private String getDisplayState() { + final short state = getState(); switch (state) { - case HOLDING.value : return "HOLDING" ; - case ACTIVE.value : return "ACTIVE" ; - case DISCARDING.value : return "DISCARDING" ; - case INACTIVE.value : return "INACTIVE" ; - case NON_EXISTENT.value : return "NON_EXISTENT" ; - default : return "" ; + case HOLDING.value: + return "HOLDING"; + case ACTIVE.value: + return "ACTIVE"; + case DISCARDING.value: + return "DISCARDING"; + case INACTIVE.value: + return "INACTIVE"; + case NON_EXISTENT.value: + return "NON_EXISTENT"; + default: + return ""; } } - final public ObjectReferenceTemplate getAdapterTemplate() - { - return adapterTemplate ; + final public ObjectReferenceTemplate getAdapterTemplate() { + return adapterTemplate; } - final public ObjectReferenceFactory getCurrentFactory() - { - return currentFactory ; + final public ObjectReferenceFactory getCurrentFactory() { + return currentFactory; } - final public void setCurrentFactory( ObjectReferenceFactory factory ) - { - currentFactory = factory ; + final public void setCurrentFactory(ObjectReferenceFactory factory) { + currentFactory = factory; } - abstract public org.omg.CORBA.Object getLocalServant( byte[] objectId ) ; + abstract public org.omg.CORBA.Object getLocalServant(byte[] objectId); - abstract public void getInvocationServant( OAInvocationInfo info ) ; + abstract public void getInvocationServant(OAInvocationInfo info); - abstract public void returnServant() ; + abstract public void returnServant(); - abstract public void enter() throws OADestroyed ; + abstract public void enter() throws OADestroyed; - abstract public void exit() ; + abstract public void exit(); - abstract protected ObjectCopierFactory getObjectCopierFactory() ; + abstract protected ObjectCopierFactory getObjectCopierFactory(); // Note that all current subclasses share the same implementation of this method, // but overriding it would make sense for OAs that use a different InvocationInfo. - public OAInvocationInfo makeInvocationInfo( byte[] objectId ) - { - OAInvocationInfo info = new OAInvocationInfo( this, objectId ) ; - info.setCopierFactory( getObjectCopierFactory() ) ; - return info ; + public OAInvocationInfo makeInvocationInfo(byte[] objectId) { + OAInvocationInfo info = new OAInvocationInfo(this, objectId); + info.setCopierFactory(getObjectCopierFactory()); + return info; } - abstract public String[] getInterfaces( Object servant, byte[] objectId ) ; + abstract public String[] getInterfaces(Object servant, byte[] objectId); public boolean isNameService() { - return isNameService ; + return isNameService; } - public void setNameService( boolean flag ) { - isNameService = flag ; + public void setNameService(boolean flag) { + isNameService = flag; } -} +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapterFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapterFactory.java index 96bbffb14..d5e124934 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapterFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/ObjectAdapterFactory.java @@ -17,32 +17,36 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.oa ; +package com.sun.corba.ee.spi.oa; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; -import com.sun.corba.ee.spi.ior.ObjectAdapterId ; +import com.sun.corba.ee.spi.ior.ObjectAdapterId; public interface ObjectAdapterFactory { - - /** Initialize this object adapter factory instance. + + /** + * Initialize this object adapter factory instance. + * * @param orb to use for initalisation - */ - void init( ORB orb ) ; + */ + void init(ORB orb); - /** Shutdown all object adapters and other state associated - * with this factory. - * @param waitForCompletion if true then wait for all ongoing requests to finish before shutting down, - * if false then shutdown immediatly. + /** + * Shutdown all object adapters and other state associated with this factory. + * + * @param waitForCompletion if true then wait for all ongoing requests to finish before shutting down, if false then + * shutdown immediatly. */ - void shutdown( boolean waitForCompletion ) ; + void shutdown(boolean waitForCompletion); - /** Find the ObjectAdapter instance that corresponds to the - * given ObjectAdapterId. - * @param oaid id to look up - * @return found ObjectAdapter - */ - ObjectAdapter find( ObjectAdapterId oaid ) ; + /** + * Find the ObjectAdapter instance that corresponds to the given ObjectAdapterId. + * + * @param oaid id to look up + * @return found ObjectAdapter + */ + ObjectAdapter find(ObjectAdapterId oaid); - ORB getORB() ; + ORB getORB(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/rfm/ReferenceFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/rfm/ReferenceFactory.java index 43f81e2db..1befa4dfe 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/rfm/ReferenceFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/rfm/ReferenceFactory.java @@ -17,20 +17,19 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.oa.rfm ; +package com.sun.corba.ee.spi.oa.rfm; -public interface ReferenceFactory extends org.omg.CORBA.Object, - org.omg.CORBA.portable.IDLEntity -{ - /** Create an object reference with the given key and - * repository ID. +public interface ReferenceFactory extends org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity { + /** + * Create an object reference with the given key and repository ID. * * @param key key for object * @return the resulting object */ - org.omg.CORBA.Object createReference( byte[] key ) ; + org.omg.CORBA.Object createReference(byte[] key); - /** Destroy this ReferenceFactory. + /** + * Destroy this ReferenceFactory. */ - void destroy() ; + void destroy(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/rfm/ReferenceFactoryManager.java b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/rfm/ReferenceFactoryManager.java index a16fa1e66..150a0e618 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/oa/rfm/ReferenceFactoryManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/oa/rfm/ReferenceFactoryManager.java @@ -17,149 +17,141 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.oa.rfm ; +package com.sun.corba.ee.spi.oa.rfm; -import java.util.Map ; -import java.util.List ; +import java.util.Map; +import java.util.List; import org.glassfish.pfl.basic.contain.Pair; -import org.omg.CORBA.Policy ; +import org.omg.CORBA.Policy; -import org.omg.PortableServer.ServantLocator ; +import org.omg.PortableServer.ServantLocator; -/** ReferenceFactoryManager uses the ORB POA to create - * a specialized reference factory. This is done primarily - * so that all POAs managed here can be restarted in order - * to be updated when parts of the ORB configuration are - * changed. For example, this is used in AS 9 to support - * dynamic fail over, which requires re-configuring the - * App server POAs whenever an instance joins or leaves - * a cluster. +/** + * ReferenceFactoryManager uses the ORB POA to create a specialized reference factory. This is done primarily so that + * all POAs managed here can be restarted in order to be updated when parts of the ORB configuration are changed. For + * example, this is used in AS 9 to support dynamic fail over, which requires re-configuring the App server POAs + * whenever an instance joins or leaves a cluster. *

    - * An instance of this interface can be obtained - * from an ORB by calling resolve_initial_references( "ReferenceFactoryManager" ). - * The ORB will have an instance of this available if it is started with the - * property ORBConstants.USER_CONFIGURATOR_PREFIX + - * "com.sun.corba.ee.impl.oa.rfm.ReferenceManagerConfigurator" set to a value - * (usually we use "1" as the value, but that does not matter). - * This will cause the configurator to set up the ORB so that the - * ReferenceFactoryManager is available, so long as the configurator class - * is available. Since this code is in the optional package, this just - * means that the optional ORB package contents must be in the classpath. + * An instance of this interface can be obtained from an ORB by calling resolve_initial_references( + * "ReferenceFactoryManager" ). The ORB will have an instance of this available if it is started with the property + * ORBConstants.USER_CONFIGURATOR_PREFIX + "com.sun.corba.ee.impl.oa.rfm.ReferenceManagerConfigurator" set to a value + * (usually we use "1" as the value, but that does not matter). This will cause the configurator to set up the ORB so + * that the ReferenceFactoryManager is available, so long as the configurator class is available. Since this code is in + * the optional package, this just means that the optional ORB package contents must be in the classpath. *

    - * Note that this interface is a simulated IDL local interface, but there - * is no actual IDL for this interface. + * Note that this interface is a simulated IDL local interface, but there is no actual IDL for this interface. *

    - * Note that the suspend and resume methods must be called from the - * same thread in order for the thread synchronization to be handled - * correctly. Calling either of the restart() methods guarantees this, - * but disallows more complex ORB configuration changes. + * Note that the suspend and resume methods must be called from the same thread in order for the thread synchronization + * to be handled correctly. Calling either of the restart() methods guarantees this, but disallows more complex ORB + * configuration changes. */ -public interface ReferenceFactoryManager extends org.omg.CORBA.Object, - org.omg.CORBA.portable.IDLEntity -{ - public enum RFMState { READY, SUSPENDED } - - /** The state of the ReferenceFactoryManager. +public interface ReferenceFactoryManager extends org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity { + public enum RFMState { + READY, SUSPENDED + } + + /** + * The state of the ReferenceFactoryManager. + * * @return whether the manager is READY or SUSPENDED */ public RFMState getState(); - /** Must be called before any other operation. - * Used to activate the ORB reference creation function. + /** + * Must be called before any other operation. Used to activate the ORB reference creation function. */ - public void activate() ; + public void activate(); - /** Suspend all CORBA request processing on all references created - * by ReferenceFactory instances that were created by this - * ReferenceFactoryManager. This call does not return until - * after all currently executing calls have completed. + /** + * Suspend all CORBA request processing on all references created by ReferenceFactory instances that were created by + * this ReferenceFactoryManager. This call does not return until after all currently executing calls have completed. */ - public void suspend() ; + public void suspend(); - /** Resume all CORBA request processing on all references created - * by ReferenceFactory instances that were created by this - * ReferenceFactoryManager. + /** + * Resume all CORBA request processing on all references created by ReferenceFactory instances that were created by this + * ReferenceFactoryManager. */ - public void resume() ; + public void resume(); - /** Create a new reference factory with the given policies. - * All such reference factories will be persistent. The - * ServantLocator is solely responsible for creating - * servants: no internal caching will be performed. - * The following policies are always applied here: + /** + * Create a new reference factory with the given policies. All such reference factories will be persistent. The + * ServantLocator is solely responsible for creating servants: no internal caching will be performed. The following + * policies are always applied here: *

      *
    • Servant retention policy NON_RETAIN *
    • Request processing policy USE_SERVANT_MANAGER *
    • Lifespan policy PERSISTENT *
    - * These policies are required because all are essential to - * the correct functioning of this class in handling restarts. - * It is an error for the policies list to contain any value - * of the above 3 policies. - * All other policies must be given explicitly in the list. - * @param name is the name of this ReferenceFactory. This is a - * simple flat name, not a hierarchical name. - * @param repositoryId is the repoid to be used when this reference factory - * creates a new CORBA Object reference. + * These policies are required because all are essential to the correct functioning of this class in handling restarts. + * It is an error for the policies list to contain any value of the above 3 policies. All other policies must be given + * explicitly in the list. + * + * @param name is the name of this ReferenceFactory. This is a simple flat name, not a hierarchical name. + * @param repositoryId is the repoid to be used when this reference factory creates a new CORBA Object reference. * @param policies are the policies to be used to create the underlying POA. * @param manager locator to use for the reference * @return resulting ReferenceFactory with given policies */ - public ReferenceFactory create( String name, String repositoryId, List policies, - ServantLocator manager ) ; + public ReferenceFactory create(String name, String repositoryId, List policies, ServantLocator manager); - /** Get the ReferenceFactory name from a String[] adapterName, if - * adapterName is the name of a ReferenceFactory. If not, return null. + /** + * Get the ReferenceFactory name from a String[] adapterName, if adapterName is the name of a ReferenceFactory. If not, + * return null. + * * @param adapterName of factory * @return found ReferenceFactory, null otherwise */ - public ReferenceFactory find( String[] adapterName ) ; + public ReferenceFactory find(String[] adapterName); - /** Find the ReferenceFactory with the given name. - * If no such ReferenceFactory exists, return null. + /** + * Find the ReferenceFactory with the given name. If no such ReferenceFactory exists, return null. + * * @param name of factory * @return found ReferenceFactory, null otherwise */ - public ReferenceFactory find( String name ) ; + public ReferenceFactory find(String name); - /** Restart all ReferenceFactories. - * @param updates is a map giving the updated policies for - * some or all of the ReferenceFactory instances in this ReferenceFactoryManager. - * This parameter must not be null. + /** + * Restart all ReferenceFactories. + * + * @param updates is a map giving the updated policies for some or all of the ReferenceFactory instances in this + * ReferenceFactoryManager. This parameter must not be null. */ - public void restartFactories( Map>> updates ) ; + public void restartFactories(Map>> updates); - /** Restart all ReferenceFactories. - * Equivalent to calling restartFactories( new Map() ). + /** + * Restart all ReferenceFactories. Equivalent to calling restartFactories( new Map() ). */ - public void restartFactories() ; + public void restartFactories(); - /** Restart all ReferenceFactories. This is done safely, so that - * any request against object references created from these factories - * complete correctly. Restart does not return until all restart - * activity completes. This method is equivalent to: + /** + * Restart all ReferenceFactories. This is done safely, so that any request against object references created from these + * factories complete correctly. Restart does not return until all restart activity completes. This method is equivalent + * to: + * *
    -     * suspend() ;
    +     * suspend();
          * try {
    -     *     restartFactories( updates ) ;
    +     *     restartFactories(updates);
          * } finally {
    -     *     resume() ;
    +     *     resume();
          * }
          * 
    - * @param updates is a map giving the updated policies for - * some or all of the ReferenceFactory instances in this ReferenceFactoryManager. - * This parameter must not be null. + * + * @param updates is a map giving the updated policies for some or all of the ReferenceFactory instances in this + * ReferenceFactoryManager. This parameter must not be null. */ - public void restart( Map>> updates ) ; + public void restart(Map>> updates); - /** Restart all ReferenceFactories. This is done safely, so that - * any request against object references created from these factories - * complete correctly. Restart does not return until all restart - * activity completes. Equivalent to calling restart( new Map() ). + /** + * Restart all ReferenceFactories. This is done safely, so that any request against object references created from these + * factories complete correctly. Restart does not return until all restart activity completes. Equivalent to calling + * restart( new Map() ). */ - public void restart() ; + public void restart(); - public boolean isRfmName( String[] adapterName ) ; + public boolean isRfmName(String[] adapterName); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ClassCodeBaseHandler.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ClassCodeBaseHandler.java index a0249feee..ea37bf364 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ClassCodeBaseHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ClassCodeBaseHandler.java @@ -20,23 +20,24 @@ package com.sun.corba.ee.spi.orb; public interface ClassCodeBaseHandler { - /** Returns some sort of codebase for the given class, or null. - * It is expected that, if str is the result of getCodeBase( cls ), - * then loadClass( str, cls.getClassName() ) will return cls. + /** + * Returns some sort of codebase for the given class, or null. It is expected that, if str is the result of getCodeBase( + * cls ), then loadClass( str, cls.getClassName() ) will return cls. + * * @param cls Class for which we need a codebase - * @return A codebase to use with this handler, or null if this handler - * does not apply to this class. + * @return A codebase to use with this handler, or null if this handler does not apply to this class. */ - String getCodeBase( Class cls ) ; + String getCodeBase(Class cls); - /** load a class given the classname and a codebase. - * The className will always satisfy cls.getClassName().equals( className ) - * if the call succeeds and returns a Class. - * @param codebase A string that somehow describes which ClassLoader to use. - * For example, the string could be an ordinary URL that a URL ClassLoader can use, - * or something more specialized, such as a description of an OSGi bundles and version. + /** + * load a class given the classname and a codebase. The className will always satisfy cls.getClassName().equals( + * className ) if the call succeeds and returns a Class. + * + * @param codebase A string that somehow describes which ClassLoader to use. For example, the string could be an + * ordinary URL that a URL ClassLoader can use, or something more specialized, such as a description of an OSGi bundles + * and version. * @param className The name of the class to load * @return The loaded class, or null if the class could not be loaded. */ - Class loadClass( String codebase, String className ) ; + Class loadClass(String codebase, String className); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/DataCollector.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/DataCollector.java index a82018b36..3a4713a69 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/DataCollector.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/DataCollector.java @@ -17,49 +17,46 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import java.util.Properties ; +import java.util.Properties; -/** Interface for collecting all sources of ORB configuration properties - * into a single properties object. A PropertyParser is needed so that - * the set of property names of interest is known. +/** + * Interface for collecting all sources of ORB configuration properties into a single properties object. A + * PropertyParser is needed so that the set of property names of interest is known. */ public interface DataCollector { - /** Return true iff this DataCollector was created from - * applet data. + /** + * Return true iff this DataCollector was created from applet data. * * @return if this was created from an applet */ - boolean isApplet() ; + boolean isApplet(); - /** Return true iff the local host and ORB initial host are the same. - * This is provided to avoid exposing the local host in insecure - * contexts. - * - * @return if the local host and ORB initial host are the same - */ - boolean initialHostIsLocal() ; + /** + * Return true iff the local host and ORB initial host are the same. This is provided to avoid exposing the local host + * in insecure contexts. + * + * @return if the local host and ORB initial host are the same + */ + boolean initialHostIsLocal(); - /** Set the parser which is used to obtain property names. - * This must be called before getProperties - * may be called. It may be called multiple times if different - * sets of properties are needed for the same data sources. + /** + * Set the parser which is used to obtain property names. This must be called before getProperties may be called. It may + * be called multiple times if different sets of properties are needed for the same data sources. * * @param parser parser used to obtain property names */ - void setParser( PropertyParser parser ) ; + void setParser(PropertyParser parser); - /** Return the consolidated property information to be used - * for ORB configuration. Note that -ORBInitRef arguments are - * handled specially: all -ORBInitRef name=value arguments are - * converted into ( org.omg.CORBA.ORBInitRef.name, value ) - * mappings in the resulting properties. Also, -ORBInitialServices - * is handled specially in applet mode: they are converted from - * relative to absolute URLs. + /** + * Return the consolidated property information to be used for ORB configuration. Note that -ORBInitRef arguments are + * handled specially: all -ORBInitRef name=value arguments are converted into ( org.omg.CORBA.ORBInitRef.name, value ) + * mappings in the resulting properties. Also, -ORBInitialServices is handled specially in applet mode: they are + * converted from relative to absolute URLs. + * * @return consolidated property information - * @throws IllegalStateException if setPropertyNames has not - * been called. + * @throws IllegalStateException if setPropertyNames has not been called. */ - Properties getProperties() ; + Properties getProperties(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORB.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORB.java index 403e37de3..a3e32347e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORB.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORB.java @@ -84,73 +84,69 @@ @OrbLifeCycle @ManagedObject -@Description( "The Main ORB Implementation object" ) -@AMXMetadata( type="ORB-Root" ) -public abstract class ORB extends com.sun.corba.ee.org.omg.CORBA.ORB - implements TypeCodeFactory -{ +@Description("The Main ORB Implementation object") +@AMXMetadata(type = "ORB-Root") +public abstract class ORB extends com.sun.corba.ee.org.omg.CORBA.ORB implements TypeCodeFactory { static { - MethodMonitorFactoryDefaults.addPrefix( "com.sun.corba.ee", "ORB" ) ; + MethodMonitorFactoryDefaults.addPrefix("com.sun.corba.ee", "ORB"); } - // As much as possible, this class should be stateless. However, + // As much as possible, this class should be stateless. However, // there are a few reasons why it is not: // // 1. The ORB debug flags are defined here because they are accessed - // frequently, and we do not want a cast to the impl just for that. + // frequently, and we do not want a cast to the impl just for that. // 2. typeCodeMap and primitiveTypeCodeConstants are here because they - // are needed in both ORBImpl and ORBSingleton. + // are needed in both ORBImpl and ORBSingleton. // 3. Logging support is here so that we can avoid problems with - // incompletely initialized ORBs that need to perform logging. - + // incompletely initialized ORBs that need to perform logging. + // This is not one of the xxxDebugFlags because it is used to debug the mechanism // that sets the xxxDebugFlags! - public static final boolean orbInitDebug = AccessController.doPrivileged( - new PrivilegedAction() { - public Boolean run() { - return Boolean.getBoolean( ORBConstants.INIT_DEBUG_PROPERTY ); - } + public static final boolean orbInitDebug = AccessController.doPrivileged(new PrivilegedAction() { + public Boolean run() { + return Boolean.getBoolean(ORBConstants.INIT_DEBUG_PROPERTY); } - ) ; + }); - // Currently defined debug flags. Any additions must be called xxxDebugFlag. + // Currently defined debug flags. Any additions must be called xxxDebugFlag. // All debug flags must be public boolean types. // These are set by passing the flag -ORBDebug x,y,z in the ORB init args. // Note that x,y,z must not contain spaces. - // + // // The annotations (when present) connect the ORB debug flags to the tracing - // system. Whenever a flag is set, the corresponding tracing annotation + // system. Whenever a flag is set, the corresponding tracing annotation // is also set in the MethodMonitorRegistry to a standard tracing - // MethodMonitorFactory. A few cases still make direct access to this + // MethodMonitorFactory. A few cases still make direct access to this // flags, and the flags are much faster to test than the state of the // MethodMonitorRegistry. @Transport - public boolean transportDebugFlag = false ; + public boolean transportDebugFlag = false; @Subcontract - public boolean subcontractDebugFlag = false ; + public boolean subcontractDebugFlag = false; @Osgi - public boolean osgiDebugFlag = false ; + public boolean osgiDebugFlag = false; @Poa - public boolean poaDebugFlag = false ; - + public boolean poaDebugFlag = false; + @PoaFSM - public boolean poaFSMDebugFlag = false ; + public boolean poaFSMDebugFlag = false; @Orbd - public boolean orbdDebugFlag = false ; + public boolean orbdDebugFlag = false; @Naming - public boolean namingDebugFlag = false ; + public boolean namingDebugFlag = false; @TraceServiceContext - public boolean serviceContextDebugFlag = false ; + public boolean serviceContextDebugFlag = false; @TransientObjectManager - public boolean transientObjectManagerDebugFlag = false ; + public boolean transientObjectManagerDebugFlag = false; @Shutdown public boolean shutdownDebugFlag = false; @@ -162,138 +158,137 @@ public Boolean run() { public boolean giopReadDebugFlag = false; @TraceInterceptor - public boolean interceptorDebugFlag = false ; + public boolean interceptorDebugFlag = false; @Folb - public boolean folbDebugFlag = false ; + public boolean folbDebugFlag = false; - public boolean cdrCacheDebugFlag = false ; + public boolean cdrCacheDebugFlag = false; @Cdr - public boolean cdrDebugFlag = false ; + public boolean cdrDebugFlag = false; @StreamFormatVersion - public boolean streamFormatVersionDebugFlag = false ; + public boolean streamFormatVersionDebugFlag = false; @TraceValueHandler - public boolean valueHandlerDebugFlag = false ; + public boolean valueHandlerDebugFlag = false; - public boolean mbeanDebugFlag = false ; - public boolean mbeanFineDebugFlag = false ; - public boolean mbeanRuntimeDebugFlag = false ; + public boolean mbeanDebugFlag = false; + public boolean mbeanFineDebugFlag = false; + public boolean mbeanRuntimeDebugFlag = false; @OrbLifeCycle - public boolean orbLifecycleDebugFlag = false ; + public boolean orbLifecycleDebugFlag = false; - public boolean operationTraceDebugFlag = false ; + public boolean operationTraceDebugFlag = false; @DynamicType - public boolean dynamicTypeDebugFlag = false ; + public boolean dynamicTypeDebugFlag = false; @IsLocal - public boolean isLocalDebugFlag = false ; + public boolean isLocalDebugFlag = false; @ManagedAttribute - @Description( "The current settings of the ORB debug flags" ) - private Map getDebugFlags() { - Map result = new HashMap() ; + @Description("The current settings of the ORB debug flags") + private Map getDebugFlags() { + Map result = new HashMap(); for (Field fld : this.getClass().getFields()) { if (fld.getName().endsWith("DebugFlag")) { - Boolean value = false ; + Boolean value = false; try { - value = fld.getBoolean( this ); - result.put( fld.getName(), value ) ; + value = fld.getBoolean(this); + result.put(fld.getName(), value); } catch (Exception exc) { } } } - return result ; + return result; } @InfoMethod - private void mbeanRegistrationSuspended(String oRBId) { } + private void mbeanRegistrationSuspended(String oRBId) { + } - public enum DebugFlagResult { OK, BAD_NAME } + public enum DebugFlagResult { + OK, BAD_NAME + } @ManagedOperation - @Description( "Enable debugging for several ORB debug flags") - public DebugFlagResult setDebugFlags( String... names ) { - return setDebugFlags( true, names ) ; + @Description("Enable debugging for several ORB debug flags") + public DebugFlagResult setDebugFlags(String... names) { + return setDebugFlags(true, names); } @ManagedOperation - @Description( "Enable debugging for a particular ORB debug flag") - public DebugFlagResult setDebugFlag( String name ) { - return setDebugFlag( name, true ) ; + @Description("Enable debugging for a particular ORB debug flag") + public DebugFlagResult setDebugFlag(String name) { + return setDebugFlag(name, true); } @ManagedOperation - @Description( "Disable debugging for several ORB debug flags") - public DebugFlagResult clearDebugFlags( String... names ) { - return setDebugFlags( false, names ) ; + @Description("Disable debugging for several ORB debug flags") + public DebugFlagResult clearDebugFlags(String... names) { + return setDebugFlags(false, names); } @ManagedOperation - @Description( "Disable debugging for a particular ORB debug flag") - public DebugFlagResult clearDebugFlag( String name ) { - return setDebugFlag( name, false ) ; + @Description("Disable debugging for a particular ORB debug flag") + public DebugFlagResult clearDebugFlag(String name) { + return setDebugFlag(name, false); } - - private DebugFlagResult setDebugFlags( boolean flag, String... names ) { - DebugFlagResult res = DebugFlagResult.OK ; + + private DebugFlagResult setDebugFlags(boolean flag, String... names) { + DebugFlagResult res = DebugFlagResult.OK; for (String name : names) { - DebugFlagResult lres = setDebugFlag( name, flag ) ; + DebugFlagResult lres = setDebugFlag(name, flag); if (lres == DebugFlagResult.BAD_NAME) { - res = DebugFlagResult.BAD_NAME ; + res = DebugFlagResult.BAD_NAME; } } - return res ; + return res; } - private DebugFlagResult setDebugFlag( String name, boolean value ) { + private DebugFlagResult setDebugFlag(String name, boolean value) { try { - Field fld = this.getClass().getField( name + "DebugFlag" ) ; - fld.set( this, value ) ; + Field fld = this.getClass().getField(name + "DebugFlag"); + fld.set(this, value); - Annotation[] annots = fld.getAnnotations() ; + Annotation[] annots = fld.getAnnotations(); for (Annotation anno : annots) { - Class annoClass = anno.annotationType() ; + Class annoClass = anno.annotationType(); - if (annoClass.isAnnotationPresent( - MethodMonitorGroup.class )) { + if (annoClass.isAnnotationPresent(MethodMonitorGroup.class)) { if (value) { - MethodMonitorRegistry.register( annoClass, - MethodMonitorFactoryDefaults.dprint() ); + MethodMonitorRegistry.register(annoClass, MethodMonitorFactoryDefaults.dprint()); } else { - MethodMonitorRegistry.clear( annoClass ) ; + MethodMonitorRegistry.clear(annoClass); } } } - return DebugFlagResult.OK ; + return DebugFlagResult.OK; } catch (Exception exc) { - return DebugFlagResult.BAD_NAME ; + return DebugFlagResult.BAD_NAME; } } // mom MUST be initialized in a subclass by calling createManagedObjectManager. - // In ORBSingleton, this happens in the constructor. It ORBImpl, it cannot + // In ORBSingleton, this happens in the constructor. It ORBImpl, it cannot // happen in the constructor: instead, it must be called in post_init. - protected ManagedObjectManager mom ; - - // SystemException log wrappers. Protected so that they can be used in + protected ManagedObjectManager mom; + + // SystemException log wrappers. Protected so that they can be used in // subclasses. - protected static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; - protected static final OMGSystemException omgWrapper = - OMGSystemException.self ; + protected static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; + protected static final OMGSystemException omgWrapper = OMGSystemException.self; // This map is needed for resolving recursive type code placeholders // based on the unique repository id. - private Map typeCodeMap ; + private Map typeCodeMap; - private TypeCodeImpl[] primitiveTypeCodeConstants ; + private TypeCodeImpl[] primitiveTypeCodeConstants; // ByteBufferPool - needed by both ORBImpl and ORBSingleton ByteBufferPool byteBufferPool; @@ -302,146 +297,126 @@ private DebugFlagResult setDebugFlag( String name, boolean value ) { WireObjectKeyTemplate wireObjectKeyTemplate; // Local testing - public abstract boolean isLocalHost( String hostName ) ; - public abstract boolean isLocalServerId( int subcontractId, int serverId ) ; + public abstract boolean isLocalHost(String hostName); + + public abstract boolean isLocalServerId(int subcontractId, int serverId); // Invocation stack manipulation - public abstract OAInvocationInfo peekInvocationInfo() ; - public abstract void pushInvocationInfo( OAInvocationInfo info ) ; - public abstract OAInvocationInfo popInvocationInfo() ; + public abstract OAInvocationInfo peekInvocationInfo(); + + public abstract void pushInvocationInfo(OAInvocationInfo info); + + public abstract OAInvocationInfo popInvocationInfo(); @ManagedAttribute - @Description( "The ORB's transport manager" ) + @Description("The ORB's transport manager") public abstract TransportManager getCorbaTransportManager(); public abstract LegacyServerSocketManager getLegacyServerSocketManager(); private static PresentationManager presentationManager = PresentationDefaults.makeOrbPresentationManager(); - private UnaryFunction> classNameResolver = defaultClassNameResolver ; - private ClassCodeBaseHandler ccbHandler = null ; + private UnaryFunction> classNameResolver = defaultClassNameResolver; + private ClassCodeBaseHandler ccbHandler = null; @Override public synchronized void destroy() { - typeCodeMap = null ; - primitiveTypeCodeConstants = null ; - byteBufferPool = null ; - wireObjectKeyTemplate = null ; + typeCodeMap = null; + primitiveTypeCodeConstants = null; + byteBufferPool = null; + wireObjectKeyTemplate = null; } /** - * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific - * AppContext to hold it. Creates and records one if needed. + * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific AppContext to hold it. + * Creates and records one if needed. + * * @return The PresentationManager. */ @ManagedAttribute - @Description( "The presentation manager, which handles stub creation" ) - public static PresentationManager getPresentationManager() - { + @Description("The presentation manager, which handles stub creation") + public static PresentationManager getPresentationManager() { /**/ return presentationManager; - /*/ - AppContext ac = AppContext.getAppContext(); - PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class); - if (pm == null) { - pm = PresentationDefaults.makeOrbPresentationManager() ; - ac.put(PresentationManager.class, pm); - } - - return pm; - /**/ + /* + * / AppContext ac = AppContext.getAppContext(); PresentationManager pm = (PresentationManager) + * ac.get(PresentationManager.class); if (pm == null) { pm = PresentationDefaults.makeOrbPresentationManager() ; + * ac.put(PresentationManager.class, pm); } + * + * return pm; / + **/ } - /** Get the appropriate StubFactoryFactory. This - * will be dynamic or static depending on whether + /** + * Get the appropriate StubFactoryFactory. This will be dynamic or static depending on whether * com.sun.corba.ee.ORBUseDynamicStub is true or false. + * * @return The stub factory factory. */ - public static PresentationManager.StubFactoryFactory - getStubFactoryFactory() - { - PresentationManager gPM = getPresentationManager(); - boolean useDynamicStubs = gPM.useDynamicStubs() ; + public static PresentationManager.StubFactoryFactory getStubFactoryFactory() { + PresentationManager gPM = getPresentationManager(); + boolean useDynamicStubs = gPM.useDynamicStubs(); return useDynamicStubs ? gPM.getDynamicStubFactoryFactory() : gPM.getStaticStubFactoryFactory(); } - /** Obtain the InvocationInterceptor for this ORB instance. - * By default this does nothing. + /** + * Obtain the InvocationInterceptor for this ORB instance. By default this does nothing. + * * @return The InvocationInterceptor. */ - public abstract InvocationInterceptor getInvocationInterceptor() ; + public abstract InvocationInterceptor getInvocationInterceptor(); - /** Set the InvocationInterceptor for this ORB instance. - * This will be used around all dynamic RMI-IIOP calls that - * are mediated by this ORB instance. + /** + * Set the InvocationInterceptor for this ORB instance. This will be used around all dynamic RMI-IIOP calls that are + * mediated by this ORB instance. + * * @param interceptor The InvocationInterceptor to add. */ - public abstract void setInvocationInterceptor( - InvocationInterceptor interceptor ) ; - - protected ORB() - { + public abstract void setInvocationInterceptor(InvocationInterceptor interceptor); - typeCodeMap = new HashMap(); + protected ORB() { + + typeCodeMap = new HashMap(); wireObjectKeyTemplate = new WireObjectKeyTemplate(this); } protected void initializePrimitiveTypeCodeConstants() { - primitiveTypeCodeConstants = new TypeCodeImpl[] { - new TypeCodeImpl(this, TCKind._tk_null), - new TypeCodeImpl(this, TCKind._tk_void), - new TypeCodeImpl(this, TCKind._tk_short), - new TypeCodeImpl(this, TCKind._tk_long), - new TypeCodeImpl(this, TCKind._tk_ushort), - new TypeCodeImpl(this, TCKind._tk_ulong), - new TypeCodeImpl(this, TCKind._tk_float), - new TypeCodeImpl(this, TCKind._tk_double), - new TypeCodeImpl(this, TCKind._tk_boolean), - new TypeCodeImpl(this, TCKind._tk_char), - new TypeCodeImpl(this, TCKind._tk_octet), - new TypeCodeImpl(this, TCKind._tk_any), - new TypeCodeImpl(this, TCKind._tk_TypeCode), - new TypeCodeImpl(this, TCKind._tk_Principal), - new TypeCodeImpl(this, TCKind._tk_objref), - null, // tk_struct - null, // tk_union - null, // tk_enum - new TypeCodeImpl(this, TCKind._tk_string), - null, // tk_sequence - null, // tk_array - null, // tk_alias - null, // tk_except - new TypeCodeImpl(this, TCKind._tk_longlong), - new TypeCodeImpl(this, TCKind._tk_ulonglong), - new TypeCodeImpl(this, TCKind._tk_longdouble), - new TypeCodeImpl(this, TCKind._tk_wchar), - new TypeCodeImpl(this, TCKind._tk_wstring), - new TypeCodeImpl(this, TCKind._tk_fixed), - new TypeCodeImpl(this, TCKind._tk_value), - new TypeCodeImpl(this, TCKind._tk_value_box), - new TypeCodeImpl(this, TCKind._tk_native), - new TypeCodeImpl(this, TCKind._tk_abstract_interface) - } ; + primitiveTypeCodeConstants = new TypeCodeImpl[] { new TypeCodeImpl(this, TCKind._tk_null), new TypeCodeImpl(this, TCKind._tk_void), + new TypeCodeImpl(this, TCKind._tk_short), new TypeCodeImpl(this, TCKind._tk_long), + new TypeCodeImpl(this, TCKind._tk_ushort), new TypeCodeImpl(this, TCKind._tk_ulong), + new TypeCodeImpl(this, TCKind._tk_float), new TypeCodeImpl(this, TCKind._tk_double), + new TypeCodeImpl(this, TCKind._tk_boolean), new TypeCodeImpl(this, TCKind._tk_char), + new TypeCodeImpl(this, TCKind._tk_octet), new TypeCodeImpl(this, TCKind._tk_any), + new TypeCodeImpl(this, TCKind._tk_TypeCode), new TypeCodeImpl(this, TCKind._tk_Principal), + new TypeCodeImpl(this, TCKind._tk_objref), null, // tk_struct + null, // tk_union + null, // tk_enum + new TypeCodeImpl(this, TCKind._tk_string), null, // tk_sequence + null, // tk_array + null, // tk_alias + null, // tk_except + new TypeCodeImpl(this, TCKind._tk_longlong), new TypeCodeImpl(this, TCKind._tk_ulonglong), + new TypeCodeImpl(this, TCKind._tk_longdouble), new TypeCodeImpl(this, TCKind._tk_wchar), + new TypeCodeImpl(this, TCKind._tk_wstring), new TypeCodeImpl(this, TCKind._tk_fixed), + new TypeCodeImpl(this, TCKind._tk_value), new TypeCodeImpl(this, TCKind._tk_value_box), + new TypeCodeImpl(this, TCKind._tk_native), new TypeCodeImpl(this, TCKind._tk_abstract_interface) }; } // Typecode support: needed in both ORBImpl and ORBSingleton - public TypeCodeImpl get_primitive_tc(int kind) - { + public TypeCodeImpl get_primitive_tc(int kind) { try { - return primitiveTypeCodeConstants[kind] ; + return primitiveTypeCodeConstants[kind]; } catch (Throwable t) { - throw wrapper.invalidTypecodeKind( t, kind ) ; + throw wrapper.invalidTypecodeKind(t, kind); } } - public synchronized void setTypeCode(String id, TypeCodeImpl code) - { + public synchronized void setTypeCode(String id, TypeCodeImpl code) { typeCodeMap.put(id, code); } - public synchronized TypeCodeImpl getTypeCode(String id) - { + public synchronized TypeCodeImpl getTypeCode(String id) { return typeCodeMap.get(id); } @@ -451,218 +426,232 @@ public synchronized TypeCodeImpl getTypeCode(String id) // those properties passes explicitly in props, not by // the system properties and orb.properties files as // with the standard ORB.init methods. - public abstract void set_parameters( Properties props ) ; + public abstract void set_parameters(Properties props); // Added to provide an API for creating an ORB that avoids the org.omg.CORBA.ORB API // to get around an OSGi problem. - public abstract void setParameters( String[] args, Properties props ) ; + public abstract void setParameters(String[] args, Properties props); // ORB versioning /** * Returns the implementation version of the ORB + * * @return the ORB version. */ @ManagedAttribute - @Description( "The implementation version of the ORB" ) - public abstract ORBVersion getORBVersion() ; + @Description("The implementation version of the ORB") + public abstract ORBVersion getORBVersion(); - public abstract void setORBVersion( ORBVersion version ) ; + public abstract void setORBVersion(ORBVersion version); /** * Returns the IOR used for the Full Value Description + * * @return The IOR used for the Full Value Description */ @ManagedAttribute - @Description( "The IOR used for the Full Value Description" ) - public abstract IOR getFVDCodeBaseIOR() ; + @Description("The IOR used for the Full Value Description") + public abstract IOR getFVDCodeBaseIOR(); /** - * Handle a bad server id for the given object key. This should - * always through an exception: either a ForwardException to - * allow another server to handle the request, or else an error - * indication. + * Handle a bad server id for the given object key. This should always through an exception: either a ForwardException + * to allow another server to handle the request, or else an error indication. + * * @param okey The ObjectKey to check for a valid server id. */ - public abstract void handleBadServerId( ObjectKey okey ) ; - public abstract void setBadServerIdHandler( BadServerIdHandler handler ) ; - public abstract void initBadServerIdHandler() ; - - public abstract void notifyORB() ; + public abstract void handleBadServerId(ObjectKey okey); + + public abstract void setBadServerIdHandler(BadServerIdHandler handler); + + public abstract void initBadServerIdHandler(); - @ManagedAttribute - @Description( "The PortableInterceptor Handler" ) - public abstract PIHandler getPIHandler() ; + public abstract void notifyORB(); - public abstract void createPIHandler() ; + @ManagedAttribute + @Description("The PortableInterceptor Handler") + public abstract PIHandler getPIHandler(); + + public abstract void createPIHandler(); // Dispatch support: in the ORB because it is needed for shutdown. // This is used by the first level server side subcontract. - public abstract boolean isDuringDispatch() ; + public abstract boolean isDuringDispatch(); + public abstract void startingDispatch(); + public abstract void finishedDispatch(); - /** Return this ORB's transient server ID. This is needed for - * initializing object adapters. + /** + * Return this ORB's transient server ID. This is needed for initializing object adapters. + * * @return The transient server id. */ @ManagedAttribute - @Description( "The transient ServerId of this ORB instance" ) + @Description("The transient ServerId of this ORB instance") public abstract int getTransientServerId(); /** * Returns the registry for all ServerContext factories of this server. + * * @return the registry. */ @ManagedAttribute - @Description( "The registry for all ServerContext factories" ) - public abstract ServiceContextFactoryRegistry getServiceContextFactoryRegistry() ; + @Description("The registry for all ServerContext factories") + public abstract ServiceContextFactoryRegistry getServiceContextFactoryRegistry(); /** * Returns the cache used to optimise marshaling of ServiceContexts + * * @return the cache used */ @ManagedAttribute - @Description( "The cache used to opimize marshaling of ServiceContexts" ) + @Description("The cache used to opimize marshaling of ServiceContexts") public abstract ServiceContextsCache getServiceContextsCache(); /** * The RequestDispatcher registry, which contains the request handling code + * * @return The RequestDispatcher registry */ @ManagedAttribute - @Description( "The RequestDispatcher registry, which contains the request handling code" ) + @Description("The RequestDispatcher registry, which contains the request handling code") public abstract RequestDispatcherRegistry getRequestDispatcherRegistry(); /** * The ORB configuration data + * * @return Config data */ @ManagedAttribute - @Description( "The ORB configuration data" ) - public abstract ORBData getORBData() ; + @Description("The ORB configuration data") + public abstract ORBData getORBData(); - public abstract void setClientDelegateFactory( ClientDelegateFactory factory ) ; + public abstract void setClientDelegateFactory(ClientDelegateFactory factory); /** * Returns the ClientDelegateFactory, which is used to create the ClientDelegate that represents an IOR + * * @return The ClientDelegateFactory */ @ManagedAttribute - @Description( "The ClientDelegateFactory, which is used to create the ClientDelegate that represents an IOR" ) - public abstract ClientDelegateFactory getClientDelegateFactory() ; + @Description("The ClientDelegateFactory, which is used to create the ClientDelegate that represents an IOR") + public abstract ClientDelegateFactory getClientDelegateFactory(); - public abstract void setCorbaContactInfoListFactory( ContactInfoListFactory factory ) ; + public abstract void setCorbaContactInfoListFactory(ContactInfoListFactory factory); /** - * Returns the CorbaContactInfoListFactory, which creates the contact info list that represents - * possible endpoints in an IOR. + * Returns the CorbaContactInfoListFactory, which creates the contact info list that represents possible endpoints in an + * IOR. + * * @return CorbaContactInfoListFactory used */ @ManagedAttribute - @Description( "The CorbaContactInfoListFactory, which creates the contact info list that represents " - + "possible endpoints in an IOR" ) - public abstract ContactInfoListFactory getCorbaContactInfoListFactory() ; + @Description("The CorbaContactInfoListFactory, which creates the contact info list that represents " + "possible endpoints in an IOR") + public abstract ContactInfoListFactory getCorbaContactInfoListFactory(); - /** Set the resolver used in this ORB. This resolver will be used for list_initial_services - * and resolve_initial_references. + /** + * Set the resolver used in this ORB. This resolver will be used for list_initial_services and + * resolve_initial_references. * * @param resolver resolver to be used */ - public abstract void setResolver( Resolver resolver ) ; + public abstract void setResolver(Resolver resolver); - /** Get the resolver used in this ORB. This resolver will be used for list_initial_services - * and resolve_initial_references. + /** + * Get the resolver used in this ORB. This resolver will be used for list_initial_services and + * resolve_initial_references. * * @return ORB Name resolver */ @ManagedAttribute - @Description( "ORB Name resolver" ) - public abstract Resolver getResolver() ; + @Description("ORB Name resolver") + public abstract Resolver getResolver(); - /** Set the LocalResolver used in this ORB. This LocalResolver is used for - * register_initial_reference only. + /** + * Set the LocalResolver used in this ORB. This LocalResolver is used for register_initial_reference only. * * @param resolver ORB Local Name resolver */ - public abstract void setLocalResolver( LocalResolver resolver ) ; + public abstract void setLocalResolver(LocalResolver resolver); - /** Get the LocalResolver used in this ORB. This LocalResolver is used for - * register_initial_reference only. + /** + * Get the LocalResolver used in this ORB. This LocalResolver is used for register_initial_reference only. * * @return ORB Local Name resolver */ @ManagedAttribute - @Description( "ORB Local Name resolver" ) - public abstract LocalResolver getLocalResolver() ; + @Description("ORB Local Name resolver") + public abstract LocalResolver getLocalResolver(); - /** Set the operation used in string_to_object calls. The Operation must expect a - * String and return an org.omg.CORBA.Object. + /** + * Set the operation used in string_to_object calls. The Operation must expect a String and return an + * org.omg.CORBA.Object. * * @param stringToObject operation to be used */ - public abstract void setURLOperation( Operation stringToObject ) ; + public abstract void setURLOperation(Operation stringToObject); - /** Get the operation used in string_to_object calls. The Operation must expect a - * String and return an org.omg.CORBA.Object. + /** + * Get the operation used in string_to_object calls. The Operation must expect a String and return an + * org.omg.CORBA.Object. * * @return operation used */ - public abstract Operation getURLOperation() ; + public abstract Operation getURLOperation(); - /** Set the ServerRequestDispatcher that should be used for handling INS requests. + /** + * Set the ServerRequestDispatcher that should be used for handling INS requests. * * @param insDelegate dispatcher to be used */ - public abstract void setINSDelegate( ServerRequestDispatcher insDelegate ) ; + public abstract void setINSDelegate(ServerRequestDispatcher insDelegate); - /** Factory finders for the various parts of the IOR: tagged components, tagged - * profiles, and tagged profile templates. + /** + * Factory finders for the various parts of the IOR: tagged components, tagged profiles, and tagged profile templates. * * @return Finder of Factories for TaggedComponents of IORs */ @ManagedAttribute - @Description( "Finder of Factories for TaggedComponents of IORs" ) - public abstract TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() ; + @Description("Finder of Factories for TaggedComponents of IORs") + public abstract TaggedComponentFactoryFinder getTaggedComponentFactoryFinder(); /** * Factory finders for the various parts of the IOR: tagged profiles + * * @return Finder of Factories for TaggedProfiles of IORs */ @ManagedAttribute - @Description( "Finder of Factories for TaggedProfiles of IORs" ) - public abstract IdentifiableFactoryFinder - getTaggedProfileFactoryFinder() ; + @Description("Finder of Factories for TaggedProfiles of IORs") + public abstract IdentifiableFactoryFinder getTaggedProfileFactoryFinder(); /** * Factory finders for the various parts of the IOR: tagged profile templates + * * @return Finder of Factories for TaggedProfileTemplates of IORs */ @ManagedAttribute - @Description( "Finder of Factories for TaggedProfileTemplates of IORs" ) - public abstract IdentifiableFactoryFinder - getTaggedProfileTemplateFactoryFinder() ; + @Description("Finder of Factories for TaggedProfileTemplates of IORs") + public abstract IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder(); @ManagedAttribute - @Description( "Factory for creating ObjectKeys" ) - public abstract ObjectKeyFactory getObjectKeyFactory() ; + @Description("Factory for creating ObjectKeys") + public abstract ObjectKeyFactory getObjectKeyFactory(); - public abstract void setObjectKeyFactory( ObjectKeyFactory factory ) ; + public abstract void setObjectKeyFactory(ObjectKeyFactory factory); // Logging SPI - public static Logger getLogger( String name ) - { - return Logger.getLogger( name, ORBConstants.LOG_RESOURCE_FILE ) ; + public static Logger getLogger(String name) { + return Logger.getLogger(name, ORBConstants.LOG_RESOURCE_FILE); } // get a reference to a ByteBufferPool, a pool of NIO ByteBuffers // NOTE: ByteBuffer pool must be unique per ORB, not per process. - // There can be more than one ORB per process. - // This method must also be inherited by both ORB and ORBSingleton. + // There can be more than one ORB per process. + // This method must also be inherited by both ORB and ORBSingleton. @ManagedAttribute - @Description( "The ByteBuffer pool used in the ORB" ) - public ByteBufferPool getByteBufferPool() - { + @Description("The ByteBuffer pool used in the ORB") + public ByteBufferPool getByteBufferPool() { if (byteBufferPool == null) byteBufferPool = new ByteBufferPoolImpl(this); @@ -676,143 +665,133 @@ public WireObjectKeyTemplate getWireObjectKeyTemplate() { public abstract void setThreadPoolManager(ThreadPoolManager mgr); @ManagedAttribute - @Description( "The ORB's threadpool manager" ) + @Description("The ORB's threadpool manager") public abstract ThreadPoolManager getThreadPoolManager(); @ManagedAttribute - @Description( "The ORB's object copier manager" ) - public abstract CopierManager getCopierManager() ; + @Description("The ORB's object copier manager") + public abstract CopierManager getCopierManager(); - /** Returns a name for this ORB that is based on the ORB id (if any) - * and guaranteed to be unique within the ClassLoader that loaded the - * ORB class. This is the default implementation inherited by the - * ORBSingleton. + /** + * Returns a name for this ORB that is based on the ORB id (if any) and guaranteed to be unique within the ClassLoader + * that loaded the ORB class. This is the default implementation inherited by the ORBSingleton. * * @return a unique name */ @NameValue - public String getUniqueOrbId() { - return "###DEFAULT_UNIQUE_ORB_ID###" ; + public String getUniqueOrbId() { + return "###DEFAULT_UNIQUE_ORB_ID###"; } - + // Interfaces used only to define InheritedAttributes for other classes // If we register a class that has Servant in its inheritance, it will // pick up these InheritedAttributes. @ManagedData - @Description( "A servant, which implements a remote object in the server" ) - @InheritedAttributes( { - @InheritedAttribute( methodName="_get_delegate", id="delegate", - description="Delegate that implements this servant" ), - @InheritedAttribute( methodName="_orb", id="orb", - description="The ORB for this Servant" ), - @InheritedAttribute( methodName="toString", id="representation", - description="Representation of this Servant" ), - @InheritedAttribute( methodName="_all_interfaces", id="typeIds", - description="The types implemented by this Servant" ) } - ) - public interface DummyServant{} + @Description("A servant, which implements a remote object in the server") + @InheritedAttributes({ + @InheritedAttribute(methodName = "_get_delegate", id = "delegate", description = "Delegate that implements this servant"), + @InheritedAttribute(methodName = "_orb", id = "orb", description = "The ORB for this Servant"), + @InheritedAttribute(methodName = "toString", id = "representation", description = "Representation of this Servant"), + @InheritedAttribute(methodName = "_all_interfaces", id = "typeIds", description = "The types implemented by this Servant") }) + public interface DummyServant { + } // DummyDelegate // DummyORB // DummyPOA - private ObjectName rootParentObjectName = null ; + private ObjectName rootParentObjectName = null; - public void setRootParentObjectName( ObjectName oname ) { - rootParentObjectName = oname ; + public void setRootParentObjectName(ObjectName oname) { + rootParentObjectName = oname; } @OrbLifeCycle public void createORBManagedObjectManager() { if (rootParentObjectName == null) { - mom = ManagedObjectManagerFactory.createStandalone( "com.sun.corba" ) ; + mom = ManagedObjectManagerFactory.createStandalone("com.sun.corba"); } else { - mom = ManagedObjectManagerFactory.createFederated( rootParentObjectName ) ; + mom = ManagedObjectManagerFactory.createFederated(rootParentObjectName); } if (mbeanFineDebugFlag) { - mom.setRegistrationDebug( ManagedObjectManager.RegistrationDebugLevel.FINE ) ; + mom.setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel.FINE); } else if (mbeanDebugFlag) { - mom.setRegistrationDebug( ManagedObjectManager.RegistrationDebugLevel.NORMAL ) ; + mom.setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel.NORMAL); } else { - mom.setRegistrationDebug( ManagedObjectManager.RegistrationDebugLevel.NONE ) ; + mom.setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel.NONE); } - mom.addAnnotation( Servant.class, DummyServant.class.getAnnotation( ManagedData.class ) ) ; - mom.addAnnotation( Servant.class, DummyServant.class.getAnnotation( Description.class ) ) ; - mom.addAnnotation( Servant.class, DummyServant.class.getAnnotation( InheritedAttributes.class ) ) ; + mom.addAnnotation(Servant.class, DummyServant.class.getAnnotation(ManagedData.class)); + mom.addAnnotation(Servant.class, DummyServant.class.getAnnotation(Description.class)); + mom.addAnnotation(Servant.class, DummyServant.class.getAnnotation(InheritedAttributes.class)); - mom.setRuntimeDebug( mbeanRuntimeDebugFlag ) ; + mom.setRuntimeDebug(mbeanRuntimeDebugFlag); - mom.stripPrefix( "com.sun.corba.ee", "com.sun.corba.ee.spi", "com.sun.corba.ee.spi.orb", - "com.sun.corba.ee.impl" ) ; + mom.stripPrefix("com.sun.corba.ee", "com.sun.corba.ee.spi", "com.sun.corba.ee.spi.orb", "com.sun.corba.ee.impl"); - mom.suspendJMXRegistration() ; + mom.suspendJMXRegistration(); - mbeanRegistrationSuspended( getORBData().getORBId() ) ; + mbeanRegistrationSuspended(getORBData().getORBId()); - mom.createRoot( this, getUniqueOrbId() ) ; + mom.createRoot(this, getUniqueOrbId()); } - - /** This method obtains an IOR from a CORBA object reference. - * The result is never null. + + /** + * This method obtains an IOR from a CORBA object reference. The result is never null. + * * @param obj CORBA object reference * @return obtained IOR - * @throws org.omg.CORBA.BAD_OPERATION (from oi._get_delegate) if obj is a - * normal objref, but does not have a delegate set. + * @throws org.omg.CORBA.BAD_OPERATION (from oi._get_delegate) if obj is a normal objref, but does not have a delegate + * set. * @throws org.omg.CORBA.BAD_PARAM if obj is a local object - */ - protected IOR getIOR( org.omg.CORBA.Object obj ) - { + */ + protected IOR getIOR(org.omg.CORBA.Object obj) { if (obj == null) - throw wrapper.nullObjectReference() ; + throw wrapper.nullObjectReference(); - IOR ior = null ; + IOR ior = null; if (StubAdapter.isStub(obj)) { - org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate( - obj ) ; + org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(obj); if (del instanceof ClientDelegate) { - ClientDelegate cdel = (ClientDelegate)del ; - ContactInfoList ccil = cdel.getContactInfoList() ; - ior = ccil.getTargetIOR() ; + ClientDelegate cdel = (ClientDelegate) del; + ContactInfoList ccil = cdel.getContactInfoList(); + ior = ccil.getTargetIOR(); if (ior == null) - throw wrapper.nullIor() ; + throw wrapper.nullIor(); - return ior ; - } + return ior; + } if (obj instanceof ObjectImpl) { // Get the ORB instance of obj so we can use that ORB // to marshal the object. - ObjectImpl oi = ObjectImpl.class.cast( obj ) ; - org.omg.CORBA.ORB oiorb = oi._orb() ; + ObjectImpl oi = ObjectImpl.class.cast(obj); + org.omg.CORBA.ORB oiorb = oi._orb(); // obj is implemented by a foreign ORB, because the Delegate is not a - // CorbaClientDelegate. Here we need to marshal obj to an output stream, - // then read the IOR back in. Note that the output stream MUST be + // CorbaClientDelegate. Here we need to marshal obj to an output stream, + // then read the IOR back in. Note that the output stream MUST be // created by the ORB to which obj is attached, otherwise we get an - // infinite recursion between this code and + // infinite recursion between this code and // CDROutputStream_1_0.write_Object. - org.omg.CORBA.portable.OutputStream os = oiorb.create_output_stream() ; - os.write_Object( obj ) ; - org.omg.CORBA.portable.InputStream is = os.create_input_stream() ; - ior = IORFactories.makeIOR( this, - org.omg.CORBA_2_3.portable.InputStream.class.cast( is ) ) ; - return ior ; + org.omg.CORBA.portable.OutputStream os = oiorb.create_output_stream(); + os.write_Object(obj); + org.omg.CORBA.portable.InputStream is = os.create_input_stream(); + ior = IORFactories.makeIOR(this, org.omg.CORBA_2_3.portable.InputStream.class.cast(is)); + return ior; } else { - throw wrapper.notAnObjectImpl() ; + throw wrapper.notAnObjectImpl(); } } else - throw wrapper.localObjectNotAllowed() ; + throw wrapper.localObjectNotAllowed(); } - - /** Get the IOR for the CORBA object. If the object is an RMI-IIOP object that - * is not connected, and connectIfNecessary is true, connect to this ORB. - * This method will obtain an IOR for any non-local CORBA object, regardless of - * what ORB implementation created it. It may be more efficient for objrefs - * that were created by this ORB implementation. + /** + * Get the IOR for the CORBA object. If the object is an RMI-IIOP object that is not connected, and connectIfNecessary + * is true, connect to this ORB. This method will obtain an IOR for any non-local CORBA object, regardless of what ORB + * implementation created it. It may be more efficient for objrefs that were created by this ORB implementation. * * @param obj CORBA object to get IOR for * @param connectIfNecessary connect to RMI-IIOP if not already @@ -820,96 +799,98 @@ protected IOR getIOR( org.omg.CORBA.Object obj ) * @exception SystemException (nullObjectReference) if obj is null * @exception SystemException (localObjectNotAllowed) of obj is a local CORBA object. */ - public IOR getIOR( org.omg.CORBA.Object obj, boolean connectIfNecessary ) { + public IOR getIOR(org.omg.CORBA.Object obj, boolean connectIfNecessary) { // Note: this version ignores connectIfNecessary, since an objref can only // be connected to an ORBImpl, not an ORBSingleton. - return getIOR( obj ) ; + return getIOR(obj); } - /** The singleton ORB does not need the cache, so just return null here. + /** + * The singleton ORB does not need the cache, so just return null here. + * * @param objKey ignored * @return null */ public ObjectKeyCacheEntry extractObjectKeyCacheEntry(byte[] objKey) { - return null ; + return null; } - /** Return whether or not the ORB is shutdown. A shutdown ORB cannot process - * incoming requests. + /** + * Return whether or not the ORB is shutdown. A shutdown ORB cannot process incoming requests. + * * @return true */ public boolean orbIsShutdown() { - return true ; + return true; } - private static final UnaryFunction> defaultClassNameResolver = - new UnaryFunction>() { - public Class evaluate( String name ) { - try { - return ORBClassLoader.getClassLoader().loadClass( name ) ; - } catch (ClassNotFoundException exc) { - throw new RuntimeException( exc ) ; - } + private static final UnaryFunction> defaultClassNameResolver = new UnaryFunction>() { + public Class evaluate(String name) { + try { + return ORBClassLoader.getClassLoader().loadClass(name); + } catch (ClassNotFoundException exc) { + throw new RuntimeException(exc); } + } - @Override - public String toString() { - return "ORBClassNameResolver" ; - } - } ; + @Override + public String toString() { + return "ORBClassNameResolver"; + } + }; - public static UnaryFunction> defaultClassNameResolver() { - return defaultClassNameResolver ; + public static UnaryFunction> defaultClassNameResolver() { + return defaultClassNameResolver; } - public UnaryFunction> makeCompositeClassNameResolver( - final UnaryFunction> first, - final UnaryFunction> second ) { + public UnaryFunction> makeCompositeClassNameResolver(final UnaryFunction> first, + final UnaryFunction> second) { - return new UnaryFunction>() { - public Class evaluate( String className ) { - Class result = first.evaluate( className ) ; + return new UnaryFunction>() { + public Class evaluate(String className) { + Class result = first.evaluate(className); if (result == null) { - return second.evaluate( className ) ; + return second.evaluate(className); } else { - return result ; + return result; } } @Override public String toString() { - return "CompositeClassNameResolver[" + first + "," + second + "]" ; + return "CompositeClassNameResolver[" + first + "," + second + "]"; } - } ; + }; } - public UnaryFunction> classNameResolver() { - return classNameResolver ; + public UnaryFunction> classNameResolver() { + return classNameResolver; } - public void classNameResolver( UnaryFunction> arg ) { - classNameResolver = arg ; + public void classNameResolver(UnaryFunction> arg) { + classNameResolver = arg; } public ManagedObjectManager mom() { - return mom ; + return mom; } public ClassCodeBaseHandler classCodeBaseHandler() { - return ccbHandler ; + return ccbHandler; } - public void classCodeBaseHandler( ClassCodeBaseHandler ccbh ) { - ccbHandler = ccbh ; + public void classCodeBaseHandler(ClassCodeBaseHandler ccbh) { + ccbHandler = ccbh; } - public abstract ClientInvocationInfo createOrIncrementInvocationInfo() ; + public abstract ClientInvocationInfo createOrIncrementInvocationInfo(); + public abstract ClientInvocationInfo getInvocationInfo(); + public abstract void releaseOrDecrementInvocationInfo(); public abstract TransportManager getTransportManager(); - } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBConfigurator.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBConfigurator.java index 453796cab..1a0cd0162 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBConfigurator.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBConfigurator.java @@ -17,16 +17,14 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -/** Interface used to configure an ORB instance. The DataCollector dc has all - * available config info available. The configure method may constructor a - * parser, call dc.setParser( parser ), get the consolidated properties from dc, - * and parse this information. The configure method may also register ORB - * components with the ORB and perform other parts of ORB initialization. - * Implementations of this interface must have a public no-args constructor. +/** + * Interface used to configure an ORB instance. The DataCollector dc has all available config info available. The + * configure method may constructor a parser, call dc.setParser( parser ), get the consolidated properties from dc, and + * parse this information. The configure method may also register ORB components with the ORB and perform other parts of + * ORB initialization. Implementations of this interface must have a public no-args constructor. */ public interface ORBConfigurator { - void configure( DataCollector dc, ORB orb ) ; + void configure(DataCollector dc, ORB orb); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBData.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBData.java index 5fe7bfbc7..2c512f7cc 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBData.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBData.java @@ -17,27 +17,27 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import org.omg.PortableInterceptor.ORBInitializer ; +import org.omg.PortableInterceptor.ORBInitializer; import com.sun.corba.ee.spi.transport.Acceptor; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; import com.sun.corba.ee.spi.transport.ContactInfoListFactory; import com.sun.corba.ee.spi.transport.IORToSocketInfo; import com.sun.corba.ee.spi.transport.IIOPPrimaryToContactInfo; import com.sun.corba.ee.spi.transport.TcpTimeouts; import com.sun.corba.ee.impl.legacy.connection.USLPort; -import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo ; +import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; -import org.glassfish.gmbal.ManagedObject ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.AMXMetadata ; +import org.glassfish.gmbal.ManagedObject; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.AMXMetadata; -import org.glassfish.pfl.basic.contain.Pair ; +import org.glassfish.pfl.basic.contain.Pair; import java.util.concurrent.TimeUnit; @@ -46,356 +46,347 @@ // over time. On the other hande, essentially everything should be readable. @ManagedObject -@Description( "ORB Configuration data" ) -@AMXMetadata( isSingleton=true ) +@Description("ORB Configuration data") +@AMXMetadata(isSingleton = true) public interface ORBData { @ManagedAttribute - @Description( "Value of ORBInitialHost, the host name of the remote name service" ) - public String getORBInitialHost() ; + @Description("Value of ORBInitialHost, the host name of the remote name service") + public String getORBInitialHost(); // XXX add setter? @ManagedAttribute - @Description( "Value of ORBInitialPort, the port number of the remote name service" ) - public int getORBInitialPort() ; + @Description("Value of ORBInitialPort, the port number of the remote name service") + public int getORBInitialPort(); // XXX add setter? @ManagedAttribute - @Description( "DESC" ) - public String getORBServerHost() ; + @Description("DESC") + public String getORBServerHost(); // XXX add setter? @ManagedAttribute - @Description( "DESC" ) - public int getORBServerPort() ; + @Description("DESC") + public int getORBServerPort(); // XXX add setter? @ManagedAttribute - @Description( "If true, the ORB listens at its ports on all IP interfaces on the host" ) + @Description("If true, the ORB listens at its ports on all IP interfaces on the host") public boolean getListenOnAllInterfaces(); // XXX add setter? @ManagedAttribute - @Description( "The implementation of the legacy ORBSocketFactory interface in use (if any)" ) - public com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory () ; + @Description("The implementation of the legacy ORBSocketFactory interface in use (if any)") + public com.sun.corba.ee.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory(); @ManagedAttribute - @Description( "The implementation of the ORBSocketFactory interface in use (if any)" ) + @Description("The implementation of the ORBSocketFactory interface in use (if any)") public com.sun.corba.ee.spi.transport.ORBSocketFactory getSocketFactory(); @ManagedAttribute - @Description( "Return the user-specified listen ports, on which the ORB listens for incoming requests" ) - public USLPort[] getUserSpecifiedListenPorts () ; + @Description("Return the user-specified listen ports, on which the ORB listens for incoming requests") + public USLPort[] getUserSpecifiedListenPorts(); // XXX This is legacy: can we remove it? @ManagedAttribute - @Description( "Return the instance of the IORToSocketInfo interface, " - + "which is used to get SocketInfo from IORs" ) + @Description("Return the instance of the IORToSocketInfo interface, " + "which is used to get SocketInfo from IORs") public IORToSocketInfo getIORToSocketInfo(); // XXX Make the setter visible to JMX? - public void setIORToSocketInfo(IORToSocketInfo x); + public void setIORToSocketInfo(IORToSocketInfo x); @ManagedAttribute - @Description( "Return the instance of the IIOPPrimaryToContactInfo interface" ) + @Description("Return the instance of the IIOPPrimaryToContactInfo interface") public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo(); // XXX Make the setter visible to JMX? - public void setIIOPPrimaryToContactInfo( - IIOPPrimaryToContactInfo x); + public void setIIOPPrimaryToContactInfo(IIOPPrimaryToContactInfo x); @ManagedAttribute - @Description( "Return the configured ORB ID" ) - public String getORBId() ; + @Description("Return the configured ORB ID") + public String getORBId(); @ManagedAttribute - @Description( "Returns true if the RMI-IIOP local optimization " - + "(caching servant in local subcontract) is allowed." ) - public boolean isLocalOptimizationAllowed() ; + @Description("Returns true if the RMI-IIOP local optimization " + "(caching servant in local subcontract) is allowed.") + public boolean isLocalOptimizationAllowed(); @ManagedAttribute - @Description( "Return the GIOP version that will be prefered for sending requests" ) - public GIOPVersion getGIOPVersion() ; + @Description("Return the GIOP version that will be prefered for sending requests") + public GIOPVersion getGIOPVersion(); @ManagedAttribute - @Description( "Return the high water mark for the connection cache" ) - public int getHighWaterMark() ; + @Description("Return the high water mark for the connection cache") + public int getHighWaterMark(); // XXX add setter? @ManagedAttribute - @Description( "Return the number of connections to attempt to reclaim " - + "when the total number of connections exceeds the high water mark" ) - public int getNumberToReclaim() ; + @Description("Return the number of connections to attempt to reclaim " + + "when the total number of connections exceeds the high water mark") + public int getNumberToReclaim(); // XXX add setter? @ManagedAttribute - @Description( "Return the " ) - public int getGIOPFragmentSize() ; + @Description("Return the ") + public int getGIOPFragmentSize(); // XXX add setter? - // Probably don't really want to expose this + // Probably don't really want to expose this // @ManagedAttribute - // @Description( "Buffer size to use for Java serialization encoding (NOT SUPPORTED)" ) - public int getGIOPBufferSize() ; + // @Description( "Buffer size to use for Java serialization encoding (NOT SUPPORTED)" ) + public int getGIOPBufferSize(); // XXX add setter? // Can't have an argument: what is the correct action here? // @ManagedAttribute - // @Description( "Int describing GIOP buffer management strategy: " - // + "0:grow, 1:collect, 2:stream (the default)") - public int getGIOPBuffMgrStrategy(GIOPVersion gv) ; + // @Description( "Int describing GIOP buffer management strategy: " + // + "0:grow, 1:collect, 2:stream (the default)") + public int getGIOPBuffMgrStrategy(GIOPVersion gv); /** - * @return the GIOP Target Addressing preference of the ORB. - * This ORB by default supports all addressing dispositions unless specified - * otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING + * @return the GIOP Target Addressing preference of the ORB. This ORB by default supports all addressing dispositions + * unless specified otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING */ @ManagedAttribute - @Description( "The ORB required target addressing mode: " - + "0:ObjectKey, 1:TaggedProfile, 2:EntireIOR, 3:Accept All (default)" ) - public short getGIOPTargetAddressPreference() ; + @Description("The ORB required target addressing mode: " + "0:ObjectKey, 1:TaggedProfile, 2:EntireIOR, 3:Accept All (default)") + public short getGIOPTargetAddressPreference(); @ManagedAttribute - @Description( "The ORB required target addressing mode: " - + "0:ObjectKey, 1:TaggedProfile, 2:EntireIOR, 3:Accept All (default)" ) - public short getGIOPAddressDisposition() ; + @Description("The ORB required target addressing mode: " + "0:ObjectKey, 1:TaggedProfile, 2:EntireIOR, 3:Accept All (default)") + public short getGIOPAddressDisposition(); @ManagedAttribute - @Description( "DESC" ) - public boolean useByteOrderMarkers() ; + @Description("DESC") + public boolean useByteOrderMarkers(); @ManagedAttribute - @Description( "DESC" ) - public boolean useByteOrderMarkersInEncapsulations() ; + @Description("DESC") + public boolean useByteOrderMarkersInEncapsulations(); @ManagedAttribute - @Description( "DESC" ) - public boolean alwaysSendCodeSetServiceContext() ; + @Description("DESC") + public boolean alwaysSendCodeSetServiceContext(); @ManagedAttribute - @Description( "DESC" ) - public boolean getPersistentPortInitialized() ; + @Description("DESC") + public boolean getPersistentPortInitialized(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public int getPersistentServerPort(); @ManagedAttribute - @Description( "DESC" ) - public boolean getPersistentServerIdInitialized() ; + @Description("DESC") + public boolean getPersistentServerIdInitialized(); - /** Return the persistent-server-id of this server. This id is the same - * across multiple activations of this server. - * The user/environment is required to supply the - * persistent-server-id every time this server is started, in - * the ORBServerId parameter, System properties, or other means. - * The user is also required to ensure that no two persistent servers - * on the same host have the same server-id. + /** + * Return the persistent-server-id of this server. This id is the same across multiple activations of this server. The + * user/environment is required to supply the persistent-server-id every time this server is started, in the ORBServerId + * parameter, System properties, or other means. The user is also required to ensure that no two persistent servers on + * the same host have the same server-id. * * @return persistent-server-id of server */ @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public int getPersistentServerId(); @ManagedAttribute - @Description( "DESC" ) - public boolean getServerIsORBActivated() ; + @Description("DESC") + public boolean getServerIsORBActivated(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public Class getBadServerIdHandler(); /** - * Get the preferred code sets for connections. Should the client send the - * code set service context on every request? - * @return code sets for connections - */ + * Get the preferred code sets for connections. Should the client send the code set service context on every request? + * + * @return code sets for connections + */ @ManagedAttribute - @Description( "DESC" ) - public CodeSetComponentInfo getCodeSetComponentInfo() ; + @Description("DESC") + public CodeSetComponentInfo getCodeSetComponentInfo(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public ORBInitializer[] getORBInitializers(); - /** Added to allow user configurators to add ORBInitializers - * for PI. This makes it possible to add interceptors from - * an ORBConfigurator. - * XXX Should this be an operation, or a set only attribute? - * Should it even be exposed in the MBean? + /** + * Added to allow user configurators to add ORBInitializers for PI. This makes it possible to add interceptors from an + * ORBConfigurator. XXX Should this be an operation, or a set only attribute? Should it even be exposed in the MBean? + * * @param init used to initialize resolve_initial_references */ // @ManagedAttribute - // @Description( "DESC" ) - public void addORBInitializer( ORBInitializer init ) ; + // @Description( "DESC" ) + public void addORBInitializer(ORBInitializer init); @ManagedAttribute - @Description( "Pair of (name, CORBA URL) used to initialize resolve_initial_references" ) - public Pair[] getORBInitialReferences(); + @Description("Pair of (name, CORBA URL) used to initialize resolve_initial_references") + public Pair[] getORBInitialReferences(); - public String getORBDefaultInitialReference() ; + public String getORBDefaultInitialReference(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public String[] getORBDebugFlags(); // Add operation to set flags @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public Acceptor[] getAcceptors(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public ContactInfoListFactory getCorbaContactInfoListFactory(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public String acceptorSocketType(); - + @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean acceptorSocketUseSelectThreadToWait(); - + @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean acceptorSocketUseWorkerThreadForEvent(); - + @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public String connectionSocketType(); - + @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean connectionSocketUseSelectThreadToWait(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean connectionSocketUseWorkerThreadForEvent(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public long getCommunicationsRetryTimeout(); // XXX add setter - + @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public long getWaitForResponseTimeout(); // XXX add setter @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public TcpTimeouts getTransportTcpTimeouts(); // XXX add setter @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public TcpTimeouts getTransportTcpConnectTimeouts(); // XXX add setter @ManagedAttribute - @Description( "DESC" ) - public boolean disableDirectByteBufferUse() ; + @Description("DESC") + public boolean disableDirectByteBufferUse(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean isJavaSerializationEnabled(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean useRepId(); @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean showInfoMessages(); @ManagedAttribute - @Description( "DESC" ) - public boolean getServiceContextReturnsNull() ; + @Description("DESC") + public boolean getServiceContextReturnsNull(); // this method tells whether the current ORB was created from within the app server - // This helps in performance improvement (for certain computations that donot need to be - //performed again and again. For e.g. getMaxStreamFormatVersion()) + // This helps in performance improvement (for certain computations that donot need to be + // performed again and again. For e.g. getMaxStreamFormatVersion()) @ManagedAttribute - @Description( "DESC" ) - public boolean isAppServerMode() ; - + @Description("DESC") + public boolean isAppServerMode(); + // Get the ByteBuffer size to use when reading from a SocketChannel, // i.e optimized read strategy @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public int getReadByteBufferSize(); - + // Get maximum read ByteBuffer size to re-allocate @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public int getMaxReadByteBufferSizeThreshold(); // Get the pooled DirectByteBuffer slab size @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public int getPooledDirectByteBufferSlabSize(); - + // Should a blocking read always be done when using the optimized read // strategy ? @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean alwaysEnterBlockingRead(); - + // Set whether the read optimization should always enter a blocking read // after doing a non-blocking read @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public void alwaysEnterBlockingRead(boolean b); // Should the optimized non-blocking read include in its while loop the // condition to check the MessageParser if it is expecting more data? @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean nonBlockingReadCheckMessageParser(); // Should the optimized blocking read include in its while loop the // condition to check the MessageParser if it is expecting more data? @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") public boolean blockingReadCheckMessageParser(); @ManagedAttribute - @Description( "DESC" ) - public boolean timingPointsEnabled() ; + @Description("DESC") + public boolean timingPointsEnabled(); // XXX add setter @ManagedAttribute - @Description( "DESC" ) + @Description("DESC") // Should marshaling of enums be done with EnumDesc, or by simply - // marshaling as a value type with receiver-make-right? Use EnumDesc - // if this returns true. The default is false, but the ORB will do + // marshaling as a value type with receiver-make-right? Use EnumDesc + // if this returns true. The default is false, but the ORB will do // the right thing if it receives an EnumDesc in any case. - public boolean useEnumDesc() ; + public boolean useEnumDesc(); @ManagedAttribute - @Description( "Returns true if ORB is running inside the GFv3 application server" ) - boolean environmentIsGFServer() ; + @Description("Returns true if ORB is running inside the GFv3 application server") + boolean environmentIsGFServer(); @ManagedAttribute - @Description( "If true, do not start any acceptors in the transport by default" ) - public boolean noDefaultAcceptors() ; + @Description("If true, do not start any acceptors in the transport by default") + public boolean noDefaultAcceptors(); // No reason to make this an attribute: if false, we won't see MBeans! - public boolean registerMBeans() ; + public boolean registerMBeans(); @ManagedAttribute - @Description( "The time that a CDRInputStream will wait for more data before throwing an exception" ) - public int fragmentReadTimeout() ; + @Description("The time that a CDRInputStream will wait for more data before throwing an exception") + public int fragmentReadTimeout(); - public void setOrbInitArgs( String[] args ) ; + public void setOrbInitArgs(String[] args); @ManagedAttribute - @Description( "The String[] args that were passed to the ORB init call (used for interceptor initialization)" ) - public String[] getOrbInitArgs() ; + @Description("The String[] args that were passed to the ORB init call (used for interceptor initialization)") + public String[] getOrbInitArgs(); @ManagedAttribute - @Description( "True if ORBD should not be used in this ORB instance") - public boolean disableORBD() ; + @Description("True if ORBD should not be used in this ORB instance") + public boolean disableORBD(); default void waitNanos(Object obj, long waitNanos) throws InterruptedException { TimeUnit.NANOSECONDS.timedWait(obj, waitNanos); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBVersion.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBVersion.java index 5382081b0..78c99ef4a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBVersion.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBVersion.java @@ -17,30 +17,29 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import org.omg.CORBA.portable.OutputStream ; +import org.omg.CORBA.portable.OutputStream; -import org.glassfish.gmbal.ManagedData ; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.ManagedAttribute ; +import org.glassfish.gmbal.ManagedData; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.ManagedAttribute; @ManagedData -@Description( "The version of the ORB" ) -public interface ORBVersion extends Comparable -{ - byte FOREIGN = 0 ; // ORB from another vendor - byte OLD = 1 ; // JDK 1.3.0 or earlier - byte NEW = 2 ; // JDK 1.3.1 FCS - byte JDK1_3_1_01 = 3; // JDK1_3_1_01 patch - byte NEWER = 10 ; // JDK 1.4.x - byte PEORB = 20 ; // PEORB in JDK 1.5, S1AS 8, J2EE 1.4 +@Description("The version of the ORB") +public interface ORBVersion extends Comparable { + byte FOREIGN = 0; // ORB from another vendor + byte OLD = 1; // JDK 1.3.0 or earlier + byte NEW = 2; // JDK 1.3.1 FCS + byte JDK1_3_1_01 = 3; // JDK1_3_1_01 patch + byte NEWER = 10; // JDK 1.4.x + byte PEORB = 20; // PEORB in JDK 1.5, S1AS 8, J2EE 1.4 @ManagedAttribute - @Description( "ORB version (0=FOREIGN,1=OLD,2=NEW,3=JDK1_3_1_01,10=NEWER,20=PEORB)" ) - byte getORBType() ; + @Description("ORB version (0=FOREIGN,1=OLD,2=NEW,3=JDK1_3_1_01,10=NEWER,20=PEORB)") + byte getORBType(); - void write( OutputStream os ) ; + void write(OutputStream os); - public boolean lessThan( ORBVersion version ) ; + public boolean lessThan(ORBVersion version); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBVersionFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBVersionFactory.java index bfcfb38ff..6fa684003 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBVersionFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ORBVersionFactory.java @@ -17,92 +17,86 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import com.sun.corba.ee.spi.orb.ORBVersion ; -import com.sun.corba.ee.impl.orb.ORBVersionImpl ; -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.INTERNAL ; +import com.sun.corba.ee.spi.orb.ORBVersion; +import com.sun.corba.ee.impl.orb.ORBVersionImpl; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.INTERNAL; public class ORBVersionFactory { - private ORBVersionFactory() {} ; + private ORBVersionFactory() { + }; - public static ORBVersion getFOREIGN() - { - return ORBVersionImpl.FOREIGN ; + public static ORBVersion getFOREIGN() { + return ORBVersionImpl.FOREIGN; } - public static ORBVersion getOLD() - { - return ORBVersionImpl.OLD ; + public static ORBVersion getOLD() { + return ORBVersionImpl.OLD; } - public static ORBVersion getNEW() - { - return ORBVersionImpl.NEW ; + public static ORBVersion getNEW() { + return ORBVersionImpl.NEW; } - public static ORBVersion getJDK1_3_1_01() - { - return ORBVersionImpl.JDK1_3_1_01 ; + public static ORBVersion getJDK1_3_1_01() { + return ORBVersionImpl.JDK1_3_1_01; } - public static ORBVersion getNEWER() - { - return ORBVersionImpl.NEWER ; + public static ORBVersion getNEWER() { + return ORBVersionImpl.NEWER; } - public static ORBVersion getPEORB() - { - return ORBVersionImpl.PEORB ; + public static ORBVersion getPEORB() { + return ORBVersionImpl.PEORB; } - /** Return the current version of this ORB + /** + * Return the current version of this ORB + * * @return ORB version */ - public static ORBVersion getORBVersion() - { - return ORBVersionImpl.PEORB ; + public static ORBVersion getORBVersion() { + return ORBVersionImpl.PEORB; } - public static ORBVersion create( InputStream is ) - { - byte value = is.read_octet() ; - return byteToVersion( value ) ; + public static ORBVersion create(InputStream is) { + byte value = is.read_octet(); + return byteToVersion(value); } - private static ORBVersion byteToVersion( byte value ) - { - /* Throwing an exception here would cause this version to be - * incompatible with future versions of the ORB, to the point - * that this version could - * not even unmarshal objrefs from a newer version that uses - * extended versioning. Therefore, we will simply treat all - * unknown versions as the latest version. - if (value < 0) - throw new INTERNAL() ; - */ + private static ORBVersion byteToVersion(byte value) { + /* + * Throwing an exception here would cause this version to be incompatible with future versions of the ORB, to the point + * that this version could not even unmarshal objrefs from a newer version that uses extended versioning. Therefore, we + * will simply treat all unknown versions as the latest version. if (value < 0) throw new INTERNAL() ; + */ /** - * Update: If we treat all unknown versions as the latest version - * then when we send an IOR with a PEORB version to an ORB that - * doesn't know the PEORB version it will treat it as whatever - * its idea of the latest version is. Then, if that IOR is - * sent back to the server and compared with the original - * the equality check will fail because the versions will be - * different. + * Update: If we treat all unknown versions as the latest version then when we send an IOR with a PEORB version to an + * ORB that doesn't know the PEORB version it will treat it as whatever its idea of the latest version is. Then, if that + * IOR is sent back to the server and compared with the original the equality check will fail because the versions will + * be different. * * Instead, just capture the version bytes. */ switch (value) { - case ORBVersion.FOREIGN : return ORBVersionImpl.FOREIGN ; - case ORBVersion.OLD : return ORBVersionImpl.OLD ; - case ORBVersion.NEW : return ORBVersionImpl.NEW ; - case ORBVersion.JDK1_3_1_01: return ORBVersionImpl.JDK1_3_1_01 ; - case ORBVersion.NEWER : return ORBVersionImpl.NEWER ; - case ORBVersion.PEORB : return ORBVersionImpl.PEORB ; - default : return new ORBVersionImpl(value); + case ORBVersion.FOREIGN: + return ORBVersionImpl.FOREIGN; + case ORBVersion.OLD: + return ORBVersionImpl.OLD; + case ORBVersion.NEW: + return ORBVersionImpl.NEW; + case ORBVersion.JDK1_3_1_01: + return ORBVersionImpl.JDK1_3_1_01; + case ORBVersion.NEWER: + return ORBVersionImpl.NEWER; + case ORBVersion.PEORB: + return ORBVersionImpl.PEORB; + default: + return new ORBVersionImpl(value); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ObjectKeyCacheEntry.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ObjectKeyCacheEntry.java index 8c747de48..4bd40285d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ObjectKeyCacheEntry.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ObjectKeyCacheEntry.java @@ -17,21 +17,21 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import com.sun.corba.ee.spi.ior.ObjectKey ; +import com.sun.corba.ee.spi.ior.ObjectKey; -import com.sun.corba.ee.spi.oa.ObjectAdapter ; +import com.sun.corba.ee.spi.oa.ObjectAdapter; -/** Interface used to represent information cached for a particular byte[] that - * represent a GIOP marshalled ObjectKey. +/** + * Interface used to represent information cached for a particular byte[] that represent a GIOP marshalled ObjectKey. */ public interface ObjectKeyCacheEntry { - ObjectKey getObjectKey() ; + ObjectKey getObjectKey(); - ObjectAdapter getObjectAdapter() ; + ObjectAdapter getObjectAdapter(); - void clearObjectAdapter() ; + void clearObjectAdapter(); - void setObjectAdapter( ObjectAdapter oa ) ; + void setObjectAdapter(ObjectAdapter oa); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/Operation.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/Operation.java index b318cea88..760e0958d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/Operation.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/Operation.java @@ -17,15 +17,18 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -/** A generic class representing a function that takes a value and returns - * a value. This is a building block for property parsing. +/** + * A generic class representing a function that takes a value and returns a value. This is a building block for property + * parsing. */ -public interface Operation{ - /** Apply some function to a value and return the result. +public interface Operation { + /** + * Apply some function to a value and return the result. + * * @param value value to apply function to * @return result of function - */ - Object operate( Object value ) ; + */ + Object operate(Object value); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/OperationFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/OperationFactory.java index 74b128a0e..8ec579d2c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/OperationFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/OperationFactory.java @@ -17,61 +17,60 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; - +package com.sun.corba.ee.spi.orb; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -import java.util.StringTokenizer ; +import java.util.StringTokenizer; -import java.lang.reflect.Array ; +import java.lang.reflect.Array; -import java.net.URL ; -import java.net.MalformedURLException ; +import java.net.URL; +import java.net.MalformedURLException; import org.glassfish.pfl.basic.algorithm.ObjectUtility; import org.glassfish.pfl.basic.contain.Pair; import org.glassfish.pfl.basic.func.UnaryFunction; -/** This is a static factory class for commonly used operations -* for property parsing. The following operations are supported: -*
      -*
    • maskErrorAction( Operation op ) executes op and returns the result. If op throws an -* exception, the result is null. -*
    • indexAction( int arg ) returns the [arg] element of value, which must be an Object[]
    • -*
    • identityAction() return the value
    • -*
    • booleanAction() return a Boolean representing true or false values of the String value
    • -*
    • integerAction() returns an Integer for the String value, which must be a decimal integer
    • -*
    • stringAction() returns the String value
    • -*
    • classAction() returns a class for the String value, as loaded by the ORB classloader
    • -*
    • setFlagAction() always return Boolean.TRUE
    • -*
    • URLAction() returns a java.net.URL for the String value, which must be a valid URL
    • -*
    • integerRangeAction( int min, int max ) returns an Integer for the String value, which must be a -* decimal integer in the range min to max inclusive
    • -*
    • listAction( String sep, Operation ) tokenizes the String value with sep as separator, then -* applies the Operation to each token, and returns an array of the result
    • -*
    • sequenceAction( String, Operation[] ) tokenizes the String value with sep as separator, then -* applies each Operation in the Operation array to successive tokens, and returns an array of the results
    • -*
    • compose( Operation op1, Operation op2 ) is the operation that applies op2 to the result of applying -* op1 to the value
    • -*
    • mapAction( Operation ) applies the Operation to each element of an array of objects, and returns -* an array of the results
    • -*
    • mapSequenceAction( Operation[] ) applies the corresponding element of the Operation array to an -* element of the Object[] value, and returns an array of the results
    • -*
    • convertIntegerToShort coerces an Integer into a Short.
    • -*
    -* Other operations can be directly defined, and combined using these basic operations. -*

    -* This class also provides a simple ArgumentParser that can be used to parse -* simple String[] data using the Operations framework. -*/ +/** + * This is a static factory class for commonly used operations for property parsing. The following operations are + * supported: + *

      + *
    • maskErrorAction( Operation op ) executes op and returns the result. If op throws an exception, the result is + * null. + *
    • indexAction( int arg ) returns the [arg] element of value, which must be an Object[]
    • + *
    • identityAction() return the value
    • + *
    • booleanAction() return a Boolean representing true or false values of the String value
    • + *
    • integerAction() returns an Integer for the String value, which must be a decimal integer
    • + *
    • stringAction() returns the String value
    • + *
    • classAction() returns a class for the String value, as loaded by the ORB classloader
    • + *
    • setFlagAction() always return Boolean.TRUE
    • + *
    • URLAction() returns a java.net.URL for the String value, which must be a valid URL
    • + *
    • integerRangeAction( int min, int max ) returns an Integer for the String value, which must be a decimal integer + * in the range min to max inclusive
    • + *
    • listAction( String sep, Operation ) tokenizes the String value with sep as separator, then applies the Operation + * to each token, and returns an array of the result
    • + *
    • sequenceAction( String, Operation[] ) tokenizes the String value with sep as separator, then applies each + * Operation in the Operation array to successive tokens, and returns an array of the results
    • + *
    • compose( Operation op1, Operation op2 ) is the operation that applies op2 to the result of applying op1 to the + * value
    • + *
    • mapAction( Operation ) applies the Operation to each element of an array of objects, and returns an array of the + * results
    • + *
    • mapSequenceAction( Operation[] ) applies the corresponding element of the Operation array to an element of the + * Object[] value, and returns an array of the results
    • + *
    • convertIntegerToShort coerces an Integer into a Short.
    • + *
    + * Other operations can be directly defined, and combined using these basic operations. + *

    + * This class also provides a simple ArgumentParser that can be used to parse simple String[] data using the Operations + * framework. + */ public abstract class OperationFactory { // I18N for errors through log wrappers: bug 5051545 - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private OperationFactory() {} + private OperationFactory() { + } - private static String getString( Object obj ) - { + private static String getString(Object obj) { if (obj instanceof String) { return (String) obj; } else { @@ -79,8 +78,7 @@ private static String getString( Object obj ) } } - private static Object[] getObjectArray( Object obj ) - { + private static Object[] getObjectArray(Object obj) { if (obj instanceof Object[]) { return (Object[]) obj; } else { @@ -88,8 +86,7 @@ private static Object[] getObjectArray( Object obj ) } } - private static Pair getStringPair( Object obj ) - { + private static Pair getStringPair(Object obj) { if (obj instanceof Pair) { return (Pair) obj; } else { @@ -97,11 +94,10 @@ private static Pair getStringPair( Object obj ) } } - private static abstract class OperationBase implements Operation{ + private static abstract class OperationBase implements Operation { @Override - public boolean equals( Object obj ) - { - if (this==obj) { + public boolean equals(Object obj) { + if (this == obj) { return true; } @@ -109,267 +105,243 @@ public boolean equals( Object obj ) return false; } - OperationBase other = (OperationBase)obj ; + OperationBase other = (OperationBase) obj; - return toString().equals( other.toString() ) ; + return toString().equals(other.toString()); } @Override - public int hashCode() - { - return toString().hashCode() ; + public int hashCode() { + return toString().hashCode(); } } - private static class MaskErrorAction extends OperationBase - { - private Operation op ; + private static class MaskErrorAction extends OperationBase { + private Operation op; - public MaskErrorAction( Operation op ) - { - this.op = op ; + public MaskErrorAction(Operation op) { + this.op = op; } - public Object operate( Object arg ) - { + public Object operate(Object arg) { try { - return op.operate( arg ) ; + return op.operate(arg); } catch (java.lang.Exception exc) { - return null ; + return null; } } @Override - public String toString() - { - return "maskErrorAction(" + op + ")" ; + public String toString() { + return "maskErrorAction(" + op + ")"; } } - public static Operation maskErrorAction( Operation op ) - { - return new MaskErrorAction( op ) ; + public static Operation maskErrorAction(Operation op) { + return new MaskErrorAction(op); } - private static class IndexAction extends OperationBase - { - private int index ; + private static class IndexAction extends OperationBase { + private int index; - public IndexAction( int index ) - { - this.index = index ; + public IndexAction(int index) { + this.index = index; } - public Object operate( Object value ) - { - return getObjectArray( value )[ index ] ; + public Object operate(Object value) { + return getObjectArray(value)[index]; } @Override - public String toString() - { - return "indexAction(" + index + ")" ; + public String toString() { + return "indexAction(" + index + ")"; } } - public static Operation indexAction( int index ) - { - return new IndexAction( index ) ; + public static Operation indexAction(int index) { + return new IndexAction(index); } - private static class SuffixAction extends OperationBase - { - public Object operate( Object value ) - { - return getStringPair( value ).first() ; + private static class SuffixAction extends OperationBase { + public Object operate(Object value) { + return getStringPair(value).first(); } @Override - public String toString() { return "suffixAction" ; } + public String toString() { + return "suffixAction"; + } } - private static Operation suffixActionImpl = new SuffixAction() ; + private static Operation suffixActionImpl = new SuffixAction(); - private static class ValueAction extends OperationBase - { - public Object operate( Object value ) - { - return getStringPair( value ).second() ; + private static class ValueAction extends OperationBase { + public Object operate(Object value) { + return getStringPair(value).second(); } @Override - public String toString() { return "valueAction" ; } + public String toString() { + return "valueAction"; + } } - private static Operation valueActionImpl = new ValueAction() ; + private static Operation valueActionImpl = new ValueAction(); - private static class IdentityAction extends OperationBase - { - public Object operate( Object value ) - { - return value ; + private static class IdentityAction extends OperationBase { + public Object operate(Object value) { + return value; } @Override - public String toString() { return "identityAction" ; } + public String toString() { + return "identityAction"; + } } - private static Operation identityActionImpl = new IdentityAction() ; + private static Operation identityActionImpl = new IdentityAction(); - private static class BooleanAction extends OperationBase - { - public Object operate( Object value ) - { - return Boolean.valueOf( getString( value ) ) ; + private static class BooleanAction extends OperationBase { + public Object operate(Object value) { + return Boolean.valueOf(getString(value)); } @Override - public String toString() { return "booleanAction" ; } + public String toString() { + return "booleanAction"; + } } - private static Operation booleanActionImpl = new BooleanAction() ; + private static Operation booleanActionImpl = new BooleanAction(); - private static class IntegerAction extends OperationBase - { - public Object operate( Object value ) - { - return Integer.valueOf( getString( value ) ) ; + private static class IntegerAction extends OperationBase { + public Object operate(Object value) { + return Integer.valueOf(getString(value)); } @Override - public String toString() { return "integerAction" ; } + public String toString() { + return "integerAction"; + } } - private static Operation integerActionImpl = new IntegerAction() ; + private static Operation integerActionImpl = new IntegerAction(); - private static class StringAction extends OperationBase - { - public Object operate( Object value ) - { - return value ; + private static class StringAction extends OperationBase { + public Object operate(Object value) { + return value; } @Override - public String toString() { return "stringAction" ; } + public String toString() { + return "stringAction"; + } } - private static Operation stringActionImpl = new StringAction() ; + private static Operation stringActionImpl = new StringAction(); - private static class ClassAction extends OperationBase - { - private UnaryFunction> resolver ; + private static class ClassAction extends OperationBase { + private UnaryFunction> resolver; - public ClassAction( UnaryFunction> resolver ) { - this.resolver = resolver ; + public ClassAction(UnaryFunction> resolver) { + this.resolver = resolver; } - public Object operate( Object value ) - { - String className = getString( value ) ; + public Object operate(Object value) { + String className = getString(value); try { - Class result = resolver.evaluate( className ) ; - return result ; + Class result = resolver.evaluate(className); + return result; } catch (Exception exc) { - throw wrapper.classActionException( exc, className ) ; + throw wrapper.classActionException(exc, className); } - } + } @Override - public String toString() { return "classAction[" + resolver + "]" ; } + public String toString() { + return "classAction[" + resolver + "]"; + } } - private static class SetFlagAction extends OperationBase - { - public Object operate( Object value ) - { - return Boolean.TRUE ; - } + private static class SetFlagAction extends OperationBase { + public Object operate(Object value) { + return Boolean.TRUE; + } @Override - public String toString() { return "setFlagAction" ; } + public String toString() { + return "setFlagAction"; + } } - private static Operation setFlagActionImpl = new SetFlagAction() ; + private static Operation setFlagActionImpl = new SetFlagAction(); - private static class URLAction extends OperationBase - { - public Object operate( Object value ) - { - String val = (String)value ; + private static class URLAction extends OperationBase { + public Object operate(Object value) { + String val = (String) value; try { - return new URL( val ) ; + return new URL(val); } catch (MalformedURLException exc) { - throw wrapper.badUrlInAction( exc, val ) ; + throw wrapper.badUrlInAction(exc, val); } } @Override - public String toString() { return "URLAction" ; } + public String toString() { + return "URLAction"; + } } - private static Operation URLActionImpl = new URLAction() ; + private static Operation URLActionImpl = new URLAction(); - public static Operation identityAction() - { - return identityActionImpl ; + public static Operation identityAction() { + return identityActionImpl; } - public static Operation suffixAction() - { - return suffixActionImpl ; + public static Operation suffixAction() { + return suffixActionImpl; } - public static Operation valueAction() - { - return valueActionImpl ; + public static Operation valueAction() { + return valueActionImpl; } - public static Operation booleanAction() - { - return booleanActionImpl ; + public static Operation booleanAction() { + return booleanActionImpl; } - public static Operation integerAction() - { - return integerActionImpl ; + public static Operation integerAction() { + return integerActionImpl; } - public static Operation stringAction() - { - return stringActionImpl ; + public static Operation stringAction() { + return stringActionImpl; } - public static Operation classAction( - final UnaryFunction> resolver ) - { - return new ClassAction( resolver ) ; + public static Operation classAction(final UnaryFunction> resolver) { + return new ClassAction(resolver); } - public static Operation setFlagAction() - { - return setFlagActionImpl ; + public static Operation setFlagAction() { + return setFlagActionImpl; } - public static Operation URLAction() - { - return URLActionImpl ; + public static Operation URLAction() { + return URLActionImpl; } - private static class IntegerRangeAction extends OperationBase - { - private int min ; - private int max ; + private static class IntegerRangeAction extends OperationBase { + private int min; + private int max; - IntegerRangeAction( int min, int max ) - { - this.min = min ; - this.max = max ; + IntegerRangeAction(int min, int max) { + this.min = min; + this.max = max; } - public Object operate( Object value ) - { - int result = Integer.parseInt( getString( value ) ) ; + public Object operate(Object value) { + int result = Integer.parseInt(getString(value)); if ((result >= min) && (result <= max)) { return Integer.valueOf(result); } else { @@ -378,214 +350,182 @@ public Object operate( Object value ) } @Override - public String toString() { - return "integerRangeAction(" + min + "," + max + ")" ; + public String toString() { + return "integerRangeAction(" + min + "," + max + ")"; } } - public static Operation integerRangeAction( int min, int max ) - { - return new IntegerRangeAction( min, max ) ; + public static Operation integerRangeAction(int min, int max) { + return new IntegerRangeAction(min, max); } private static class ListAction extends OperationBase { - private String sep ; - private Operation act ; + private String sep; + private Operation act; - ListAction( String sep, Operation act ) - { - this.sep = sep ; - this.act = act ; + ListAction(String sep, Operation act) { + this.sep = sep; + this.act = act; } // Note that this method carefully constructs an array of the type // of the first result, rather than just using Object[], which is - // not convertible into the correct type. Also note that no tokens + // not convertible into the correct type. Also note that no tokens // results in a null result. - public Object operate( Object value ) - { - StringTokenizer st = new StringTokenizer( getString( value ), - sep ) ; - int length = st.countTokens() ; - Object result = null ; - int ctr = 0 ; + public Object operate(Object value) { + StringTokenizer st = new StringTokenizer(getString(value), sep); + int length = st.countTokens(); + Object result = null; + int ctr = 0; while (st.hasMoreTokens()) { - String next = st.nextToken() ; - Object val = act.operate( next ) ; + String next = st.nextToken(); + Object val = act.operate(next); if (result == null) { - result = - Array.newInstance(val.getClass(), length); + result = Array.newInstance(val.getClass(), length); } - Array.set( result, ctr++, val ) ; + Array.set(result, ctr++, val); } - return result ; - } + return result; + } @Override - public String toString() { - return "listAction(separator=\"" + sep + - "\",action=" + act + ")" ; + public String toString() { + return "listAction(separator=\"" + sep + "\",action=" + act + ")"; } } - public static Operation listAction( String sep, Operation act ) - { - return new ListAction( sep, act ) ; + public static Operation listAction(String sep, Operation act) { + return new ListAction(sep, act); } - private static class SequenceAction extends OperationBase - { - private String sep ; - private Operation[] actions ; + private static class SequenceAction extends OperationBase { + private String sep; + private Operation[] actions; - SequenceAction( String sep, Operation[] actions ) - { - this.sep = sep ; - this.actions = actions ; + SequenceAction(String sep, Operation[] actions) { + this.sep = sep; + this.actions = actions; } - public Object operate( Object value ) - { - StringTokenizer st = new StringTokenizer( getString( value ), - sep ) ; + public Object operate(Object value) { + StringTokenizer st = new StringTokenizer(getString(value), sep); - int numTokens = st.countTokens() ; + int numTokens = st.countTokens(); if (numTokens != actions.length) { - throw wrapper.numTokensActionsDontMatch(numTokens, - actions.length); + throw wrapper.numTokensActionsDontMatch(numTokens, actions.length); } - int ctr = 0 ; - Object[] result = new Object[ numTokens ] ; + int ctr = 0; + Object[] result = new Object[numTokens]; while (st.hasMoreTokens()) { - Operation act = actions[ctr] ; - String next = st.nextToken() ; - result[ctr++] = act.operate( next ) ; + Operation act = actions[ctr]; + String next = st.nextToken(); + result[ctr++] = act.operate(next); } - return result ; - } + return result; + } @Override - public String toString() { - return "sequenceAction(separator=\"" + sep + - "\",actions=" + - ObjectUtility.compactObjectToString(actions) + ")" ; + public String toString() { + return "sequenceAction(separator=\"" + sep + "\",actions=" + ObjectUtility.compactObjectToString(actions) + ")"; } } - public static Operation sequenceAction( String sep, - Operation[] actions ) - { - return new SequenceAction( sep, actions ) ; + public static Operation sequenceAction(String sep, Operation[] actions) { + return new SequenceAction(sep, actions); } - private static class ComposeAction extends OperationBase - { - private Operation op1 ; - private Operation op2 ; + private static class ComposeAction extends OperationBase { + private Operation op1; + private Operation op2; - ComposeAction( Operation op1, Operation op2 ) - { - this.op1 = op1 ; - this.op2 = op2 ; + ComposeAction(Operation op1, Operation op2) { + this.op1 = op1; + this.op2 = op2; } - public Object operate( Object value ) - { - return op2.operate( op1.operate( value ) ) ; - } + public Object operate(Object value) { + return op2.operate(op1.operate(value)); + } @Override - public String toString() { - return "composition(" + op1 + "," + op2 + ")" ; + public String toString() { + return "composition(" + op1 + "," + op2 + ")"; } } - public static Operation compose( Operation op1, Operation op2 ) - { - return new ComposeAction( op1, op2 ) ; + public static Operation compose(Operation op1, Operation op2) { + return new ComposeAction(op1, op2); } - private static class MapAction extends OperationBase - { - private Operation op ; + private static class MapAction extends OperationBase { + private Operation op; - MapAction( Operation op ) - { - this.op = op ; + MapAction(Operation op) { + this.op = op; } - public Object operate( Object value ) - { - Object[] values = (Object[])value ; - Object[] result = new Object[ values.length ] ; - for (int ctr=0; ctr - * This is split off here to avoid problems with the build depending on the - * version of OperationFactory that is in Java SE 5.0. +/** + * Provides an extension to the OperationFactory for convertAction( Class ), which takes a Class with a constructor that + * takes a String as an argument. It uses the constructor to create an instance of the Class from its argument. + *

    + * This is split off here to avoid problems with the build depending on the version of OperationFactory that is in Java + * SE 5.0. */ public class OperationFactoryExt { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - private OperationFactoryExt() {} + private OperationFactoryExt() { + } private static class ConvertAction implements Operation { - private Class cls ; - private Constructor cons ; + private Class cls; + private Constructor cons; - public ConvertAction( Class cls ) { - this.cls = cls ; + public ConvertAction(Class cls) { + this.cls = cls; try { - cons = cls.getConstructor( String.class ) ; + cons = cls.getConstructor(String.class); } catch (Exception exc) { - throw wrapper.exceptionInConvertActionConstructor( exc, - cls.getName() ) ; + throw wrapper.exceptionInConvertActionConstructor(exc, cls.getName()); } } - public Object operate( Object value ) - { + public Object operate(Object value) { try { - return cons.newInstance( value ) ; + return cons.newInstance(value); } catch (Exception exc) { - throw wrapper.exceptionInConvertAction( exc ) ; + throw wrapper.exceptionInConvertAction(exc); } } @Override public String toString() { - return "ConvertAction[" + cls.getName() + "]" ; + return "ConvertAction[" + cls.getName() + "]"; } @Override - public boolean equals( Object obj ) - { - if (this==obj) { + public boolean equals(Object obj) { + if (this == obj) { return true; } @@ -75,19 +72,18 @@ public boolean equals( Object obj ) return false; } - ConvertAction other = (ConvertAction)obj ; + ConvertAction other = (ConvertAction) obj; - return toString().equals( other.toString() ) ; + return toString().equals(other.toString()); } @Override - public int hashCode() - { - return toString().hashCode() ; + public int hashCode() { + return toString().hashCode(); } } - public static Operation convertAction( Class cls ) { - return new ConvertAction( cls ) ; + public static Operation convertAction(Class cls) { + return new ConvertAction(cls); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserData.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserData.java index 819dc73c4..45fe0d8e0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserData.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserData.java @@ -17,23 +17,22 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import java.util.Properties ; +import java.util.Properties; public interface ParserData { - public String getPropertyName() ; + public String getPropertyName(); - public Operation getOperation() ; + public Operation getOperation(); - public String getFieldName() ; + public String getFieldName(); - public Object getDefaultValue() ; + public Object getDefaultValue(); - public Object getTestValue() ; + public Object getTestValue(); - public void addToParser( PropertyParser parser ) ; + public void addToParser(PropertyParser parser); - public void addToProperties( Properties props ) ; + public void addToProperties(Properties props); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserDataFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserDataFactory.java index 9373ba979..662e743c3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserDataFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserDataFactory.java @@ -17,26 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import com.sun.corba.ee.impl.orb.NormalParserData ; -import com.sun.corba.ee.impl.orb.PrefixParserData ; +import com.sun.corba.ee.impl.orb.NormalParserData; +import com.sun.corba.ee.impl.orb.PrefixParserData; import org.glassfish.pfl.basic.contain.Pair; public class ParserDataFactory { - public static ParserData make( String propertyName, - Operation operation, String fieldName, Object defaultValue, - Object testValue, String testData ) - { - return new NormalParserData( propertyName, operation, fieldName, - defaultValue, testValue, testData ) ; + public static ParserData make(String propertyName, Operation operation, String fieldName, Object defaultValue, Object testValue, + String testData) { + return new NormalParserData(propertyName, operation, fieldName, defaultValue, testValue, testData); } - public static ParserData make( String propertyName, - Operation operation, String fieldName, Object defaultValue, - Object testValue, Pair[] testData, Class componentType ) - { - return new PrefixParserData( propertyName, operation, fieldName, - defaultValue, testValue, testData, componentType ) ; + public static ParserData make(String propertyName, Operation operation, String fieldName, Object defaultValue, Object testValue, + Pair[] testData, Class componentType) { + return new PrefixParserData(propertyName, operation, fieldName, defaultValue, testValue, testData, componentType); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserImplBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserImplBase.java index 383d736bc..7cedb7755 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserImplBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserImplBase.java @@ -17,103 +17,93 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import java.util.Map ; -import java.util.Set ; -import java.util.Iterator ; -import java.util.Properties ; +import java.util.Map; +import java.util.Set; +import java.util.Iterator; +import java.util.Properties; -import java.security.PrivilegedExceptionAction ; -import java.security.PrivilegedActionException ; -import java.security.AccessController ; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; +import java.security.AccessController; -import java.lang.reflect.Field ; +import java.lang.reflect.Field; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; public abstract class ParserImplBase { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - protected abstract PropertyParser makeParser() ; + protected abstract PropertyParser makeParser(); - /** Override this method if there is some needed initialization - * that takes place after argument parsing. - */ - protected void complete() - { + /** + * Override this method if there is some needed initialization that takes place after argument parsing. + */ + protected void complete() { } - public ParserImplBase() - { + public ParserImplBase() { } - public void init( DataCollector coll ) - { - PropertyParser parser = makeParser() ; - coll.setParser( parser ) ; - Properties props = coll.getProperties() ; - Map map = parser.parse( props ) ; - setFields( map ) ; + public void init(DataCollector coll) { + PropertyParser parser = makeParser(); + coll.setParser(parser); + Properties props = coll.getProperties(); + Map map = parser.parse(props); + setFields(map); // Make sure that any extra initialization takes place after all the // fields are set from the map. - complete() ; + complete(); } - private Field getAnyField( String name ) - { - Field result = null ; + private Field getAnyField(String name) { + Field result = null; try { - Class cls = this.getClass() ; - result = cls.getDeclaredField( name ) ; + Class cls = this.getClass(); + result = cls.getDeclaredField(name); while (result == null) { - cls = cls.getSuperclass() ; + cls = cls.getSuperclass(); if (cls == null) { break; } - result = cls.getDeclaredField( name ) ; + result = cls.getDeclaredField(name); } } catch (Exception exc) { - throw wrapper.fieldNotFound( exc, name ) ; + throw wrapper.fieldNotFound(exc, name); } if (result == null) { throw wrapper.fieldNotFound(name); } - return result ; + return result; } - protected void setFields( Map map ) - { - Set entries = map.entrySet() ; - Iterator iter = entries.iterator() ; + protected void setFields(Map map) { + Set entries = map.entrySet(); + Iterator iter = entries.iterator(); while (iter.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)(iter.next()) ; - final String name = (String)(entry.getKey()) ; - final Object value = entry.getValue() ; + java.util.Map.Entry entry = (java.util.Map.Entry) (iter.next()); + final String name = (String) (entry.getKey()); + final Object value = entry.getValue(); try { - AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() throws IllegalAccessException, - IllegalArgumentException - { - Field field = getAnyField( name ) ; - field.setAccessible( true ) ; - field.set( ParserImplBase.this, value ) ; - return null ; - } - } - ) ; + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IllegalAccessException, IllegalArgumentException { + Field field = getAnyField(name); + field.setAccessible(true); + field.set(ParserImplBase.this, value); + return null; + } + }); } catch (PrivilegedActionException exc) { // Since exc wraps the actual exception, use exc.getCause() // instead of exc. - throw wrapper.errorSettingField( exc.getCause(), name, value ) ; + throw wrapper.errorSettingField(exc.getCause(), name, value); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserImplTableBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserImplTableBase.java index e3e77f25c..6b92bf1a5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserImplTableBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/orb/ParserImplTableBase.java @@ -17,149 +17,130 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.orb ; +package com.sun.corba.ee.spi.orb; -import java.util.Map ; -import java.util.AbstractMap ; -import java.util.Set ; -import java.util.AbstractSet ; -import java.util.Iterator ; -import java.util.Properties ; +import java.util.Map; +import java.util.AbstractMap; +import java.util.Set; +import java.util.AbstractSet; +import java.util.Iterator; +import java.util.Properties; -import java.lang.reflect.Field ; +import java.lang.reflect.Field; -import org.omg.CORBA.INTERNAL ; +import org.omg.CORBA.INTERNAL; public abstract class ParserImplTableBase extends ParserImplBase { - private final ParserData[] entries ; + private final ParserData[] entries; - public ParserImplTableBase( ParserData[] entries ) - { - this.entries = entries ; - setDefaultValues() ; + public ParserImplTableBase(ParserData[] entries) { + this.entries = entries; + setDefaultValues(); } - protected PropertyParser makeParser() - { - PropertyParser result = new PropertyParser() ; - for (int ctr=0; ctr actions ; + private List actions; - public PropertyParser( ) - { - actions = new LinkedList() ; + public PropertyParser() { + actions = new LinkedList(); } - public PropertyParser add( String propName, - Operation action, String fieldName ) - { - actions.add( ParserActionFactory.makeNormalAction( propName, - action, fieldName ) ) ; - return this ; + public PropertyParser add(String propName, Operation action, String fieldName) { + actions.add(ParserActionFactory.makeNormalAction(propName, action, fieldName)); + return this; } - public PropertyParser addPrefix( String propName, - Operation action, String fieldName, Class componentType ) - { - actions.add( ParserActionFactory.makePrefixAction( propName, - action, fieldName, componentType ) ) ; - return this ; + public PropertyParser addPrefix(String propName, Operation action, String fieldName, Class componentType) { + actions.add(ParserActionFactory.makePrefixAction(propName, action, fieldName, componentType)); + return this; } - /** Return a map from field name to value. + /** + * Return a map from field name to value. + * * @param props properties to convert * @return unsynchonized Map - */ - public Map parse( Properties props ) - { - Map map = new HashMap() ; - Iterator iter = actions.iterator() ; + */ + public Map parse(Properties props) { + Map map = new HashMap(); + Iterator iter = actions.iterator(); while (iter.hasNext()) { - ParserAction act = iter.next() ; - Object result = act.apply( props ) ; - + ParserAction act = iter.next(); + Object result = act.apply(props); + // A null result means that the property was not set for // this action, so do not override the default value in this case. if (result != null) { @@ -72,11 +66,10 @@ public Map parse( Properties props ) } } - return map ; + return map; } - public Iterator iterator() - { - return actions.iterator() ; + public Iterator iterator() { + return actions.iterator(); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/osgi/ORBFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/osgi/ORBFactory.java index ba0870c79..52487be4b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/osgi/ORBFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/osgi/ORBFactory.java @@ -19,71 +19,70 @@ package com.sun.corba.ee.spi.osgi; -import java.util.Properties ; +import java.util.Properties; -import org.glassfish.external.amx.AMXGlassfish ; +import org.glassfish.external.amx.AMXGlassfish; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ClassCodeBaseHandler ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ClassCodeBaseHandler; -import com.sun.corba.ee.impl.orb.ORBImpl ; +import com.sun.corba.ee.impl.orb.ORBImpl; import com.sun.corba.ee.impl.osgi.loader.OSGIListener; import com.sun.corba.ee.spi.misc.ORBConstants; -/** A simple factory for creating our ORB that avoids the ClassLoader - * problems with org.omg.CORBA.ORB.init, which must load the ORB impl class. - * The usual OSGi configuration prevents this, so we just directly use a - * static factory method here. Note that this also assumes that the created - * ORB should be suitable for running inside GlassFish v3. +/** + * A simple factory for creating our ORB that avoids the ClassLoader problems with org.omg.CORBA.ORB.init, which must + * load the ORB impl class. The usual OSGi configuration prevents this, so we just directly use a static factory method + * here. Note that this also assumes that the created ORB should be suitable for running inside GlassFish v3. */ -public class ORBFactory { - private ORBFactory() {} +public class ORBFactory { + private ORBFactory() { + } - public static ORB create( String[] args, Properties props, boolean useOSGi ) { - ORB result = create() ; - initialize( result, args, props, useOSGi ) ; - return result ; + public static ORB create(String[] args, Properties props, boolean useOSGi) { + ORB result = create(); + initialize(result, args, props, useOSGi); + return result; } - /** Create but do not initialize an ORB instance. + /** + * Create but do not initialize an ORB instance. + * * @return The newly created uninitialized ORB. */ public static ORB create() { - ORB result = new ORBImpl() ; - return result ; + ORB result = new ORBImpl(); + return result; } - /** Complete the initialization of the ORB. - * useOSGi if true will cause an ORB initialization - * suitable for use in GlassFish v3. + /** + * Complete the initialization of the ORB. useOSGi if true will cause an ORB initialization suitable for use in + * GlassFish v3. + * * @param orb The orb to initialize. * @param args Usual args passed to an ORB.init() call. * @param props Usual props passed to an ORB.init() call. * @param useOSGi true if the ORB is running in GFv3 or later (generally means an OSGI environment). */ @SuppressWarnings("static-access") - public static void initialize( ORB orb, String[] args, Properties props, boolean useOSGi ) { + public static void initialize(ORB orb, String[] args, Properties props, boolean useOSGi) { // Always disable ORBD if coming through the ORBFactory. // Anyone that wants ORBD must use ORB.init as usual. // Actually we assume that we are running in GFv3 if this method is called, // regardless of whether OSGi is used or not. - props.setProperty( ORBConstants.DISABLE_ORBD_INIT_PROPERTY, "true" ) ; + props.setProperty(ORBConstants.DISABLE_ORBD_INIT_PROPERTY, "true"); if (useOSGi) { - orb.classNameResolver( - orb.makeCompositeClassNameResolver( - OSGIListener.classNameResolver(), - orb.defaultClassNameResolver() - ) ); + orb.classNameResolver(orb.makeCompositeClassNameResolver(OSGIListener.classNameResolver(), orb.defaultClassNameResolver())); - ClassCodeBaseHandler ccbh = OSGIListener.classCodeBaseHandler() ; - orb.classCodeBaseHandler( ccbh ) ; + ClassCodeBaseHandler ccbh = OSGIListener.classCodeBaseHandler(); + orb.classCodeBaseHandler(ccbh); } - orb.setRootParentObjectName( AMXGlassfish.DEFAULT.serverMonForDAS() ) ; + orb.setRootParentObjectName(AMXGlassfish.DEFAULT.serverMonForDAS()); - orb.setParameters( args, props ) ; + orb.setParameters(args, props); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/DynamicMethodMarshaller.java b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/DynamicMethodMarshaller.java index b9adf5ccf..7e13ccb76 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/DynamicMethodMarshaller.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/DynamicMethodMarshaller.java @@ -17,30 +17,31 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.presentation.rmi ; +package com.sun.corba.ee.spi.presentation.rmi; -import org.omg.CORBA.ORB ; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA.portable.ApplicationException ; +import org.omg.CORBA.ORB; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; +import org.omg.CORBA.portable.ApplicationException; -import java.lang.reflect.Method ; +import java.lang.reflect.Method; -import java.rmi.RemoteException ; +import java.rmi.RemoteException; -/** Used to read and write arguments and results for a particular method. -* -*/ -public interface DynamicMethodMarshaller -{ - /** Returns the method used to create this DynamicMethodMarshaller. +/** + * Used to read and write arguments and results for a particular method. + * + */ +public interface DynamicMethodMarshaller { + /** + * Returns the method used to create this DynamicMethodMarshaller. * * @return the method used */ - Method getMethod() ; + Method getMethod(); - /** Copy the arguments as needed for this particular method. - * Can be optimized so that as little copying as possible is + /** + * Copy the arguments as needed for this particular method. Can be optimized so that as little copying as possible is * performed. * * @param args arguments to copy @@ -48,26 +49,26 @@ public interface DynamicMethodMarshaller * @throws RemoteException if there is a remote error * @return a copy of the arguments */ - Object[] copyArguments( Object[] args, ORB orb ) throws RemoteException ; + Object[] copyArguments(Object[] args, ORB orb) throws RemoteException; - /** Read the arguments for this method from the InputStream. - * Returns null if there are no arguments. + /** + * Read the arguments for this method from the InputStream. Returns null if there are no arguments. * * @param is stream to read arguments from * @return array of arguments */ - Object[] readArguments( InputStream is ) ; + Object[] readArguments(InputStream is); - /** Write arguments for this method to the OutputStream. - * Does nothing if there are no arguments. + /** + * Write arguments for this method to the OutputStream. Does nothing if there are no arguments. * * @param os stream to write to * @param args arguments to write */ - void writeArguments( OutputStream os, Object[] args ) ; + void writeArguments(OutputStream os, Object[] args); - /** Copy the result as needed for this particular method. - * Can be optimized so that as little copying as possible is + /** + * Copy the result as needed for this particular method. Can be optimized so that as little copying as possible is * performed. * * @param result Object to copy @@ -75,47 +76,48 @@ public interface DynamicMethodMarshaller * @throws RemoteException if there is an error with the ORB * @return copied object */ - Object copyResult( Object result, ORB orb ) throws RemoteException ; + Object copyResult(Object result, ORB orb) throws RemoteException; - /** Read the result from the InputStream. Returns null - * if the result type is null. + /** + * Read the result from the InputStream. Returns null if the result type is null. * * @param is stream to read from * @return result */ - Object readResult( InputStream is ) ; + Object readResult(InputStream is); - /** Write the result to the OutputStream. Does nothing if - * the result type is null. + /** + * Write the result to the OutputStream. Does nothing if the result type is null. * * @param os stream to write to * @param result result to write to stream */ - void writeResult( OutputStream os, Object result ) ; + void writeResult(OutputStream os, Object result); - /** Returns true iff thr's class is a declared exception (or a subclass of - * a declared exception) for this DynamicMethodMarshaller's method. + /** + * Returns true iff thr's class is a declared exception (or a subclass of a declared exception) for this + * DynamicMethodMarshaller's method. * * @param thr throwable to checl * @return if it is a declared (non-runtime) exception */ - boolean isDeclaredException( Throwable thr ) ; + boolean isDeclaredException(Throwable thr); - /** Write the repository ID of the exception and the value of the - * exception to the OutputStream. ex should be a declared exception - * for this DynamicMethodMarshaller's method. + /** + * Write the repository ID of the exception and the value of the exception to the OutputStream. ex should be a declared + * exception for this DynamicMethodMarshaller's method. * * @param os stream to write to * @param ex exception to write */ - void writeException( OutputStream os, Exception ex ) ; + void writeException(OutputStream os, Exception ex); - /** Reads an exception ID and the corresponding exception from - * the input stream. This should be an exception declared in + /** + * Reads an exception ID and the corresponding exception from the input stream. This should be an exception declared in * this method. * * @param ae id of exception to read * @return read exception */ - Exception readException( ApplicationException ae ) ; + Exception readException(ApplicationException ae); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/DynamicStub.java b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/DynamicStub.java index 234274d0c..b1dcddbf0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/DynamicStub.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/DynamicStub.java @@ -17,63 +17,63 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.presentation.rmi ; +package com.sun.corba.ee.spi.presentation.rmi; -import java.rmi.RemoteException ; +import java.rmi.RemoteException; -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.portable.OutputStream ; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.ORB ; +import org.omg.CORBA.ORB; -/** Interface used to support dynamically generated stubs. - * This supplies some methods that are found in - * org.omg.CORBA.portable.ObjectImpl that are not available - * in org.omg.CORBA.Object. +/** + * Interface used to support dynamically generated stubs. This supplies some methods that are found in + * org.omg.CORBA.portable.ObjectImpl that are not available in org.omg.CORBA.Object. */ -public interface DynamicStub extends org.omg.CORBA.Object -{ - /** Similar to ObjectImpl._set_delegate +public interface DynamicStub extends org.omg.CORBA.Object { + /** + * Similar to ObjectImpl._set_delegate * * @param delegate delegate to set * @see org.omg.CORBA.portable.ObjectImpl#_set_delegate(org.omg.CORBA.portable.Delegate) */ - void setDelegate( Delegate delegate ) ; + void setDelegate(Delegate delegate); - /** Similar to ObjectImpl._get_delegate + /** + * Similar to ObjectImpl._get_delegate * * @return Delegate contained - * @see org.omg.CORBA.portable.ObjectImpl#_get_delegate() + * @see org.omg.CORBA.portable.ObjectImpl#_get_delegate() */ - Delegate getDelegate() ; + Delegate getDelegate(); - /** Similar to ObjectImpl._orb() + /** + * Similar to ObjectImpl._orb() * * @return the ORB instance that created the Delegat * @see org.omg.CORBA.portable.ObjectImpl#_orb() */ - ORB getORB() ; + ORB getORB(); - /** Similar to ObjectImpl._ids + /** + * Similar to ObjectImpl._ids * * @return the array of all repository identifiers * @see org.omg.CORBA.portable.ObjectImpl#_ids() */ - String[] getTypeIds() ; + String[] getTypeIds(); - /** Connect this dynamic stub to an ORB. - * Just as in standard RMI-IIOP, this is required after - * a dynamic stub is deserialized from an ObjectInputStream. - * It is not needed when unmarshalling from a + /** + * Connect this dynamic stub to an ORB. Just as in standard RMI-IIOP, this is required after a dynamic stub is + * deserialized from an ObjectInputStream. It is not needed when unmarshalling from a * org.omg.CORBA.portable.InputStream. * * @param orb ORB to connect to * @throws RemoteException if unable to connect */ - void connect( ORB orb ) throws RemoteException ; + void connect(ORB orb) throws RemoteException; - boolean isLocal() ; + boolean isLocal(); - OutputStream request( String operation, boolean responseExpected ) ; + OutputStream request(String operation, boolean responseExpected); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/IDLNameTranslator.java b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/IDLNameTranslator.java index e8e594bf7..859ce31ae 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/IDLNameTranslator.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/IDLNameTranslator.java @@ -17,45 +17,44 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.presentation.rmi ; +package com.sun.corba.ee.spi.presentation.rmi; -import java.lang.reflect.Method ; +import java.lang.reflect.Method; -/** Translates between methods on an interface and RMI-IIOP encodings - * of those methods as names. +/** + * Translates between methods on an interface and RMI-IIOP encodings of those methods as names. */ -public interface IDLNameTranslator -{ - /** Get the interfaces that this IDLNameTranslator describes. +public interface IDLNameTranslator { + /** + * Get the interfaces that this IDLNameTranslator describes. * * @return interfaces described */ - Class[] getInterfaces() ; + Class[] getInterfaces(); - /** Get all methods for this remote interface. - * The methods are returned in a canonical order, that is, - * they are always in the same order for a particular interface. + /** + * Get all methods for this remote interface. The methods are returned in a canonical order, that is, they are always in + * the same order for a particular interface. * * @return methods for interface */ - Method[] getMethods() ; + Method[] getMethods(); - /** Get the method from this IDLNameTranslator's interfaces that - * corresponds to the mangled name idlName. Returns null - * if there is no matching method. + /** + * Get the method from this IDLNameTranslator's interfaces that corresponds to the mangled name idlName. Returns null if + * there is no matching method. * * @param idlName name of method * @return method with the specified name */ - Method getMethod( String idlName ) ; + Method getMethod(String idlName); - /** Get the mangled name that corresponds to the given method - * on this IDLNameTranslator's interface. Returns null - * if there is no matching name. + /** + * Get the mangled name that corresponds to the given method on this IDLNameTranslator's interface. Returns null if + * there is no matching name. * * @param method method to get name of * @return the corresponding name */ - String getIDLName( Method method ) ; + String getIDLName(Method method); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/InvocationInterceptor.java b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/InvocationInterceptor.java index 93019ef82..77bd1232f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/InvocationInterceptor.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/InvocationInterceptor.java @@ -17,22 +17,21 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.presentation.rmi ; +package com.sun.corba.ee.spi.presentation.rmi; -/** Represents an interceptor that is invoked around a - * RMI-IIOP method invocation when dynamic RMI-IIOP is used. - * This facility is not available either in IDL-based - * calls, or in static RMI-IIOP. +/** + * Represents an interceptor that is invoked around a RMI-IIOP method invocation when dynamic RMI-IIOP is used. This + * facility is not available either in IDL-based calls, or in static RMI-IIOP. */ public interface InvocationInterceptor { - /** Called just before a dynamic RMI-IIOP stub is called. - * Any exceptions thrown by this method are ignored. + /** + * Called just before a dynamic RMI-IIOP stub is called. Any exceptions thrown by this method are ignored. */ - void preInvoke() ; + void preInvoke(); - /** Called just before a dynamic RMI-IIOP stub returns control - * to the caller. Any exceptions thrown by this method are + /** + * Called just before a dynamic RMI-IIOP stub returns control to the caller. Any exceptions thrown by this method are * ignored. */ - void postInvoke() ; + void postInvoke(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/PresentationDefaults.java b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/PresentationDefaults.java index 5c5de26f2..125bc8676 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/PresentationDefaults.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/PresentationDefaults.java @@ -28,79 +28,73 @@ import java.security.AccessController; import java.security.PrivilegedAction; -public abstract class PresentationDefaults -{ +public abstract class PresentationDefaults { private static PresentationManager.StubFactoryFactory staticImpl = null; private static PresentationManager.StubFactoryFactory dynamicImpl = null; - private PresentationDefaults() {} + private PresentationDefaults() { + } synchronized static PresentationManager.StubFactoryFactory getDynamicStubFactoryFactory() { - if (dynamicImpl == null) dynamicImpl = new StubFactoryFactoryCodegenImpl(); + if (dynamicImpl == null) + dynamicImpl = new StubFactoryFactoryCodegenImpl(); - return dynamicImpl ; + return dynamicImpl; } public synchronized static PresentationManager.StubFactoryFactory getStaticStubFactoryFactory() { - if (staticImpl == null) staticImpl = new StubFactoryFactoryStaticImpl(); + if (staticImpl == null) + staticImpl = new StubFactoryFactoryStaticImpl(); return staticImpl; } - public static PresentationManager.StubFactory makeStaticStubFactory( - final Class stubClass ) - { - return new StubFactoryStaticImpl( stubClass ) ; + public static PresentationManager.StubFactory makeStaticStubFactory(final Class stubClass) { + return new StubFactoryStaticImpl(stubClass); } - private static InvocationInterceptor nullInvocationInterceptor = - new InvocationInterceptor() { - public void preInvoke() {} - public void postInvoke() {} - } ; + private static InvocationInterceptor nullInvocationInterceptor = new InvocationInterceptor() { + public void preInvoke() { + } - public static InvocationInterceptor getNullInvocationInterceptor() - { - return nullInvocationInterceptor ; + public void postInvoke() { + } + }; + + public static InvocationInterceptor getNullInvocationInterceptor() { + return nullInvocationInterceptor; } - + public static boolean inAppServer() { - final String thisClassRenamed = - "com.sun.corba.ee.spi.presentation.rmi.PresentationDefaults" ; - final boolean inAppServer = - PresentationDefaults.class.getName().equals( thisClassRenamed ) ; - return inAppServer ; + final String thisClassRenamed = "com.sun.corba.ee.spi.presentation.rmi.PresentationDefaults"; + final boolean inAppServer = PresentationDefaults.class.getName().equals(thisClassRenamed); + return inAppServer; } - private static boolean getBooleanPropertyValue( final String propName, - final boolean def ) { + private static boolean getBooleanPropertyValue(final String propName, final boolean def) { - final String defs = Boolean.toString( def ) ; - final String value = AccessController.doPrivileged( - new PrivilegedAction() { - public String run() { - return System.getProperty( propName, defs ) ; - } + final String defs = Boolean.toString(def); + final String value = AccessController.doPrivileged(new PrivilegedAction() { + public String run() { + return System.getProperty(propName, defs); } - ) ; + }); - return Boolean.valueOf( value ) ; + return Boolean.valueOf(value); } public static PresentationManagerImpl makeOrbPresentationManager() { - final boolean useDynamicStub = getBooleanPropertyValue( - ORBConstants.USE_DYNAMIC_STUB_PROPERTY, inAppServer() ) ; + final boolean useDynamicStub = getBooleanPropertyValue(ORBConstants.USE_DYNAMIC_STUB_PROPERTY, inAppServer()); - final boolean debug = getBooleanPropertyValue( - ORBConstants.DEBUG_DYNAMIC_STUB, false ) ; + final boolean debug = getBooleanPropertyValue(ORBConstants.DEBUG_DYNAMIC_STUB, false); - final PresentationManagerImpl result = new PresentationManagerImpl( useDynamicStub ) ; + final PresentationManagerImpl result = new PresentationManagerImpl(useDynamicStub); result.setStaticStubFactoryFactory(PresentationDefaults.getStaticStubFactoryFactory()); result.setDynamicStubFactoryFactory(PresentationDefaults.getDynamicStubFactoryFactory()); if (debug) { - result.enableDebug( System.out ) ; + result.enableDebug(System.out); } - return result ; + return result; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/PresentationManager.java b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/PresentationManager.java index dd14722af..80dea8957 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/PresentationManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/PresentationManager.java @@ -17,200 +17,203 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.presentation.rmi ; +package com.sun.corba.ee.spi.presentation.rmi; -import java.io.PrintStream ; +import java.io.PrintStream; -import java.util.Map ; +import java.util.Map; -import java.lang.reflect.Method ; +import java.lang.reflect.Method; -import javax.rmi.CORBA.Tie ; +import javax.rmi.CORBA.Tie; import org.glassfish.pfl.basic.proxy.InvocationHandlerFactory; -/** Provides access to RMI-IIOP stubs and ties. - * Any style of stub and tie generation may be used. - * This includes compiler generated stubs and runtime generated stubs - * as well as compiled and reflective ties. There is normally - * only one instance of this interface per VM. The instance - * is obtained from the static method +/** + * Provides access to RMI-IIOP stubs and ties. Any style of stub and tie generation may be used. This includes compiler + * generated stubs and runtime generated stubs as well as compiled and reflective ties. There is normally only one + * instance of this interface per VM. The instance is obtained from the static method * com.sun.corba.ee.spi.orb.ORB.getPresentationManager. *

    - * Note that - * the getClassData and getDynamicMethodMarshaller methods - * maintain caches to avoid redundant computation. + * Note that the getClassData and getDynamicMethodMarshaller methods maintain caches to avoid redundant computation. */ -public interface PresentationManager -{ - /** Creates StubFactory and Tie instances. +public interface PresentationManager { + /** + * Creates StubFactory and Tie instances. */ - public interface StubFactoryFactory - { - /** Return the standard name of a stub (according to the RMI-IIOP specification - * and rmic). This is needed so that the name of a stub is known for - * standalone clients of the app server. + public interface StubFactoryFactory { + /** + * Return the standard name of a stub (according to the RMI-IIOP specification and rmic). This is needed so that the + * name of a stub is known for standalone clients of the app server. * * @param className name of the class * @return the stub name */ - String getStubName( String className ) ; + String getStubName(String className); - /** Create a stub factory for stubs for the interface whose type is given by - * className. className may identify either an IDL interface or an RMI-IIOP - * interface. + /** + * Create a stub factory for stubs for the interface whose type is given by className. className may identify either an + * IDL interface or an RMI-IIOP interface. + * * @param className The name of the remote interface as a Java class name. * @param isIDLStub True if className identifies an IDL stub, else false. - * @param remoteCodeBase The CodeBase to use for loading Stub classes, if - * necessary (may be null or unused). + * @param remoteCodeBase The CodeBase to use for loading Stub classes, if necessary (may be null or unused). * @param expectedClass The expected stub type (may be null or unused). * @param classLoader The classLoader to use (may be null). * @return The stub factory */ - PresentationManager.StubFactory createStubFactory( String className, - boolean isIDLStub, String remoteCodeBase, Class expectedClass, - ClassLoader classLoader); + PresentationManager.StubFactory createStubFactory(String className, boolean isIDLStub, String remoteCodeBase, + Class expectedClass, ClassLoader classLoader); - /** Return a Tie for the given class. + /** + * Return a Tie for the given class. * * @param cls class * @return The tie corresponding to cls */ - Tie getTie( Class cls ) ; + Tie getTie(Class cls); - /** Return whether or not this StubFactoryFactory creates StubFactory - * instances that create dynamic stubs and ties. At the top level, - * true indicates that rmic -iiop is not needed for generating stubs - * or ties. + /** + * Return whether or not this StubFactoryFactory creates StubFactory instances that create dynamic stubs and ties. At + * the top level, true indicates that rmic -iiop is not needed for generating stubs or ties. * * @return true iff we are using dynamic stubs */ - boolean createsDynamicStubs() ; + boolean createsDynamicStubs(); } - /** Creates the actual stub needed for RMI-IIOP remote - * references. + /** + * Creates the actual stub needed for RMI-IIOP remote references. */ - public interface StubFactory - { - /** Create a new dynamic stub. It has the type that was - * used to create this factory. + public interface StubFactory { + /** + * Create a new dynamic stub. It has the type that was used to create this factory. * * @return The dynamic stub */ - org.omg.CORBA.Object makeStub() ; + org.omg.CORBA.Object makeStub(); - /** Return the repository ID information for all Stubs - * created by this stub factory. + /** + * Return the repository ID information for all Stubs created by this stub factory. * * @return Array of type ids, most derived type first. */ - String[] getTypeIds() ; + String[] getTypeIds(); } - public interface ClassData - { - /** Get the class used to create this ClassData instance + public interface ClassData { + /** + * Get the class used to create this ClassData instance * * @return Class of this ClassData. */ - Class getMyClass() ; + Class getMyClass(); - /** Get the IDLNameTranslator for the class used to create - * this ClassData instance. + /** + * Get the IDLNameTranslator for the class used to create this ClassData instance. * * @return IDLNameTranslator for the class of this ClassData */ - IDLNameTranslator getIDLNameTranslator() ; + IDLNameTranslator getIDLNameTranslator(); - /** Return the array of repository IDs for all of the remote - * interfaces implemented by this class. + /** + * Return the array of repository IDs for all of the remote interfaces implemented by this class. * * @return The typeids, most derived first. */ - String[] getTypeIds() ; + String[] getTypeIds(); - /** Get the InvocationHandlerFactory that is used to create - * an InvocationHandler for dynamic stubs of the type of the - * ClassData. + /** + * Get the InvocationHandlerFactory that is used to create an InvocationHandler for dynamic stubs of the type of the + * ClassData. * * @return InvocationHandlerFactory. */ - InvocationHandlerFactory getInvocationHandlerFactory() ; + InvocationHandlerFactory getInvocationHandlerFactory(); - /** Get the dictionary for this ClassData instance. - * This is used to hold class-specific information for a Class - * in the class data. This avoids the need to create other - * caches for accessing the information. + /** + * Get the dictionary for this ClassData instance. This is used to hold class-specific information for a Class in the + * class data. This avoids the need to create other caches for accessing the information. * * @return the dictionary. */ - Map getDictionary() ; + Map getDictionary(); } - /** Get the ClassData for a particular class. - * This class may be an implementation class, in which - * case the IDLNameTranslator handles all Remote interfaces implemented by - * the class. If the class implements more than one remote interface, and not - * all of the remote interfaces are related by inheritance, then the type - * IDs have the implementation class as element 0. + /** + * Get the ClassData for a particular class. This class may be an implementation class, in which case the + * IDLNameTranslator handles all Remote interfaces implemented by the class. If the class implements more than one + * remote interface, and not all of the remote interfaces are related by inheritance, then the type IDs have the + * implementation class as element 0. + * * @param cls iClass fro which we need ClassData. * @return The ClassData. */ - ClassData getClassData( Class cls ) ; + ClassData getClassData(Class cls); - /** Given a particular method, return a DynamicMethodMarshaller - * for that method. This is used for dynamic stubs and ties. + /** + * Given a particular method, return a DynamicMethodMarshaller for that method. This is used for dynamic stubs and ties. + * * @param method Method for which we need a DynamicMethodMarshaller. * @return The DynamicMethodMarshaller. */ - DynamicMethodMarshaller getDynamicMethodMarshaller( Method method ) ; + DynamicMethodMarshaller getDynamicMethodMarshaller(Method method); - /** Return the registered StubFactoryFactory. + /** + * Return the registered StubFactoryFactory. + * * @param isDynamic true iff we want the dynamic stub factory * @return static or dynamic stub factory. * @deprecated use {@link #getDynamicStubFactoryFactory()} or {@link #getStaticStubFactoryFactory()} */ - StubFactoryFactory getStubFactoryFactory( boolean isDynamic ) ; + StubFactoryFactory getStubFactoryFactory(boolean isDynamic); - /** Return the registered static StubFactoryFactory. + /** + * Return the registered static StubFactoryFactory. + * * @return static stub factory. */ StubFactoryFactory getStaticStubFactoryFactory(); - /** Return the registered dynamic StubFactoryFactory. + /** + * Return the registered dynamic StubFactoryFactory. + * * @return dynamic stub factory. */ StubFactoryFactory getDynamicStubFactoryFactory(); - /** Equivalent to getStubFactoryFactory( true ).getTie( null ). - * Provided for compatibility with earlier versions of PresentationManager - * as used in the app server. The class argument is ignored in - * the dynamic case, so this is safe. + /** + * Equivalent to getStubFactoryFactory( true ).getTie( null ). Provided for compatibility with earlier versions of + * PresentationManager as used in the app server. The class argument is ignored in the dynamic case, so this is safe. + * * @return The static tie. */ - Tie getTie() ; + Tie getTie(); - /** Get the correct repository ID for the given implementation - * instance. This is useful when using dynamic RMI with the POA. + /** + * Get the correct repository ID for the given implementation instance. This is useful when using dynamic RMI with the + * POA. + * * @param impl implementation * @return repository ID string */ - String getRepositoryId( java.rmi.Remote impl ) ; + String getRepositoryId(java.rmi.Remote impl); - /** Returns the value of the com.sun.corba.ee.ORBUseDynamicStub - * property. + /** + * Returns the value of the com.sun.corba.ee.ORBUseDynamicStub property. + * * @return whether to use dynamic stubs. */ - boolean useDynamicStubs() ; + boolean useDynamicStubs(); - /** Remove all internal references to Class cls from the - * PresentationManager. This allows ClassLoaders to - * be garbage collected when they are no longer needed. + /** + * Remove all internal references to Class cls from the PresentationManager. This allows ClassLoaders to be garbage + * collected when they are no longer needed. + * * @param cls Class to flush */ - void flushClass( Class cls ) ; + void flushClass(Class cls); - boolean getDebug() ; + boolean getDebug(); - PrintStream getPrintStream() ; + PrintStream getPrintStream(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/StubAdapter.java b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/StubAdapter.java index 823675c73..4801693a6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/StubAdapter.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/StubAdapter.java @@ -17,58 +17,50 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.presentation.rmi ; +package com.sun.corba.ee.spi.presentation.rmi; -import javax.rmi.CORBA.Tie ; +import javax.rmi.CORBA.Tie; -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.portable.ObjectImpl ; -import org.omg.CORBA.portable.OutputStream ; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; -import org.omg.PortableServer.POA ; -import org.omg.PortableServer.POAManager ; -import org.omg.PortableServer.POAManagerPackage.State ; -import org.omg.PortableServer.Servant ; +import org.omg.PortableServer.POA; +import org.omg.PortableServer.POAManager; +import org.omg.PortableServer.POAManagerPackage.State; +import org.omg.PortableServer.Servant; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAManagerPackage.AdapterInactive ; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAManagerPackage.AdapterInactive; -import org.omg.CORBA.ORB ; +import org.omg.CORBA.ORB; -import com.sun.corba.ee.spi.logging.ORBUtilSystemException ; +import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -import com.sun.corba.ee.impl.oa.poa.POAManagerImpl ; +import com.sun.corba.ee.impl.oa.poa.POAManagerImpl; -/** Provide access to stub delegate and type id information - * independent of the stub type. This class exists because - * ObjectImpl does not have an interface for the 3 delegate and - * type id methods, so a DynamicStub has a different type. - * We cannot simply change ObjectImpl as it is a standard API. - * We also cannot change the code generation of Stubs, as that - * is also standard. Hence I am left with this ugly class. - */ -public abstract class StubAdapter -{ - private StubAdapter() {} +/** + * Provide access to stub delegate and type id information independent of the stub type. This class exists because + * ObjectImpl does not have an interface for the 3 delegate and type id methods, so a DynamicStub has a different type. + * We cannot simply change ObjectImpl as it is a standard API. We also cannot change the code generation of Stubs, as + * that is also standard. Hence I am left with this ugly class. + */ +public abstract class StubAdapter { + private StubAdapter() { + } - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - public static boolean isStubClass( Class cls ) - { - return (ObjectImpl.class.isAssignableFrom( cls )) || - (DynamicStub.class.isAssignableFrom( cls )) ; + public static boolean isStubClass(Class cls) { + return (ObjectImpl.class.isAssignableFrom(cls)) || (DynamicStub.class.isAssignableFrom(cls)); } - public static boolean isStub( Object stub ) - { - return (stub instanceof DynamicStub) || - (stub instanceof ObjectImpl) ; + public static boolean isStub(Object stub) { + return (stub instanceof DynamicStub) || (stub instanceof ObjectImpl); } - public static void setDelegate( Object stub, Delegate delegate ) - { + public static void setDelegate(Object stub, Delegate delegate) { if (stub instanceof DynamicStub) { ((DynamicStub) stub).setDelegate(delegate); } else if (stub instanceof ObjectImpl) { @@ -78,157 +70,143 @@ public static void setDelegate( Object stub, Delegate delegate ) } } - /** Use implicit activation to get an object reference for the servant. + /** + * Use implicit activation to get an object reference for the servant. * * @param servant servant to activate * @return reference to servant */ - public static org.omg.CORBA.Object activateServant( Servant servant ) - { - POA poa = servant._default_POA() ; - org.omg.CORBA.Object ref = null ; + public static org.omg.CORBA.Object activateServant(Servant servant) { + POA poa = servant._default_POA(); + org.omg.CORBA.Object ref = null; try { - ref = poa.servant_to_reference( servant ) ; + ref = poa.servant_to_reference(servant); } catch (ServantNotActive sna) { - throw wrapper.getDelegateServantNotActive( sna ) ; + throw wrapper.getDelegateServantNotActive(sna); } catch (WrongPolicy wp) { - throw wrapper.getDelegateWrongPolicy( wp ) ; + throw wrapper.getDelegateWrongPolicy(wp); } // Make sure that the POAManager is activated if no other // POAManager state management has taken place. - POAManager mgr = poa.the_POAManager() ; + POAManager mgr = poa.the_POAManager(); if (mgr instanceof POAManagerImpl) { // This servant is managed by one of our POAs, // so only activate it if there has not been // an explicit state change, that is, if the POA - // has never changed state from the initial + // has never changed state from the initial // HOLDING state. - POAManagerImpl mgrImpl = (POAManagerImpl)mgr ; - mgrImpl.implicitActivation() ; + POAManagerImpl mgrImpl = (POAManagerImpl) mgr; + mgrImpl.implicitActivation(); } else { // This servant is not managed by one of our POAs, // so activate it if the state is HOLDING, which is the - // initial state. Note that this may NOT be exactly + // initial state. Note that this may NOT be exactly // what the user intended! if (mgr.get_state().value() == State._HOLDING) { try { - mgr.activate() ; + mgr.activate(); } catch (AdapterInactive ai) { - throw wrapper.adapterInactiveInActivateServant( ai ) ; + throw wrapper.adapterInactiveInActivateServant(ai); } } } - return ref ; + return ref; } - /** Given any Tie, return the corresponding object refernce, activating - * the Servant if necessary. + /** + * Given any Tie, return the corresponding object refernce, activating the Servant if necessary. * * @param tie tie to activate * @return reference to Tie */ - public static org.omg.CORBA.Object activateTie( Tie tie ) - { - /** Any implementation of Tie should be either a Servant or an ObjectImpl, - * depending on which style of code generation is used. rmic -iiop by - * default results in an ObjectImpl-based Tie, while rmic -iiop -poa - * results in a Servant-based Tie. Dynamic RMI-IIOP also uses Servant-based - * Ties (see impl.presentation.rmi.ReflectiveTie). + public static org.omg.CORBA.Object activateTie(Tie tie) { + /** + * Any implementation of Tie should be either a Servant or an ObjectImpl, depending on which style of code generation is + * used. rmic -iiop by default results in an ObjectImpl-based Tie, while rmic -iiop -poa results in a Servant-based Tie. + * Dynamic RMI-IIOP also uses Servant-based Ties (see impl.presentation.rmi.ReflectiveTie). */ if (tie instanceof ObjectImpl) { - return tie.thisObject() ; + return tie.thisObject(); } else if (tie instanceof Servant) { - Servant servant = (Servant)tie ; - return activateServant( servant ) ; + Servant servant = (Servant) tie; + return activateServant(servant); } else { - throw wrapper.badActivateTieCall() ; + throw wrapper.badActivateTieCall(); } } - - /** This also gets the delegate from a Servant by - * using Servant._this_object() + /** + * This also gets the delegate from a Servant by using Servant._this_object() * * @param stub stub to get delegate of * @return the stub's Delegate */ - public static Delegate getDelegate( Object stub ) - { + public static Delegate getDelegate(Object stub) { if (stub instanceof DynamicStub) { return ((DynamicStub) stub).getDelegate(); } else if (stub instanceof ObjectImpl) { return ((ObjectImpl) stub)._get_delegate(); } else if (stub instanceof Tie) { - Tie tie = (Tie)stub ; - org.omg.CORBA.Object ref = activateTie( tie ) ; - return getDelegate( ref ) ; + Tie tie = (Tie) stub; + org.omg.CORBA.Object ref = activateTie(tie); + return getDelegate(ref); } else { throw wrapper.getDelegateRequiresStub(); } } - - public static ORB getORB( Object stub ) - { + + public static ORB getORB(Object stub) { if (stub instanceof DynamicStub) { - return ((DynamicStub)stub).getORB() ; + return ((DynamicStub) stub).getORB(); } else if (stub instanceof ObjectImpl) { - return ((ObjectImpl) stub)._orb() ; + return ((ObjectImpl) stub)._orb(); } else { - throw wrapper.getOrbRequiresStub() ; + throw wrapper.getOrbRequiresStub(); } } - public static String[] getTypeIds( Object stub ) - { + public static String[] getTypeIds(Object stub) { if (stub instanceof DynamicStub) { - return ((DynamicStub)stub).getTypeIds() ; + return ((DynamicStub) stub).getTypeIds(); } else if (stub instanceof ObjectImpl) { - return ((ObjectImpl)stub)._ids() ; + return ((ObjectImpl) stub)._ids(); } else { - throw wrapper.getTypeIdsRequiresStub() ; + throw wrapper.getTypeIdsRequiresStub(); } } - public static void connect( Object stub, - ORB orb ) throws java.rmi.RemoteException - { + public static void connect(Object stub, ORB orb) throws java.rmi.RemoteException { if (stub instanceof DynamicStub) { - ((DynamicStub)stub).connect( - (com.sun.corba.ee.spi.orb.ORB)orb ) ; + ((DynamicStub) stub).connect((com.sun.corba.ee.spi.orb.ORB) orb); } else if (stub instanceof javax.rmi.CORBA.Stub) { - ((javax.rmi.CORBA.Stub)stub).connect( orb ) ; + ((javax.rmi.CORBA.Stub) stub).connect(orb); } else if (stub instanceof ObjectImpl) { - orb.connect( (org.omg.CORBA.Object)stub ) ; + orb.connect((org.omg.CORBA.Object) stub); } else { - throw wrapper.connectRequiresStub() ; + throw wrapper.connectRequiresStub(); } } - public static boolean isLocal( Object stub ) - { + public static boolean isLocal(Object stub) { if (stub instanceof DynamicStub) { - return ((DynamicStub)stub).isLocal() ; + return ((DynamicStub) stub).isLocal(); } else if (stub instanceof ObjectImpl) { - return ((ObjectImpl)stub)._is_local() ; + return ((ObjectImpl) stub)._is_local(); } else { - throw wrapper.isLocalRequiresStub() ; + throw wrapper.isLocalRequiresStub(); } } - public static OutputStream request( Object stub, - String operation, boolean responseExpected ) - { + public static OutputStream request(Object stub, String operation, boolean responseExpected) { if (stub instanceof DynamicStub) { - return ((DynamicStub)stub).request( operation, - responseExpected ) ; + return ((DynamicStub) stub).request(operation, responseExpected); } else if (stub instanceof ObjectImpl) { - return ((ObjectImpl)stub)._request( operation, - responseExpected ) ; + return ((ObjectImpl) stub)._request(operation, responseExpected); } else { - throw wrapper.requestRequiresStub() ; + throw wrapper.requestRequiresStub(); } } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/StubWrapper.java b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/StubWrapper.java index 1f2dc7696..5df967b6a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/StubWrapper.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/presentation/rmi/StubWrapper.java @@ -17,140 +17,115 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.presentation.rmi ; - -import java.rmi.RemoteException ; - -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.ORB ; -import org.omg.CORBA.Request ; -import org.omg.CORBA.Context ; -import org.omg.CORBA.NamedValue ; -import org.omg.CORBA.NVList ; -import org.omg.CORBA.ContextList ; -import org.omg.CORBA.ExceptionList ; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.DomainManager ; -import org.omg.CORBA.SetOverrideType ; - -import org.omg.CORBA.portable.OutputStream ; - -/** Wrapper that can take any stub (object x such that StubAdapter.isStub(x)) - * and treat it as a DynamicStub. +package com.sun.corba.ee.spi.presentation.rmi; + +import java.rmi.RemoteException; + +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Request; +import org.omg.CORBA.Context; +import org.omg.CORBA.NamedValue; +import org.omg.CORBA.NVList; +import org.omg.CORBA.ContextList; +import org.omg.CORBA.ExceptionList; +import org.omg.CORBA.Policy; +import org.omg.CORBA.DomainManager; +import org.omg.CORBA.SetOverrideType; + +import org.omg.CORBA.portable.OutputStream; + +/** + * Wrapper that can take any stub (object x such that StubAdapter.isStub(x)) and treat it as a DynamicStub. */ -public class StubWrapper implements DynamicStub -{ - private org.omg.CORBA.Object object ; +public class StubWrapper implements DynamicStub { + private org.omg.CORBA.Object object; - public StubWrapper( org.omg.CORBA.Object object ) - { + public StubWrapper(org.omg.CORBA.Object object) { if (!(StubAdapter.isStub(object))) - throw new IllegalStateException() ; + throw new IllegalStateException(); - this.object = object ; + this.object = object; } - public void setDelegate( Delegate delegate ) - { - StubAdapter.setDelegate( object, delegate ) ; + public void setDelegate(Delegate delegate) { + StubAdapter.setDelegate(object, delegate); } - public Delegate getDelegate() - { - return StubAdapter.getDelegate( object ) ; + public Delegate getDelegate() { + return StubAdapter.getDelegate(object); } - public ORB getORB() - { - return StubAdapter.getORB( object ) ; + public ORB getORB() { + return StubAdapter.getORB(object); } - public String[] getTypeIds() - { - return StubAdapter.getTypeIds( object ) ; + public String[] getTypeIds() { + return StubAdapter.getTypeIds(object); } - public void connect( ORB orb ) throws RemoteException - { - StubAdapter.connect( object, (com.sun.corba.ee.spi.orb.ORB)orb ) ; + public void connect(ORB orb) throws RemoteException { + StubAdapter.connect(object, (com.sun.corba.ee.spi.orb.ORB) orb); } - public boolean isLocal() - { - return StubAdapter.isLocal( object ) ; + public boolean isLocal() { + return StubAdapter.isLocal(object); } - public OutputStream request( String operation, boolean responseExpected ) - { - return StubAdapter.request( object, operation, responseExpected ) ; + public OutputStream request(String operation, boolean responseExpected) { + return StubAdapter.request(object, operation, responseExpected); } - public boolean _is_a(String repositoryIdentifier) - { - return object._is_a( repositoryIdentifier ) ; + public boolean _is_a(String repositoryIdentifier) { + return object._is_a(repositoryIdentifier); } - public boolean _is_equivalent(org.omg.CORBA.Object other) - { - return object._is_equivalent( other ) ; + public boolean _is_equivalent(org.omg.CORBA.Object other) { + return object._is_equivalent(other); } - public boolean _non_existent() - { - return object._non_existent() ; + public boolean _non_existent() { + return object._non_existent(); } - public int _hash(int maximum) - { - return object._hash( maximum ) ; + public int _hash(int maximum) { + return object._hash(maximum); } - public org.omg.CORBA.Object _duplicate() - { - return object._duplicate() ; + public org.omg.CORBA.Object _duplicate() { + return object._duplicate(); } - public void _release() - { - object._release() ; + public void _release() { + object._release(); } - public org.omg.CORBA.Object _get_interface_def() - { - return object._get_interface_def() ; + public org.omg.CORBA.Object _get_interface_def() { + return object._get_interface_def(); } - public Request _request(String operation) - { - return object._request( operation ) ; + public Request _request(String operation) { + return object._request(operation); } - public Request _create_request( Context ctx, String operation, NVList arg_list, - NamedValue result) - { - return object._create_request( ctx, operation, arg_list, result ) ; + public Request _create_request(Context ctx, String operation, NVList arg_list, NamedValue result) { + return object._create_request(ctx, operation, arg_list, result); } - public Request _create_request( Context ctx, String operation, NVList arg_list, - NamedValue result, ExceptionList exclist, ContextList ctxlist) - { - return object._create_request( ctx, operation, arg_list, result, - exclist, ctxlist ) ; + public Request _create_request(Context ctx, String operation, NVList arg_list, NamedValue result, ExceptionList exclist, + ContextList ctxlist) { + return object._create_request(ctx, operation, arg_list, result, exclist, ctxlist); } - public Policy _get_policy(int policy_type) - { - return object._get_policy( policy_type ) ; + public Policy _get_policy(int policy_type) { + return object._get_policy(policy_type); } - public DomainManager[] _get_domain_managers() - { - return object._get_domain_managers() ; + public DomainManager[] _get_domain_managers() { + return object._get_domain_managers(); } - public org.omg.CORBA.Object _set_policy_override( Policy[] policies, - SetOverrideType set_add) - { - return object._set_policy_override( policies, set_add ) ; + public org.omg.CORBA.Object _set_policy_override(Policy[] policies, SetOverrideType set_add) { + return object._set_policy_override(policies, set_add); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientDelegate.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientDelegate.java index 98a5a9f24..ba852c45e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientDelegate.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientDelegate.java @@ -22,9 +22,7 @@ import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.transport.ContactInfoList; -public abstract class ClientDelegate - extends org.omg.CORBA_2_3.portable.Delegate -{ +public abstract class ClientDelegate extends org.omg.CORBA_2_3.portable.Delegate { /** * The ORB associated * with an invocation. * @@ -33,8 +31,8 @@ public abstract class ClientDelegate public abstract ORB getBroker(); /** - * Get the CorbaContactInfoList which represents they encoding/protocol/transport - * combinations that may be used to contact the service. + * Get the CorbaContactInfoList which represents they encoding/protocol/transport combinations that may be used to + * contact the service. * * @return CorbaContactInfoList */ diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientDelegateFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientDelegateFactory.java index 49b297c59..1fc5626bc 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientDelegateFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientDelegateFactory.java @@ -17,14 +17,15 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.protocol ; +package com.sun.corba.ee.spi.protocol; -import com.sun.corba.ee.spi.transport.ContactInfoList ; +import com.sun.corba.ee.spi.transport.ContactInfoList; -import com.sun.corba.ee.spi.protocol.ClientDelegate ; +import com.sun.corba.ee.spi.protocol.ClientDelegate; -/** Interface used to create a ClientDelegate from a ContactInfoList. +/** + * Interface used to create a ClientDelegate from a ContactInfoList. */ public interface ClientDelegateFactory { - ClientDelegate create( ContactInfoList list ) ; + ClientDelegate create(ContactInfoList list); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientInvocationInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientInvocationInfo.java index bbbd2c286..bc3b6bc7a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientInvocationInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientInvocationInfo.java @@ -24,20 +24,19 @@ /** * @author Harold Carr */ -public interface ClientInvocationInfo -{ +public interface ClientInvocationInfo { public Iterator getContactInfoListIterator(); - + public void setContactInfoListIterator(Iterator contactInfoListIterator); - + public boolean isRetryInvocation(); - + public void setIsRetryInvocation(boolean isRetryInvocation); - + public int getEntryCount(); - + public void incrementEntryCount(); - + public void decrementEntryCount(); public void setClientRequestDispatcher(ClientRequestDispatcher clientRequestDispatcher); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientRequestDispatcher.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientRequestDispatcher.java index a9cfb66de..40cb80d7b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientRequestDispatcher.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ClientRequestDispatcher.java @@ -25,67 +25,54 @@ import com.sun.corba.ee.spi.transport.ContactInfo; /** - * ClientRequestDispatcher coordinates the request (and possible - * response) processing for a specific protocol. + * ClientRequestDispatcher coordinates the request (and possible response) processing for a specific + * protocol. * * @author Harold Carr */ -public interface ClientRequestDispatcher -{ +public interface ClientRequestDispatcher { /** - * At the beginning of a request the presentation block uses this - * to obtain an OutputObject to set data to be sent on a message. + * At the beginning of a request the presentation block uses this to obtain an OutputObject to set data to be sent on a + * message. * * @param self - * @param methodName - the remote method name * @param isOneWay - true if the message is asynchronous - * @param contactInfo - the CorbaContactInfo - * which which created/chose this ClientRequestDispatcher + * @param contactInfo - the CorbaContactInfo which which created/chose this ClientRequestDispatcher * * @return OutputObject */ - public CDROutputObject beginRequest(Object self, - String methodName, - boolean isOneWay, - ContactInfo contactInfo); + public CDROutputObject beginRequest(Object self, String methodName, boolean isOneWay, ContactInfo contactInfo); /** - * After the presentation block has set data on the CDROutputObject - * it signals the PEPt runtime to send the encoded data by calling this - * method. + * After the presentation block has set data on the CDROutputObject it signals the PEPt runtime to send the encoded data + * by calling this method. * * @param self - * @param outputObject object to mark as complete * * @return CDRInputObject if the message is synchronous. * - * @throws org.omg.CORBA.portable.ApplicationException - * if the remote side raises an exception declared in the remote interface. + * @throws org.omg.CORBA.portable.ApplicationException if the remote side raises an exception declared in the remote + * interface. * - * @throws org.omg.CORBA.portable.RemarshalException RemarshalException - * if the PEPt runtime would like the presentation block to start over. + * @throws org.omg.CORBA.portable.RemarshalException RemarshalException if the PEPt runtime would like the presentation + * block to start over. */ - public CDRInputObject marshalingComplete(java.lang.Object self, - CDROutputObject outputObject) - // REVISIT EXCEPTIONS - throws - org.omg.CORBA.portable.ApplicationException, - org.omg.CORBA.portable.RemarshalException; + public CDRInputObject marshalingComplete(java.lang.Object self, CDROutputObject outputObject) + // REVISIT EXCEPTIONS + throws org.omg.CORBA.portable.ApplicationException, org.omg.CORBA.portable.RemarshalException; /** - * After the presentation block completes a request it signals - * the PEPt runtime by calling this method. + * After the presentation block completes a request it signals the PEPt runtime by calling this method. * - * This method may release resources. In some cases it may cause - * control or error messages to be sent. + * This method may release resources. In some cases it may cause control or error messages to be sent. * * @param broker ORB used * @param self unused * @param inputObject unused */ - public void endRequest(ORB broker, - java.lang.Object self, - CDRInputObject inputObject); + public void endRequest(ORB broker, java.lang.Object self, CDRInputObject inputObject); } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ForwardException.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ForwardException.java index c60844647..03c9594ca 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ForwardException.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ForwardException.java @@ -19,60 +19,58 @@ package com.sun.corba.ee.spi.protocol; -import org.omg.CORBA.BAD_PARAM ; +import org.omg.CORBA.BAD_PARAM; -import com.sun.corba.ee.impl.misc.ORBUtility ; +import com.sun.corba.ee.impl.misc.ORBUtility; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; /** * Thrown to signal an OBJECT_FORWARD or LOCATION_FORWARD */ public class ForwardException extends RuntimeException { - private ORB orb ; + private ORB orb; private org.omg.CORBA.Object obj; - private IOR ior ; + private IOR ior; - public ForwardException( ORB orb, IOR ior ) { + public ForwardException(ORB orb, IOR ior) { super(); - this.orb = orb ; - this.obj = null ; - this.ior = ior ; + this.orb = orb; + this.obj = null; + this.ior = ior; } - public ForwardException( ORB orb, org.omg.CORBA.Object obj) { + public ForwardException(ORB orb, org.omg.CORBA.Object obj) { super(); // This check is done early so that no attempt // may be made to do a location forward to a local - // object. Doing this lazily would allow + // object. Doing this lazily would allow // forwarding to locals in some restricted cases. if (obj instanceof org.omg.CORBA.LocalObject) - throw new BAD_PARAM() ; + throw new BAD_PARAM(); - this.orb = orb ; - this.obj = obj ; - this.ior = null ; + this.orb = orb; + this.obj = obj; + this.ior = null; } - public synchronized org.omg.CORBA.Object getObject() - { + public synchronized org.omg.CORBA.Object getObject() { if (obj == null) { - obj = ORBUtility.makeObjectReference( ior ) ; + obj = ORBUtility.makeObjectReference(ior); } - return obj ; + return obj; } - public synchronized IOR getIOR() - { + public synchronized IOR getIOR() { if (ior == null) { - ior = orb.getIOR( obj, false ) ; + ior = orb.getIOR(obj, false); } - return ior ; + return ior; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/InitialServerRequestDispatcher.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/InitialServerRequestDispatcher.java index 324dd17ee..dd2830a1c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/InitialServerRequestDispatcher.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/InitialServerRequestDispatcher.java @@ -19,20 +19,18 @@ package com.sun.corba.ee.spi.protocol; -import com.sun.corba.ee.spi.resolver.Resolver ; +import com.sun.corba.ee.spi.resolver.Resolver; -/** InitialServerRequestDispatcher is a specialized version of a ServerRequestDispatcher - * that provides an initialization method. This delegate is used - * to implement bootstrapping of initial object references. +/** + * InitialServerRequestDispatcher is a specialized version of a ServerRequestDispatcher that provides an initialization + * method. This delegate is used to implement bootstrapping of initial object references. */ -public interface InitialServerRequestDispatcher - extends ServerRequestDispatcher -{ - /** Plug in the resolver that this InitialServerRequestDispatcher should - * use in order to lookup or list initial name to object reference - * bindings. +public interface InitialServerRequestDispatcher extends ServerRequestDispatcher { + /** + * Plug in the resolver that this InitialServerRequestDispatcher should use in order to lookup or list initial name to + * object reference bindings. + * * @param resolver that this should use */ - void init( Resolver resolver ) ; + void init(Resolver resolver); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/LocalClientRequestDispatcher.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/LocalClientRequestDispatcher.java index 466a56a06..b25448035 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/LocalClientRequestDispatcher.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/LocalClientRequestDispatcher.java @@ -25,43 +25,32 @@ * @author Harold Carr */ -public interface LocalClientRequestDispatcher -{ +public interface LocalClientRequestDispatcher { public boolean useLocalInvocation(org.omg.CORBA.Object self); public boolean is_local(org.omg.CORBA.Object self); /** - * Returns a Java reference to the servant which should be used for this - * request. servant_preinvoke() is invoked by a local stub. - * If a ServantObject object is returned, then its servant field - * has been set to an object of the expected type (Note: the object may - * or may not be the actual servant instance). The local stub may cast - * the servant field to the expected type, and then invoke the operation - * directly. + * Returns a Java reference to the servant which should be used for this request. servant_preinvoke() is invoked by a + * local stub. If a ServantObject object is returned, then its servant field has been set to an object of the expected + * type (Note: the object may or may not be the actual servant instance). The local stub may cast the servant field to + * the expected type, and then invoke the operation directly. * * @param self The object reference which delegated to this delegate. * - * @param operation a string containing the operation name. - * The operation name corresponds to the operation name as it would be - * encoded in a GIOP request. + * @param operation a string containing the operation name. The operation name corresponds to the operation name as it + * would be encoded in a GIOP request. * - * @param expectedType a Class object representing the expected type of the servant. - * The expected type is the Class object associated with the operations - * class of the stub's interface (e.g. A stub for an interface Foo, - * would pass the Class object for the FooOperations interface). + * @param expectedType a Class object representing the expected type of the servant. The expected type is the Class + * object associated with the operations class of the stub's interface (e.g. A stub for an interface Foo, would pass the + * Class object for the FooOperations interface). * - * @return a ServantObject object. - * The method may return a null value if it does not wish to support - * this optimization (e.g. due to security, transactions, etc). - * The method must return null if the servant is not of the expected type. + * @return a ServantObject object. The method may return a null value if it does not wish to support this optimization + * (e.g. due to security, transactions, etc). The method must return null if the servant is not of the expected type. */ - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType); + public ServantObject servant_preinvoke(org.omg.CORBA.Object self, String operation, Class expectedType); - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servant); + public void servant_postinvoke(org.omg.CORBA.Object self, ServantObject servant); } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/LocalClientRequestDispatcherFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/LocalClientRequestDispatcherFactory.java index 4b432802c..2e8f63bb5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/LocalClientRequestDispatcherFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/LocalClientRequestDispatcherFactory.java @@ -19,9 +19,8 @@ package com.sun.corba.ee.spi.protocol; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; public interface LocalClientRequestDispatcherFactory { - public LocalClientRequestDispatcher create( int id, IOR ior ) ; + public LocalClientRequestDispatcher create(int id, IOR ior); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/MessageMediator.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/MessageMediator.java index 09859caa9..0886b7b10 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/MessageMediator.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/MessageMediator.java @@ -45,28 +45,43 @@ /** * @author Harold Carr */ -public abstract interface MessageMediator - extends - ResponseHandler -{ +public abstract interface MessageMediator extends ResponseHandler { RequestId getRequestIdFromRawBytes(); + public void setReplyHeader(LocateReplyOrReplyMessage header); + public LocateReplyMessage getLocateReplyHeader(); + public ReplyMessage getReplyHeader(); + public void setReplyExceptionDetailMessage(String message); + public RequestMessage getRequestHeader(); + public GIOPVersion getGIOPVersion(); + public byte getEncodingVersion(); + public int getRequestId(); + public boolean isOneWay(); + public String getOperationName(); + public ServiceContexts getRequestServiceContexts(); + public void setRequestServiceContexts(ServiceContexts sc); + public ServiceContexts getReplyServiceContexts(); + public Message getDispatchHeader(); + public int getThreadPoolToUse(); + public boolean dispatch(); + public byte getStreamFormatVersion(); // REVIST name ForRequest? + public byte getStreamFormatVersionForReply(); // REVISIT - not sure if the final fragment and DII stuff should @@ -75,19 +90,29 @@ public abstract interface MessageMediator public void sendCancelRequestIfFinalFragmentNotSent(); public void setDIIInfo(org.omg.CORBA.Request request); + public boolean isDIIRequest(); - public Exception unmarshalDIIUserException(String repoId, - InputStream inputStream); + + public Exception unmarshalDIIUserException(String repoId, InputStream inputStream); + public void setDIIException(Exception exception); + public void handleDIIReply(InputStream inputStream); public boolean isSystemExceptionReply(); + public boolean isUserExceptionReply(); + public boolean isLocationForwardReply(); + public boolean isDifferentAddrDispositionRequestedReply(); + public short getAddrDispositionReply(); + public IOR getForwardedIOR(); + public SystemException getSystemExceptionReply(); + public void cancelRequest(); //////////////////////////////////////////////////// @@ -96,6 +121,7 @@ public Exception unmarshalDIIUserException(String repoId, // public ObjectKeyCacheEntry getObjectKeyCacheEntry(); + public ProtocolHandler getProtocolHandler(); //////////////////////////////////////////////////// @@ -104,6 +130,7 @@ public Exception unmarshalDIIUserException(String repoId, // public org.omg.CORBA.portable.OutputStream createReply(); + public org.omg.CORBA.portable.OutputStream createExceptionReply(); //////////////////////////////////////////////////// @@ -121,7 +148,7 @@ public Exception unmarshalDIIUserException(String repoId, public boolean executePIInResponseConstructor(); - public void setExecutePIInResponseConstructor( boolean b ); + public void setExecutePIInResponseConstructor(boolean b); public ORB getBroker(); @@ -155,4 +182,3 @@ public Exception unmarshalDIIUserException(String repoId, } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/MessageParser.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/MessageParser.java index 8a4fae2f9..2f69e6739 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/MessageParser.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/MessageParser.java @@ -27,7 +27,6 @@ import com.sun.corba.ee.impl.protocol.giopmsgheaders.Message; - /** * * An interface that knows how to parse bytes into a protocol data unit. @@ -40,112 +39,109 @@ public interface MessageParser { /** * Is this MessageParser expecting more data ? * - * This method is typically called after a call to parseBytes() - * to determine if the ByteBuffer which has been parsed - * contains a partial Message. + * This method is typically called after a call to parseBytes() to determine if the ByteBuffer + * which has been parsed contains a partial Message. * - * @return - true if more bytes are needed to construct a - * Message. false, if no - * additional bytes remain to be parsed into a Message. + * @return - true if more bytes are needed to construct a Message. false, if no + * additional bytes remain to be parsed into a Message. */ boolean isExpectingMoreData(); /** - * If there are sufficient bytes in the ByteBuffer to compose a - * Message, then return a newly initialized Message. - * Otherwise, return null. + * If there are sufficient bytes in the ByteBuffer to compose a Message, then return a newly + * initialized Message. Otherwise, return null. * - * When this method is first called, it is assumed that - * ByteBuffer.position() points to the location in the - * ByteBuffer where the beginning of the first - * Message begins. + * When this method is first called, it is assumed that ByteBuffer.position() points to the location in the + * ByteBuffer where the beginning of the first Message begins. * - * If there is no partial Message remaining in the - * ByteBuffer when this method exits, this method will e - * this.expectingMoreData to false. - * Otherwise, it will be set to true. + * If there is no partial Message remaining in the ByteBuffer when this method exits, this + * method will e this.expectingMoreData to false. Otherwise, it will be set to + * true. * - * Callees of this method may check isExpectingMoreData() - * subsequently to determine if this MessageParser is expecting - * more data to complete a protocol data unit. Callees may also - * subsequently check hasMoreBytesToParse() to determine if this - * MessageParser has more data to parse in the given - * ByteBuffer. + * Callees of this method may check isExpectingMoreData() subsequently to determine if this + * MessageParser is expecting more data to complete a protocol data unit. Callees may also subsequently + * check hasMoreBytesToParse() to determine if this MessageParser has more data to parse in + * the given ByteBuffer. * * @param byteBuffer Buffer to parse * @param connection connection for message - * @return Message if one is found in the ByteBuffer. - * Otherwise, returns null. + * @return Message if one is found in the ByteBuffer. Otherwise, returns null. */ // REVISIT - This interface should be declared without a CorbaConnection. - // As a result, this interface will likely be deprecated in a - // future release in favor of Message parseBytes(ByteBuffer byteBuffer) + // As a result, this interface will likely be deprecated in a + // future release in favor of Message parseBytes(ByteBuffer byteBuffer) Message parseBytes(ByteBuffer byteBuffer, Connection connection); /** - * Are there more bytes to be parsed in the ByteBuffer given - * to this MessageParser's parseBytes ? + * Are there more bytes to be parsed in the ByteBuffer given to this MessageParser's + * parseBytes ? * - * This method is typically called after a call to parseBytes() - * to determine if the ByteBuffer has more bytes which need to - * parsed into a Message. + * This method is typically called after a call to parseBytes() to determine if the ByteBuffer + * has more bytes which need to parsed into a Message. * - * @return true if there are more bytes to be parsed. - * Otherwise false. + * @return true if there are more bytes to be parsed. Otherwise false. */ boolean hasMoreBytesToParse(); /** - * Set the starting position where the next message in the - * ByteBuffer given to parseBytes() begins. + * Set the starting position where the next message in the ByteBuffer given to parseBytes() + * begins. + * * @param position the next starting position */ void setNextMessageStartPosition(int position); /** - * Get the starting position where the next message in the - * ByteBuffer given to parseBytes() begins. + * Get the starting position where the next message in the ByteBuffer given to parseBytes() + * begins. + * * @return start position in the buffer of the next message */ int getNextMessageStartPosition(); /** - * Return the suggested number of bytes needed to hold the next message - * to be parsed. + * Return the suggested number of bytes needed to hold the next message to be parsed. + * * @return bytes needed to hold message */ int getSizeNeeded(); /** * Returns the byte buffer (if any) associated with the last message returned. + * * @return the associated byte buffer */ ByteBuffer getMsgByteBuffer(); /** - * Offers an input buffer to the parser. Position must be set to 0, and the buffer must contain at least the start - * of a GIOP message. The parser will consume what it can and make the remainder available in {@link #getRemainderBuffer} + * Offers an input buffer to the parser. Position must be set to 0, and the buffer must contain at least the start of a + * GIOP message. The parser will consume what it can and make the remainder available in {@link #getRemainderBuffer} + * * @param buffer a buffer containing at least the start of a GIOP message. */ void offerBuffer(ByteBuffer buffer); /** - * Returns a buffer containing whatever is left after processing the buffer provided in {@link #offerBuffer(ByteBuffer)}, - * which could be the same buffer. The buffer could also be null if all data has been consumed. + * Returns a buffer containing whatever is left after processing the buffer provided in + * {@link #offerBuffer(ByteBuffer)}, which could be the same buffer. The buffer could also be null if all data has been + * consumed. + * * @return a byte buffer representing data which still needs to be processed. */ ByteBuffer getRemainderBuffer(); /** - * Returns the full message constructed by the last call to {@link #offerBuffer(ByteBuffer)}. Will be null if - * the last such call did not complete a message. + * Returns the full message constructed by the last call to {@link #offerBuffer(ByteBuffer)}. Will be null if the last + * such call did not complete a message. + * * @return a complete message, wrapped in a message mediator. */ MessageMediator getMessageMediator(); /** - * Checks for a stalled or rogue client. If in the middle of receiving a message and the time exceeds the limit, - * will throw a communications failure exception. + * Checks for a stalled or rogue client. If in the middle of receiving a message and the time exceeds the limit, will + * throw a communications failure exception. + * * @param timeSinceLastInput the number of milliseconds since the last input was received. */ void checkTimeout(long timeSinceLastInput); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/PIHandler.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/PIHandler.java index 0709c3cef..ccefc3bd4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/PIHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/PIHandler.java @@ -19,40 +19,40 @@ package com.sun.corba.ee.spi.protocol; -import java.io.Closeable ; +import java.io.Closeable; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.Interceptor ; -import org.omg.PortableInterceptor.Current ; -import org.omg.PortableInterceptor.PolicyFactory ; -import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; +import org.omg.PortableInterceptor.Interceptor; +import org.omg.PortableInterceptor.Current; +import org.omg.PortableInterceptor.PolicyFactory; +import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; -import org.omg.CORBA.NVList ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.PolicyError ; +import org.omg.CORBA.NVList; +import org.omg.CORBA.Any; +import org.omg.CORBA.Policy; +import org.omg.CORBA.PolicyError; import org.omg.CORBA.portable.RemarshalException; -import com.sun.corba.ee.spi.oa.ObjectAdapter ; +import com.sun.corba.ee.spi.oa.ObjectAdapter; -import com.sun.corba.ee.spi.ior.ObjectKeyTemplate ; +import com.sun.corba.ee.spi.ior.ObjectKeyTemplate; -import com.sun.corba.ee.impl.corba.RequestImpl ; -import com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage ; +import com.sun.corba.ee.impl.corba.RequestImpl; +import com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage; -/** This interface defines the PI interface that is used to interface the rest of the - * ORB to the PI implementation. +/** + * This interface defines the PI interface that is used to interface the rest of the ORB to the PI implementation. */ public interface PIHandler extends Closeable { - /** Complete the initialization of the PIHandler. This will execute the methods - * on the ORBInitializers, if any are defined. This must be done here so that - * the ORB can obtain the PIHandler BEFORE the ORBInitializers run, since they - * will need access to the PIHandler through the ORB. - */ - public void initialize() ; - - public void destroyInterceptors() ; + /** + * Complete the initialization of the PIHandler. This will execute the methods on the ORBInitializers, if any are + * defined. This must be done here so that the ORB can obtain the PIHandler BEFORE the ORBInitializers run, since they + * will need access to the PIHandler through the ORB. + */ + public void initialize(); + + public void destroyInterceptors(); /* **************************** @@ -60,32 +60,28 @@ public interface PIHandler extends Closeable { ****************************/ /** - * Called when a new object adapter is created. + * Called when a new object adapter is created. * - * @param oa The adapter associated with the interceptors to be - * invoked. + * @param oa The adapter associated with the interceptors to be invoked. */ - void objectAdapterCreated( ObjectAdapter oa ) ; + void objectAdapterCreated(ObjectAdapter oa); - /** + /** * Called whenever a state change occurs in an adapter manager. * * @param managerId managerId The adapter manager id - * @param newState newState The new state of the adapter manager, - * and by implication of all object adapters managed by this manager. + * @param newState newState The new state of the adapter manager, and by implication of all object adapters managed by + * this manager. */ - void adapterManagerStateChanged( int managerId, - short newState ) ; - - /** Called whenever a state change occurs in an object adapter that - * was not caused by an adapter manager state change. - * - * @param templates The templates that are changing state. - * @param newState The new state of the adapters identified by the - * templates. - */ - void adapterStateChanged( ObjectReferenceTemplate[] templates, - short newState ) ; + void adapterManagerStateChanged(int managerId, short newState); + + /** + * Called whenever a state change occurs in an object adapter that was not caused by an adapter manager state change. + * + * @param templates The templates that are changing state. + * @param newState The new state of the adapters identified by the templates. + */ + void adapterStateChanged(ObjectReferenceTemplate[] templates, short newState); /* ***************** @@ -93,100 +89,83 @@ void adapterStateChanged( ObjectReferenceTemplate[] templates, *****************/ /** - * Called for pseudo-ops to temporarily disable portable interceptor - * hooks for calls on this thread. Keeps track of the number of - * times this is called and increments the disabledCount. + * Called for pseudo-ops to temporarily disable portable interceptor hooks for calls on this thread. Keeps track of the + * number of times this is called and increments the disabledCount. */ - void disableInterceptorsThisThread() ; + void disableInterceptorsThisThread(); /** - * Called for pseudo-ops to re-enable portable interceptor - * hooks for calls on this thread. Decrements the disabledCount. + * Called for pseudo-ops to re-enable portable interceptor hooks for calls on this thread. Decrements the disabledCount. * If disabledCount is 0, interceptors are re-enabled. */ - void enableInterceptorsThisThread() ; + void enableInterceptorsThisThread(); /** - * Called when the send_request or send_poll portable interception point - * is to be invoked for all appropriate client-side request interceptors. + * Called when the send_request or send_poll portable interception point is to be invoked for all appropriate + * client-side request interceptors. * - * @exception RemarshalException - Thrown when this request needs to - * be retried. + * @exception RemarshalException - Thrown when this request needs to be retried. */ - void invokeClientPIStartingPoint() - throws RemarshalException ; + void invokeClientPIStartingPoint() throws RemarshalException; /** - * Called when the appropriate client ending interception point is - * to be invoked for all apporpriate client-side request interceptors. + * Called when the appropriate client ending interception point is to be invoked for all apporpriate client-side request + * interceptors. * - * @param replyStatus One of the constants in iiop.messages.ReplyMessage - * indicating which reply status to set. - * @param exception The exception before ending interception points have - * been invoked, or null if no exception at the moment. - * @return The exception to be thrown, after having gone through - * all ending points, or null if there is no exception to be - * thrown. Note that this exception can be either the same or - * different from the exception set using setClientPIException. - * There are four possible return types: null (no exception), - * SystemException, UserException, or RemarshalException. + * @param replyStatus One of the constants in iiop.messages.ReplyMessage indicating which reply status to set. + * @param exception The exception before ending interception points have been invoked, or null if no exception at the + * moment. + * @return The exception to be thrown, after having gone through all ending points, or null if there is no exception to + * be thrown. Note that this exception can be either the same or different from the exception set using + * setClientPIException. There are four possible return types: null (no exception), SystemException, UserException, or + * RemarshalException. */ - Exception invokeClientPIEndingPoint( - int replyStatus, Exception exception ) ; + Exception invokeClientPIEndingPoint(int replyStatus, Exception exception); /** - * Called when a retry is needed after initiateClientPIRequest but - * before invokeClientPIRequest. In this case, we need to properly - * balance initiateClientPIRequest/cleanupClientPIRequest calls, - * but WITHOUT extraneous calls to invokeClientPIEndingPoint - * (see bug 6763340). + * Called when a retry is needed after initiateClientPIRequest but before invokeClientPIRequest. In this case, we need + * to properly balance initiateClientPIRequest/cleanupClientPIRequest calls, but WITHOUT extraneous calls to + * invokeClientPIEndingPoint (see bug 6763340). * - * @param replyStatus One of the constants in iiop.messages.ReplyMessage - * indicating which reply status to set. - * @param exception The exception before ending interception points have - * been invoked, or null if no exception at the moment. - * @return The exception to be thrown, after having gone through - * all ending points, or null if there is no exception to be - * thrown. Note that this exception can be either the same or - * different from the exception set using setClientPIException. - * There are four possible return types: null (no exception), - * SystemException, UserException, or RemarshalException. + * @param replyStatus One of the constants in iiop.messages.ReplyMessage indicating which reply status to set. + * @param exception The exception before ending interception points have been invoked, or null if no exception at the + * moment. + * @return The exception to be thrown, after having gone through all ending points, or null if there is no exception to + * be thrown. Note that this exception can be either the same or different from the exception set using + * setClientPIException. There are four possible return types: null (no exception), SystemException, UserException, or + * RemarshalException. */ - Exception makeCompletedClientRequest( - int replyStatus, Exception exception ) ; + Exception makeCompletedClientRequest(int replyStatus, Exception exception); /** - * Invoked when a request is about to be created. Must be called before - * any of the setClientPI* methods so that a new info object can be - * prepared for information collection. + * Invoked when a request is about to be created. Must be called before any of the setClientPI* methods so that a new + * info object can be prepared for information collection. * - * @param diiRequest True if this is to be a DII request, or false if it - * is a "normal" request. In the DII case, initiateClientPIRequest - * is called twice and we need to ignore the second one. + * @param diiRequest True if this is to be a DII request, or false if it is a "normal" request. In the DII case, + * initiateClientPIRequest is called twice and we need to ignore the second one. */ - void initiateClientPIRequest( boolean diiRequest ) ; + void initiateClientPIRequest(boolean diiRequest); /** - * Invoked when a request is about to be cleaned up. Must be called - * after ending points are called so that the info object on the stack - * can be deinitialized and popped from the stack at the appropriate - * time. + * Invoked when a request is about to be cleaned up. Must be called after ending points are called so that the info + * object on the stack can be deinitialized and popped from the stack at the appropriate time. */ - void cleanupClientPIRequest() ; + void cleanupClientPIRequest(); /** - * Notifies PI of additional information for client-side interceptors. - * PI will use this information as a source of information for the - * ClientRequestInfo object. + * Notifies PI of additional information for client-side interceptors. PI will use this information as a source of + * information for the ClientRequestInfo object. + * * @param requestImpl request used as source of information */ - void setClientPIInfo( RequestImpl requestImpl ) ; + void setClientPIInfo(RequestImpl requestImpl); - /** + /** * Notify PI of the MessageMediator for the request. - * @param messageMediator Mediator to notify + * + * @param messageMediator Mediator to notify */ - void setClientPIInfo(MessageMediator messageMediator) ; + void setClientPIInfo(MessageMediator messageMediator); /* ***************** @@ -194,114 +173,100 @@ Exception makeCompletedClientRequest( *****************/ /** - * Called when the appropriate server starting interception point is - * to be invoked for all appropriate server-side request interceptors. + * Called when the appropriate server starting interception point is to be invoked for all appropriate server-side + * request interceptors. * - * @throws ForwardException Thrown if an interceptor raises - * ForwardRequest. This is an unchecked exception so that we need - * not modify the entire execution path to declare throwing - * ForwardException. + * @throws ForwardException Thrown if an interceptor raises ForwardRequest. This is an unchecked exception so that we + * need not modify the entire execution path to declare throwing ForwardException. */ - void invokeServerPIStartingPoint() ; + void invokeServerPIStartingPoint(); /** - * Called when the appropriate server intermediate interception point is - * to be invoked for all appropriate server-side request interceptors. + * Called when the appropriate server intermediate interception point is to be invoked for all appropriate server-side + * request interceptors. * - * @throws ForwardException Thrown if an interceptor raises - * ForwardRequest. This is an unchecked exception so that we need - * not modify the entire execution path to declare throwing - * ForwardException. + * @throws ForwardException Thrown if an interceptor raises ForwardRequest. This is an unchecked exception so that we + * need not modify the entire execution path to declare throwing ForwardException. */ - void invokeServerPIIntermediatePoint() ; + void invokeServerPIIntermediatePoint(); /** - * Called when the appropriate server ending interception point is - * to be invoked for all appropriate server-side request interceptors. + * Called when the appropriate server ending interception point is to be invoked for all appropriate server-side request + * interceptors. * - * @param replyMessage The iiop.messages.ReplyMessage containing the - * reply status. - * @throws ForwardException Thrown if an interceptor raises - * ForwardRequest. This is an unchecked exception so that we need - * not modify the entire execution path to declare throwing - * ForwardException. + * @param replyMessage The iiop.messages.ReplyMessage containing the reply status. + * @throws ForwardException Thrown if an interceptor raises ForwardRequest. This is an unchecked exception so that we + * need not modify the entire execution path to declare throwing ForwardException. */ - void invokeServerPIEndingPoint( ReplyMessage replyMessage ) ; + void invokeServerPIEndingPoint(ReplyMessage replyMessage); /** - * Notifies PI to start a new server request and set initial - * information for server-side interceptors. - * PI will use this information as a source of information for the - * ServerRequestInfo object. poaimpl is declared as an Object so that - * we need not introduce a dependency on the POA package. + * Notifies PI to start a new server request and set initial information for server-side interceptors. PI will use this + * information as a source of information for the ServerRequestInfo object. poaimpl is declared as an Object so that we + * need not introduce a dependency on the POA package. + * * @param request Request holder, included the Connection * @param oa Object Adapter * @param objectId id of object * @param oktemp template for object */ - void initializeServerPIInfo( MessageMediator request, - ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp ) ; + void initializeServerPIInfo(MessageMediator request, ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp); /** * Notifies PI of additional information reqired for ServerRequestInfo. * - * @param servant The servant. This is java.lang.Object because in the - * POA case, this will be a org.omg.PortableServer.Servant whereas - * in the ServerRequestDispatcher case this will be an ObjectImpl. - * @param targetMostDerivedInterface The most derived interface. This - * is passed in instead of calculated when needed because it requires - * extra information in the POA case that we didn't want to bother - * creating extra methods for to pass in. + * @param servant The servant. This is java.lang.Object because in the POA case, this will be a + * org.omg.PortableServer.Servant whereas in the ServerRequestDispatcher case this will be an ObjectImpl. + * @param targetMostDerivedInterface The most derived interface. This is passed in instead of calculated when needed + * because it requires extra information in the POA case that we didn't want to bother creating extra methods for to + * pass in. */ - void setServerPIInfo( java.lang.Object servant, - String targetMostDerivedInterface ) ; + void setServerPIInfo(java.lang.Object servant, String targetMostDerivedInterface); /** * Notifies PI of additional information required for ServerRequestInfo. + * * @param exception the exception that will be returned */ - void setServerPIInfo( Exception exception ); + void setServerPIInfo(Exception exception); /** - * Notifies PI of additional information for server-side interceptors. - * PI will use this information as a source of information for the - * ServerRequestInfo object. These are the arguments for a DSI request. + * Notifies PI of additional information for server-side interceptors. PI will use this information as a source of + * information for the ServerRequestInfo object. These are the arguments for a DSI request. + * * @param arguments Arguments for a DSI request. */ - void setServerPIInfo( NVList arguments ) ; + void setServerPIInfo(NVList arguments); /** - * Notifies PI of additional information for server-side interceptors. - * PI will use this information as a source of information for the - * ServerRequestInfo object. This is the exception of a DSI request. + * Notifies PI of additional information for server-side interceptors. PI will use this information as a source of + * information for the ServerRequestInfo object. This is the exception of a DSI request. + * * @param exception Exception of a DSI request */ - void setServerPIExceptionInfo( Any exception ) ; + void setServerPIExceptionInfo(Any exception); /** - * Notifies PI of additional information for server-side interceptors. - * PI will use this information as a source of information for the - * ServerRequestInfo object. This is the result of a DSI request. + * Notifies PI of additional information for server-side interceptors. PI will use this information as a source of + * information for the ServerRequestInfo object. This is the result of a DSI request. + * * @param result Result of a DSI request */ - void setServerPIInfo( Any result ) ; + void setServerPIInfo(Any result); /** - * Invoked when a request is about to be cleaned up. Must be called - * after ending points are called so that the info object on the stack - * can be deinitialized and popped from the stack at the appropriate - * time. + * Invoked when a request is about to be cleaned up. Must be called after ending points are called so that the info + * object on the stack can be deinitialized and popped from the stack at the appropriate time. */ - void cleanupServerPIRequest() ; + void cleanupServerPIRequest(); - Policy create_policy( int type, Any val ) throws PolicyError ; + Policy create_policy(int type, Any val) throws PolicyError; - void register_interceptor( Interceptor interceptor, int type ) - throws DuplicateName ; + void register_interceptor(Interceptor interceptor, int type) throws DuplicateName; - Current getPICurrent() ; + Current getPICurrent(); - void registerPolicyFactory( int type, PolicyFactory factory ) ; + void registerPolicyFactory(int type, PolicyFactory factory); - int allocateServerRequestId() ; + int allocateServerRequestId(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ProtocolHandler.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ProtocolHandler.java index e8ed5d6a5..1adac5a7c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ProtocolHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ProtocolHandler.java @@ -23,7 +23,7 @@ import org.omg.CORBA.SystemException; import org.omg.CORBA.portable.UnknownException; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.servicecontext.ServiceContexts; import com.sun.corba.ee.impl.protocol.giopmsgheaders.LocateRequestMessage; @@ -32,36 +32,22 @@ /** * @author Harold Carr */ -public abstract interface ProtocolHandler -{ - public void handleRequest(RequestMessage header, - MessageMediator messageMediator); +public abstract interface ProtocolHandler { + public void handleRequest(RequestMessage header, MessageMediator messageMediator); - public void handleRequest(LocateRequestMessage header, - MessageMediator messageMediator); + public void handleRequest(LocateRequestMessage header, MessageMediator messageMediator); - public MessageMediator createResponse( - MessageMediator messageMediator, - ServiceContexts svc); - public MessageMediator createUserExceptionResponse( - MessageMediator messageMediator, - ServiceContexts svc); - public MessageMediator createUnknownExceptionResponse( - MessageMediator messageMediator, - UnknownException ex); - public MessageMediator createSystemExceptionResponse( - MessageMediator messageMediator, - SystemException ex, - ServiceContexts svc); - public MessageMediator createLocationForward( - MessageMediator messageMediator, - IOR ior, - ServiceContexts svc); + public MessageMediator createResponse(MessageMediator messageMediator, ServiceContexts svc); - public void handleThrowableDuringServerDispatch( - MessageMediator request, - Throwable exception, - CompletionStatus completionStatus); + public MessageMediator createUserExceptionResponse(MessageMediator messageMediator, ServiceContexts svc); + + public MessageMediator createUnknownExceptionResponse(MessageMediator messageMediator, UnknownException ex); + + public MessageMediator createSystemExceptionResponse(MessageMediator messageMediator, SystemException ex, ServiceContexts svc); + + public MessageMediator createLocationForward(MessageMediator messageMediator, IOR ior, ServiceContexts svc); + + public void handleThrowableDuringServerDispatch(MessageMediator request, Throwable exception, CompletionStatus completionStatus); public boolean handleRequest(MessageMediator messageMediator); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestDispatcherDefault.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestDispatcherDefault.java index ea6956655..cf5a22ffd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestDispatcherDefault.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestDispatcherDefault.java @@ -17,92 +17,83 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.protocol ; +package com.sun.corba.ee.spi.protocol; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory; +import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher; -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.ee.spi.protocol.ServerRequestDispatcher ; - -import com.sun.corba.ee.spi.orb.ORB ; +import com.sun.corba.ee.spi.orb.ORB; // Used only in the implementation: no client of this class ever needs these -import com.sun.corba.ee.spi.ior.IOR ; - -import com.sun.corba.ee.impl.protocol.ClientRequestDispatcherImpl ; -import com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl ; -import com.sun.corba.ee.impl.protocol.MinimalServantCacheLocalCRDImpl ; -import com.sun.corba.ee.impl.protocol.InfoOnlyServantCacheLocalCRDImpl ; -import com.sun.corba.ee.impl.protocol.FullServantCacheLocalCRDImpl ; -import com.sun.corba.ee.impl.protocol.JIDLLocalCRDImpl ; -import com.sun.corba.ee.impl.protocol.POALocalCRDImpl ; -import com.sun.corba.ee.impl.protocol.INSServerRequestDispatcher ; -import com.sun.corba.ee.impl.protocol.BootstrapServerRequestDispatcher ; +import com.sun.corba.ee.spi.ior.IOR; + +import com.sun.corba.ee.impl.protocol.ClientRequestDispatcherImpl; +import com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl; +import com.sun.corba.ee.impl.protocol.MinimalServantCacheLocalCRDImpl; +import com.sun.corba.ee.impl.protocol.InfoOnlyServantCacheLocalCRDImpl; +import com.sun.corba.ee.impl.protocol.FullServantCacheLocalCRDImpl; +import com.sun.corba.ee.impl.protocol.JIDLLocalCRDImpl; +import com.sun.corba.ee.impl.protocol.POALocalCRDImpl; +import com.sun.corba.ee.impl.protocol.INSServerRequestDispatcher; +import com.sun.corba.ee.impl.protocol.BootstrapServerRequestDispatcher; public final class RequestDispatcherDefault { - private RequestDispatcherDefault() {} + private RequestDispatcherDefault() { + } - public static ClientRequestDispatcher makeClientRequestDispatcher() - { - return new ClientRequestDispatcherImpl() ; + public static ClientRequestDispatcher makeClientRequestDispatcher() { + return new ClientRequestDispatcherImpl(); } - public static ServerRequestDispatcher makeServerRequestDispatcher( ORB orb ) - { - return new ServerRequestDispatcherImpl( (com.sun.corba.ee.spi.orb.ORB)orb ) ; + public static ServerRequestDispatcher makeServerRequestDispatcher(ORB orb) { + return new ServerRequestDispatcherImpl((com.sun.corba.ee.spi.orb.ORB) orb); } - public static ServerRequestDispatcher makeBootstrapServerRequestDispatcher( ORB orb ) - { - return new BootstrapServerRequestDispatcher( orb ) ; + public static ServerRequestDispatcher makeBootstrapServerRequestDispatcher(ORB orb) { + return new BootstrapServerRequestDispatcher(orb); } - public static ServerRequestDispatcher makeINSServerRequestDispatcher( ORB orb ) - { - return new INSServerRequestDispatcher( orb ) ; + public static ServerRequestDispatcher makeINSServerRequestDispatcher(ORB orb) { + return new INSServerRequestDispatcher(orb); } - public static LocalClientRequestDispatcherFactory makeMinimalServantCacheLocalClientRequestDispatcherFactory( final ORB orb ) - { + public static LocalClientRequestDispatcherFactory makeMinimalServantCacheLocalClientRequestDispatcherFactory(final ORB orb) { return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new MinimalServantCacheLocalCRDImpl( orb, id, ior ) ; + public LocalClientRequestDispatcher create(int id, IOR ior) { + return new MinimalServantCacheLocalCRDImpl(orb, id, ior); } - } ; + }; } - public static LocalClientRequestDispatcherFactory makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory( final ORB orb ) - { + public static LocalClientRequestDispatcherFactory makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory(final ORB orb) { return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new InfoOnlyServantCacheLocalCRDImpl( orb, id, ior ) ; + public LocalClientRequestDispatcher create(int id, IOR ior) { + return new InfoOnlyServantCacheLocalCRDImpl(orb, id, ior); } - } ; + }; } - public static LocalClientRequestDispatcherFactory makeFullServantCacheLocalClientRequestDispatcherFactory( final ORB orb ) - { + public static LocalClientRequestDispatcherFactory makeFullServantCacheLocalClientRequestDispatcherFactory(final ORB orb) { return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new FullServantCacheLocalCRDImpl( orb, id, ior ) ; + public LocalClientRequestDispatcher create(int id, IOR ior) { + return new FullServantCacheLocalCRDImpl(orb, id, ior); } - } ; + }; } - public static LocalClientRequestDispatcherFactory makeJIDLLocalClientRequestDispatcherFactory( final ORB orb ) - { + public static LocalClientRequestDispatcherFactory makeJIDLLocalClientRequestDispatcherFactory(final ORB orb) { return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new JIDLLocalCRDImpl( orb, id, ior ) ; + public LocalClientRequestDispatcher create(int id, IOR ior) { + return new JIDLLocalCRDImpl(orb, id, ior); } - } ; + }; } - public static LocalClientRequestDispatcherFactory makePOALocalClientRequestDispatcherFactory( final ORB orb ) - { + public static LocalClientRequestDispatcherFactory makePOALocalClientRequestDispatcherFactory(final ORB orb) { return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new POALocalCRDImpl( orb, id, ior ) ; + public LocalClientRequestDispatcher create(int id, IOR ior) { + return new POALocalCRDImpl(orb, id, ior); } - } ; + }; } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestDispatcherRegistry.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestDispatcherRegistry.java index 40656c5bb..d183120cf 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestDispatcherRegistry.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestDispatcherRegistry.java @@ -22,86 +22,105 @@ import java.util.Set; -import com.sun.corba.ee.spi.oa.ObjectAdapterFactory ; +import com.sun.corba.ee.spi.oa.ObjectAdapterFactory; /** - * This is a registry of all subcontract ID dependent objects. This includes: - * LocalClientRequestDispatcherFactory, ClientRequestDispatcher, ServerRequestDispatcher, and - * ObjectAdapterFactory. + * This is a registry of all subcontract ID dependent objects. This includes: LocalClientRequestDispatcherFactory, + * ClientRequestDispatcher, ServerRequestDispatcher, and ObjectAdapterFactory. */ public interface RequestDispatcherRegistry { - /** Register a ClientRequestDispatcher for a particular subcontract ID. - * The subcontract ID appears in the ObjectKey of an object reference, and is used - * to control how a remote method invocation is processed by the ORB for a - * particular kind of object reference. + /** + * Register a ClientRequestDispatcher for a particular subcontract ID. The subcontract ID appears in the ObjectKey of an + * object reference, and is used to control how a remote method invocation is processed by the ORB for a particular kind + * of object reference. + * * @param csc Dispatcher to register * @param scid ID to register with */ - void registerClientRequestDispatcher( ClientRequestDispatcher csc, int scid) ; + void registerClientRequestDispatcher(ClientRequestDispatcher csc, int scid); - /** Get the ClientRequestDispatcher for subcontract ID scid. + /** + * Get the ClientRequestDispatcher for subcontract ID scid. + * * @param scid ID of the relevant Dispatcher * @return found Dispatcher */ - ClientRequestDispatcher getClientRequestDispatcher( int scid ) ; + ClientRequestDispatcher getClientRequestDispatcher(int scid); - /** Register a LocalClientRequestDispatcher for a particular subcontract ID. - * The subcontract ID appears in the ObjectKey of an object reference, and is used - * to control how a particular kind of colocated request is processed. + /** + * Register a LocalClientRequestDispatcher for a particular subcontract ID. The subcontract ID appears in the ObjectKey + * of an object reference, and is used to control how a particular kind of colocated request is processed. + * * @param csc DispatcherFactory to register * @param scid ID of factory */ - void registerLocalClientRequestDispatcherFactory( LocalClientRequestDispatcherFactory csc, int scid) ; + void registerLocalClientRequestDispatcherFactory(LocalClientRequestDispatcherFactory csc, int scid); - /** Get the LocalClientRequestDispatcher for subcontract ID scid. + /** + * Get the LocalClientRequestDispatcher for subcontract ID scid. + * * @param scid ID to tuse to look up * @return found Dispatcher */ - LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory( int scid ) ; + LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory(int scid); - /** Register a CorbaServerRequestDispatcher for a particular subcontract ID. - * The subcontract ID appears in the ObjectKey of an object reference, and is used - * to control how a particular kind of request is processed when received by the ORB. + /** + * Register a CorbaServerRequestDispatcher for a particular subcontract ID. The subcontract ID appears in the ObjectKey + * of an object reference, and is used to control how a particular kind of request is processed when received by the + * ORB. + * * @param ssc Dispatcher to register * @param scid id to register with */ - void registerServerRequestDispatcher( ServerRequestDispatcher ssc, int scid) ; + void registerServerRequestDispatcher(ServerRequestDispatcher ssc, int scid); - /** Get the CorbaServerRequestDispatcher for subcontract ID scid. + /** + * Get the CorbaServerRequestDispatcher for subcontract ID scid. + * * @param scid ID to use to look up * @return Found Dispatcher */ - ServerRequestDispatcher getServerRequestDispatcher(int scid) ; + ServerRequestDispatcher getServerRequestDispatcher(int scid); - /** Register a CorbaServerRequestDispatcher for handling an explicit object key name. - * This is used for non-standard invocations such as INS and the bootstrap name service. + /** + * Register a CorbaServerRequestDispatcher for handling an explicit object key name. This is used for non-standard + * invocations such as INS and the bootstrap name service. + * * @param ssc Dispatcher to register * @param name Name to register with */ - void registerServerRequestDispatcher( ServerRequestDispatcher ssc, String name ) ; + void registerServerRequestDispatcher(ServerRequestDispatcher ssc, String name); - /** Get the CorbaServerRequestDispatcher for a particular object key. + /** + * Get the CorbaServerRequestDispatcher for a particular object key. + * * @param name Name of dispatcher * @return The retrieved Dispatcher */ - ServerRequestDispatcher getServerRequestDispatcher( String name ) ; + ServerRequestDispatcher getServerRequestDispatcher(String name); - /** Register an ObjectAdapterFactory for a particular subcontract ID. - * This controls how Object references are created and managed. + /** + * Register an ObjectAdapterFactory for a particular subcontract ID. This controls how Object references are created and + * managed. + * * @param oaf factory to register * @param scid id of factory */ - void registerObjectAdapterFactory( ObjectAdapterFactory oaf, int scid) ; + void registerObjectAdapterFactory(ObjectAdapterFactory oaf, int scid); - /** Get the ObjectAdapterFactory for a particular subcontract ID scid. + /** + * Get the ObjectAdapterFactory for a particular subcontract ID scid. + * * @param scid id of of factory * @return relevant factory */ - ObjectAdapterFactory getObjectAdapterFactory( int scid ) ; + ObjectAdapterFactory getObjectAdapterFactory(int scid); - /** Return the set of all ObjectAdapterFactory instances that are registered. + /** + * Return the set of all ObjectAdapterFactory instances that are registered. + * * @return All registered factories */ - Set getObjectAdapterFactories() ; + Set getObjectAdapterFactories(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestId.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestId.java index 644603ad8..4b72c9e2e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestId.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RequestId.java @@ -26,13 +26,15 @@ */ public interface RequestId { /** - * return its value + * return its value + * * @return ID */ int getValue(); /** * Is there a numeric value for this CorbaRequestId ? + * * @return if a numeric value is defined */ boolean isDefined(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RetryType.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RetryType.java index 2ea12cc1c..67157aa2c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RetryType.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/RetryType.java @@ -17,7 +17,7 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.protocol ; +package com.sun.corba.ee.spi.protocol; // Introduce more information about WHY we are re-trying a request // so we can properly handle the two cases: @@ -28,19 +28,16 @@ // - AFTER_RESPONSE means that the retry is a result either of the // request sent to the server (from the response), or from the // Client side receive_xxx interceptor point. -public enum RetryType { - NONE( false ), - BEFORE_RESPONSE( true ), - AFTER_RESPONSE( true ) ; +public enum RetryType { + NONE(false), BEFORE_RESPONSE(true), AFTER_RESPONSE(true); - private final boolean isRetry ; + private final boolean isRetry; - RetryType( boolean isRetry ) { - this.isRetry = isRetry ; + RetryType(boolean isRetry) { + this.isRetry = isRetry; } public boolean isRetry() { - return this.isRetry ; + return this.isRetry; } -} ; - +}; diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ServerRequestDispatcher.java b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ServerRequestDispatcher.java index e75785409..7e21f9335 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ServerRequestDispatcher.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/protocol/ServerRequestDispatcher.java @@ -19,23 +19,20 @@ package com.sun.corba.ee.spi.protocol; - import com.sun.corba.ee.spi.ior.ObjectKey; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; /** - * Server delegate adds behavior on the server-side -- specifically - * on the dispatch path. A single server delegate instance serves - * many server objects. This is the second level of the dispatch - * on the server side: Acceptor to ServerSubcontract to ServerRequestDispatcher to - * ObjectAdapter to Servant, although this may be short-circuited. + * Server delegate adds behavior on the server-side -- specifically on the dispatch path. A single server delegate + * instance serves many server objects. This is the second level of the dispatch on the server side: Acceptor to + * ServerSubcontract to ServerRequestDispatcher to ObjectAdapter to Servant, although this may be short-circuited. * Instances of this class are registered in the subcontract Registry. */ -public abstract interface ServerRequestDispatcher -{ +public abstract interface ServerRequestDispatcher { /** * Handle a locate request. + * * @param key key to object to locate * @return IOR for the request */ @@ -45,4 +42,3 @@ public abstract interface ServerRequestDispatcher } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/LocalResolver.java b/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/LocalResolver.java index 069ab8b1d..d71668a28 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/LocalResolver.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/LocalResolver.java @@ -17,17 +17,19 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.resolver ; +package com.sun.corba.ee.spi.resolver; import org.glassfish.pfl.basic.func.NullaryFunction; -/** A LocalResolver is a Resolver that allows registration of (name, CORBA object) - * bindings. +/** + * A LocalResolver is a Resolver that allows registration of (name, CORBA object) bindings. */ public interface LocalResolver extends Resolver { - /** Register the Closure with the given name. + /** + * Register the Closure with the given name. + * * @param name name of Closure to register * @param closure supplier of CORBA object */ - void register( String name, NullaryFunction closure ) ; + void register(String name, NullaryFunction closure); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/Resolver.java b/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/Resolver.java index 49bf687c0..76276eaac 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/Resolver.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/Resolver.java @@ -17,24 +17,27 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.resolver ; +package com.sun.corba.ee.spi.resolver; -/** Resolver defines the operations needed to support ORB operations for - * resolve_initial_references and list_initial_services. +/** + * Resolver defines the operations needed to support ORB operations for resolve_initial_references and + * list_initial_services. */ public interface Resolver { - /** Look up the name using this resolver and return the CORBA object - * reference bound to this name, if any. + /** + * Look up the name using this resolver and return the CORBA object reference bound to this name, if any. + * * @param name name of CORBA object to look up * @return {@code null} if no object is bound to the name. */ - org.omg.CORBA.Object resolve( String name ) ; + org.omg.CORBA.Object resolve(String name); - /** Return the entire collection of names that are currently bound - * by this resolver. Resulting collection contains only strings for - * which resolve does not return null. Some resolvers may not support - * this method, in which case they return an empty set. + /** + * Return the entire collection of names that are currently bound by this resolver. Resulting collection contains only + * strings for which resolve does not return null. Some resolvers may not support this method, in which case they return + * an empty set. + * * @return All currently bound names */ - java.util.Set list() ; + java.util.Set list(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/ResolverDefault.java b/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/ResolverDefault.java index 2ea449ef2..cb71729f8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/ResolverDefault.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/resolver/ResolverDefault.java @@ -17,93 +17,86 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.resolver ; +package com.sun.corba.ee.spi.resolver; -import java.io.File ; +import java.io.File; -import com.sun.corba.ee.impl.resolver.LocalResolverImpl ; -import com.sun.corba.ee.impl.resolver.ORBInitRefResolverImpl ; -import com.sun.corba.ee.impl.resolver.ORBDefaultInitRefResolverImpl ; -import com.sun.corba.ee.impl.resolver.BootstrapResolverImpl ; -import com.sun.corba.ee.impl.resolver.CompositeResolverImpl ; -import com.sun.corba.ee.impl.resolver.INSURLOperationImpl ; -import com.sun.corba.ee.impl.resolver.SplitLocalResolverImpl ; -import com.sun.corba.ee.impl.resolver.FileResolverImpl ; +import com.sun.corba.ee.impl.resolver.LocalResolverImpl; +import com.sun.corba.ee.impl.resolver.ORBInitRefResolverImpl; +import com.sun.corba.ee.impl.resolver.ORBDefaultInitRefResolverImpl; +import com.sun.corba.ee.impl.resolver.BootstrapResolverImpl; +import com.sun.corba.ee.impl.resolver.CompositeResolverImpl; +import com.sun.corba.ee.impl.resolver.INSURLOperationImpl; +import com.sun.corba.ee.impl.resolver.SplitLocalResolverImpl; +import com.sun.corba.ee.impl.resolver.FileResolverImpl; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.Operation ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.Operation; import org.glassfish.pfl.basic.contain.Pair; -/** Utility class that provides factory methods for all of the - * standard resolvers that we provide. +/** + * Utility class that provides factory methods for all of the standard resolvers that we provide. */ public class ResolverDefault { - /** Return a local resolver that simply stores bindings in a map. + /** + * Return a local resolver that simply stores bindings in a map. + * * @return a new LocalResolverImpl - */ - public static LocalResolver makeLocalResolver( ) - { - return new LocalResolverImpl() ; + */ + public static LocalResolver makeLocalResolver() { + return new LocalResolverImpl(); } - /** Return a resolver that relies on configured values of ORBInitRef for data. + /** + * Return a resolver that relies on configured values of ORBInitRef for data. + * * @param urlOperation operation to get reference from URL * @param initRefs an array of Pairs oaf <name of CORBA object, URL to get reference with> * @return a new ORBInitRefResolver - */ - public static Resolver makeORBInitRefResolver( Operation urlOperation, - Pair[] initRefs ) - { - return new ORBInitRefResolverImpl( urlOperation, initRefs ) ; + */ + public static Resolver makeORBInitRefResolver(Operation urlOperation, Pair[] initRefs) { + return new ORBInitRefResolverImpl(urlOperation, initRefs); } - public static Resolver makeORBDefaultInitRefResolver( Operation urlOperation, - String defaultInitRef ) - { - return new ORBDefaultInitRefResolverImpl( urlOperation, - defaultInitRef ) ; + public static Resolver makeORBDefaultInitRefResolver(Operation urlOperation, String defaultInitRef) { + return new ORBDefaultInitRefResolverImpl(urlOperation, defaultInitRef); } - /** Return a resolver that uses the proprietary bootstrap protocol - * to implement a resolver. Obtains the necessary host and port - * information from the ORB. - * @param orb ORB to use as resolver - * @param host host of IOR - * @param port port of IOR - * @return a new BoostrapResolver - */ - public static Resolver makeBootstrapResolver( ORB orb, String host, int port ) - { - return new BootstrapResolverImpl( orb, host, port ) ; + /** + * Return a resolver that uses the proprietary bootstrap protocol to implement a resolver. Obtains the necessary host + * and port information from the ORB. + * + * @param orb ORB to use as resolver + * @param host host of IOR + * @param port port of IOR + * @return a new BoostrapResolver + */ + public static Resolver makeBootstrapResolver(ORB orb, String host, int port) { + return new BootstrapResolverImpl(orb, host, port); } - /** Return a resolver composed of the two given resolvers. result.list() is the - * union of first.list() and second.list(). result.resolve( name ) returns - * first.resolve( name ) if that is not null, otherwise returns the result of - * second.resolve( name ). - * @param first first Resolver to try - * @param second seconds Resolver to try - * @return a new CompositeResolver - */ - public static Resolver makeCompositeResolver( Resolver first, Resolver second ) - { - return new CompositeResolverImpl( first, second ) ; + /** + * Return a resolver composed of the two given resolvers. result.list() is the union of first.list() and second.list(). + * result.resolve( name ) returns first.resolve( name ) if that is not null, otherwise returns the result of + * second.resolve( name ). + * + * @param first first Resolver to try + * @param second seconds Resolver to try + * @return a new CompositeResolver + */ + public static Resolver makeCompositeResolver(Resolver first, Resolver second) { + return new CompositeResolverImpl(first, second); } - public static Operation makeINSURLOperation( ORB orb ) - { - return new INSURLOperationImpl( orb ) ; + public static Operation makeINSURLOperation(ORB orb) { + return new INSURLOperationImpl(orb); } - public static LocalResolver makeSplitLocalResolver( Resolver resolver, - LocalResolver localResolver ) - { - return new SplitLocalResolverImpl( resolver, localResolver ) ; + public static LocalResolver makeSplitLocalResolver(Resolver resolver, LocalResolver localResolver) { + return new SplitLocalResolverImpl(resolver, localResolver); } - public static Resolver makeFileResolver( ORB orb, File file ) - { - return new FileResolverImpl( orb, file ) ; + public static Resolver makeFileResolver(ORB orb, File file) { + return new FileResolverImpl(orb, file); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/CodeSetServiceContext.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/CodeSetServiceContext.java index 5686247a2..3686e512f 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/CodeSetServiceContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/CodeSetServiceContext.java @@ -19,11 +19,10 @@ package com.sun.corba.ee.spi.servicecontext; -import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo ; +import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; public interface CodeSetServiceContext extends ServiceContext { - int SERVICE_CONTEXT_ID = 1 ; + int SERVICE_CONTEXT_ID = 1; - CodeSetComponentInfo.CodeSetContext getCodeSetContext() ; + CodeSetComponentInfo.CodeSetContext getCodeSetContext(); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/MaxStreamFormatVersionServiceContext.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/MaxStreamFormatVersionServiceContext.java index 8a363eae3..9dea100b4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/MaxStreamFormatVersionServiceContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/MaxStreamFormatVersionServiceContext.java @@ -22,7 +22,7 @@ import org.omg.IOP.RMICustomMaxStreamFormat; public interface MaxStreamFormatVersionServiceContext extends ServiceContext { - int SERVICE_CONTEXT_ID = RMICustomMaxStreamFormat.value ; + int SERVICE_CONTEXT_ID = RMICustomMaxStreamFormat.value; - byte getMaximumStreamFormatVersion() ; + byte getMaximumStreamFormatVersion(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ORBVersionServiceContext.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ORBVersionServiceContext.java index 01f27b58d..c5ec74840 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ORBVersionServiceContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ORBVersionServiceContext.java @@ -19,12 +19,12 @@ package com.sun.corba.ee.spi.servicecontext; -import com.sun.corba.ee.spi.orb.ORBVersion ; +import com.sun.corba.ee.spi.orb.ORBVersion; -import com.sun.corba.ee.spi.misc.ORBConstants ; +import com.sun.corba.ee.spi.misc.ORBConstants; public interface ORBVersionServiceContext extends ServiceContext { - int SERVICE_CONTEXT_ID = ORBConstants.TAG_ORB_VERSION ; + int SERVICE_CONTEXT_ID = ORBConstants.TAG_ORB_VERSION; - ORBVersion getVersion() ; + ORBVersion getVersion(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/SendingContextServiceContext.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/SendingContextServiceContext.java index 3937c85de..4aed41f9d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/SendingContextServiceContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/SendingContextServiceContext.java @@ -19,13 +19,12 @@ package com.sun.corba.ee.spi.servicecontext; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.servicecontext.ServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContext; -public interface SendingContextServiceContext extends ServiceContext -{ - int SERVICE_CONTEXT_ID = 6 ; +public interface SendingContextServiceContext extends ServiceContext { + int SERVICE_CONTEXT_ID = 6; - IOR getIOR() ; + IOR getIOR(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContext.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContext.java index 44c328218..09c43cca6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContext.java @@ -19,30 +19,27 @@ package com.sun.corba.ee.spi.servicecontext; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -/** Base class for all ServiceContext classes. -* There is a derived ServiceContext class for each service context that -* the ORB supports. Each subclass encapsulates the representation of -* the service context and provides any needed methods for manipulating -* the service context. -*

    -* The subclass can be constructed either directly from the service context -* representation, or by reading the representation from an input stream. -* These cases are needed when the service context is created and written to -* the request or reply, and when the service context is read from the -* received request or reply. -*/ +/** + * Base class for all ServiceContext classes. There is a derived ServiceContext class for each service context that the + * ORB supports. Each subclass encapsulates the representation of the service context and provides any needed methods + * for manipulating the service context. + *

    + * The subclass can be constructed either directly from the service context representation, or by reading the + * representation from an input stream. These cases are needed when the service context is created and written to the + * request or reply, and when the service context is read from the received request or reply. + */ public interface ServiceContext { public interface Factory { - int getId() ; + int getId(); - ServiceContext create( InputStream s, GIOPVersion gv ) ; + ServiceContext create(InputStream s, GIOPVersion gv); } - int getId() ; + int getId(); - void write(OutputStream s, GIOPVersion gv ) ; + void write(OutputStream s, GIOPVersion gv); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextBase.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextBase.java index 51d8ddc15..d54ab9cd1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextBase.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextBase.java @@ -20,74 +20,69 @@ package com.sun.corba.ee.spi.servicecontext; import org.omg.CORBA.SystemException; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.InputStream; +import org.omg.CORBA_2_3.portable.OutputStream; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.impl.encoding.EncapsOutputStream ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.impl.encoding.EncapsOutputStream; import com.sun.corba.ee.impl.encoding.OutputStreamFactory; import com.sun.corba.ee.spi.logging.ORBUtilSystemException; -/** Base class for all ServiceContext classes. -* There is a derived ServiceContext class for each service context that -* the ORB supports. Each subclass encapsulates the representation of -* the service context and provides any needed methods for manipulating -* the service context. Each subclass must provide the following -* members: -*

      -*
    • a public static final int SERVICE_CONTEXT_ID that gives the OMG -* (or other) defined id for the service context. This is needed for the -* registration mechanism defined in ServiceContexts. OMG defined -* service context ids are taken from section 13.6.7 of ptc/98-12-04.
    • -*
    • a public constructor that takes an InputStream as its argument.
    • -*
    • Appropriate definitions of getId() and writeData(). getId() must -* return SERVICE_CONTEXT_ID.
    • -*
    -* The subclass can be constructed either directly from the service context -* representation, or by reading the representation from an input stream. -* These cases are needed when the service context is created and written to -* the request or reply, and when the service context is read from the -* received request or reply. -*/ +/** + * Base class for all ServiceContext classes. There is a derived ServiceContext class for each service context that the + * ORB supports. Each subclass encapsulates the representation of the service context and provides any needed methods + * for manipulating the service context. Each subclass must provide the following members: + *
      + *
    • a public static final int SERVICE_CONTEXT_ID that gives the OMG (or other) defined id for the service context. + * This is needed for the registration mechanism defined in ServiceContexts. OMG defined service context ids are taken + * from section 13.6.7 of ptc/98-12-04.
    • + *
    • a public constructor that takes an InputStream as its argument.
    • + *
    • Appropriate definitions of getId() and writeData(). getId() must return SERVICE_CONTEXT_ID.
    • + *
    + * The subclass can be constructed either directly from the service context representation, or by reading the + * representation from an input stream. These cases are needed when the service context is created and written to the + * request or reply, and when the service context is read from the received request or reply. + */ public abstract class ServiceContextBase { - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.self ; + private static final ORBUtilSystemException wrapper = ORBUtilSystemException.self; - /** Simple default constructor used when subclass is constructed - * from its representation. + /** + * Simple default constructor used when subclass is constructed from its representation. */ private byte[] data; - protected ServiceContextBase() { } + protected ServiceContextBase() { + } - /** Stream constructor used when subclass is constructed from an - * InputStream. This constructor must be called by super( stream ) - * in the subclass. After this constructor completes, the service - * context representation can be read from in. - * Note that the service context id has been consumed from the input - * stream before this object is constructed. + /** + * Stream constructor used when subclass is constructed from an InputStream. This constructor must be called by super( + * stream ) in the subclass. After this constructor completes, the service context representation can be read from in. + * Note that the service context id has been consumed from the input stream before this object is constructed. + * * @param s stream to use to construct context */ - protected ServiceContextBase(InputStream s) - { + protected ServiceContextBase(InputStream s) { in = s; } - /** Returns Service context id. Must be overloaded in subclass. + /** + * Returns Service context id. Must be overloaded in subclass. + * * @return context id */ - public abstract int getId() ; + public abstract int getId(); - /** Write the service context to an output stream. This method - * must be used for writing the service context to a request or reply - * header. + /** + * Write the service context to an output stream. This method must be used for writing the service context to a request + * or reply header. + * * @param s stream to write to * @param gv version of the service context * @throws SystemException if an error occurred writing to the stream */ public synchronized void write(OutputStream s, GIOPVersion gv) throws SystemException { if (data == null) { - EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv); + EncapsOutputStream os = OutputStreamFactory.newEncapsOutputStream((ORB) (s.orb()), gv); try { os.putEndian(); writeData(os); @@ -105,21 +100,22 @@ public synchronized void write(OutputStream s, GIOPVersion gv) throws SystemExce s.write_octet_array(data, 0, data.length); } - /** Writes the data used to represent the subclasses service context - * into an encapsulation stream. Must be overloaded in subclass. + /** + * Writes the data used to represent the subclasses service context into an encapsulation stream. Must be overloaded in + * subclass. + * * @param os stream to write to */ - protected abstract void writeData( OutputStream os ) ; + protected abstract void writeData(OutputStream os); - /** in is the stream containing the service context representation. - * It is constructed by the stream constructor, and available for use - * in the subclass stream constructor. + /** + * in is the stream containing the service context representation. It is constructed by the stream constructor, and + * available for use in the subclass stream constructor. */ - protected InputStream in = null ; + protected InputStream in = null; @Override - public String toString() - { - return "ServiceContext[ id=" + getId() + " ]" ; - } + public String toString() { + return "ServiceContext[ id=" + getId() + " ]"; + } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextDefaults.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextDefaults.java index 506b9cdfa..30ec1955e 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextDefaults.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextDefaults.java @@ -19,188 +19,150 @@ package com.sun.corba.ee.spi.servicecontext; -import org.omg.CORBA_2_3.portable.InputStream ; +import org.omg.CORBA_2_3.portable.InputStream; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.orb.ORBVersion ; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.orb.ORBVersion; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; -import com.sun.corba.ee.spi.ior.iiop.GIOPVersion ; +import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.servicecontext.ServiceContexts ; -import com.sun.corba.ee.spi.servicecontext.ServiceContext ; -import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry ; -import com.sun.corba.ee.spi.servicecontext.CodeSetServiceContext ; -import com.sun.corba.ee.spi.servicecontext.ORBVersionServiceContext ; -import com.sun.corba.ee.spi.servicecontext.MaxStreamFormatVersionServiceContext ; -import com.sun.corba.ee.spi.servicecontext.UEInfoServiceContext ; -import com.sun.corba.ee.spi.servicecontext.UnknownServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContexts; +import com.sun.corba.ee.spi.servicecontext.ServiceContext; +import com.sun.corba.ee.spi.servicecontext.ServiceContextFactoryRegistry; +import com.sun.corba.ee.spi.servicecontext.CodeSetServiceContext; +import com.sun.corba.ee.spi.servicecontext.ORBVersionServiceContext; +import com.sun.corba.ee.spi.servicecontext.MaxStreamFormatVersionServiceContext; +import com.sun.corba.ee.spi.servicecontext.UEInfoServiceContext; +import com.sun.corba.ee.spi.servicecontext.UnknownServiceContext; -import com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl ; -import com.sun.corba.ee.impl.servicecontext.ServiceContextFactoryRegistryImpl ; -import com.sun.corba.ee.impl.servicecontext.CodeSetServiceContextImpl ; -import com.sun.corba.ee.impl.servicecontext.ORBVersionServiceContextImpl ; -import com.sun.corba.ee.impl.servicecontext.MaxStreamFormatVersionServiceContextImpl ; -import com.sun.corba.ee.impl.servicecontext.UEInfoServiceContextImpl ; -import com.sun.corba.ee.impl.servicecontext.UnknownServiceContextImpl ; -import com.sun.corba.ee.impl.servicecontext.SendingContextServiceContextImpl ; +import com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl; +import com.sun.corba.ee.impl.servicecontext.ServiceContextFactoryRegistryImpl; +import com.sun.corba.ee.impl.servicecontext.CodeSetServiceContextImpl; +import com.sun.corba.ee.impl.servicecontext.ORBVersionServiceContextImpl; +import com.sun.corba.ee.impl.servicecontext.MaxStreamFormatVersionServiceContextImpl; +import com.sun.corba.ee.impl.servicecontext.UEInfoServiceContextImpl; +import com.sun.corba.ee.impl.servicecontext.UnknownServiceContextImpl; +import com.sun.corba.ee.impl.servicecontext.SendingContextServiceContextImpl; -import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo ; +import com.sun.corba.ee.impl.encoding.CodeSetComponentInfo; import com.sun.corba.ee.spi.orb.ORBVersionFactory; - public abstract class ServiceContextDefaults { private static ORBVersion orbVersion = ORBVersionFactory.getORBVersion(); - private static ORBVersionServiceContext orbVersionContext = - new ORBVersionServiceContextImpl( orbVersion ); + private static ORBVersionServiceContext orbVersionContext = new ORBVersionServiceContextImpl(orbVersion); - private ServiceContextDefaults() {} + private ServiceContextDefaults() { + } - public static ServiceContexts makeServiceContexts( ORB orb ) - { - return new ServiceContextsImpl( orb ) ; + public static ServiceContexts makeServiceContexts(ORB orb) { + return new ServiceContextsImpl(orb); } - public static ServiceContexts makeServiceContexts( InputStream is ) - { - return new ServiceContextsImpl( is ) ; + public static ServiceContexts makeServiceContexts(InputStream is) { + return new ServiceContextsImpl(is); } - public static ServiceContextFactoryRegistry makeServiceContextFactoryRegistry( - ORB orb ) - { - return new ServiceContextFactoryRegistryImpl( orb ) ; + public static ServiceContextFactoryRegistry makeServiceContextFactoryRegistry(ORB orb) { + return new ServiceContextFactoryRegistryImpl(orb); } - public static CodeSetServiceContext makeCodeSetServiceContext( - CodeSetComponentInfo.CodeSetContext csc ) - { - return new CodeSetServiceContextImpl( csc ) ; + public static CodeSetServiceContext makeCodeSetServiceContext(CodeSetComponentInfo.CodeSetContext csc) { + return new CodeSetServiceContextImpl(csc); } - public static ServiceContext.Factory makeCodeSetServiceContextFactory() - { + public static ServiceContext.Factory makeCodeSetServiceContextFactory() { return new ServiceContext.Factory() { - public int getId() - { - return CodeSetServiceContext.SERVICE_CONTEXT_ID ; + public int getId() { + return CodeSetServiceContext.SERVICE_CONTEXT_ID; } - public ServiceContext create( InputStream s, GIOPVersion gv ) - { - return new CodeSetServiceContextImpl( s, gv ) ; + public ServiceContext create(InputStream s, GIOPVersion gv) { + return new CodeSetServiceContextImpl(s, gv); } - } ; + }; } - public static ServiceContext.Factory - makeMaxStreamFormatVersionServiceContextFactory() - { + public static ServiceContext.Factory makeMaxStreamFormatVersionServiceContextFactory() { return new ServiceContext.Factory() { - public int getId() - { - return MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID ; + public int getId() { + return MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID; } - public ServiceContext create( InputStream s, GIOPVersion gv ) - { - return new MaxStreamFormatVersionServiceContextImpl( s, gv ) ; + public ServiceContext create(InputStream s, GIOPVersion gv) { + return new MaxStreamFormatVersionServiceContextImpl(s, gv); } - } ; + }; } - public static MaxStreamFormatVersionServiceContext - getMaxStreamFormatVersionServiceContext() - { - return MaxStreamFormatVersionServiceContextImpl.singleton ; + public static MaxStreamFormatVersionServiceContext getMaxStreamFormatVersionServiceContext() { + return MaxStreamFormatVersionServiceContextImpl.singleton; } - public static MaxStreamFormatVersionServiceContext - makeMaxStreamFormatVersionServiceContext( byte version ) - { - return new MaxStreamFormatVersionServiceContextImpl( version ) ; + public static MaxStreamFormatVersionServiceContext makeMaxStreamFormatVersionServiceContext(byte version) { + return new MaxStreamFormatVersionServiceContextImpl(version); } - public static ServiceContext.Factory makeORBVersionServiceContextFactory() - { + public static ServiceContext.Factory makeORBVersionServiceContextFactory() { return new ServiceContext.Factory() { - public int getId() - { - return ORBVersionServiceContext.SERVICE_CONTEXT_ID ; + public int getId() { + return ORBVersionServiceContext.SERVICE_CONTEXT_ID; } - public ServiceContext create( InputStream s, GIOPVersion gv ) - { - return new ORBVersionServiceContextImpl( s, gv ) ; + public ServiceContext create(InputStream s, GIOPVersion gv) { + return new ORBVersionServiceContextImpl(s, gv); } - } ; + }; } - public static ORBVersionServiceContext getORBVersionServiceContext() - { - return ORBVersionServiceContextImpl.singleton ; + public static ORBVersionServiceContext getORBVersionServiceContext() { + return ORBVersionServiceContextImpl.singleton; } - public static ORBVersionServiceContext makeORBVersionServiceContext() - { - return orbVersionContext ; + public static ORBVersionServiceContext makeORBVersionServiceContext() { + return orbVersionContext; } - public static ServiceContext.Factory makeSendingContextServiceContextFactory() - { + public static ServiceContext.Factory makeSendingContextServiceContextFactory() { return new ServiceContext.Factory() { - public int getId() - { - return SendingContextServiceContext.SERVICE_CONTEXT_ID ; + public int getId() { + return SendingContextServiceContext.SERVICE_CONTEXT_ID; } - public ServiceContext create( InputStream s, GIOPVersion gv ) - { - return new SendingContextServiceContextImpl( s, gv ) ; + public ServiceContext create(InputStream s, GIOPVersion gv) { + return new SendingContextServiceContextImpl(s, gv); } - } ; + }; } - public static SendingContextServiceContext - makeSendingContextServiceContext( IOR ior ) - { - return new SendingContextServiceContextImpl( ior ) ; + public static SendingContextServiceContext makeSendingContextServiceContext(IOR ior) { + return new SendingContextServiceContextImpl(ior); } - public static ServiceContext.Factory makeUEInfoServiceContextFactory() - { + public static ServiceContext.Factory makeUEInfoServiceContextFactory() { return new ServiceContext.Factory() { - public int getId() - { - return UEInfoServiceContext.SERVICE_CONTEXT_ID ; + public int getId() { + return UEInfoServiceContext.SERVICE_CONTEXT_ID; } - public ServiceContext create( InputStream s, GIOPVersion gv ) - { - return new UEInfoServiceContextImpl( s, gv ) ; + public ServiceContext create(InputStream s, GIOPVersion gv) { + return new UEInfoServiceContextImpl(s, gv); } - } ; + }; } - public static UEInfoServiceContext - makeUEInfoServiceContext( Throwable thr ) - { - return new UEInfoServiceContextImpl( thr ) ; + public static UEInfoServiceContext makeUEInfoServiceContext(Throwable thr) { + return new UEInfoServiceContextImpl(thr); } - public static UnknownServiceContext - makeUnknownServiceContext( int id, byte[] data ) - { - return new UnknownServiceContextImpl( id, data ) ; + public static UnknownServiceContext makeUnknownServiceContext(int id, byte[] data) { + return new UnknownServiceContextImpl(id, data); } - public static UnknownServiceContext - makeUnknownServiceContext( int id, InputStream str ) - { - return new UnknownServiceContextImpl( id, str ) ; + public static UnknownServiceContext makeUnknownServiceContext(int id, InputStream str) { + return new UnknownServiceContextImpl(id, str); } } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextFactoryRegistry.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextFactoryRegistry.java index c33032b1d..70d0968e7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextFactoryRegistry.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextFactoryRegistry.java @@ -19,11 +19,11 @@ package com.sun.corba.ee.spi.servicecontext; -import com.sun.corba.ee.spi.servicecontext.ServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContext; public interface ServiceContextFactoryRegistry { - public void register( ServiceContext.Factory factory ) ; + public void register(ServiceContext.Factory factory); - public ServiceContext.Factory find( int scId ) ; + public ServiceContext.Factory find(int scId); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContexts.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContexts.java index 5042ccf45..7a44d4a2a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContexts.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContexts.java @@ -19,49 +19,50 @@ package com.sun.corba.ee.spi.servicecontext; -import org.omg.CORBA_2_3.portable.OutputStream ; +import org.omg.CORBA_2_3.portable.OutputStream; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.servicecontext.ServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContext; -/** The collection of ServiceContext instances used in a particular - * request. +/** + * The collection of ServiceContext instances used in a particular request. */ public interface ServiceContexts { - /** Write the service contexts to the output stream. - * If an UnknownExceptionInfo service context is present, - * it is written out last, so that it follows any - * SendingContext service context. This is required so that - * the codebase is available to handle value types if - * necessary. + /** + * Write the service contexts to the output stream. If an UnknownExceptionInfo service context is present, it is written + * out last, so that it follows any SendingContext service context. This is required so that the codebase is available + * to handle value types if necessary. * - * We should really do this as SendingContext goes first, so - * that we can guarantee correct marshalling of non-standard + * We should really do this as SendingContext goes first, so that we can guarantee correct marshalling of non-standard * service contexts. + * * @param os stream to write to * @param gv version to use */ - void write( OutputStream os, GIOPVersion gv ) ; - - /** Add a service context. Silently replaces an existing - * service context with the same id. + void write(OutputStream os, GIOPVersion gv); + + /** + * Add a service context. Silently replaces an existing service context with the same id. + * * @param sc service context to use */ - public void put( ServiceContext sc ) ; + public void put(ServiceContext sc); - /** Remove the service context with the id, if any. + /** + * Remove the service context with the id, if any. + * * @param scId service context id */ - public void delete( int scId ) ; + public void delete(int scId); - /** Return the service context with scId, or null if not - * found. + /** + * Return the service context with scId, or null if not found. + * * @param scId service context id * @return ServiceContext with the specified ID */ - public ServiceContext get( int scId) ; + public ServiceContext get(int scId); - public ServiceContexts copy() ; + public ServiceContexts copy(); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextsCache.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextsCache.java index 2a769b5e4..72360aa98 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextsCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/ServiceContextsCache.java @@ -26,15 +26,13 @@ public class ServiceContextsCache { public static enum CASE { - CLIENT_INITIAL, - CLIENT_SUBSEQUENT, - SERVER_INITIAL, - SERVER_SUBSEQUENT}; - + CLIENT_INITIAL, CLIENT_SUBSEQUENT, SERVER_INITIAL, SERVER_SUBSEQUENT + }; + private EnumMap data; private ORB orb; - public ServiceContextsCache (com.sun.corba.ee.spi.orb.ORB orb) { + public ServiceContextsCache(com.sun.corba.ee.spi.orb.ORB orb) { data = new EnumMap(CASE.class); this.orb = orb; @@ -45,34 +43,34 @@ public synchronized ServiceContexts get(CASE c) { if (data.size() == 0) { - //CLIENT_INITIAL + // CLIENT_INITIAL ServiceContexts scContainer = ServiceContextDefaults.makeServiceContexts(orb); scContainer.put(ServiceContextDefaults.getMaxStreamFormatVersionServiceContext()); - scContainer.put(ServiceContextDefaults.getORBVersionServiceContext()); + scContainer.put(ServiceContextDefaults.getORBVersionServiceContext()); scContainer.put(ServiceContextDefaults.makeSendingContextServiceContext(orb.getFVDCodeBaseIOR())); data.put(CASE.CLIENT_INITIAL, scContainer); - - //CLIENT_SUBSEQUENT + + // CLIENT_SUBSEQUENT scContainer = ServiceContextDefaults.makeServiceContexts(orb); scContainer.put(ServiceContextDefaults.getMaxStreamFormatVersionServiceContext()); - scContainer.put(ServiceContextDefaults.getORBVersionServiceContext()); - + scContainer.put(ServiceContextDefaults.getORBVersionServiceContext()); + data.put(CASE.CLIENT_SUBSEQUENT, scContainer); - - //SERVER_INITIAL + + // SERVER_INITIAL scContainer = ServiceContextDefaults.makeServiceContexts(orb); - scContainer.put(ServiceContextDefaults.getORBVersionServiceContext()); + scContainer.put(ServiceContextDefaults.getORBVersionServiceContext()); scContainer.put(ServiceContextDefaults.makeSendingContextServiceContext(orb.getFVDCodeBaseIOR())); - + data.put(CASE.SERVER_INITIAL, scContainer); - - //SERVER_SUBSEQUENT + + // SERVER_SUBSEQUENT scContainer = ServiceContextDefaults.makeServiceContexts(orb); - scContainer.put(ServiceContextDefaults.getORBVersionServiceContext()); - - data.put(CASE.SERVER_SUBSEQUENT, scContainer); - + scContainer.put(ServiceContextDefaults.getORBVersionServiceContext()); + + data.put(CASE.SERVER_SUBSEQUENT, scContainer); + } return (data.get(c)).copy(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/UEInfoServiceContext.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/UEInfoServiceContext.java index d5a3723a0..ce902a26d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/UEInfoServiceContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/UEInfoServiceContext.java @@ -19,12 +19,10 @@ package com.sun.corba.ee.spi.servicecontext; -import com.sun.corba.ee.spi.servicecontext.ServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContext; -public interface UEInfoServiceContext extends ServiceContext -{ - int SERVICE_CONTEXT_ID = 9 ; +public interface UEInfoServiceContext extends ServiceContext { + int SERVICE_CONTEXT_ID = 9; - Throwable getUE() ; + Throwable getUE(); } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/UnknownServiceContext.java b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/UnknownServiceContext.java index 8af9c0fb3..789e94cae 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/UnknownServiceContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/servicecontext/UnknownServiceContext.java @@ -22,9 +22,8 @@ import org.omg.CORBA_2_3.portable.InputStream; import org.omg.CORBA_2_3.portable.OutputStream; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; -import com.sun.corba.ee.spi.servicecontext.ServiceContext ; +import com.sun.corba.ee.spi.servicecontext.ServiceContext; -public interface UnknownServiceContext extends ServiceContext -{ - public byte[] getData() ; +public interface UnknownServiceContext extends ServiceContext { + public byte[] getData(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Cdr.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Cdr.java index ea863aab2..50a1bcb69 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Cdr.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Cdr.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup({ CdrRead.class, CdrWrite.class }) public @interface Cdr { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/CdrRead.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/CdrRead.java index 96c91fb2f..2ef2e86c3 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/CdrRead.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/CdrRead.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR unmarshaling - * implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * unmarshaling implementation in the ORB. */ @MethodMonitorGroup -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface CdrRead { } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/CdrWrite.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/CdrWrite.java index dac55204f..49ee79b6a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/CdrWrite.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/CdrWrite.java @@ -17,21 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR unmarshaling - * implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * unmarshaling implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface CdrWrite { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/DynamicType.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/DynamicType.java index ecfeee928..1578b328c 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/DynamicType.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/DynamicType.java @@ -17,21 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its traced methods are classified as part of the +/** + * This annotation is applied to a class or interface to indicate that its traced methods are classified as part of the * TypeCode/Any implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface DynamicType { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Folb.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Folb.java index c4afd1b9a..e381e4fae 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Folb.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Folb.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Folb { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Giop.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Giop.java index d958fdb7e..e34d9ddea 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Giop.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Giop.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Giop { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/IsLocal.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/IsLocal.java index c00157aa4..bd72f66ce 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/IsLocal.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/IsLocal.java @@ -17,19 +17,19 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the code that determines whether - * or not an invocation is a local invocation. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the code + * that determines whether or not an invocation is a local invocation. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface IsLocal { diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/MonitorRead.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/MonitorRead.java index 713a2460c..633217746 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/MonitorRead.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/MonitorRead.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class to indicate - * that its methods are classified as methods used to read primitive values. +/** + * This annotation is applied to a class to indicate that its methods are classified as methods used to read primitive + * values. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface MonitorRead { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/MonitorWrite.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/MonitorWrite.java index 09de2d173..c8a61289d 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/MonitorWrite.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/MonitorWrite.java @@ -17,18 +17,19 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class to indicate - * that its methods are classified as methods used to write primitive values. +/** + * This annotation is applied to a class to indicate that its methods are classified as methods used to write primitive + * values. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface MonitorWrite { diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Naming.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Naming.java index e24fee2ab..6e0c8eeac 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Naming.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Naming.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Naming { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/OrbLifeCycle.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/OrbLifeCycle.java index 0f230ac02..ec33202fb 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/OrbLifeCycle.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/OrbLifeCycle.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface OrbLifeCycle { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Orbd.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Orbd.java index fd4ebe9c0..5885a6044 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Orbd.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Orbd.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Orbd { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Osgi.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Osgi.java index 3c43f3f46..f77842fe4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Osgi.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Osgi.java @@ -17,18 +17,19 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Osgi { diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Poa.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Poa.java index 36fd5f569..97f03a273 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Poa.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Poa.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Poa { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PoaFSM.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PoaFSM.java index c36c64238..694d042ab 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PoaFSM.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PoaFSM.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface PoaFSM { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PrimitiveRead.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PrimitiveRead.java index 9f4099583..44b4e8a6a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PrimitiveRead.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PrimitiveRead.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class to indicate - * that its methods are classified as methods used to read primitive values. +/** + * This annotation is applied to a class to indicate that its methods are classified as methods used to read primitive + * values. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface PrimitiveRead { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PrimitiveWrite.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PrimitiveWrite.java index 08e0f5156..666c5cce2 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PrimitiveWrite.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/PrimitiveWrite.java @@ -17,21 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class to indicate - * that its methods are classified as methods used to write primitive values. +/** + * This annotation is applied to a class to indicate that its methods are classified as methods used to write primitive + * values. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface PrimitiveWrite { } - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Shutdown.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Shutdown.java index 1d9646eef..e75c55f3b 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Shutdown.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Shutdown.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Shutdown { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/StreamFormatVersion.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/StreamFormatVersion.java index ac912fb32..f312d4374 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/StreamFormatVersion.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/StreamFormatVersion.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface StreamFormatVersion { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Subcontract.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Subcontract.java index 4bb7310c9..af1e10bcf 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Subcontract.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Subcontract.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Subcontract { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceInterceptor.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceInterceptor.java index 2c25e4482..f6f27fdc0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceInterceptor.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceInterceptor.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface TraceInterceptor { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceServiceContext.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceServiceContext.java index 8558f77c2..5f7fd7f58 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceServiceContext.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceServiceContext.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface TraceServiceContext { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceValueHandler.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceValueHandler.java index 6469117a1..e8e010f25 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceValueHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TraceValueHandler.java @@ -17,19 +17,19 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the ValueHandler implementation - * in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the + * ValueHandler implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup({ ValueHandlerRead.class, ValueHandlerWrite.class }) public @interface TraceValueHandler { diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TransientObjectManager.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TransientObjectManager.java index 21cc0ee8e..feed655e9 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TransientObjectManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/TransientObjectManager.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface TransientObjectManager { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Transport.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Transport.java index 0ec8663be..a0dd992b6 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Transport.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/Transport.java @@ -17,20 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the CDR implementation in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the CDR + * implementation in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface Transport { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/ValueHandlerRead.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/ValueHandlerRead.java index 46f5a8e7d..4e6865e56 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/ValueHandlerRead.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/ValueHandlerRead.java @@ -17,21 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the ValueHandler implementation - * that is used for reading value types in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the + * ValueHandler implementation that is used for reading value types in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface ValueHandlerRead { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/ValueHandlerWrite.java b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/ValueHandlerWrite.java index a08039f53..e3a1b12ac 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/trace/ValueHandlerWrite.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/trace/ValueHandlerWrite.java @@ -17,21 +17,20 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.trace ; +package com.sun.corba.ee.spi.trace; -import java.lang.annotation.Target ; -import java.lang.annotation.ElementType ; -import java.lang.annotation.Retention ; -import java.lang.annotation.RetentionPolicy ; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import org.glassfish.pfl.tf.spi.annotation.MethodMonitorGroup; -/** This annotation is applied to a class or interface to indicate - * that its methods are classified as part of the ValueHandler implementation - * that is used for writing value types in the ORB. +/** + * This annotation is applied to a class or interface to indicate that its methods are classified as part of the + * ValueHandler implementation that is used for writing value types in the ORB. */ -@Target({ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) +@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @MethodMonitorGroup public @interface ValueHandlerWrite { } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Acceptor.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Acceptor.java index 5e0c950c1..4e794c1b7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Acceptor.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Acceptor.java @@ -30,55 +30,51 @@ import java.net.ServerSocket; import java.net.Socket; -import org.glassfish.gmbal.ManagedObject ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.Description ; +import org.glassfish.gmbal.ManagedObject; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.Description; /** * @author Harold Carr */ -@ManagedObject -@Description( "An Acceptor represents an endpoint on which the ORB handles incoming connections" ) -public abstract interface Acceptor -{ +@ManagedObject +@Description("An Acceptor represents an endpoint on which the ORB handles incoming connections") +public abstract interface Acceptor { @ManagedAttribute - @Description( "The TCP port of this Acceptor" ) - int getPort() ; + @Description("The TCP port of this Acceptor") + int getPort(); @ManagedAttribute - @Description( "The name of the IP interface for this Acceptor" ) - String getInterfaceName() ; + @Description("The name of the IP interface for this Acceptor") + String getInterfaceName(); @ManagedAttribute - @Description( "The type of requests that this Acceptor handles" ) - String getType() ; + @Description("The type of requests that this Acceptor handles") + String getType(); @ManagedAttribute - @Description( "True if this acceptor is used to lazily start the ORB" ) - boolean isLazy() ; + @Description("True if this acceptor is used to lazily start the ORB") + boolean isLazy(); + + void addToIORTemplate(IORTemplate iorTemplate, Policies policies, String codebase); - void addToIORTemplate(IORTemplate iorTemplate, Policies policies, - String codebase); String getMonitoringName(); /** * Used to initialize an Acceptor. * - * For example, initialization may mean to create a - * {@link java.nio.channels.ServerSocketChannel ServerSocketChannel}. + * For example, initialization may mean to create a {@link java.nio.channels.ServerSocketChannel ServerSocketChannel}. * * Note: this must be prepared to be be called multiple times. * - * @return true when it performs initializatin - * actions (typically the first call. + * @return true when it performs initializatin actions (typically the first call. */ boolean initialize(); /** * Used to determine if an Acceptor has been initialized. * - * @return true. if the Acceptor has been - * initialized. + * @return true. if the Acceptor has been initialized. */ boolean initialized(); @@ -89,26 +85,27 @@ void addToIORTemplate(IORTemplate iorTemplate, Policies policies, InboundConnectionCache getConnectionCache(); /** - * Used to determine if the Acceptor should register - * with a Selector to handle accept events. + * Used to determine if the Acceptor should register with a Selector to handle accept events. * - * For example, this may be false in the case of Solaris Doors - * which do not actively listen. + * For example, this may be false in the case of Solaris Doors which do not actively listen. * - * @return true if the Acceptor should be - * registered with a Selector. + * @return true if the Acceptor should be registered with a Selector. */ boolean shouldRegisterAcceptEvent(); - /** Blocks until a new Socket is available on the acceptor's port. + /** + * Blocks until a new Socket is available on the acceptor's port. + * * @return the new socket */ - Socket getAcceptedSocket(); + Socket getAcceptedSocket(); - /** Handle a newly accepted Socket. + /** + * Handle a newly accepted Socket. + * * @param channel socket to handle */ - void processSocket( Socket channel ); + void processSocket(Socket channel); /** * Close the Acceptor. @@ -118,7 +115,7 @@ void addToIORTemplate(IORTemplate iorTemplate, Policies policies, EventHandler getEventHandler(); CDROutputObject createOutputObject(ORB broker, MessageMediator messageMediator); - + ServerSocket getServerSocket(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ByteBufferPool.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ByteBufferPool.java index d3e81ed69..f7d7aba88 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ByteBufferPool.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ByteBufferPool.java @@ -24,15 +24,16 @@ /** * @author Charlie Hunt */ -public interface ByteBufferPool -{ +public interface ByteBufferPool { public ByteBuffer getByteBuffer(int theSize); + public void releaseByteBuffer(ByteBuffer thebb); + public int activeCount(); + /** - * Return a new ByteBuffer of at least minimumSize - * and copy any bytes in the oldByteBuffer starting at - * oldByteBuffer.position() up to oldByteBuffer.limit() + * Return a new ByteBuffer of at least minimumSize and copy any bytes in the + * oldByteBuffer starting at oldByteBuffer.position() up to oldByteBuffer.limit() * into the returned ByteBuffer. * * @param oldByteBuffer old buffer to take bytes from diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Connection.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Connection.java index 948301398..814824573 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Connection.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Connection.java @@ -28,8 +28,7 @@ import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.ior.iiop.GIOPVersion; import com.sun.corba.ee.spi.orb.ORB; import com.sun.corba.ee.spi.protocol.MessageMediator; @@ -42,30 +41,24 @@ /** * @author Harold Carr */ -public interface Connection - extends - com.sun.corba.ee.spi.legacy.connection.Connection -{ +public interface Connection extends com.sun.corba.ee.spi.legacy.connection.Connection { /** - * Used to determine if the Connection should register - * with the CorbaTransportManager Selector - * to handle read events. + * Used to determine if the Connection should register with the CorbaTransportManager Selector to handle + * read events. * - * For example, an HTTP transport would not register since the requesting - * thread would just block on read when waiting for the reply. + * For example, an HTTP transport would not register since the requesting thread would just block on read when waiting + * for the reply. * * @return true if it should be registered. */ public boolean shouldRegisterReadEvent(); /** - * Used to determine if the Connection should register - * with the - * CorbaTransportManager Selector - * to handle read events. + * Used to determine if the Connection should register with the CorbaTransportManager Selector to handle + * read events. * - * For example, an HTTP transport would not register since the requesting - * thread would just block on read when waiting for the reply. + * For example, an HTTP transport would not register since the requesting thread would just block on read when waiting + * for the reply. * * @return true if it should be registered. */ @@ -90,12 +83,9 @@ public interface Connection public EventHandler getEventHandler(); /** - * Indicates whether a CorbaContactInfo or CorbaAcceptor - * created the - * Connection. + * Indicates whether a CorbaContactInfo or CorbaAcceptor created the Connection. * - * @return true if a CorbaAcceptor - * created the Connection. + * @return true if a CorbaAcceptor created the Connection. */ public boolean isServer(); @@ -107,24 +97,21 @@ public interface Connection public boolean isClosed(); /** - * Indicates if the Connection is in the process of - * sending or receiving a message. + * Indicates if the Connection is in the process of sending or receiving a message. * * @return true if the Connection is busy. */ public boolean isBusy(); /** - * Timestamps are used for connection management, in particular, for - * reclaiming idle Connections. + * Timestamps are used for connection management, in particular, for reclaiming idle Connections. * * @return the "time" the Connection was last used. */ public long getTimeStamp(); /** - * Timestamps are used for connection management, in particular, for - * reclaiming idle Connections. + * Timestamps are used for connection management, in particular, for reclaiming idle Connections. * * @param time - the "time" the Connection was last used. */ @@ -140,11 +127,8 @@ public interface Connection /** * Grab a write lock on the Connection. * - * If another thread already has a write lock then the calling - * thread will block until the lock is released. The calling - * thread must call - * {@link #writeUnlock} - * when it is done. + * If another thread already has a write lock then the calling thread will block until the lock is released. The calling + * thread must call {@link #writeUnlock} when it is done. */ public void writeLock(); @@ -154,17 +138,15 @@ public interface Connection public void writeUnlock(); /* - * Send the data encoded in - * {@link com.sun.corba.ee.impl.encoding.CDROutputObject CDROutputObject} - * on the Connection. + * Send the data encoded in {@link com.sun.corba.ee.impl.encoding.CDROutputObject CDROutputObject} on the + * Connection. * * @param outputObject encoded data to send */ public void sendWithoutLock(CDROutputObject outputObject); /** - * Register an invocation's CorbaMessageMediator - * with the Connection. + * Register an invocation's CorbaMessageMediator with the Connection. * * This is useful in protocols which support fragmentation. * @@ -175,10 +157,8 @@ public interface Connection /** * If a message expect's a response then this method is called. * - * This method might block on a read (e.g., HTTP), put the calling - * thread to sleep while another thread read's the response (e.g., GIOP), - * or it may use the calling thread to perform the server-side work - * (e.g., Solaris Doors). + * This method might block on a read (e.g., HTTP), put the calling thread to sleep while another thread read's the + * response (e.g., GIOP), or it may use the calling thread to perform the server-side work (e.g., Solaris Doors). * * @param messageMediator mediator to process * @return stream @@ -186,8 +166,7 @@ public interface Connection public CDRInputObject waitForResponse(MessageMediator messageMediator); /** - * Unregister an invocation's * CorbaMessageMediator - * with the Connection. + * Unregister an invocation's * CorbaMessageMediator with the Connection. * * @param messageMediator mediator to unregister */ @@ -196,25 +175,32 @@ public interface Connection public void setConnectionCache(ConnectionCache connectionCache); public ConnectionCache getConnectionCache(); + public boolean hasSocketChannel(); - public void write(ByteBuffer byteBuffer) - throws IOException; + public void write(ByteBuffer byteBuffer) throws IOException; public int getNextRequestId(); + public ORB getBroker(); + public CodeSetComponentInfo.CodeSetContext getCodeSetContext(); + public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc); // Facade to ResponseWaitingRoom. public MessageMediator clientRequestMapGet(int requestId); public void clientReply_1_1_Put(MessageMediator x); + public MessageMediator clientReply_1_1_Get(); + public void clientReply_1_1_Remove(); public void serverRequest_1_1_Put(MessageMediator x); + public MessageMediator serverRequest_1_1_Get(); + public void serverRequest_1_1_Remove(); public boolean isPostInitialContexts(); @@ -222,8 +208,7 @@ public void write(ByteBuffer byteBuffer) // Can never be unset... public void setPostInitialContexts(); - public void purgeCalls(SystemException systemException, - boolean die, boolean lockHeld); + public void purgeCalls(SystemException systemException, boolean die, boolean lockHeld); // // Connection status @@ -236,15 +221,15 @@ public void purgeCalls(SystemException systemException, // Begin Code Base methods --------------------------------------- // - // Set this connection's code base IOR. The IOR comes from the - // SendingContext. This is an optional service context, but all + // Set this connection's code base IOR. The IOR comes from the + // SendingContext. This is an optional service context, but all // JavaSoft ORBs send it. // // The set and get methods don't need to be synchronized since the // first possible get would occur during reading a valuetype, and // that would be after the set. - // Sets this connection's code base IOR. This is done after + // Sets this connection's code base IOR. This is done after // getting the IOR out of the SendingContext service context. // Our ORBs always send this, but it's optional in CORBA. @@ -252,36 +237,31 @@ public void purgeCalls(SystemException systemException, IOR getCodeBaseIOR(); - // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase + // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase // won't connect to the remote codebase unless it's necessary. CodeBase getCodeBase(); // End Code Base methods ----------------------------------------- - public void sendCloseConnection(GIOPVersion giopVersion) - throws IOException; + public void sendCloseConnection(GIOPVersion giopVersion) throws IOException; - public void sendMessageError(GIOPVersion giopVersion) - throws IOException; + public void sendMessageError(GIOPVersion giopVersion) throws IOException; - public void sendCancelRequest(GIOPVersion giopVersion, int requestId) - throws - IOException; + public void sendCancelRequest(GIOPVersion giopVersion, int requestId) throws IOException; // NOTE: This method can throw a connection rebind SystemException. - public void sendCancelRequestWithLock(GIOPVersion giopVersion, - int requestId) - throws - IOException; + public void sendCancelRequestWithLock(GIOPVersion giopVersion, int requestId) throws IOException; public ResponseWaitingRoom getResponseWaitingRoom(); - public void serverRequestMapPut(int requestId, - MessageMediator messageMediator); + public void serverRequestMapPut(int requestId, MessageMediator messageMediator); + public MessageMediator serverRequestMapGet(int requestId); + public void serverRequestMapRemove(int requestId); public Queue getFragmentList(RequestId corbaRequestId); + public void removeFragmentList(RequestId corbaRequestId); // REVISIT: WRONG: should not expose sockets here. @@ -289,11 +269,13 @@ public void serverRequestMapPut(int requestId, // REVISIT - CorbaMessageMediator parameter? public void serverRequestProcessingBegins(); + public void serverRequestProcessingEnds(); - /** Clean up all connection resources. Used when shutting down an ORB. + /** + * Clean up all connection resources. Used when shutting down an ORB. */ - public void closeConnectionResources() ; + public void closeConnectionResources(); } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ConnectionCache.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ConnectionCache.java index 3c2da5024..06a46ede0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ConnectionCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ConnectionCache.java @@ -19,13 +19,12 @@ package com.sun.corba.ee.spi.transport; -import org.glassfish.external.statistics.CountStatistic ; +import org.glassfish.external.statistics.CountStatistic; /** * @author Harold Carr */ -public interface ConnectionCache -{ +public interface ConnectionCache { public String getMonitoringName(); public String getCacheType(); @@ -40,11 +39,11 @@ public interface ConnectionCache public boolean reclaim(); - /** Close all connections in the connection cache. - * This is used as a final cleanup, and will result - * in abrupt termination of any pending communications. + /** + * Close all connections in the connection cache. This is used as a final cleanup, and will result in abrupt termination + * of any pending communications. */ - public void close() ; + public void close(); } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfo.java index cc713fbda..da3e62ad1 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfo.java @@ -22,7 +22,7 @@ import com.sun.corba.ee.spi.protocol.ClientRequestDispatcher; import com.sun.corba.ee.impl.encoding.CDRInputObject; import com.sun.corba.ee.impl.encoding.CDROutputObject; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.ior.iiop.IIOPProfile; import com.sun.corba.ee.spi.orb.ORB; @@ -31,14 +31,19 @@ /** * @author Harold Carr */ -public abstract interface ContactInfo extends SocketInfo -{ - public ContactInfoList getContactInfoList() ; +public abstract interface ContactInfo extends SocketInfo { + public ContactInfoList getContactInfoList(); + public IOR getTargetIOR(); + public IOR getEffectiveTargetIOR(); + public IIOPProfile getEffectiveProfile(); // REVISIT - type + public void setAddressingDisposition(short addressingDisposition); + public short getAddressingDisposition(); + public String getMonitoringName(); public ORB getBroker(); @@ -46,29 +51,22 @@ public abstract interface ContactInfo extends SocketInfo public ClientRequestDispatcher getClientRequestDispatcher(); /** - * Used to determine if a CorbaConnection - * will be present in an invocation. + * Used to determine if a CorbaConnection will be present in an invocation. * - * For example, it may be - * false in the case of shared-memory - * Input/OutputObjects. + * For example, it may be false in the case of shared-memory Input/OutputObjects. * - * @return true if a CorbaConnection - * will be used for an invocation. + * @return true if a CorbaConnection will be used for an invocation. */ public boolean isConnectionBased(); /** - * Used to determine if the CorbaConnection - * used for a request should be cached. + * Used to determine if the CorbaConnection used for a request should be cached. * - * If true then the ORB will attempt to reuse an existing - * CorbaConnection. If - * one is not found it will create a new one and cache it for future use. + * If true then the ORB will attempt to reuse an existing CorbaConnection. If one is not found it will + * create a new one and cache it for future use. * * - * @return true if a CorbaConnection - * created by this ContactInfo should be cached. + * @return true if a CorbaConnection created by this ContactInfo should be cached. */ public boolean shouldCacheConnection(); @@ -80,9 +78,8 @@ public abstract interface ContactInfo extends SocketInfo public Connection createConnection(); - public MessageMediator createMessageMediator(ORB broker, - ContactInfo contactInfo, Connection connection, - String methodName, boolean isOneWay); + public MessageMediator createMessageMediator(ORB broker, ContactInfo contactInfo, Connection connection, String methodName, + boolean isOneWay); public CDROutputObject createOutputObject(MessageMediator messageMediator); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoList.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoList.java index f539f75d0..3e8175f43 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoList.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoList.java @@ -19,23 +19,24 @@ package com.sun.corba.ee.spi.transport; -import java.util.Iterator ; +import java.util.Iterator; -import com.sun.corba.ee.spi.ior.IOR ; - -import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher ; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.spi.protocol.LocalClientRequestDispatcher; /** * @author Harold Carr */ -public abstract interface ContactInfoList -{ - public Iterator iterator() ; // covariant override +public abstract interface ContactInfoList { + public Iterator iterator(); // covariant override + public void setTargetIOR(IOR ior); + public IOR getTargetIOR(); public void setEffectiveTargetIOR(IOR locatedIor); + public IOR getEffectiveTargetIOR(); public LocalClientRequestDispatcher getLocalClientRequestDispatcher(); diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoListFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoListFactory.java index 77b909645..1844ad3ce 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoListFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoListFactory.java @@ -17,29 +17,25 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.transport ; +package com.sun.corba.ee.spi.transport; - -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.ior.IOR; import com.sun.corba.ee.spi.orb.ORB; -/** Interface used to create a ContactInfoList from an IOR, as required - * for supporting CORBA semantics using the DCS framework. This is a - * natural correspondence since an IOR contains the information for - * contacting one or more communication endpoints that can be used to - * invoke a method on an object, along with the necessary information - * on particular transports, encodings, and protocols to use. - * Note that the actual implementation may support more than one - * IOR in the case of GIOP with Location Forward messages. +/** + * Interface used to create a ContactInfoList from an IOR, as required for supporting CORBA semantics using the DCS + * framework. This is a natural correspondence since an IOR contains the information for contacting one or more + * communication endpoints that can be used to invoke a method on an object, along with the necessary information on + * particular transports, encodings, and protocols to use. Note that the actual implementation may support more than one + * IOR in the case of GIOP with Location Forward messages. */ public interface ContactInfoListFactory { /** - * This will be called after the no-arg constructor before - * create is called. + * This will be called after the no-arg constructor before create is called. * * @param orb ORB to use in factory */ public void setORB(ORB orb); - public ContactInfoList create( IOR ior ) ; + public ContactInfoList create(IOR ior); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoListIterator.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoListIterator.java index 0f9043351..9cf57097a 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoListIterator.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ContactInfoListIterator.java @@ -17,20 +17,16 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.transport ; - +package com.sun.corba.ee.spi.transport; import com.sun.corba.ee.spi.ior.IOR; import java.util.Iterator; -public abstract interface ContactInfoListIterator - extends Iterator { +public abstract interface ContactInfoListIterator extends Iterator { - public void reportAddrDispositionRetry(ContactInfo contactInfo, - short disposition); + public void reportAddrDispositionRetry(ContactInfo contactInfo, short disposition); - public void reportRedirect(ContactInfo contactInfo, - IOR forwardedIOR); + public void reportRedirect(ContactInfo contactInfo, IOR forwardedIOR); public ContactInfoList getContactInfoList(); @@ -43,4 +39,3 @@ public void reportRedirect(ContactInfo contactInfo, } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/EventHandler.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/EventHandler.java index 482eb8e3d..1931d7c78 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/EventHandler.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/EventHandler.java @@ -29,9 +29,9 @@ * * This should only be registered with ONE selector. */ -public interface EventHandler -{ +public interface EventHandler { public void setUseSelectThreadToWait(boolean x); + public boolean shouldUseSelectThreadToWait(); public SelectableChannel getChannel(); @@ -39,6 +39,7 @@ public interface EventHandler public int getInterestOps(); public void setSelectionKey(SelectionKey selectionKey); + public SelectionKey getSelectionKey(); public void handleEvent(); @@ -47,23 +48,18 @@ public interface EventHandler // allow discrimination between different ops and how threading // is handled. public void setUseWorkerThreadForEvent(boolean x); + public boolean shouldUseWorkerThreadForEvent(); public void setWork(Work work); + public Work getWork(); // REVISIT: need base class with two derived. public Acceptor getAcceptor(); + public Connection getConnection(); } // End of file. - - - - - - - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IIOPPrimaryToContactInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IIOPPrimaryToContactInfo.java index 2f70a9ab2..ce54021d8 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IIOPPrimaryToContactInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IIOPPrimaryToContactInfo.java @@ -24,25 +24,20 @@ import com.sun.corba.ee.spi.transport.ContactInfo; /** - * This interface is the "sticky manager" for IIOP failover. The default - * ORB does NOT contain a sticky manager. One is registered by supplying - * a class via the com.sun.corba.ee.transport.ORBIIOPPrimaryToContactInfoClass. + * This interface is the "sticky manager" for IIOP failover. The default ORB does NOT contain a sticky manager. One is + * registered by supplying a class via the com.sun.corba.ee.transport.ORBIIOPPrimaryToContactInfoClass. * - * It uses the IIOP primary host/port (with a SocketInfo.IIOP_CLEAR_TEXT type) - * as a key to map to the last ContactInfo that resulted in successful' - * communication. + * It uses the IIOP primary host/port (with a SocketInfo.IIOP_CLEAR_TEXT type) as a key to map to the last ContactInfo + * that resulted in successful' communication. * - * It mainly prevents "fallback" - if a previously failed replica comes - * back up we do NOT want to switch back to using it - particularly in the - * case of statefull session beans. + * It mainly prevents "fallback" - if a previously failed replica comes back up we do NOT want to switch back to using + * it - particularly in the case of statefull session beans. * - * Note: This assumes static lists of replicas (e.g., AS 8.1 EE). - * This does NOT work well with LOCATION_FORWARD. + * Note: This assumes static lists of replicas (e.g., AS 8.1 EE). This does NOT work well with LOCATION_FORWARD. * * @author Harold Carr */ -public interface IIOPPrimaryToContactInfo -{ +public interface IIOPPrimaryToContactInfo { /** * @param primary - clear any state relating to primary. */ @@ -50,33 +45,23 @@ public interface IIOPPrimaryToContactInfo /** * @param primary the key. - * @param previous if null return true. Otherwise, find previous in - * contactInfos and if another ContactInfo - * follows it in the list then return true. Otherwise false. - * @param contactInfos the list of replicas associated with the - * primary. + * @param previous if null return true. Otherwise, find previous in contactInfos and if another + * ContactInfo follows it in the list then return true. Otherwise false. + * @param contactInfos the list of replicas associated with the primary. * @return if there is another */ - public boolean hasNext(ContactInfo primary, - ContactInfo previous, - List contactInfos); + public boolean hasNext(ContactInfo primary, ContactInfo previous, List contactInfos); /** * @param primary the key. - * @param previous if null then map primary to failover. If failover is - * empty then map primary to first ContactInfo in contactInfos and mapped entry. - * If failover is - * non-empty then return failover. If previous is non-null that - * indicates that the previous failed. Therefore, find previous in - * contactInfos. Map the ContactInfo following - * previous to primary and return that ContactInfo. - * @param contactInfos the list of replicas associated with the - * primary. + * @param previous if null then map primary to failover. If failover is empty then map primary to first + * ContactInfo in contactInfos and mapped entry. If failover is non-empty then return failover. If previous + * is non-null that indicates that the previous failed. Therefore, find previous in contactInfos. Map the + * ContactInfo following previous to primary and return that ContactInfo. + * @param contactInfos the list of replicas associated with the primary. * @return the next ContactInfo */ - public ContactInfo next(ContactInfo primary, - ContactInfo previous, - List contactInfos); + public ContactInfo next(ContactInfo primary, ContactInfo previous, List contactInfos); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IORToSocketInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IORToSocketInfo.java index 7ec24eac3..666dafb78 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IORToSocketInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IORToSocketInfo.java @@ -23,15 +23,15 @@ import com.sun.corba.ee.spi.ior.IOR; -public interface IORToSocketInfo -{ - /** Used to extract socket address information from an IOR. +public interface IORToSocketInfo { + /** + * Used to extract socket address information from an IOR. + * * @param ior The ior from which the socket info is extracted. * @param previous The previous list, which may be reused if not null. * @return a list of SocketInfo. */ - public List getSocketInfo(IOR ior, - List previous); + public List getSocketInfo(IOR ior, List previous); } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IORTransformer.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IORTransformer.java index b76460a23..7d81522b0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IORTransformer.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/IORTransformer.java @@ -17,18 +17,18 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.transport ; +package com.sun.corba.ee.spi.transport; -import com.sun.corba.ee.spi.ior.IOR ; -import com.sun.corba.ee.impl.encoding.CDRInputObject ; -import com.sun.corba.ee.impl.encoding.CDROutputObject ; +import com.sun.corba.ee.spi.ior.IOR; +import com.sun.corba.ee.impl.encoding.CDRInputObject; +import com.sun.corba.ee.impl.encoding.CDROutputObject; -/** Interface that provides operations to transorm an IOR - * between its programmatic representation and a representation - * in an Input or Output object. +/** + * Interface that provides operations to transorm an IOR between its programmatic representation and a representation in + * an Input or Output object. */ public interface IORTransformer { - IOR unmarshal( CDRInputObject io ) ; + IOR unmarshal(CDRInputObject io); - void marshal( CDROutputObject oo, IOR ior ) ; + void marshal(CDROutputObject oo, IOR ior); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/InboundConnectionCache.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/InboundConnectionCache.java index 157656595..14233cfba 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/InboundConnectionCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/InboundConnectionCache.java @@ -19,18 +19,15 @@ package com.sun.corba.ee.spi.transport; - /** * @author Harold Carr */ -public interface InboundConnectionCache extends ConnectionCache -{ +public interface InboundConnectionCache extends ConnectionCache { public Connection get(Acceptor acceptor); // REVISIT public void put(Acceptor acceptor, Connection connection); - public void remove( Connection connection ) ; + public void remove(Connection connection); } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ListenerThread.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ListenerThread.java index b626f18a0..d2c80e987 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ListenerThread.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ListenerThread.java @@ -22,18 +22,10 @@ /** * @author Harold Carr */ -public interface ListenerThread -{ +public interface ListenerThread { public Acceptor getAcceptor(); + public void close(); } // End of file. - - - - - - - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/MessageData.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/MessageData.java index 0ea3e3201..2eb149d87 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/MessageData.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/MessageData.java @@ -19,30 +19,27 @@ package com.sun.corba.ee.spi.transport; -import com.sun.corba.ee.impl.protocol.giopmsgheaders.Message ; +import com.sun.corba.ee.impl.protocol.giopmsgheaders.Message; import com.sun.corba.ee.impl.encoding.CDRInputObject; public interface MessageData { - /** An array of GIOP messages. The messages will - * satisfy: + /** + * An array of GIOP messages. The messages will satisfy: *
      - *
    1. If there is more than one message, the first message is - * a request or a reply.
    2. - *
    3. If there is more than one message, all messages after the first - * will be fragment messages.
    4. - *
    5. If there is more than one message, all messages will share the - * same request ID (for GIOP 1.2).
    6. - *
    7. The more fragments bit will be set on all messages except the - * last message.
    8. + *
    9. If there is more than one message, the first message is a request or a reply.
    10. + *
    11. If there is more than one message, all messages after the first will be fragment messages.
    12. + *
    13. If there is more than one message, all messages will share the same request ID (for GIOP 1.2).
    14. + *
    15. The more fragments bit will be set on all messages except the last message.
    16. *
    + * * @return GIOP messages */ - Message[] getMessages() ; + Message[] getMessages(); - /** A fully initialized input stream for the message data, positioned - * at the first element of the body. - * - * @return stream of data - */ - CDRInputObject getStream() ; + /** + * A fully initialized input stream for the message data, positioned at the first element of the body. + * + * @return stream of data + */ + CDRInputObject getStream(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/MessageTraceManager.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/MessageTraceManager.java index 347ab5fc2..64e679ca7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/MessageTraceManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/MessageTraceManager.java @@ -21,46 +21,45 @@ import java.nio.ByteBuffer; -/** Interface that supports capturing the GIOP messages for the - * last non-co-located invocation in the current thread. - * This enables easy capture of the GIOP messages for testing - * purposes. +/** + * Interface that supports capturing the GIOP messages for the last non-co-located invocation in the current thread. + * This enables easy capture of the GIOP messages for testing purposes. */ public interface MessageTraceManager { - /** Discard all messages accumulated since the last call to - * clear. + /** + * Discard all messages accumulated since the last call to clear. */ - void clear() ; + void clear(); - /** Returns true if messages are to be captured on this thread, otherwise - * false. + /** + * Returns true if messages are to be captured on this thread, otherwise false. * * @return if messages are captured */ - boolean isEnabled() ; + boolean isEnabled(); - /** Called with flag=true to enable capture of messages. + /** + * Called with flag=true to enable capture of messages. * * @param flag enable capture */ - void enable( boolean flag ) ; + void enable(boolean flag); - /** Return an array of messages (represented as byte[]) for the - * message(s) sent on this thread since the last call to clear(). - * If there is a Location Forward in this invocation, the - * the data returned will include all requests sent starting - * with the first request. + /** + * Return an array of messages (represented as byte[]) for the message(s) sent on this thread since the last call to + * clear(). If there is a Location Forward in this invocation, the the data returned will include all requests sent + * starting with the first request. * * @return array of messages */ - byte[][] getDataSent() ; + byte[][] getDataSent(); - /** Return an array of messages (represented as byte[]) for the - * message(s) received since the last call to clear(). + /** + * Return an array of messages (represented as byte[]) for the message(s) received since the last call to clear(). * * @return messages received */ - byte[][] getDataReceived() ; + byte[][] getDataReceived(); void recordDataSent(ByteBuffer message); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ORBSocketFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ORBSocketFactory.java index 3bc03e9e8..e4c35c040 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ORBSocketFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ORBSocketFactory.java @@ -30,24 +30,15 @@ /** * @author Harold Carr */ -public interface ORBSocketFactory -{ +public interface ORBSocketFactory { public void setORB(ORB orb); - public ServerSocket createServerSocket(String type, - InetSocketAddress inetSocketAddress) - throws IOException; + public ServerSocket createServerSocket(String type, InetSocketAddress inetSocketAddress) throws IOException; - public Socket createSocket(String type, - InetSocketAddress inetSocketAddress) - throws IOException; + public Socket createSocket(String type, InetSocketAddress inetSocketAddress) throws IOException; - public void setAcceptedSocketOptions(Acceptor acceptor, - ServerSocket serverSocket, - Socket socket) - throws SocketException; + public void setAcceptedSocketOptions(Acceptor acceptor, ServerSocket serverSocket, Socket socket) throws SocketException; } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/OutboundConnectionCache.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/OutboundConnectionCache.java index e9414db55..569c27237 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/OutboundConnectionCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/OutboundConnectionCache.java @@ -19,18 +19,15 @@ package com.sun.corba.ee.spi.transport; - /** * @author Harold Carr */ -public interface OutboundConnectionCache extends ConnectionCache -{ +public interface OutboundConnectionCache extends ConnectionCache { public Connection get(ContactInfo contactInfo); public void put(ContactInfo contactInfo, Connection connection); - public void remove( ContactInfo contactInfo ) ; + public void remove(ContactInfo contactInfo); } // End of file. - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ReaderThread.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ReaderThread.java index c4aaf9e90..516d2f499 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ReaderThread.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ReaderThread.java @@ -24,15 +24,8 @@ */ public interface ReaderThread { public Connection getConnection(); + public void close(); } // End of file. - - - - - - - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ResponseWaitingRoom.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ResponseWaitingRoom.java index c462dd2bb..176d08311 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ResponseWaitingRoom.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/ResponseWaitingRoom.java @@ -26,7 +26,7 @@ /** * @author Harold Carr */ -public interface ResponseWaitingRoom{ +public interface ResponseWaitingRoom { public void registerWaiter(MessageMediator messageMediator); // REVISIT: maybe return void (or MessageMediator). diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Selector.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Selector.java index f8f77df7b..4d3d545d5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Selector.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/Selector.java @@ -22,22 +22,18 @@ /** * @author Harold Carr */ -public interface Selector -{ +public interface Selector { public void setTimeout(long timeout); + public long getTimeout(); + public void registerInterestOps(EventHandler eventHandler); + public void registerForEvent(EventHandler eventHander); + public void unregisterForEvent(EventHandler eventHandler); + public void close(); } // End of file. - - - - - - - - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/SocketInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/SocketInfo.java index 762b73b87..130c725fe 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/SocketInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/SocketInfo.java @@ -19,19 +19,18 @@ package com.sun.corba.ee.spi.transport; -public interface SocketInfo -{ +public interface SocketInfo { // Endpoint types known in advance. // If you change the value of this constant then update - // activation.idl accordingly. It has a duplicate definition + // activation.idl accordingly. It has a duplicate definition // to avoid a compilation dependency. String IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT"; - String SSL_PREFIX = "SSL" ; + String SSL_PREFIX = "SSL"; String getType(); String getHost(); - int getPort(); + int getPort(); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TcpTimeouts.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TcpTimeouts.java index 71986ca2c..a135ea9bb 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TcpTimeouts.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TcpTimeouts.java @@ -19,132 +19,128 @@ package com.sun.corba.ee.spi.transport; -import com.sun.corba.ee.impl.transport.TcpTimeoutsImpl ; +import com.sun.corba.ee.impl.transport.TcpTimeoutsImpl; -/** This interface defines the ability to wait for a configurable time, - * applying an exponential backoff to increase the time. The maximum - * single wait time can be bounded, as well as the maximum total wait time. +/** + * This interface defines the ability to wait for a configurable time, applying an exponential backoff to increase the + * time. The maximum single wait time can be bounded, as well as the maximum total wait time. */ public interface TcpTimeouts { - /** Return the initial time to wait on the first getTime or sleepTime - * call on a new Waiter instance. + /** + * Return the initial time to wait on the first getTime or sleepTime call on a new Waiter instance. * * @return time in milliseconds */ int get_initial_time_to_wait(); - /** Get the maximum total time a Waiter can exist before isExpired returns - * true. -1 if not used for this TcpTimeouts instances. + /** + * Get the maximum total time a Waiter can exist before isExpired returns true. -1 if not used for this TcpTimeouts + * instances. * * @return time in milliseconds */ int get_max_time_to_wait(); - /** Get the maximum time a single sleepTime or getTime can taoke or return - * in an instance of Waiter. -1 if not used. + /** + * Get the maximum time a single sleepTime or getTime can taoke or return in an instance of Waiter. -1 if not used. * * @return time in milliseconds */ - int get_max_single_wait_time() ; + int get_max_single_wait_time(); - /** Return the backoff factor, which is the percentage multiplier used - * to compute the next timeout in the Waiter.advance method. + /** + * Return the backoff factor, which is the percentage multiplier used to compute the next timeout in the Waiter.advance + * method. * * @return percentage multiplier */ int get_backoff_factor(); - /** Interface used to represent a series of timeout values using - * exponential backoff. Supports both a maximum total wait time - * and a maximum single wait time. + /** + * Interface used to represent a series of timeout values using exponential backoff. Supports both a maximum total wait + * time and a maximum single wait time. *

    - * The total wait time starts at - * 0 and is incremented by each call to getTimeForSleep or sleepTime. - * Once the total wait time exceeds the maximum total wait time, - * isExpired returns true. + * The total wait time starts at 0 and is incremented by each call to getTimeForSleep or sleepTime. Once the total wait + * time exceeds the maximum total wait time, isExpired returns true. *

    - * The timer also has a current wait time, which is returned by getTime - * and is the interval for which sleep waits. The initial value - * of the current wait time is get_initial_time_to_wait(). - * Each subsequent call to advance increases the current wait time by - * a factor of (previous*get_backoff_factor())/100, unless - * get_max_single_wait_time is configured and - * the current wait time exceeds get_max_single_wait_time(). - * If get_max_single_wait_time() is not used, the current time - * increases without bound (until it overflows). Once - * get_max_single_wait_time() is reached, - * every subsequent call to next() returnes get_max_single_wait_time(), - * and advance has no effect. + * The timer also has a current wait time, which is returned by getTime and is the interval for which sleep waits. The + * initial value of the current wait time is get_initial_time_to_wait(). Each subsequent call to advance increases the + * current wait time by a factor of (previous*get_backoff_factor())/100, unless get_max_single_wait_time is configured + * and the current wait time exceeds get_max_single_wait_time(). If get_max_single_wait_time() is not used, the current + * time increases without bound (until it overflows). Once get_max_single_wait_time() is reached, every subsequent call + * to next() returnes get_max_single_wait_time(), and advance has no effect. */ public interface Waiter { - /** Advance to the next timeout value. + /** + * Advance to the next timeout value. */ - void advance() ; + void advance(); - /** Set the current timeout back to the initial - * value. Accumulated time is not affected. + /** + * Set the current timeout back to the initial value. Accumulated time is not affected. */ - void reset() ; + void reset(); - /** Return the current timeout value. - * Also increments total time. + /** + * Return the current timeout value. Also increments total time. * * @return timeout in milliseconds */ - int getTimeForSleep() ; + int getTimeForSleep(); - /** Return the current timeout value, - * but do not increment total wait time. + /** + * Return the current timeout value, but do not increment total wait time. * * @return timeout in milliseconds */ - int getTime() ; + int getTime(); - /** Return the accumulated wait time. + /** + * Return the accumulated wait time. * * @return time in milliseconds */ - int timeWaiting() ; + int timeWaiting(); - /** Sleep for the current timeout value. - * Returns true if sleep happened, otherwise false, - * in the case where the Waiter has expired. + /** + * Sleep for the current timeout value. Returns true if sleep happened, otherwise false, in the case where the Waiter + * has expired. * * @return true if sleep happened */ - boolean sleepTime() ; + boolean sleepTime(); - /** Returns true if the waiter has expired. It expires - * once the total wait time exceeds get_max_wait_time. + /** + * Returns true if the waiter has expired. It expires once the total wait time exceeds get_max_wait_time. * * @return if the waiter has expired */ - boolean isExpired() ; + boolean isExpired(); } - /** Return a Waiter that can be used for computing a series - * of timeouts. + /** + * Return a Waiter that can be used for computing a series of timeouts. * * @return Waiter for timeouts */ - Waiter waiter() ; + Waiter waiter(); - /** Factory used to create TcpTimeouts instances. + /** + * Factory used to create TcpTimeouts instances. */ public interface Factory { - /** Create TcpTimeouts assuming that max_single_wait is - * unbounded. + /** + * Create TcpTimeouts assuming that max_single_wait is unbounded. * * @param initial_time_to_wait initial time in milliseconds * @param backoff_value percentage multiplier * @param max_time_to_wait max time in milliseconds * @return Constructed TcpTimeout */ - TcpTimeouts create( int initial_time_to_wait, - int max_time_to_wait, int backoff_value ) ; + TcpTimeouts create(int initial_time_to_wait, int max_time_to_wait, int backoff_value); - /** Create TcpTimeouts using all configuration parameters, - * including a bound on the maximum single wait time. + /** + * Create TcpTimeouts using all configuration parameters, including a bound on the maximum single wait time. * * @param initial_time_to_wait initial time in milliseconds * @param backoff_value percentage multiplier @@ -152,39 +148,33 @@ TcpTimeouts create( int initial_time_to_wait, * @param max_single_wait max single time in milliseconds * @return Constructed TcpTimeout */ - TcpTimeouts create( int initial_time_to_wait, - int max_time_to_wait, int backoff_value, int max_single_wait ) ; + TcpTimeouts create(int initial_time_to_wait, int max_time_to_wait, int backoff_value, int max_single_wait); - /** Create TcpTimeouts from a configuration string. args must - * be a : separated string, with 3 or 4 args, all of which are - * positive decimal integers. The integers are in the same - * order as the arguments to the other create methods. + /** + * Create TcpTimeouts from a configuration string. args must be a : separated string, with 3 or 4 args, all of which are + * positive decimal integers. The integers are in the same order as the arguments to the other create methods. * * @param args a colon separated string * @return Constructed TcpTimeout */ - TcpTimeouts create( String args ) ; + TcpTimeouts create(String args); } Factory factory = new Factory() { - public TcpTimeouts create( int initial_time_to_wait, - int max_time_to_wait, int backoff_value ) { + public TcpTimeouts create(int initial_time_to_wait, int max_time_to_wait, int backoff_value) { - return new TcpTimeoutsImpl( initial_time_to_wait, - max_time_to_wait, backoff_value ) ; + return new TcpTimeoutsImpl(initial_time_to_wait, max_time_to_wait, backoff_value); } - public TcpTimeouts create( int initial_time_to_wait, - int max_time_to_wait, int backoff_value, int max_single_wait ) { + public TcpTimeouts create(int initial_time_to_wait, int max_time_to_wait, int backoff_value, int max_single_wait) { - return new TcpTimeoutsImpl( initial_time_to_wait, - max_time_to_wait, backoff_value, max_single_wait ) ; + return new TcpTimeoutsImpl(initial_time_to_wait, max_time_to_wait, backoff_value, max_single_wait); } - public TcpTimeouts create( String args ) { - return new TcpTimeoutsImpl( args ) ; + public TcpTimeouts create(String args) { + return new TcpTimeoutsImpl(args); } - } ; + }; } // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TemporarySelectorState.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TemporarySelectorState.java index df6eaceee..3a2863ef5 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TemporarySelectorState.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TemporarySelectorState.java @@ -36,154 +36,118 @@ */ public interface TemporarySelectorState { /** - * Selects a set of keys whose corresponding SelectableChannel is ready for - * I/O operations. + * Selects a set of keys whose corresponding SelectableChannel is ready for I/O operations. * - *

    This method performs a blocking selection - * operation on theSelector. It returns only after the - * SelectableChannel is selected, theSelector's wakeup - * method is invoked, the current thread is interrupted, or the given - * timeout period expires, whichever comes first. + *

    + * This method performs a blocking selection operation on theSelector. It returns only after the + * SelectableChannel is selected, theSelector's wakeup method is invoked, the current thread is interrupted, or the + * given timeout period expires, whichever comes first. * - *

    This method does not offer real-time guarantees: It schedules - * theTimeout as if by invoking the {@link Object#wait(long)} method.

    + *

    + * This method does not offer real-time guarantees: It schedules theTimeout as if by invoking the + * {@link Object#wait(long)} method. + *

    * - * @param theSelector The Selector to use - * @param theTimeout If positive, block for up to theTimeout - * milliseconds, more or less, while waiting for a - * SelectableChannel to become ready; must be greater - * than 0 in value + * @param theSelector The Selector to use + * @param theTimeout If positive, block for up to theTimeout milliseconds, more or less, while waiting for a + * SelectableChannel to become ready; must be greater than 0 in value * - * @throws IOException - * If an I/O error occurs + * @throws IOException If an I/O error occurs * - * @throws java.nio.channels.ClosedSelectorException - * If this theSelector is closed + * @throws java.nio.channels.ClosedSelectorException If this theSelector is closed * - * @throws IllegalArgumentException - * If the value of the theTimeout argument is not greater than 0 + * @throws IllegalArgumentException If the value of the theTimeout argument is not greater than 0 * - * @return The number of keys, possibly zero, whose ready-operation sets - * was updated. + * @return The number of keys, possibly zero, whose ready-operation sets was updated. */ public int select(Selector theSelector, long theTimeout) throws IOException; - /** - * Registers theSelectableChannel with theSelector, setting theSelection to - * the key returned by the registeration. + /** + * Registers theSelectableChannel with theSelector, setting theSelection to the key returned by the registeration. * - * @param theSelector - * The selector with which this channel is to be registered + * @param theSelector The selector with which this channel is to be registered * - * @param theSelectableChannel - * The SelectableChannel to register theSelector with. + * @param theSelectableChannel The SelectableChannel to register theSelector with. * - * @param theOps - * The interest set for the resulting key + * @param theOps The interest set for the resulting key * - * @throws java.nio.channels.ClosedChannelException - * If theSelectableChannel is closed + * @throws java.nio.channels.ClosedChannelException If theSelectableChannel is closed * - * @throws java.nio.channels.IllegalBlockingModeException - * If theSelectableChannel is in blocking mode + * @throws java.nio.channels.IllegalBlockingModeException If theSelectableChannel is in blocking mode * - * @throws java.nio.channels.IllegalSelectorException - * If thSelectableChannel was not created by the same provider - * as theSelector + * @throws java.nio.channels.IllegalSelectorException If thSelectableChannel was not created by the same provider as + * theSelector * - * @throws java.nio.channels.CancelledKeyException - * If theSelectableChannel is currently registered with theSelector - * but the corresponding key has already been cancelled + * @throws java.nio.channels.CancelledKeyException If theSelectableChannel is currently registered with theSelector but + * the corresponding key has already been cancelled * - * @throws IllegalArgumentException - * If a bit in theOps does not correspond to an operation - * that is supported by theSelectableChannel, that is, if set & + * @throws IllegalArgumentException If a bit in theOps does not correspond to an operation that is + * supported by theSelectableChannel, that is, if set & * ~theSeletableChannel.validOps() != 0 * - * @return A key representing the registration of theSelectableChannel with - * theSelector. + * @return A key representing the registration of theSelectableChannel with theSelector. */ - public SelectionKey registerChannel(Selector theSelector, - SelectableChannel theSelectableChannel, - int theOps) throws IOException; + public SelectionKey registerChannel(Selector theSelector, SelectableChannel theSelectableChannel, int theOps) throws IOException; - /** - * Requests that the registration of a SelectableChannel with theSelector, - * theSelectionKey be cancelled and flushed from theSelector. Upon return - * theSelectionKey will be invalid and will have been flushed from - * theSelector's key sets. - * - *

    If theSelectionKey has already been cancelled and it has been flushed - * from theSelector, then invoking this method has no effect. Once - * theSelectionKey is cancelled and flushed, theSelectionKey remains forever - * invalid.

    - * - *

    This method may be invoked at any time. It synchronizes on the - * theSelector's cancelled-key set, and therefore may block briefly if - * invoked concurrently with a cancellation or selection operation - * involving the same selector.

    - * - * @param theSelector - * The selector with which this channel is to be registered - * - * @param theSelectionKey - * A key representing the registration of theSelectableChannel with - * theSelector + /** + * Requests that the registration of a SelectableChannel with theSelector, theSelectionKey be cancelled and flushed from + * theSelector. Upon return theSelectionKey will be invalid and will have been flushed from theSelector's key sets. + * + *

    + * If theSelectionKey has already been cancelled and it has been flushed from theSelector, then invoking this method has + * no effect. Once theSelectionKey is cancelled and flushed, theSelectionKey remains forever invalid. + *

    + * + *

    + * This method may be invoked at any time. It synchronizes on the theSelector's cancelled-key set, and therefore may + * block briefly if invoked concurrently with a cancellation or selection operation involving the same selector. + *

    + * + * @param theSelector The selector with which this channel is to be registered + * + * @param theSelectionKey A key representing the registration of theSelectableChannel with theSelector * @throws IOException if an error occurred - * @return TemporarySelectorState, the state of the TemporarySelector after - * invoking this method. + * @return TemporarySelectorState, the state of the TemporarySelector after invoking this method. */ - public TemporarySelectorState cancelKeyAndFlushSelector(Selector theSelector, - SelectionKey theSelectionKey) - throws IOException; + public TemporarySelectorState cancelKeyAndFlushSelector(Selector theSelector, SelectionKey theSelectionKey) throws IOException; - /** + /** * Closes theSelector. * - *

    If a thread is currently blocked in one of theSelector's selection - * methods then it is interrupted as if by invoking theSelector's - * wakeup method. + *

    + * If a thread is currently blocked in one of theSelector's selection methods then it is interrupted as if by invoking + * theSelector's wakeup method. * - *

    Any uncancelled keys still associated with theSelector are - * invalidated, their SelectableChannels are deregistered, and any other - * resources associated with this selector are released. + *

    + * Any uncancelled keys still associated with theSelector are invalidated, their SelectableChannels are deregistered, + * and any other resources associated with this selector are released. * - *

    If theSelector is already closed then invoking this method has no - * effect. + *

    + * If theSelector is already closed then invoking this method has no effect. * - *

    After theSelector is closed, any further attempt to use it, except by - * invoking this method, will cause a ClosedSelectorException to be - * thrown.

    + *

    + * After theSelector is closed, any further attempt to use it, except by invoking this method, will cause a + * ClosedSelectorException to be thrown. + *

    * - * @param theSelector - * The selector with which this channel is to be registered - * @throws IOException - * If an I/O error occurs + * @param theSelector The selector with which this channel is to be registered + * @throws IOException If an I/O error occurs * - * @return TemporarySelectorState, the state of the TemporarySelector after - * invoking this method. + * @return TemporarySelectorState, the state of the TemporarySelector after invoking this method. */ public TemporarySelectorState close(Selector theSelector) throws IOException; - /** + /** * Remove theSelectionKey from the theSelector's selected key set. * - * @param theSelector - * The selector whose selected key set should have theSelectionKey - * removed. + * @param theSelector The selector whose selected key set should have theSelectionKey removed. * - * @param theSelectionKey - * A key representing the registration of theSelectableChannel with - * theSelector and the key should be removed key removed from the - * selected key set. + * @param theSelectionKey A key representing the registration of theSelectableChannel with theSelector and the key + * should be removed key removed from the selected key set. * - * @return TemporarySelectorState, the state of the TemporarySelector after - * invoking this method. + * @return TemporarySelectorState, the state of the TemporarySelector after invoking this method. * - * @throws IOException - * If this selector is closed + * @throws IOException If this selector is closed */ - public TemporarySelectorState removeSelectedKey(Selector theSelector, - SelectionKey theSelectionKey) - throws IOException; + public TemporarySelectorState removeSelectedKey(Selector theSelector, SelectionKey theSelectionKey) throws IOException; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TransportDefault.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TransportDefault.java index cd4974d35..809b93969 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TransportDefault.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TransportDefault.java @@ -17,76 +17,66 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.transport ; +package com.sun.corba.ee.spi.transport; -import com.sun.corba.ee.spi.protocol.ClientDelegate ; -import com.sun.corba.ee.spi.protocol.ClientDelegateFactory ; -import com.sun.corba.ee.spi.orb.ORB ; -import com.sun.corba.ee.spi.ior.IOR ; +import com.sun.corba.ee.spi.protocol.ClientDelegate; +import com.sun.corba.ee.spi.protocol.ClientDelegateFactory; +import com.sun.corba.ee.spi.orb.ORB; +import com.sun.corba.ee.spi.ior.IOR; // Internal imports, not used in the interface to this package -import com.sun.corba.ee.impl.protocol.ClientDelegateImpl ; +import com.sun.corba.ee.impl.protocol.ClientDelegateImpl; import com.sun.corba.ee.impl.transport.AcceptorAcceptOnlyImpl; import com.sun.corba.ee.impl.transport.ContactInfoListImpl; -import com.sun.corba.ee.impl.transport.AcceptorImpl ; -import com.sun.corba.ee.impl.transport.AcceptorLazyImpl ; +import com.sun.corba.ee.impl.transport.AcceptorImpl; +import com.sun.corba.ee.impl.transport.AcceptorLazyImpl; import java.net.Socket; import org.glassfish.pfl.basic.func.UnaryVoidFunction; -/** This class provices standard building blocks for the ORB, as do all Default classes - * in the various packages. +/** + * This class provices standard building blocks for the ORB, as do all Default classes in the various packages. */ public abstract class TransportDefault { - private TransportDefault() {} + private TransportDefault() { + } - public static ContactInfoListFactory makeCorbaContactInfoListFactory( - final ORB broker ) - { + public static ContactInfoListFactory makeCorbaContactInfoListFactory(final ORB broker) { return new ContactInfoListFactory() { - public void setORB(ORB orb) { } - public ContactInfoList create( IOR ior ) { - return new ContactInfoListImpl( - (com.sun.corba.ee.spi.orb.ORB)broker, ior ) ; + public void setORB(ORB orb) { + } + + public ContactInfoList create(IOR ior) { + return new ContactInfoListImpl((com.sun.corba.ee.spi.orb.ORB) broker, ior); } }; } - public static ClientDelegateFactory makeClientDelegateFactory( - final ORB broker ) - { + public static ClientDelegateFactory makeClientDelegateFactory(final ORB broker) { return new ClientDelegateFactory() { - public ClientDelegate create( ContactInfoList info ) { - return new ClientDelegateImpl( - (com.sun.corba.ee.spi.orb.ORB)broker, info ) ; + public ClientDelegate create(ContactInfoList info) { + return new ClientDelegateImpl((com.sun.corba.ee.spi.orb.ORB) broker, info); } }; } - public static IORTransformer makeIORTransformer( - final ORB broker ) - { - return null ; + public static IORTransformer makeIORTransformer(final ORB broker) { + return null; } - public static Acceptor makeStandardCorbaAcceptor( - ORB orb, int port, String name, String type ) { + public static Acceptor makeStandardCorbaAcceptor(ORB orb, int port, String name, String type) { - return new AcceptorImpl( orb, port, name, type ) ; + return new AcceptorImpl(orb, port, name, type); } - public static Acceptor makeLazyCorbaAcceptor( - ORB orb, int port, String name, String type ) { + public static Acceptor makeLazyCorbaAcceptor(ORB orb, int port, String name, String type) { - return new AcceptorLazyImpl( orb, port, name, type ) ; + return new AcceptorLazyImpl(orb, port, name, type); } - public static Acceptor makeAcceptOnlyCorbaAcceptor( - ORB orb, int port, String name, String type, - UnaryVoidFunction operation ) { + public static Acceptor makeAcceptOnlyCorbaAcceptor(ORB orb, int port, String name, String type, UnaryVoidFunction operation) { - return new AcceptorAcceptOnlyImpl( orb, port, name, type, - operation ) ; + return new AcceptorAcceptOnlyImpl(orb, port, name, type, operation); } } - + // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TransportManager.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TransportManager.java index 03bebc7ae..118662157 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TransportManager.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/TransportManager.java @@ -24,74 +24,68 @@ import com.sun.corba.ee.spi.ior.IORTemplate; import com.sun.corba.ee.spi.ior.ObjectAdapterId; -import com.sun.corba.ee.impl.protocol.giopmsgheaders.Message ; +import com.sun.corba.ee.impl.protocol.giopmsgheaders.Message; // // REVISIT - impl/poa specific: import com.sun.corba.ee.impl.oa.poa.Policies; import com.sun.corba.ee.spi.orb.ORB; -import org.glassfish.gmbal.Description ; -import org.glassfish.gmbal.ManagedAttribute ; -import org.glassfish.gmbal.ManagedObject ; -import org.glassfish.gmbal.AMXMetadata ; +import org.glassfish.gmbal.Description; +import org.glassfish.gmbal.ManagedAttribute; +import org.glassfish.gmbal.ManagedObject; +import org.glassfish.gmbal.AMXMetadata; /** * @author Harold Carr */ @ManagedObject -@Description( "The Transport Manager for the ORB" ) -@AMXMetadata( isSingleton=true ) +@Description("The Transport Manager for the ORB") +@AMXMetadata(isSingleton = true) public interface TransportManager { public ByteBufferPool getByteBufferPool(int id); @ManagedAttribute - @Description( "The Selector, which listens for all I/O events" ) + @Description("The Selector, which listens for all I/O events") public Selector getSelector(); public Selector getSelector(int id); public void close(); - public static final String SOCKET_OR_CHANNEL_CONNECTION_CACHE = - "SocketOrChannelConnectionCache"; + public static final String SOCKET_OR_CHANNEL_CONNECTION_CACHE = "SocketOrChannelConnectionCache"; @ManagedAttribute - @Description( "List of all Acceptors in this ORB" ) - public Collection getAcceptors() ; + @Description("List of all Acceptors in this ORB") + public Collection getAcceptors(); - public Collection getAcceptors(String objectAdapterManagerId, - ObjectAdapterId objectAdapterId); + public Collection getAcceptors(String objectAdapterManagerId, ObjectAdapterId objectAdapterId); // REVISIT - POA specific policies - public void addToIORTemplate(IORTemplate iorTemplate, - Policies policies, - String codebase, - String objectAdapterManagerId, - ObjectAdapterId objectAdapterId); + public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, String codebase, String objectAdapterManagerId, + ObjectAdapterId objectAdapterId); // Methods for GIOP debugging support - /** Return a MessageTraceManager for the current thread. - * Each thread that calls getMessageTraceManager gets its own + /** + * Return a MessageTraceManager for the current thread. Each thread that calls getMessageTraceManager gets its own * independent copy. * * @return MessageTraceManager for the current thread */ - MessageTraceManager getMessageTraceManager() ; + MessageTraceManager getMessageTraceManager(); - public OutboundConnectionCache getOutboundConnectionCache( - ContactInfo contactInfo); + public OutboundConnectionCache getOutboundConnectionCache(ContactInfo contactInfo); @ManagedAttribute - @Description( "Outbound Connection Cache (client initiated connections)" ) + @Description("Outbound Connection Cache (client initiated connections)") public Collection getOutboundConnectionCaches(); public InboundConnectionCache getInboundConnectionCache(Acceptor acceptor); // Only used for MBeans @ManagedAttribute - @Description( "Inbound Connection Cache (server accepted connections)" ) + @Description("Inbound Connection Cache (server accepted connections)") public Collection getInboundConnectionCaches(); public void registerAcceptor(Acceptor acceptor); @@ -99,5 +93,5 @@ public OutboundConnectionCache getOutboundConnectionCache( public void unregisterAcceptor(Acceptor acceptor); } - + // End of file. diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/concurrent/ConcurrentQueue.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/concurrent/ConcurrentQueue.java index b6f107bd4..eebdb4dd4 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/concurrent/ConcurrentQueue.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/concurrent/ConcurrentQueue.java @@ -17,68 +17,71 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.transport.concurrent ; +package com.sun.corba.ee.spi.transport.concurrent; -/** A class that provides a very simply unbounded queue. - * The main requirement here is that the class support constant time (very fast) - * deletion of arbitrary elements. An instance of this class must be thread safe, - * either by locking or by using a wait-free algorithm (preferred). - * The interface is made as simple is possible to make it easier to produce +/** + * A class that provides a very simply unbounded queue. The main requirement here is that the class support constant + * time (very fast) deletion of arbitrary elements. An instance of this class must be thread safe, either by locking or + * by using a wait-free algorithm (preferred). The interface is made as simple is possible to make it easier to produce * a wait-free implementation. */ public interface ConcurrentQueue { - /** A Handle provides the capability to delete an element of a ConcurrentQueue - * very quickly. Typically, the handle is stored in the element, so that an - * element located from another data structure can be quickly deleted from - * a ConcurrentQueue. + /** + * A Handle provides the capability to delete an element of a ConcurrentQueue very quickly. Typically, the handle is + * stored in the element, so that an element located from another data structure can be quickly deleted from a + * ConcurrentQueue. */ public interface Handle { - /** Return the value that corresponds to this handle. + /** + * Return the value that corresponds to this handle. * * @return the value */ - V value() ; + V value(); - /** Delete the element corresponding to this handle - * from the queue. Takes constant time. Returns - * true if the removal succeeded, or false if it failed. - * which can occur if another thread has already called - * poll or remove on this element. + /** + * Delete the element corresponding to this handle from the queue. Takes constant time. Returns true if the removal + * succeeded, or false if it failed. which can occur if another thread has already called poll or remove on this + * element. * * @return if operation succeeded */ - boolean remove() ; + boolean remove(); - /** Time at which the element will expire + /** + * Time at which the element will expire * * @return time in milliseconds since 1/1/70 when this item expires. */ - long expiration() ; + long expiration(); } - /** Return the number of elements in the queue. + /** + * Return the number of elements in the queue. * * @return the number of elements */ - int size() ; + int size(); - /** Add a new element to the tail of the queue. - * Returns a handle for the element in the queue. + /** + * Add a new element to the tail of the queue. Returns a handle for the element in the queue. * * @param arg element to add * @return handle for element */ - Handle offer( V arg ) ; + Handle offer(V arg); - /** Return the handle for the head of the queue. - * The element is removed from the queue. + /** + * Return the handle for the head of the queue. The element is removed from the queue. + * * @return handle for head of queue */ - Handle poll() ; + Handle poll(); - /** Return the handle for the head of the queue. - * The element is not removed from the queue. + /** + * Return the handle for the head of the queue. The element is not removed from the queue. + * * @return handle for head of queue */ - Handle peek() ; -} + Handle peek(); +} diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/concurrent/ConcurrentQueueFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/concurrent/ConcurrentQueueFactory.java index bb0d79842..c5626c5be 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/concurrent/ConcurrentQueueFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/concurrent/ConcurrentQueueFactory.java @@ -17,55 +17,56 @@ * Classpath-exception-2.0 */ -package com.sun.corba.ee.spi.transport.concurrent ; +package com.sun.corba.ee.spi.transport.concurrent; -import com.sun.corba.ee.impl.transport.concurrent.ConcurrentQueueBlockingImpl ; -import com.sun.corba.ee.impl.transport.concurrent.ConcurrentQueueNonBlockingImpl ; -import com.sun.corba.ee.impl.transport.concurrent.ConcurrentQueueImpl ; +import com.sun.corba.ee.impl.transport.concurrent.ConcurrentQueueBlockingImpl; +import com.sun.corba.ee.impl.transport.concurrent.ConcurrentQueueNonBlockingImpl; +import com.sun.corba.ee.impl.transport.concurrent.ConcurrentQueueImpl; -/** A factory class for creating instances of ConcurrentQueue. - * Note that a rather unusual syntax is needed for calling these methods: +/** + * A factory class for creating instances of ConcurrentQueue. Note that a rather unusual syntax is needed for calling + * these methods: * - * ConcurrentQueueFactory.<V>makeXXXConcurrentQueue() + * ConcurrentQueueFactory.<V>makeXXXConcurrentQueue() * - * This is required because the type variable V is not used in the - * parameters of the factory method, so the correct type + * This is required because the type variable V is not used in the parameters of the factory method, so the correct type * cannot be inferred by the compiler. */ public final class ConcurrentQueueFactory { - private ConcurrentQueueFactory() {} + private ConcurrentQueueFactory() { + } - /** Create a ConcurrentQueue whose implementation never blocks. - * Currently not fully implemented: the NonBlocking and Blocking - * impls are basically the same. + /** + * Create a ConcurrentQueue whose implementation never blocks. Currently not fully implemented: the NonBlocking and + * Blocking impls are basically the same. * * @param type of queue * @param ttl time to live in milliseconds * @return ConcurrentQueue */ - public static ConcurrentQueue makeNonBlockingConcurrentQueue(final long ttl ) { - return new ConcurrentQueueNonBlockingImpl( ttl ) ; + public static ConcurrentQueue makeNonBlockingConcurrentQueue(final long ttl) { + return new ConcurrentQueueNonBlockingImpl(ttl); } - /** Create a ConcurrentQueue whose implementation uses conventional - * locking to protect the data structure. + /** + * Create a ConcurrentQueue whose implementation uses conventional locking to protect the data structure. * * @param type of queue * @param ttl time to live in milliseconds * @return ConcurrentQueue */ - public static ConcurrentQueue makeBlockingConcurrentQueue(final long ttl ) { - return new ConcurrentQueueBlockingImpl( ttl ) ; + public static ConcurrentQueue makeBlockingConcurrentQueue(final long ttl) { + return new ConcurrentQueueBlockingImpl(ttl); } - /** Create a ConcurrentQueue that does no locking at all. - * For use in data structures that manage their own locking. + /** + * Create a ConcurrentQueue that does no locking at all. For use in data structures that manage their own locking. * * @param type of queue * @param ttl time to live in milliseconds * @return ConcurrentQueue */ - public static ConcurrentQueue makeConcurrentQueue(final long ttl ) { - return new ConcurrentQueueImpl( ttl ) ; + public static ConcurrentQueue makeConcurrentQueue(final long ttl) { + return new ConcurrentQueueImpl(ttl); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/Connection.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/Connection.java index 8192a2ee5..8e888d6c0 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/Connection.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/Connection.java @@ -19,15 +19,14 @@ package com.sun.corba.ee.spi.transport.connection; -import java.io.IOException ; +import java.io.IOException; -/** A Connection represents some kind of channel to a (possibly different) process. - * Here we only need the capability of closing the connection. Any connection - * must also define hashCode and equals properly so that it can be used in a map. - * It is also recommended that toString() be defined to return a useful summary - * of the connection (e.g. address information). +/** + * A Connection represents some kind of channel to a (possibly different) process. Here we only need the capability of + * closing the connection. Any connection must also define hashCode and equals properly so that it can be used in a map. + * It is also recommended that toString() be defined to return a useful summary of the connection (e.g. address + * information). */ public interface Connection { - void close() throws IOException ; + void close() throws IOException; } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionCache.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionCache.java index 1b90e0409..46a2fc289 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionCache.java @@ -19,63 +19,67 @@ package com.sun.corba.ee.spi.transport.connection; -/** A connection cache manages a group of connections which may be re-used - * for sending and receiving messages. +/** + * A connection cache manages a group of connections which may be re-used for sending and receiving messages. */ public interface ConnectionCache { - /** User-provided identifier for an instance of the - * OutboundConnectionCache. + /** + * User-provided identifier for an instance of the OutboundConnectionCache. * * @return identifier String */ - String getCacheType() ; + String getCacheType(); - /** Total number of connections currently managed by the cache. + /** + * Total number of connections currently managed by the cache. * * @return number of connections */ - long numberOfConnections() ; + long numberOfConnections(); - /** Number of idle connections; that is, connections for which the number of - * get/release or responseReceived/responseProcessed calls are equal. + /** + * Number of idle connections; that is, connections for which the number of get/release or + * responseReceived/responseProcessed calls are equal. * * @return number of idle connections */ - long numberOfIdleConnections() ; + long numberOfIdleConnections(); - /** Number of non-idle connections. Normally, busy+idle==total, but this - * may not be strictly true due to concurrent updates to the connection - * cache. + /** + * Number of non-idle connections. Normally, busy+idle==total, but this may not be strictly true due to concurrent + * updates to the connection cache. * * @return number of non-idle connections */ - long numberOfBusyConnections() ; + long numberOfBusyConnections(); - /** Number of idle connections that are reclaimable. Such connections - * are not in use, and are not waiting to handle any responses. + /** + * Number of idle connections that are reclaimable. Such connections are not in use, and are not waiting to handle any + * responses. * * @return number of reclaimable idle connections */ - long numberOfReclaimableConnections() ; + long numberOfReclaimableConnections(); - /** Threshold at which connection reclamation begins. + /** + * Threshold at which connection reclamation begins. * - * @return threshold + * @return threshold */ - int highWaterMark() ; + int highWaterMark(); - /** Number of connections to reclaim each time reclamation starts. + /** + * Number of connections to reclaim each time reclamation starts. * * @return number to reclaim */ - int numberToReclaim() ; - - /** Close a connection, regardless of its state. This may cause requests - * to fail to be sent, and responses to be lost. Intended for - * handling serious errors, such as loss of framing on a TCP stream, - * that require closing the connection. + int numberToReclaim(); + + /** + * Close a connection, regardless of its state. This may cause requests to fail to be sent, and responses to be lost. + * Intended for handling serious errors, such as loss of framing on a TCP stream, that require closing the connection. * * @param conn connection to close */ - void close( final C conn ) ; + void close(final C conn); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionCacheFactory.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionCacheFactory.java index 35b8f0548..20836ebfd 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionCacheFactory.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionCacheFactory.java @@ -19,50 +19,43 @@ package com.sun.corba.ee.spi.transport.connection; - -import com.sun.corba.ee.impl.transport.connection.OutboundConnectionCacheBlockingImpl ; -import com.sun.corba.ee.impl.transport.connection.OutboundConnectionCacheImpl ; -import com.sun.corba.ee.impl.transport.connection.InboundConnectionCacheBlockingImpl ; -import com.sun.corba.ee.impl.transport.connection.InboundConnectionCacheImpl ; - -/** A factory class for creating connections caches. - * Note that a rather unusual syntax is needed for calling these methods: +import com.sun.corba.ee.impl.transport.connection.OutboundConnectionCacheBlockingImpl; +import com.sun.corba.ee.impl.transport.connection.OutboundConnectionCacheImpl; +import com.sun.corba.ee.impl.transport.connection.InboundConnectionCacheBlockingImpl; +import com.sun.corba.ee.impl.transport.connection.InboundConnectionCacheImpl; + +/** + * A factory class for creating connections caches. Note that a rather unusual syntax is needed for calling these + * methods: * * {@code ConnectionCacheFactory.makeXXXCache()} * - * This is required because the type variable V is not used in the - * parameters of the factory method (there are no parameters). + * This is required because the type variable V is not used in the parameters of the factory method (there are no + * parameters). */ public final class ConnectionCacheFactory { - private ConnectionCacheFactory() {} + private ConnectionCacheFactory() { + } - public static OutboundConnectionCache - makeBlockingOutboundConnectionCache( String cacheType, int highWaterMark, - int numberToReclaim, int maxParallelConnections, int ttl ) { + public static OutboundConnectionCache makeBlockingOutboundConnectionCache(String cacheType, int highWaterMark, + int numberToReclaim, int maxParallelConnections, int ttl) { - return new OutboundConnectionCacheBlockingImpl( cacheType, highWaterMark, - numberToReclaim, maxParallelConnections, ttl ) ; + return new OutboundConnectionCacheBlockingImpl(cacheType, highWaterMark, numberToReclaim, maxParallelConnections, ttl); } - public static OutboundConnectionCache - makeNonBlockingOutboundConnectionCache( String cacheType, int highWaterMark, - int numberToReclaim, int maxParallelConnections, int ttl ) { + public static OutboundConnectionCache makeNonBlockingOutboundConnectionCache(String cacheType, + int highWaterMark, int numberToReclaim, int maxParallelConnections, int ttl) { - return new OutboundConnectionCacheImpl( cacheType, highWaterMark, - numberToReclaim, maxParallelConnections, ttl ) ; + return new OutboundConnectionCacheImpl(cacheType, highWaterMark, numberToReclaim, maxParallelConnections, ttl); } - public static InboundConnectionCache - makeBlockingInboundConnectionCache( String cacheType, int highWaterMark, - int numberToReclaim, int ttl ) { - return new InboundConnectionCacheBlockingImpl( cacheType, - highWaterMark, numberToReclaim, ttl ) ; + public static InboundConnectionCache makeBlockingInboundConnectionCache(String cacheType, int highWaterMark, + int numberToReclaim, int ttl) { + return new InboundConnectionCacheBlockingImpl(cacheType, highWaterMark, numberToReclaim, ttl); } - public static InboundConnectionCache - makeNonBlockingInboundConnectionCache( String cacheType, int highWaterMark, - int numberToReclaim, int ttl ) { - return new InboundConnectionCacheImpl( cacheType, - highWaterMark, numberToReclaim, ttl ) ; + public static InboundConnectionCache makeNonBlockingInboundConnectionCache(String cacheType, + int highWaterMark, int numberToReclaim, int ttl) { + return new InboundConnectionCacheImpl(cacheType, highWaterMark, numberToReclaim, ttl); } } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionFinder.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionFinder.java index 004755385..39f166537 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionFinder.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ConnectionFinder.java @@ -19,17 +19,17 @@ package com.sun.corba.ee.spi.transport.connection; -import java.util.Collection ; +import java.util.Collection; -import java.io.IOException ; +import java.io.IOException; -/** An instance of a ConnectionFinder may be supplied to the - * OutboundConnectionCache.get method. +/** + * An instance of a ConnectionFinder may be supplied to the OutboundConnectionCache.get method. */ public interface ConnectionFinder { - /** Method that searches idleConnections and busyConnections for - * the best connection. May return null if no best connection - * exists. May create a new connection and return it. + /** + * Method that searches idleConnections and busyConnections for the best connection. May return null if no best + * connection exists. May create a new connection and return it. * * @param cinfo info to match in the search * @param idleConnections idle connections to search @@ -37,7 +37,5 @@ public interface ConnectionFinder { * @throws IOException if an error occurred * @return the best connection */ - C find( ContactInfo cinfo, Collection idleConnections, - Collection busyConnections ) throws IOException ; + C find(ContactInfo cinfo, Collection idleConnections, Collection busyConnections) throws IOException; } - diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ContactInfo.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ContactInfo.java index 0d9b95cbc..26ef17249 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ContactInfo.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/ContactInfo.java @@ -19,21 +19,20 @@ package com.sun.corba.ee.spi.transport.connection; -import java.io.IOException ; +import java.io.IOException; -/** The ContactInfo represents the information needed to establish a connection - * to a (possibly different) process. This is a subset of the PEPt 2.0 connection. - * Any implemetnation of this interface must define hashCode and equals properly so that - * it may be used in a Map. - * It is also recommended that toString() be defined to return a useful summary - * of the contact info (e.g. address information). +/** + * The ContactInfo represents the information needed to establish a connection to a (possibly different) process. This + * is a subset of the PEPt 2.0 connection. Any implemetnation of this interface must define hashCode and equals properly + * so that it may be used in a Map. It is also recommended that toString() be defined to return a useful summary of the + * contact info (e.g. address information). */ public interface ContactInfo { - /** Create a new Connection from this ContactInfo. - * Throws an IOException if Connection creation fails. + /** + * Create a new Connection from this ContactInfo. Throws an IOException if Connection creation fails. * * @throws IOException if creation fails * @return a new {@link Connection} */ - C createConnection() throws IOException ; + C createConnection() throws IOException; } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/InboundConnectionCache.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/InboundConnectionCache.java index 081696bc5..aa9cda8b7 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/InboundConnectionCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/InboundConnectionCache.java @@ -19,79 +19,63 @@ package com.sun.corba.ee.spi.transport.connection; -/** A concurrent connection cache for passively created connections (e.g. - * from an acceptor). Here a Connection is an - * abstraction of a Socket or SocketChannel: basically some sort of resource - * that is expensive to acquire, and can be re-used freely. - * The cache maintains a loose - * upper bound on the number of cached connections, and reclaims connections as - * needed. +/** + * A concurrent connection cache for passively created connections (e.g. from an acceptor). Here a Connection is an + * abstraction of a Socket or SocketChannel: basically some sort of resource that is expensive to acquire, and can be + * re-used freely. The cache maintains a loose upper bound on the number of cached connections, and reclaims connections + * as needed. *

    * This cache places minimal requirements on the Connections that it contains: *

      - *
    1. A Connection must implement a close() method. This is called when idle - * connections are reclaimed. - *
    2. A Connection must be usable as a HashMap key. + *
    3. A Connection must implement a close() method. This is called when idle connections are reclaimed. + *
    4. A Connection must be usable as a HashMap key. *
    *

    - * Some simple methods are provided for monitoring the state of the cache: - * numbers of busy and idle connections, and the total number of - * connections in the cache. + * Some simple methods are provided for monitoring the state of the cache: numbers of busy and idle connections, and the + * total number of connections in the cache. *

    - * Access is also provided to the cache configuration: maxParallelConnections, - * highWaterMark, and numberToReclaim. Currently these can only be set when - * the cache is created. + * Access is also provided to the cache configuration: maxParallelConnections, highWaterMark, and numberToReclaim. + * Currently these can only be set when the cache is created. * * XXX We may wish to make the cache configuration dynamically configurable. */ public interface InboundConnectionCache extends ConnectionCache { - /** Mark a connection as busy because a request is being processed - * on the connection. The connection may or may not be previously - * known to the cache when this method is called. - * Busy connections cannot be reclaimed. - * This provides an early indication that a Connection is in use, - * before we know how many responses still need to be sent on - * the Connection for this request. This reduces the likelyhood - * of reclaiming a connection on which we are processing a request. + /** + * Mark a connection as busy because a request is being processed on the connection. The connection may or may not be + * previously known to the cache when this method is called. Busy connections cannot be reclaimed. This provides an + * early indication that a Connection is in use, before we know how many responses still need to be sent on the + * Connection for this request. This reduces the likelyhood of reclaiming a connection on which we are processing a + * request. *

    - * Note that this problem is inherent in a distributed system. - * We could in any case reclaim a connection AFTER a client - * has sent a request but BEFORE the request is received. - * Note that AFTER and BEFORE refer to global time which does - * not really exist in a distributed system (or at least we - * want to pretend it is not available). + * Note that this problem is inherent in a distributed system. We could in any case reclaim a connection AFTER a client + * has sent a request but BEFORE the request is received. Note that AFTER and BEFORE refer to global time which does not + * really exist in a distributed system (or at least we want to pretend it is not available). * - * XXX Should we age out connections? - * This would require actual time stamps, rather than just an LRU queue. + * XXX Should we age out connections? This would require actual time stamps, rather than just an LRU queue. * * @param conn connection to mark as busy */ - void requestReceived( C conn ) ; + void requestReceived(C conn); - /** Indicate that request processing has been completed for a request - * received on conn. This indicates that a Connection that received - * a request as indicated in a previous call to requestReceived has - * completed request processing for that request. Responses may still - * need to be sent. Some number of - * responses (usually 0 or 1) may be expected ON THE SAME CONNECTION - * even for an idle connection. We maintain a count of the number of - * outstanding responses we expect for protocols that return the response - * on the same connection on which the request was received. This is - * necessary to prevent reclamation of a Connection that is idle, but - * still needed to send responses to old requests. + /** + * Indicate that request processing has been completed for a request received on conn. This indicates that a Connection + * that received a request as indicated in a previous call to requestReceived has completed request processing for that + * request. Responses may still need to be sent. Some number of responses (usually 0 or 1) may be expected ON THE SAME + * CONNECTION even for an idle connection. We maintain a count of the number of outstanding responses we expect for + * protocols that return the response on the same connection on which the request was received. This is necessary to + * prevent reclamation of a Connection that is idle, but still needed to send responses to old requests. * * @param conn connection to mark as completed * @param numResponseExpected responses expected */ - void requestProcessed( C conn, int numResponseExpected ) ; + void requestProcessed(C conn, int numResponseExpected); - /** Inform the cache that a response has been sent on a particular - * connection. + /** + * Inform the cache that a response has been sent on a particular connection. *

    - * When a Connection is idle, and has no pending responses, it is - * eligible for reclamation. + * When a Connection is idle, and has no pending responses, it is eligible for reclamation. * * @param conn connection that response has been sent on */ - void responseSent( C conn ) ; + void responseSent(C conn); } diff --git a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/OutboundConnectionCache.java b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/OutboundConnectionCache.java index c45c8341c..23f2f0f90 100644 --- a/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/OutboundConnectionCache.java +++ b/orbmain/src/main/java/com/sun/corba/ee/spi/transport/connection/OutboundConnectionCache.java @@ -19,128 +19,111 @@ package com.sun.corba.ee.spi.transport.connection; -import java.io.IOException ; +import java.io.IOException; -/** A concurrent mostly non-blocking connection cache. Here a Connection is an - * abstraction of a Socket or SocketChannel: basically some sort of resource - * that is expensive to acquire, and can be re-used freely. The cache - * maintains a loose upper bound on the number of cached connections, and - * reclaims connections as needed. +/** + * A concurrent mostly non-blocking connection cache. Here a Connection is an abstraction of a Socket or SocketChannel: + * basically some sort of resource that is expensive to acquire, and can be re-used freely. The cache maintains a loose + * upper bound on the number of cached connections, and reclaims connections as needed. *

    * This cache places minimal requirements on the Connections that it contains: *

      - *
    1. A Connection must implement a close() method. This is called when idle - * connections are reclaimed. - *
    2. A Connection must be usable as a HashMap key. - *
    3. There must be a ContactInfo class that is used to create Connection - * instances. The ContactInfo class must support a create() method that - * returns a Connection. + *
    4. A Connection must implement a close() method. This is called when idle connections are reclaimed. + *
    5. A Connection must be usable as a HashMap key. + *
    6. There must be a ContactInfo class that is used to create Connection instances. The ContactInfo class must support + * a create() method that returns a Connection. *
    7. The ContactInfo must be usable as a HashMap key. - *
    8. All instances created from a ContactInfo are equal; that is, any request - * sent to a particular ContactInfo can used an instance created from that - * ContactInfo. For example, in the CORBA case, IP host and port is not always - * sufficient: we may also need the Codeset type that indicates how Strings are - * encoded. Basically, protocols (like GIOP) that bind session state to a - * Connection may need more than transport information in the ContactInfo. + *
    9. All instances created from a ContactInfo are equal; that is, any request sent to a particular ContactInfo can + * used an instance created from that ContactInfo. For example, in the CORBA case, IP host and port is not always + * sufficient: we may also need the Codeset type that indicates how Strings are encoded. Basically, protocols (like + * GIOP) that bind session state to a Connection may need more than transport information in the ContactInfo. *
    *

    - * Some simple methods are provided for monitoring the state of the cache: - * numbers of busy and idle connections, and the total number of connections in - * the cache. + * Some simple methods are provided for monitoring the state of the cache: numbers of busy and idle connections, and the + * total number of connections in the cache. */ -public interface OutboundConnectionCache - extends ConnectionCache { - /** Configured maximum number of connections supported per ContactInfo. +public interface OutboundConnectionCache extends ConnectionCache { + /** + * Configured maximum number of connections supported per ContactInfo. + * * @return maximum number of connections */ - int maxParallelConnections() ; + int maxParallelConnections(); - /** Determine whether a new connection could be created by the - * ConnectionCache or not. + /** + * Determine whether a new connection could be created by the ConnectionCache or not. * * @param cinfo info to use for {@link Connection} * @return if a new connection can be created */ - boolean canCreateNewConnection( ContactInfo cinfo ) ; + boolean canCreateNewConnection(ContactInfo cinfo); - /** Return a Connection corresponding to the given ContactInfo. - * This works as follows: + /** + * Return a Connection corresponding to the given ContactInfo. This works as follows: *

      - *
    • Call the finder. If it returns non-null, use that connection; - * (Note that this may be a new connection, created in the finder). - * The finder SHOULD NOT create a new connection if canCreateNewConnection - * returns false, but this is advisory. - *
    • otherwise, Use an idle connection, if one is available; - *
    • otherwise, create a new connection, if not too many connections are - * open; + *
    • Call the finder. If it returns non-null, use that connection; (Note that this may be a new connection, created in + * the finder). The finder SHOULD NOT create a new connection if canCreateNewConnection returns false, but this is + * advisory. + *
    • otherwise, Use an idle connection, if one is available; + *
    • otherwise, create a new connection, if not too many connections are open; *
    • otherwise, use a busy connection. *
    * Note that creating a new connection requires EITHER: *
      - *
    • there is no existing connection for the ContactInfo - *
    • OR the total number of connections in the cache is less than the - * HighWaterMark and the number of connections for this ContactInfo - * is less than MaxParallelConnections. + *
    • there is no existing connection for the ContactInfo + *
    • OR the total number of connections in the cache is less than the HighWaterMark and the number of connections for + * this ContactInfo is less than MaxParallelConnections. *
    - * We will always return a - * Connection for a get call UNLESS we have no existing connection and - * an attempt to create a new connection fails. In this case, the - * IOException thrown by ContactInfo.create is propagated out of this - * method. + * We will always return a Connection for a get call UNLESS we have no existing connection and an attempt to create a + * new connection fails. In this case, the IOException thrown by ContactInfo.create is propagated out of this method. *

    - * It is possible that the cache contains connections that no longer connect - * to their destination. In this case, it is the responsibility of the - * client of the cache to close the broken connection as they are detected. - * Connection reclamation may also handle the cleanup, but note that a - * broken connection with pending responses will never be reclaimed. + * It is possible that the cache contains connections that no longer connect to their destination. In this case, it is + * the responsibility of the client of the cache to close the broken connection as they are detected. Connection + * reclamation may also handle the cleanup, but note that a broken connection with pending responses will never be + * reclaimed. *

    - * Note that the idle and busy connection collections that are - * passed to the finder are unmodifiable collections. They have iterators - * that return connections in LRU order, with the least recently used - * connection first. This is done to aid a finder that wishes to consider - * load balancing in its determination of an appropriate connection. + * Note that the idle and busy connection collections that are passed to the finder are unmodifiable collections. They + * have iterators that return connections in LRU order, with the least recently used connection first. This is done to + * aid a finder that wishes to consider load balancing in its determination of an appropriate connection. *

    + * * @param cinfo info on Connection to get * @param finder Finder to use to search for Connection * @throws IOException if an error occurred * @return {@link Connection} corresponding to the ContactInfo */ - C get( ContactInfo cinfo, ConnectionFinder finder - ) throws IOException ; + C get(ContactInfo cinfo, ConnectionFinder finder) throws IOException; - /** Behaves the same as {@link #get(ContactInfo, ConnectionFinder)} - * except that no connection finder is provided, so that step is - * ignored. + /** + * Behaves the same as {@link #get(ContactInfo, ConnectionFinder)} except that no connection finder is provided, so that + * step is ignored. + * * @param cinfo info on Connection to get * @throws IOException if an error occurred * @return {@link Connection} corresponding to the ContactInfo */ - C get( ContactInfo cinfo ) throws IOException ; + C get(ContactInfo cinfo) throws IOException; - /** Release a Connection previously obtained from get. Connections that - * have been released as many times as they have been returned by - * get are idle; otherwise a Connection is busy. Some number of - * responses (usually 0 or 1) may be expected ON THE SAME CONNECTION - * even for an idle connection. We maintain a count of the number of - * outstanding responses we expect for protocols that return the response - * on the same connection on which the request was received. This is - * necessary to prevent reclamation of a Connection that is idle, but - * still needed to send responses to old requests. + /** + * Release a Connection previously obtained from get. Connections that have been released as many times as they have + * been returned by get are idle; otherwise a Connection is busy. Some number of responses (usually 0 or 1) may be + * expected ON THE SAME CONNECTION even for an idle connection. We maintain a count of the number of outstanding + * responses we expect for protocols that return the response on the same connection on which the request was received. + * This is necessary to prevent reclamation of a Connection that is idle, but still needed to send responses to old + * requests. * * @param conn connection to release * @param numResponseExpected number of responses expected */ - void release( C conn, int numResponseExpected ) ; + void release(C conn, int numResponseExpected); - /** Inform the cache that a response has been received on a particular - * connection. This must also be called in the event that no response - * is received, but the client times out waiting for a response, and - * decides to abandon the request. + /** + * Inform the cache that a response has been received on a particular connection. This must also be called in the event + * that no response is received, but the client times out waiting for a response, and decides to abandon the request. *

    - * When a Connection is idle, and has no pending responses, it is - * eligible for reclamation. + * When a Connection is idle, and has no pending responses, it is eligible for reclamation. * * @param conn Connection that has received a response */ - void responseReceived( C conn ) ; + void responseReceived(C conn); } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java index be0e2e53f..67fd2f354 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java @@ -19,67 +19,57 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ + * com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:51 AM PDT + */ -public final class AttrDescriptionSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/AttrDescriptionSeq:1.0"; +public final class AttrDescriptionSeqHelper { + private static String _id = "IDL:omg.org/CORBA/AttrDescriptionSeq:1.0"; - public AttrDescriptionSeqHelper() - { + public AttrDescriptionSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeDescription[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.AttributeDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.AttributeDescription[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.AttributeDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.id (), "AttrDescriptionSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = com.sun.org.omg.CORBA.AttributeDescriptionHelper.type(); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.id(), "AttrDescriptionSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.AttributeDescription[] read (org.omg.CORBA.portable.InputStream istream) - { + public static com.sun.org.omg.CORBA.AttributeDescription[] read(org.omg.CORBA.portable.InputStream istream) { com.sun.org.omg.CORBA.AttributeDescription value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new com.sun.org.omg.CORBA.AttributeDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.AttributeDescriptionHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.AttributeDescriptionHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.AttributeDescriptionHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeDescription[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.AttributeDescriptionHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeDescription.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeDescription.java index 14bde679b..5b138aa3a 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeDescription.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeDescription.java @@ -19,16 +19,12 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/AttributeDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/AttributeDescription.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class AttributeDescription implements org.omg.CORBA.portable.IDLEntity -{ +public final class AttributeDescription implements org.omg.CORBA.portable.IDLEntity { public String name = null; public String id = null; public String defined_in = null; @@ -36,12 +32,11 @@ public final class AttributeDescription implements org.omg.CORBA.portable.IDLEnt public org.omg.CORBA.TypeCode type = null; public com.sun.org.omg.CORBA.AttributeMode mode = null; - public AttributeDescription () - { + public AttributeDescription() { } // ctor - public AttributeDescription (String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _type, com.sun.org.omg.CORBA.AttributeMode _mode) - { + public AttributeDescription(String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _type, + com.sun.org.omg.CORBA.AttributeMode _mode) { name = _name; id = _id; defined_in = _defined_in; diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java index c82c770d1..ed91ff229 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java @@ -19,119 +19,92 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/AttributeDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/AttributeDescriptionHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class AttributeDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/AttributeDescription:1.0"; +public final class AttributeDescriptionHelper { + private static String _id = "IDL:omg.org/CORBA/AttributeDescription:1.0"; - public AttributeDescriptionHelper() - { + public AttributeDescriptionHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeDescription that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.AttributeDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.AttributeDescription extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [6]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.AttributeModeHelper.type (); - _members0[5] = new org.omg.CORBA.StructMember ( - "mode", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.AttributeDescriptionHelper.id (), "AttributeDescription", _members0); - __active = false; - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[6]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _members0[0] = new org.omg.CORBA.StructMember("name", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[1] = new org.omg.CORBA.StructMember("id", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[2] = new org.omg.CORBA.StructMember("defined_in", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.VersionSpecHelper.id(), "VersionSpec", + _tcOf_members0); + _members0[3] = new org.omg.CORBA.StructMember("version", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode); + _members0[4] = new org.omg.CORBA.StructMember("type", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.AttributeModeHelper.type(); + _members0[5] = new org.omg.CORBA.StructMember("mode", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc(com.sun.org.omg.CORBA.AttributeDescriptionHelper.id(), + "AttributeDescription", _members0); + __active = false; + } } + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.AttributeDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.AttributeDescription value = new com.sun.org.omg.CORBA.AttributeDescription (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.type = istream.read_TypeCode (); - value.mode = com.sun.org.omg.CORBA.AttributeModeHelper.read (istream); + public static com.sun.org.omg.CORBA.AttributeDescription read(org.omg.CORBA.portable.InputStream istream) { + com.sun.org.omg.CORBA.AttributeDescription value = new com.sun.org.omg.CORBA.AttributeDescription(); + value.name = istream.read_string(); + value.id = istream.read_string(); + value.defined_in = istream.read_string(); + value.version = istream.read_string(); + value.type = istream.read_TypeCode(); + value.mode = com.sun.org.omg.CORBA.AttributeModeHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeDescription value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.type); - com.sun.org.omg.CORBA.AttributeModeHelper.write (ostream, value.mode); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeDescription value) { + ostream.write_string(value.name); + ostream.write_string(value.id); + ostream.write_string(value.defined_in); + ostream.write_string(value.version); + ostream.write_TypeCode(value.type); + com.sun.org.omg.CORBA.AttributeModeHelper.write(ostream, value.mode); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeMode.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeMode.java index 5b0e71ba1..551b67bc6 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeMode.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeMode.java @@ -19,40 +19,33 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/AttributeMode.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/AttributeMode.java Generated by the IDL-to-Java compiler (portable), version "3.0" from ir.idl + * Thursday, May 6, 1999 1:51:50 AM PDT + */ -public class AttributeMode implements org.omg.CORBA.portable.IDLEntity -{ - private int __value; +public class AttributeMode implements org.omg.CORBA.portable.IDLEntity { + private int __value; private static int __size = 2; - private static com.sun.org.omg.CORBA.AttributeMode[] __array = new com.sun.org.omg.CORBA.AttributeMode [__size]; + private static com.sun.org.omg.CORBA.AttributeMode[] __array = new com.sun.org.omg.CORBA.AttributeMode[__size]; public static final int _ATTR_NORMAL = 0; public static final com.sun.org.omg.CORBA.AttributeMode ATTR_NORMAL = new com.sun.org.omg.CORBA.AttributeMode(_ATTR_NORMAL); public static final int _ATTR_READONLY = 1; public static final com.sun.org.omg.CORBA.AttributeMode ATTR_READONLY = new com.sun.org.omg.CORBA.AttributeMode(_ATTR_READONLY); - public int value () - { + public int value() { return __value; } - public static com.sun.org.omg.CORBA.AttributeMode from_int (int value) - { + public static com.sun.org.omg.CORBA.AttributeMode from_int(int value) { if (value >= 0 && value < __size) return __array[value]; else - throw new org.omg.CORBA.BAD_PARAM (); + throw new org.omg.CORBA.BAD_PARAM(); } - protected AttributeMode (int value) - { + protected AttributeMode(int value) { __value = value; __array[__value] = this; } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeModeHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeModeHelper.java index 6bf105c63..08bde81f1 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeModeHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/AttributeModeHelper.java @@ -19,58 +19,48 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/AttributeModeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/AttributeModeHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class AttributeModeHelper -{ - private static String _id = "IDL:omg.org/CORBA/AttributeMode:1.0"; +public final class AttributeModeHelper { + private static String _id = "IDL:omg.org/CORBA/AttributeMode:1.0"; - public AttributeModeHelper() - { + public AttributeModeHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeMode that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeMode that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.AttributeMode extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.AttributeMode extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (com.sun.org.omg.CORBA.AttributeModeHelper.id (), "AttributeMode", new String[] { "ATTR_NORMAL", "ATTR_READONLY"} ); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_enum_tc(com.sun.org.omg.CORBA.AttributeModeHelper.id(), "AttributeMode", + new String[] { "ATTR_NORMAL", "ATTR_READONLY" }); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.AttributeMode read (org.omg.CORBA.portable.InputStream istream) - { - return com.sun.org.omg.CORBA.AttributeMode.from_int (istream.read_long ()); + public static com.sun.org.omg.CORBA.AttributeMode read(org.omg.CORBA.portable.InputStream istream) { + return com.sun.org.omg.CORBA.AttributeMode.from_int(istream.read_long()); } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeMode value) - { - ostream.write_long (value.value ()); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeMode value) { + ostream.write_long(value.value()); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ContextIdSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ContextIdSeqHelper.java index 3c0154af0..3a6e70e02 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ContextIdSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ContextIdSeqHelper.java @@ -19,69 +19,60 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ContextIdSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ + * com/sun/org/omg/CORBA/ContextIdSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:51 AM PDT + */ -public final class ContextIdSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ContextIdSeq:1.0"; +public final class ContextIdSeqHelper { + private static String _id = "IDL:omg.org/CORBA/ContextIdSeq:1.0"; - public ContextIdSeqHelper() - { + public ContextIdSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, String[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, String[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static String[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static String[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdentifierHelper.id (), "ContextIdentifier", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdSeqHelper.id (), "ContextIdSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ContextIdentifierHelper.id(), "ContextIdentifier", + __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ContextIdSeqHelper.id(), "ContextIdSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static String[] read (org.omg.CORBA.portable.InputStream istream) - { + public static String[] read(org.omg.CORBA.portable.InputStream istream) { String value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new String[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ContextIdentifierHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.ContextIdentifierHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ContextIdentifierHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, String[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.ContextIdentifierHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ContextIdentifierHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ContextIdentifierHelper.java index a415a2a62..409f1a0cf 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ContextIdentifierHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ContextIdentifierHelper.java @@ -19,62 +19,52 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ContextIdentifierHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/ContextIdentifierHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class ContextIdentifierHelper -{ - private static String _id = "IDL:omg.org/CORBA/ContextIdentifier:1.0"; +public final class ContextIdentifierHelper { + private static String _id = "IDL:omg.org/CORBA/ContextIdentifier:1.0"; - public ContextIdentifierHelper() - { + public ContextIdentifierHelper() { } - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, String that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static String extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdentifierHelper.id (), "ContextIdentifier", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ContextIdentifierHelper.id(), "ContextIdentifier", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static String read (org.omg.CORBA.portable.InputStream istream) - { + public static String read(org.omg.CORBA.portable.InputStream istream) { String value = null; - value = istream.read_string (); + value = istream.read_string(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); + public static void write(org.omg.CORBA.portable.OutputStream ostream, String value) { + ostream.write_string(value); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/DefinitionKindHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/DefinitionKindHelper.java index 1f70ec84c..5a1c8dcf4 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/DefinitionKindHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/DefinitionKindHelper.java @@ -19,70 +19,63 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/DefinitionKindHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:43 AM PDT -*/ + * com/sun/org/omg/CORBA/DefinitionKindHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:43 AM PDT + */ // This file has been manually _CHANGED_ -public final class DefinitionKindHelper -{ - private static String _id = "IDL:omg.org/CORBA/DefinitionKind:1.0"; +public final class DefinitionKindHelper { + private static String _id = "IDL:omg.org/CORBA/DefinitionKind:1.0"; - public DefinitionKindHelper() - { + public DefinitionKindHelper() { } // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.DefinitionKind that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.DefinitionKind that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + // public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.DefinitionKind that) + public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.DefinitionKind that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } // _CHANGED_ - //public static com.sun.org.omg.CORBA.DefinitionKind extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.DefinitionKind extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + // public static com.sun.org.omg.CORBA.DefinitionKind extract (org.omg.CORBA.Any a) + public static org.omg.CORBA.DefinitionKind extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (com.sun.org.omg.CORBA.DefinitionKindHelper.id (), "DefinitionKind", new String[] { "dk_none", "dk_all", "dk_Attribute", "dk_Constant", "dk_Exception", "dk_Interface", "dk_Module", "dk_Operation", "dk_Typedef", "dk_Alias", "dk_Struct", "dk_Union", "dk_Enum", "dk_Primitive", "dk_String", "dk_Sequence", "dk_Array", "dk_Repository", "dk_Wstring", "dk_Fixed", "dk_Value", "dk_ValueBox", "dk_ValueMember", "dk_Native"} ); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_enum_tc(com.sun.org.omg.CORBA.DefinitionKindHelper.id(), "DefinitionKind", + new String[] { "dk_none", "dk_all", "dk_Attribute", "dk_Constant", "dk_Exception", "dk_Interface", "dk_Module", + "dk_Operation", "dk_Typedef", "dk_Alias", "dk_Struct", "dk_Union", "dk_Enum", "dk_Primitive", "dk_String", + "dk_Sequence", "dk_Array", "dk_Repository", "dk_Wstring", "dk_Fixed", "dk_Value", "dk_ValueBox", + "dk_ValueMember", "dk_Native" }); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } // _CHANGED_ - //public static com.sun.org.omg.CORBA.DefinitionKind read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.DefinitionKind read (org.omg.CORBA.portable.InputStream istream) - { + // public static com.sun.org.omg.CORBA.DefinitionKind read (org.omg.CORBA.portable.InputStream istream) + public static org.omg.CORBA.DefinitionKind read(org.omg.CORBA.portable.InputStream istream) { // _CHANGED_ - //return com.sun.org.omg.CORBA.DefinitionKind.from_int (istream.read_long ()); - return org.omg.CORBA.DefinitionKind.from_int (istream.read_long ()); + // return com.sun.org.omg.CORBA.DefinitionKind.from_int (istream.read_long ()); + return org.omg.CORBA.DefinitionKind.from_int(istream.read_long()); } // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.DefinitionKind value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.DefinitionKind value) - { - ostream.write_long (value.value ()); + // public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.DefinitionKind value) + public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.DefinitionKind value) { + ostream.write_long(value.value()); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java index 4f5e67d60..39ac4a1de 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java @@ -19,67 +19,57 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ + * com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:51 AM PDT + */ -public final class ExcDescriptionSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ExcDescriptionSeq:1.0"; +public final class ExcDescriptionSeqHelper { + private static String _id = "IDL:omg.org/CORBA/ExcDescriptionSeq:1.0"; - public ExcDescriptionSeqHelper() - { + public ExcDescriptionSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ExceptionDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ExceptionDescription[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.ExceptionDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.ExceptionDescription[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.id (), "ExcDescriptionSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.type(); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.id(), "ExcDescriptionSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.ExceptionDescription[] read (org.omg.CORBA.portable.InputStream istream) - { + public static com.sun.org.omg.CORBA.ExceptionDescription[] read(org.omg.CORBA.portable.InputStream istream) { com.sun.org.omg.CORBA.ExceptionDescription value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new com.sun.org.omg.CORBA.ExceptionDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ExceptionDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ExceptionDescriptionHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ExceptionDescription[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.ExceptionDescriptionHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ExceptionDescription.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ExceptionDescription.java index 6bb5766fa..e34529956 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ExceptionDescription.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ExceptionDescription.java @@ -19,28 +19,22 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ExceptionDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/ExceptionDescription.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class ExceptionDescription implements org.omg.CORBA.portable.IDLEntity -{ +public final class ExceptionDescription implements org.omg.CORBA.portable.IDLEntity { public String name = null; public String id = null; public String defined_in = null; public String version = null; public org.omg.CORBA.TypeCode type = null; - public ExceptionDescription () - { + public ExceptionDescription() { } // ctor - public ExceptionDescription (String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _type) - { + public ExceptionDescription(String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _type) { name = _name; id = _id; defined_in = _defined_in; diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java index b51915d8a..9db09ae91 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java @@ -19,112 +19,88 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class ExceptionDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/ExceptionDescription:1.0"; +public final class ExceptionDescriptionHelper { + private static String _id = "IDL:omg.org/CORBA/ExceptionDescription:1.0"; - public ExceptionDescriptionHelper() - { + public ExceptionDescriptionHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ExceptionDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ExceptionDescription that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.ExceptionDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.ExceptionDescription extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [5]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.ExceptionDescriptionHelper.id (), "ExceptionDescription", _members0); - __active = false; - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[5]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _members0[0] = new org.omg.CORBA.StructMember("name", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[1] = new org.omg.CORBA.StructMember("id", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[2] = new org.omg.CORBA.StructMember("defined_in", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.VersionSpecHelper.id(), "VersionSpec", + _tcOf_members0); + _members0[3] = new org.omg.CORBA.StructMember("version", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode); + _members0[4] = new org.omg.CORBA.StructMember("type", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc(com.sun.org.omg.CORBA.ExceptionDescriptionHelper.id(), + "ExceptionDescription", _members0); + __active = false; + } } + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.ExceptionDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ExceptionDescription value = new com.sun.org.omg.CORBA.ExceptionDescription (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.type = istream.read_TypeCode (); + public static com.sun.org.omg.CORBA.ExceptionDescription read(org.omg.CORBA.portable.InputStream istream) { + com.sun.org.omg.CORBA.ExceptionDescription value = new com.sun.org.omg.CORBA.ExceptionDescription(); + value.name = istream.read_string(); + value.id = istream.read_string(); + value.defined_in = istream.read_string(); + value.version = istream.read_string(); + value.type = istream.read_TypeCode(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ExceptionDescription value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.type); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ExceptionDescription value) { + ostream.write_string(value.name); + ostream.write_string(value.id); + ostream.write_string(value.defined_in); + ostream.write_string(value.version); + ostream.write_TypeCode(value.type); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/IDLTypeHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/IDLTypeHelper.java index 395939c2f..50ff05b46 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/IDLTypeHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/IDLTypeHelper.java @@ -19,89 +19,76 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/IDLTypeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:45 AM PDT -*/ + * com/sun/org/omg/CORBA/IDLTypeHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from ir.idl + * Thursday, May 6, 1999 1:51:45 AM PDT + */ // This file has been _CHANGED_ -public final class IDLTypeHelper -{ - private static String _id = "IDL:omg.org/CORBA/IDLType:1.0"; +public final class IDLTypeHelper { + private static String _id = "IDL:omg.org/CORBA/IDLType:1.0"; - public IDLTypeHelper() - { + public IDLTypeHelper() { } // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.IDLType that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.IDLType that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + // public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.IDLType that) + public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.IDLType that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } // _CHANGED_ - //public static com.sun.org.omg.CORBA.IDLType extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.IDLType extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + // public static com.sun.org.omg.CORBA.IDLType extract (org.omg.CORBA.Any a) + public static org.omg.CORBA.IDLType extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (com.sun.org.omg.CORBA.IDLTypeHelper.id (), "IDLType"); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_interface_tc(com.sun.org.omg.CORBA.IDLTypeHelper.id(), "IDLType"); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } // _CHANGED_ - //public static com.sun.org.omg.CORBA.IDLType read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.IDLType read (org.omg.CORBA.portable.InputStream istream) - { - return narrow (istream.read_Object (org.glassfish.corba.org.omg.CORBA._IDLTypeStub.class)); + // public static com.sun.org.omg.CORBA.IDLType read (org.omg.CORBA.portable.InputStream istream) + public static org.omg.CORBA.IDLType read(org.omg.CORBA.portable.InputStream istream) { + return narrow(istream.read_Object(org.glassfish.corba.org.omg.CORBA._IDLTypeStub.class)); } // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.IDLType value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.IDLType value) - { - ostream.write_Object ((org.omg.CORBA.Object) value); + // public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.IDLType value) + public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.IDLType value) { + ostream.write_Object((org.omg.CORBA.Object) value); } // _CHANGED_ - //public static com.sun.org.omg.CORBA.IDLType narrow (org.omg.CORBA.Object obj) - public static org.omg.CORBA.IDLType narrow (org.omg.CORBA.Object obj) - { + // public static com.sun.org.omg.CORBA.IDLType narrow (org.omg.CORBA.Object obj) + public static org.omg.CORBA.IDLType narrow(org.omg.CORBA.Object obj) { if (obj == null) return null; // _CHANGED_ - //else if (obj instanceof com.sun.org.omg.CORBA.IDLType) + // else if (obj instanceof com.sun.org.omg.CORBA.IDLType) else if (obj instanceof org.omg.CORBA.IDLType) // _CHANGED_ - //return (com.sun.org.omg.CORBA.IDLType)obj; - return (org.omg.CORBA.IDLType)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - else - { - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); - return new org.glassfish.corba.org.omg.CORBA._IDLTypeStub(delegate); - } + // return (com.sun.org.omg.CORBA.IDLType)obj; + return (org.omg.CORBA.IDLType) obj; + else if (!obj._is_a(id())) + throw new org.omg.CORBA.BAD_PARAM(); + else { + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate(); + return new org.glassfish.corba.org.omg.CORBA._IDLTypeStub(delegate); + } } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/IDLTypeOperations.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/IDLTypeOperations.java index 1ad8e1341..4e53b9192 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/IDLTypeOperations.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/IDLTypeOperations.java @@ -19,15 +19,11 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/IDLTypeOperations.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:45 AM PDT -*/ + * com/sun/org/omg/CORBA/IDLTypeOperations.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:45 AM PDT + */ -public interface IDLTypeOperations extends com.sun.org.omg.CORBA.IRObjectOperations -{ - org.omg.CORBA.TypeCode type (); +public interface IDLTypeOperations extends com.sun.org.omg.CORBA.IRObjectOperations { + org.omg.CORBA.TypeCode type(); } // interface IDLTypeOperations diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/IRObjectOperations.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/IRObjectOperations.java index 11c65e276..6e4d9c74e 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/IRObjectOperations.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/IRObjectOperations.java @@ -19,25 +19,21 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/IRObjectOperations.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:43 AM PDT -*/ + * com/sun/org/omg/CORBA/IRObjectOperations.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:43 AM PDT + */ // This file has been manually _CHANGED_ -public interface IRObjectOperations -{ +public interface IRObjectOperations { // read interface // _CHANGED_ - //com.sun.org.omg.CORBA.DefinitionKind def_kind (); - org.omg.CORBA.DefinitionKind def_kind (); + // com.sun.org.omg.CORBA.DefinitionKind def_kind (); + org.omg.CORBA.DefinitionKind def_kind(); // write interface - void destroy (); + void destroy(); } // interface IRObjectOperations diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/IdentifierHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/IdentifierHelper.java index eeb5d76d0..ea856dddb 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/IdentifierHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/IdentifierHelper.java @@ -19,61 +19,50 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/IdentifierHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:42 AM PDT -*/ + * com/sun/org/omg/CORBA/IdentifierHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:42 AM PDT + */ -public final class IdentifierHelper -{ - private static String _id = "IDL:omg.org/CORBA/Identifier:1.0"; +public final class IdentifierHelper { + private static String _id = "IDL:omg.org/CORBA/Identifier:1.0"; - public IdentifierHelper() - { + public IdentifierHelper() { } - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, String that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static String extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static String read (org.omg.CORBA.portable.InputStream istream) - { + public static String read(org.omg.CORBA.portable.InputStream istream) { String value = null; - value = istream.read_string (); + value = istream.read_string(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); + public static void write(org.omg.CORBA.portable.OutputStream ostream, String value) { + ostream.write_string(value); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/Initializer.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/Initializer.java index 00cf4b43c..ad64e41e5 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/Initializer.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/Initializer.java @@ -19,31 +19,25 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/Initializer.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ + * com/sun/org/omg/CORBA/Initializer.java Generated by the IDL-to-Java compiler (portable), version "3.0" from ir.idl + * Thursday, May 6, 1999 1:51:44 AM PDT + */ // This file has been _CHANGED_ -public final class Initializer implements org.omg.CORBA.portable.IDLEntity -{ +public final class Initializer implements org.omg.CORBA.portable.IDLEntity { // _CHANGED_ - //public com.sun.org.omg.CORBA.StructMember members[] = null; + // public com.sun.org.omg.CORBA.StructMember members[] = null; public org.omg.CORBA.StructMember members[] = null; public String name = null; - public Initializer () - { + public Initializer() { } // ctor // _CHANGED_ - //public Initializer (com.sun.org.omg.CORBA.StructMember[] _members, String _name) - public Initializer (org.omg.CORBA.StructMember[] _members, String _name) - { + // public Initializer (com.sun.org.omg.CORBA.StructMember[] _members, String _name) + public Initializer(org.omg.CORBA.StructMember[] _members, String _name) { members = _members; name = _name; } // ctor diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/InitializerHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/InitializerHelper.java index 6bfbe1219..d4b6b2440 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/InitializerHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/InitializerHelper.java @@ -19,90 +19,73 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/InitializerHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ + * com/sun/org/omg/CORBA/InitializerHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:44 AM PDT + */ -public final class InitializerHelper -{ - private static String _id = "IDL:omg.org/CORBA/Initializer:1.0"; +public final class InitializerHelper { + private static String _id = "IDL:omg.org/CORBA/Initializer:1.0"; - public InitializerHelper() - { + public InitializerHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.Initializer that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.Initializer that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.Initializer extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.Initializer extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = com.sun.org.omg.CORBA.StructMemberHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.StructMemberSeqHelper.id (), "StructMemberSeq", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "members", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.InitializerHelper.id (), "Initializer", _members0); - __active = false; - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[2]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = com.sun.org.omg.CORBA.StructMemberHelper.type(); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.StructMemberSeqHelper.id(), + "StructMemberSeq", _tcOf_members0); + _members0[0] = new org.omg.CORBA.StructMember("members", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _members0[1] = new org.omg.CORBA.StructMember("name", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc(com.sun.org.omg.CORBA.InitializerHelper.id(), "Initializer", + _members0); + __active = false; + } } + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.Initializer read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.Initializer value = new com.sun.org.omg.CORBA.Initializer (); - value.members = com.sun.org.omg.CORBA.StructMemberSeqHelper.read (istream); - value.name = istream.read_string (); + public static com.sun.org.omg.CORBA.Initializer read(org.omg.CORBA.portable.InputStream istream) { + com.sun.org.omg.CORBA.Initializer value = new com.sun.org.omg.CORBA.Initializer(); + value.members = com.sun.org.omg.CORBA.StructMemberSeqHelper.read(istream); + value.name = istream.read_string(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.Initializer value) - { - com.sun.org.omg.CORBA.StructMemberSeqHelper.write (ostream, value.members); - ostream.write_string (value.name); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.Initializer value) { + com.sun.org.omg.CORBA.StructMemberSeqHelper.write(ostream, value.members); + ostream.write_string(value.name); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/InitializerSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/InitializerSeqHelper.java index f084acb9e..7912f8600 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/InitializerSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/InitializerSeqHelper.java @@ -19,67 +19,57 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/InitializerSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ + * com/sun/org/omg/CORBA/InitializerSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:44 AM PDT + */ -public final class InitializerSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/InitializerSeq:1.0"; +public final class InitializerSeqHelper { + private static String _id = "IDL:omg.org/CORBA/InitializerSeq:1.0"; - public InitializerSeqHelper() - { + public InitializerSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.Initializer[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.Initializer[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.Initializer[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.Initializer[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.InitializerHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.InitializerSeqHelper.id (), "InitializerSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = com.sun.org.omg.CORBA.InitializerHelper.type(); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.InitializerSeqHelper.id(), "InitializerSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.Initializer[] read (org.omg.CORBA.portable.InputStream istream) - { + public static com.sun.org.omg.CORBA.Initializer[] read(org.omg.CORBA.portable.InputStream istream) { com.sun.org.omg.CORBA.Initializer value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new com.sun.org.omg.CORBA.Initializer[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.InitializerHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.InitializerHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.Initializer[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.InitializerHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.Initializer[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.InitializerHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java index c06c0da85..6f6993149 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java @@ -19,67 +19,57 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ + * com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:51 AM PDT + */ -public final class OpDescriptionSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/OpDescriptionSeq:1.0"; +public final class OpDescriptionSeqHelper { + private static String _id = "IDL:omg.org/CORBA/OpDescriptionSeq:1.0"; - public OpDescriptionSeqHelper() - { + public OpDescriptionSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationDescription[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.OperationDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.OperationDescription[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.OperationDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.OpDescriptionSeqHelper.id (), "OpDescriptionSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = com.sun.org.omg.CORBA.OperationDescriptionHelper.type(); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.OpDescriptionSeqHelper.id(), "OpDescriptionSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.OperationDescription[] read (org.omg.CORBA.portable.InputStream istream) - { + public static com.sun.org.omg.CORBA.OperationDescription[] read(org.omg.CORBA.portable.InputStream istream) { com.sun.org.omg.CORBA.OperationDescription value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new com.sun.org.omg.CORBA.OperationDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.OperationDescriptionHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.OperationDescriptionHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.OperationDescriptionHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationDescription[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.OperationDescriptionHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationDescription.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationDescription.java index 4f268ada7..50d043036 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationDescription.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationDescription.java @@ -19,16 +19,12 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/OperationDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ + * com/sun/org/omg/CORBA/OperationDescription.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:51 AM PDT + */ -public final class OperationDescription implements org.omg.CORBA.portable.IDLEntity -{ +public final class OperationDescription implements org.omg.CORBA.portable.IDLEntity { public String name = null; public String id = null; public String defined_in = null; @@ -39,12 +35,12 @@ public final class OperationDescription implements org.omg.CORBA.portable.IDLEnt public com.sun.org.omg.CORBA.ParameterDescription parameters[] = null; public com.sun.org.omg.CORBA.ExceptionDescription exceptions[] = null; - public OperationDescription () - { + public OperationDescription() { } // ctor - public OperationDescription (String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _result, com.sun.org.omg.CORBA.OperationMode _mode, String[] _contexts, com.sun.org.omg.CORBA.ParameterDescription[] _parameters, com.sun.org.omg.CORBA.ExceptionDescription[] _exceptions) - { + public OperationDescription(String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _result, + com.sun.org.omg.CORBA.OperationMode _mode, String[] _contexts, com.sun.org.omg.CORBA.ParameterDescription[] _parameters, + com.sun.org.omg.CORBA.ExceptionDescription[] _exceptions) { name = _name; id = _id; defined_in = _defined_in; diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationDescriptionHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationDescriptionHelper.java index db8f82cc1..5a2c0f11f 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationDescriptionHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationDescriptionHelper.java @@ -19,148 +19,117 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/OperationDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ + * com/sun/org/omg/CORBA/OperationDescriptionHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:51 AM PDT + */ -public final class OperationDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/OperationDescription:1.0"; +public final class OperationDescriptionHelper { + private static String _id = "IDL:omg.org/CORBA/OperationDescription:1.0"; - public OperationDescriptionHelper() - { + public OperationDescriptionHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationDescription that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.OperationDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.OperationDescription extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [9]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "result", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.OperationModeHelper.type (); - _members0[5] = new org.omg.CORBA.StructMember ( - "mode", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdentifierHelper.id (), "ContextIdentifier", _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdSeqHelper.id (), "ContextIdSeq", _tcOf_members0); - _members0[6] = new org.omg.CORBA.StructMember ( - "contexts", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.ParameterDescriptionHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ParDescriptionSeqHelper.id (), "ParDescriptionSeq", _tcOf_members0); - _members0[7] = new org.omg.CORBA.StructMember ( - "parameters", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.id (), "ExcDescriptionSeq", _tcOf_members0); - _members0[8] = new org.omg.CORBA.StructMember ( - "exceptions", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.OperationDescriptionHelper.id (), "OperationDescription", _members0); - __active = false; - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[9]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _members0[0] = new org.omg.CORBA.StructMember("name", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[1] = new org.omg.CORBA.StructMember("id", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[2] = new org.omg.CORBA.StructMember("defined_in", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.VersionSpecHelper.id(), "VersionSpec", + _tcOf_members0); + _members0[3] = new org.omg.CORBA.StructMember("version", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode); + _members0[4] = new org.omg.CORBA.StructMember("result", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.OperationModeHelper.type(); + _members0[5] = new org.omg.CORBA.StructMember("mode", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ContextIdentifierHelper.id(), + "ContextIdentifier", _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ContextIdSeqHelper.id(), "ContextIdSeq", + _tcOf_members0); + _members0[6] = new org.omg.CORBA.StructMember("contexts", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.ParameterDescriptionHelper.type(); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ParDescriptionSeqHelper.id(), + "ParDescriptionSeq", _tcOf_members0); + _members0[7] = new org.omg.CORBA.StructMember("parameters", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.type(); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.id(), + "ExcDescriptionSeq", _tcOf_members0); + _members0[8] = new org.omg.CORBA.StructMember("exceptions", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc(com.sun.org.omg.CORBA.OperationDescriptionHelper.id(), + "OperationDescription", _members0); + __active = false; + } } + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.OperationDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.OperationDescription value = new com.sun.org.omg.CORBA.OperationDescription (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.result = istream.read_TypeCode (); - value.mode = com.sun.org.omg.CORBA.OperationModeHelper.read (istream); - value.contexts = com.sun.org.omg.CORBA.ContextIdSeqHelper.read (istream); - value.parameters = com.sun.org.omg.CORBA.ParDescriptionSeqHelper.read (istream); - value.exceptions = com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.read (istream); + public static com.sun.org.omg.CORBA.OperationDescription read(org.omg.CORBA.portable.InputStream istream) { + com.sun.org.omg.CORBA.OperationDescription value = new com.sun.org.omg.CORBA.OperationDescription(); + value.name = istream.read_string(); + value.id = istream.read_string(); + value.defined_in = istream.read_string(); + value.version = istream.read_string(); + value.result = istream.read_TypeCode(); + value.mode = com.sun.org.omg.CORBA.OperationModeHelper.read(istream); + value.contexts = com.sun.org.omg.CORBA.ContextIdSeqHelper.read(istream); + value.parameters = com.sun.org.omg.CORBA.ParDescriptionSeqHelper.read(istream); + value.exceptions = com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationDescription value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.result); - com.sun.org.omg.CORBA.OperationModeHelper.write (ostream, value.mode); - com.sun.org.omg.CORBA.ContextIdSeqHelper.write (ostream, value.contexts); - com.sun.org.omg.CORBA.ParDescriptionSeqHelper.write (ostream, value.parameters); - com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.write (ostream, value.exceptions); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationDescription value) { + ostream.write_string(value.name); + ostream.write_string(value.id); + ostream.write_string(value.defined_in); + ostream.write_string(value.version); + ostream.write_TypeCode(value.result); + com.sun.org.omg.CORBA.OperationModeHelper.write(ostream, value.mode); + com.sun.org.omg.CORBA.ContextIdSeqHelper.write(ostream, value.contexts); + com.sun.org.omg.CORBA.ParDescriptionSeqHelper.write(ostream, value.parameters); + com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.write(ostream, value.exceptions); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationMode.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationMode.java index b309b61eb..3ac2745a8 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationMode.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationMode.java @@ -19,40 +19,33 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/OperationMode.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/OperationMode.java Generated by the IDL-to-Java compiler (portable), version "3.0" from ir.idl + * Thursday, May 6, 1999 1:51:50 AM PDT + */ -public class OperationMode implements org.omg.CORBA.portable.IDLEntity -{ - private int __value; +public class OperationMode implements org.omg.CORBA.portable.IDLEntity { + private int __value; private static int __size = 2; - private static com.sun.org.omg.CORBA.OperationMode[] __array = new com.sun.org.omg.CORBA.OperationMode [__size]; + private static com.sun.org.omg.CORBA.OperationMode[] __array = new com.sun.org.omg.CORBA.OperationMode[__size]; public static final int _OP_NORMAL = 0; public static final com.sun.org.omg.CORBA.OperationMode OP_NORMAL = new com.sun.org.omg.CORBA.OperationMode(_OP_NORMAL); public static final int _OP_ONEWAY = 1; public static final com.sun.org.omg.CORBA.OperationMode OP_ONEWAY = new com.sun.org.omg.CORBA.OperationMode(_OP_ONEWAY); - public int value () - { + public int value() { return __value; } - public static com.sun.org.omg.CORBA.OperationMode from_int (int value) - { + public static com.sun.org.omg.CORBA.OperationMode from_int(int value) { if (value >= 0 && value < __size) return __array[value]; else - throw new org.omg.CORBA.BAD_PARAM (); + throw new org.omg.CORBA.BAD_PARAM(); } - protected OperationMode (int value) - { + protected OperationMode(int value) { __value = value; __array[__value] = this; } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationModeHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationModeHelper.java index ff9336ba8..6f87ef8bd 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationModeHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/OperationModeHelper.java @@ -19,58 +19,48 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/OperationModeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/OperationModeHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class OperationModeHelper -{ - private static String _id = "IDL:omg.org/CORBA/OperationMode:1.0"; +public final class OperationModeHelper { + private static String _id = "IDL:omg.org/CORBA/OperationMode:1.0"; - public OperationModeHelper() - { + public OperationModeHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationMode that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationMode that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.OperationMode extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.OperationMode extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (com.sun.org.omg.CORBA.OperationModeHelper.id (), "OperationMode", new String[] { "OP_NORMAL", "OP_ONEWAY"} ); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_enum_tc(com.sun.org.omg.CORBA.OperationModeHelper.id(), "OperationMode", + new String[] { "OP_NORMAL", "OP_ONEWAY" }); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.OperationMode read (org.omg.CORBA.portable.InputStream istream) - { - return com.sun.org.omg.CORBA.OperationMode.from_int (istream.read_long ()); + public static com.sun.org.omg.CORBA.OperationMode read(org.omg.CORBA.portable.InputStream istream) { + return com.sun.org.omg.CORBA.OperationMode.from_int(istream.read_long()); } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationMode value) - { - ostream.write_long (value.value ()); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationMode value) { + ostream.write_long(value.value()); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java index f000d97f4..be57a665a 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java @@ -19,67 +19,57 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class ParDescriptionSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ParDescriptionSeq:1.0"; +public final class ParDescriptionSeqHelper { + private static String _id = "IDL:omg.org/CORBA/ParDescriptionSeq:1.0"; - public ParDescriptionSeqHelper() - { + public ParDescriptionSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterDescription[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.ParameterDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.ParameterDescription[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.ParameterDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ParDescriptionSeqHelper.id (), "ParDescriptionSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = com.sun.org.omg.CORBA.ParameterDescriptionHelper.type(); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ParDescriptionSeqHelper.id(), "ParDescriptionSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.ParameterDescription[] read (org.omg.CORBA.portable.InputStream istream) - { + public static com.sun.org.omg.CORBA.ParameterDescription[] read(org.omg.CORBA.portable.InputStream istream) { com.sun.org.omg.CORBA.ParameterDescription value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new com.sun.org.omg.CORBA.ParameterDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ParameterDescriptionHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.ParameterDescriptionHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ParameterDescriptionHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterDescription[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.ParameterDescriptionHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterDescription.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterDescription.java index 269ce4de4..29099df62 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterDescription.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterDescription.java @@ -19,33 +19,29 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ParameterDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/ParameterDescription.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ // This file has been _CHANGED_ -public final class ParameterDescription implements org.omg.CORBA.portable.IDLEntity -{ +public final class ParameterDescription implements org.omg.CORBA.portable.IDLEntity { public String name = null; public org.omg.CORBA.TypeCode type = null; // _CHANGED_ - //public com.sun.org.omg.CORBA.IDLType type_def = null; + // public com.sun.org.omg.CORBA.IDLType type_def = null; public org.omg.CORBA.IDLType type_def = null; public com.sun.org.omg.CORBA.ParameterMode mode = null; - public ParameterDescription () - { + public ParameterDescription() { } // ctor // _CHANGED_ - //public ParameterDescription (String _name, org.omg.CORBA.TypeCode _type, com.sun.org.omg.CORBA.IDLType _type_def, com.sun.org.omg.CORBA.ParameterMode _mode) - public ParameterDescription (String _name, org.omg.CORBA.TypeCode _type, org.omg.CORBA.IDLType _type_def, com.sun.org.omg.CORBA.ParameterMode _mode) - { + // public ParameterDescription (String _name, org.omg.CORBA.TypeCode _type, com.sun.org.omg.CORBA.IDLType _type_def, + // com.sun.org.omg.CORBA.ParameterMode _mode) + public ParameterDescription(String _name, org.omg.CORBA.TypeCode _type, org.omg.CORBA.IDLType _type_def, + com.sun.org.omg.CORBA.ParameterMode _mode) { name = _name; type = _type; type_def = _type_def; diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java index b928599f1..300a2d009 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java @@ -19,102 +19,78 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ParameterDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/ParameterDescriptionHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class ParameterDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/ParameterDescription:1.0"; +public final class ParameterDescriptionHelper { + private static String _id = "IDL:omg.org/CORBA/ParameterDescription:1.0"; - public ParameterDescriptionHelper() - { + public ParameterDescriptionHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterDescription that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.ParameterDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.ParameterDescription extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [4]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[1] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type (); - _members0[2] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.ParameterModeHelper.type (); - _members0[3] = new org.omg.CORBA.StructMember ( - "mode", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.ParameterDescriptionHelper.id (), "ParameterDescription", _members0); - __active = false; - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[4]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _members0[0] = new org.omg.CORBA.StructMember("name", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode); + _members0[1] = new org.omg.CORBA.StructMember("type", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type(); + _members0[2] = new org.omg.CORBA.StructMember("type_def", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.ParameterModeHelper.type(); + _members0[3] = new org.omg.CORBA.StructMember("mode", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc(com.sun.org.omg.CORBA.ParameterDescriptionHelper.id(), + "ParameterDescription", _members0); + __active = false; + } } + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.ParameterDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ParameterDescription value = new com.sun.org.omg.CORBA.ParameterDescription (); - value.name = istream.read_string (); - value.type = istream.read_TypeCode (); - value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read (istream); - value.mode = com.sun.org.omg.CORBA.ParameterModeHelper.read (istream); + public static com.sun.org.omg.CORBA.ParameterDescription read(org.omg.CORBA.portable.InputStream istream) { + com.sun.org.omg.CORBA.ParameterDescription value = new com.sun.org.omg.CORBA.ParameterDescription(); + value.name = istream.read_string(); + value.type = istream.read_TypeCode(); + value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read(istream); + value.mode = com.sun.org.omg.CORBA.ParameterModeHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterDescription value) - { - ostream.write_string (value.name); - ostream.write_TypeCode (value.type); - com.sun.org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); - com.sun.org.omg.CORBA.ParameterModeHelper.write (ostream, value.mode); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterDescription value) { + ostream.write_string(value.name); + ostream.write_TypeCode(value.type); + com.sun.org.omg.CORBA.IDLTypeHelper.write(ostream, value.type_def); + com.sun.org.omg.CORBA.ParameterModeHelper.write(ostream, value.mode); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterMode.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterMode.java index e3ba7885d..cb588aa67 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterMode.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterMode.java @@ -19,19 +19,15 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ParameterMode.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/ParameterMode.java Generated by the IDL-to-Java compiler (portable), version "3.0" from ir.idl + * Thursday, May 6, 1999 1:51:50 AM PDT + */ -public class ParameterMode implements org.omg.CORBA.portable.IDLEntity -{ - private int __value; +public class ParameterMode implements org.omg.CORBA.portable.IDLEntity { + private int __value; private static int __size = 3; - private static com.sun.org.omg.CORBA.ParameterMode[] __array = new com.sun.org.omg.CORBA.ParameterMode [__size]; + private static com.sun.org.omg.CORBA.ParameterMode[] __array = new com.sun.org.omg.CORBA.ParameterMode[__size]; public static final int _PARAM_IN = 0; public static final com.sun.org.omg.CORBA.ParameterMode PARAM_IN = new com.sun.org.omg.CORBA.ParameterMode(_PARAM_IN); @@ -40,21 +36,18 @@ public class ParameterMode implements org.omg.CORBA.portable.IDLEntity public static final int _PARAM_INOUT = 2; public static final com.sun.org.omg.CORBA.ParameterMode PARAM_INOUT = new com.sun.org.omg.CORBA.ParameterMode(_PARAM_INOUT); - public int value () - { + public int value() { return __value; } - public static com.sun.org.omg.CORBA.ParameterMode from_int (int value) - { + public static com.sun.org.omg.CORBA.ParameterMode from_int(int value) { if (value >= 0 && value < __size) return __array[value]; else - throw new org.omg.CORBA.BAD_PARAM (); + throw new org.omg.CORBA.BAD_PARAM(); } - protected ParameterMode (int value) - { + protected ParameterMode(int value) { __value = value; __array[__value] = this; } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterModeHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterModeHelper.java index b04b624f6..5169b5dee 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterModeHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ParameterModeHelper.java @@ -19,58 +19,48 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ParameterModeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ + * com/sun/org/omg/CORBA/ParameterModeHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:50 AM PDT + */ -public final class ParameterModeHelper -{ - private static String _id = "IDL:omg.org/CORBA/ParameterMode:1.0"; +public final class ParameterModeHelper { + private static String _id = "IDL:omg.org/CORBA/ParameterMode:1.0"; - public ParameterModeHelper() - { + public ParameterModeHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterMode that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterMode that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.ParameterMode extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.ParameterMode extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (com.sun.org.omg.CORBA.ParameterModeHelper.id (), "ParameterMode", new String[] { "PARAM_IN", "PARAM_OUT", "PARAM_INOUT"} ); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_enum_tc(com.sun.org.omg.CORBA.ParameterModeHelper.id(), "ParameterMode", + new String[] { "PARAM_IN", "PARAM_OUT", "PARAM_INOUT" }); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.ParameterMode read (org.omg.CORBA.portable.InputStream istream) - { - return com.sun.org.omg.CORBA.ParameterMode.from_int (istream.read_long ()); + public static com.sun.org.omg.CORBA.ParameterMode read(org.omg.CORBA.portable.InputStream istream) { + return com.sun.org.omg.CORBA.ParameterMode.from_int(istream.read_long()); } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterMode value) - { - ostream.write_long (value.value ()); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterMode value) { + ostream.write_long(value.value()); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/Repository.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/Repository.java index d5a34ac13..14a3588b0 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/Repository.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/Repository.java @@ -19,6 +19,5 @@ package com.sun.org.omg.CORBA; -public interface Repository extends org.omg.CORBA.IRObject, org.omg.CORBA.portable.IDLEntity -{ +public interface Repository extends org.omg.CORBA.IRObject, org.omg.CORBA.portable.IDLEntity { } // interface Repository diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryHelper.java index e3e01ba42..12cadb69b 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryHelper.java @@ -19,53 +19,45 @@ package com.sun.org.omg.CORBA; -public final class RepositoryHelper -{ - private static String _id = "IDL:com.sun.omg.org/CORBA/Repository:3.0"; +public final class RepositoryHelper { + private static String _id = "IDL:com.sun.omg.org/CORBA/Repository:3.0"; - public RepositoryHelper() - { + public RepositoryHelper() { } - public static void insert (org.omg.CORBA.Any a, Repository that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, Repository that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static Repository extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static Repository extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryHelper.id (), "Repository", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryHelper.id(), "Repository", __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static Repository read (org.omg.CORBA.portable.InputStream istream) - { + public static Repository read(org.omg.CORBA.portable.InputStream istream) { String value = null; - value = istream.read_string (); + value = istream.read_string(); return null; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, Repository value) - { - ostream.write_string (null); + public static void write(org.omg.CORBA.portable.OutputStream ostream, Repository value) { + ostream.write_string(null); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryIdHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryIdHelper.java index 25889766b..9883e8b34 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryIdHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryIdHelper.java @@ -19,61 +19,51 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/RepositoryIdHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:43 AM PDT -*/ + * com/sun/org/omg/CORBA/RepositoryIdHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:43 AM PDT + */ -public final class RepositoryIdHelper -{ - private static String _id = "IDL:omg.org/CORBA/RepositoryId:1.0"; +public final class RepositoryIdHelper { + private static String _id = "IDL:omg.org/CORBA/RepositoryId:1.0"; - public RepositoryIdHelper() - { + public RepositoryIdHelper() { } - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, String that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static String extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static String read (org.omg.CORBA.portable.InputStream istream) - { + public static String read(org.omg.CORBA.portable.InputStream istream) { String value = null; - value = istream.read_string (); + value = istream.read_string(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); + public static void write(org.omg.CORBA.portable.OutputStream ostream, String value) { + ostream.write_string(value); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java index 63fb32520..a4ad4bf4f 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java @@ -19,68 +19,59 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ + * com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:51 AM PDT + */ -public final class RepositoryIdSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/RepositoryIdSeq:1.0"; +public final class RepositoryIdSeqHelper { + private static String _id = "IDL:omg.org/CORBA/RepositoryIdSeq:1.0"; - public RepositoryIdSeqHelper() - { + public RepositoryIdSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, String[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, String[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static String[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static String[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id (), "RepositoryIdSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id(), "RepositoryIdSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static String[] read (org.omg.CORBA.portable.InputStream istream) - { + public static String[] read(org.omg.CORBA.portable.InputStream istream) { String value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new String[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.RepositoryIdHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.RepositoryIdHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.RepositoryIdHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, String[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.RepositoryIdHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/StructMemberHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/StructMemberHelper.java index 51b62e3a9..f79b496a0 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/StructMemberHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/StructMemberHelper.java @@ -19,107 +19,86 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/StructMemberHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ + * com/sun/org/omg/CORBA/StructMemberHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:44 AM PDT + */ // This file has been manually _CHANGED_ -public final class StructMemberHelper -{ - private static String _id = "IDL:omg.org/CORBA/StructMember:1.0"; +public final class StructMemberHelper { + private static String _id = "IDL:omg.org/CORBA/StructMember:1.0"; - public StructMemberHelper() - { + public StructMemberHelper() { } // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.StructMember that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.StructMember that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + // public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.StructMember that) + public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.StructMember that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } // _CHANGED_ - //public static com.sun.org.omg.CORBA.StructMember extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.StructMember extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + // public static com.sun.org.omg.CORBA.StructMember extract (org.omg.CORBA.Any a) + public static org.omg.CORBA.StructMember extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [3]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[1] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type (); - _members0[2] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.StructMemberHelper.id (), "StructMember", _members0); - __active = false; - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[3]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _members0[0] = new org.omg.CORBA.StructMember("name", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode); + _members0[1] = new org.omg.CORBA.StructMember("type", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type(); + _members0[2] = new org.omg.CORBA.StructMember("type_def", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc(com.sun.org.omg.CORBA.StructMemberHelper.id(), "StructMember", + _members0); + __active = false; + } } + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } // _CHANGED_ - //public static com.sun.org.omg.CORBA.StructMember read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.StructMember read (org.omg.CORBA.portable.InputStream istream) - { + // public static com.sun.org.omg.CORBA.StructMember read (org.omg.CORBA.portable.InputStream istream) + public static org.omg.CORBA.StructMember read(org.omg.CORBA.portable.InputStream istream) { // _CHANGED_ - //com.sun.org.omg.CORBA.StructMember value = new com.sun.org.omg.CORBA.StructMember (); - org.omg.CORBA.StructMember value = new org.omg.CORBA.StructMember (); - value.name = istream.read_string (); - value.type = istream.read_TypeCode (); - value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read (istream); + // com.sun.org.omg.CORBA.StructMember value = new com.sun.org.omg.CORBA.StructMember (); + org.omg.CORBA.StructMember value = new org.omg.CORBA.StructMember(); + value.name = istream.read_string(); + value.type = istream.read_TypeCode(); + value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read(istream); return value; } // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.StructMember value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.StructMember value) - { - ostream.write_string (value.name); - ostream.write_TypeCode (value.type); - com.sun.org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); + // public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.StructMember value) + public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.StructMember value) { + ostream.write_string(value.name); + ostream.write_TypeCode(value.type); + com.sun.org.omg.CORBA.IDLTypeHelper.write(ostream, value.type_def); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/StructMemberSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/StructMemberSeqHelper.java index 871888951..d4930d8bd 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/StructMemberSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/StructMemberSeqHelper.java @@ -19,81 +19,71 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/StructMemberSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ + * com/sun/org/omg/CORBA/StructMemberSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:44 AM PDT + */ // This file has been _CHANGED_ -public final class StructMemberSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/StructMemberSeq:1.0"; +public final class StructMemberSeqHelper { + private static String _id = "IDL:omg.org/CORBA/StructMemberSeq:1.0"; - public StructMemberSeqHelper() - { + public StructMemberSeqHelper() { } // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.StructMember[] that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.StructMember[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + // public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.StructMember[] that) + public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.StructMember[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } // _CHANGED_ - //public static com.sun.org.omg.CORBA.StructMember[] extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.StructMember[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + // public static com.sun.org.omg.CORBA.StructMember[] extract (org.omg.CORBA.Any a) + public static org.omg.CORBA.StructMember[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.StructMemberHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.StructMemberSeqHelper.id (), "StructMemberSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = com.sun.org.omg.CORBA.StructMemberHelper.type(); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.StructMemberSeqHelper.id(), "StructMemberSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } // _CHANGED_ - //public static com.sun.org.omg.CORBA.StructMember[] read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.StructMember[] read (org.omg.CORBA.portable.InputStream istream) - { + // public static com.sun.org.omg.CORBA.StructMember[] read (org.omg.CORBA.portable.InputStream istream) + public static org.omg.CORBA.StructMember[] read(org.omg.CORBA.portable.InputStream istream) { // _CHANGED_ - //com.sun.org.omg.CORBA.StructMember value[] = null; + // com.sun.org.omg.CORBA.StructMember value[] = null; org.omg.CORBA.StructMember value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); // _CHANGED_ - //value = new com.sun.org.omg.CORBA.StructMember[_len0]; + // value = new com.sun.org.omg.CORBA.StructMember[_len0]; value = new org.omg.CORBA.StructMember[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.StructMemberHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.StructMemberHelper.read(istream); return value; } // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.StructMember[] value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.StructMember[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.StructMemberHelper.write (ostream, value[_i0]); + // public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.StructMember[] value) + public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.StructMember[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.StructMemberHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java index a023e41a1..73fc4a39b 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java @@ -19,18 +19,14 @@ package com.sun.org.omg.CORBA.ValueDefPackage; - /** -* com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:52 AM PDT -*/ + * com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java Generated by the IDL-to-Java compiler (portable), + * version "3.0" from ir.idl Thursday, May 6, 1999 1:51:52 AM PDT + */ // This file has been manually _CHANGED_ -public final class FullValueDescription implements org.omg.CORBA.portable.IDLEntity -{ +public final class FullValueDescription implements org.omg.CORBA.portable.IDLEntity { public String name = null; public String id = null; public boolean is_abstract = false; @@ -41,9 +37,9 @@ public final class FullValueDescription implements org.omg.CORBA.portable.IDLEnt public com.sun.org.omg.CORBA.AttributeDescription attributes[] = null; // _CHANGED_ - //public com.sun.org.omg.CORBA.ValueMember members[] = null; + // public com.sun.org.omg.CORBA.ValueMember members[] = null; public org.omg.CORBA.ValueMember members[] = null; - + public com.sun.org.omg.CORBA.Initializer initializers[] = null; public String supported_interfaces[] = null; public String abstract_base_values[] = null; @@ -51,14 +47,19 @@ public final class FullValueDescription implements org.omg.CORBA.portable.IDLEnt public String base_value = null; public org.omg.CORBA.TypeCode type = null; - public FullValueDescription () - { + public FullValueDescription() { } // ctor // _CHANGED_ - //public FullValueDescription (String _name, String _id, boolean _is_abstract, boolean _is_custom, String _defined_in, String _version, com.sun.org.omg.CORBA.OperationDescription[] _operations, com.sun.org.omg.CORBA.AttributeDescription[] _attributes, com.sun.org.omg.CORBA.ValueMember[] _members, com.sun.org.omg.CORBA.Initializer[] _initializers, String[] _supported_interfaces, String[] _abstract_base_values, boolean _is_truncatable, String _base_value, org.omg.CORBA.TypeCode _type) - public FullValueDescription (String _name, String _id, boolean _is_abstract, boolean _is_custom, String _defined_in, String _version, com.sun.org.omg.CORBA.OperationDescription[] _operations, com.sun.org.omg.CORBA.AttributeDescription[] _attributes, org.omg.CORBA.ValueMember[] _members, com.sun.org.omg.CORBA.Initializer[] _initializers, String[] _supported_interfaces, String[] _abstract_base_values, boolean _is_truncatable, String _base_value, org.omg.CORBA.TypeCode _type) - { + // public FullValueDescription (String _name, String _id, boolean _is_abstract, boolean _is_custom, String _defined_in, + // String _version, com.sun.org.omg.CORBA.OperationDescription[] _operations, + // com.sun.org.omg.CORBA.AttributeDescription[] _attributes, com.sun.org.omg.CORBA.ValueMember[] _members, + // com.sun.org.omg.CORBA.Initializer[] _initializers, String[] _supported_interfaces, String[] _abstract_base_values, + // boolean _is_truncatable, String _base_value, org.omg.CORBA.TypeCode _type) + public FullValueDescription(String _name, String _id, boolean _is_abstract, boolean _is_custom, String _defined_in, String _version, + com.sun.org.omg.CORBA.OperationDescription[] _operations, com.sun.org.omg.CORBA.AttributeDescription[] _attributes, + org.omg.CORBA.ValueMember[] _members, com.sun.org.omg.CORBA.Initializer[] _initializers, String[] _supported_interfaces, + String[] _abstract_base_values, boolean _is_truncatable, String _base_value, org.omg.CORBA.TypeCode _type) { name = _name; id = _id; is_abstract = _is_abstract; diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java index 2b1cd507e..a9bde61cb 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java @@ -19,197 +19,153 @@ package com.sun.org.omg.CORBA.ValueDefPackage; - /** -* com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:52 AM PDT -*/ + * com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java Generated by the IDL-to-Java compiler + * (portable), version "3.0" from ir.idl Thursday, May 6, 1999 1:51:52 AM PDT + */ -public final class FullValueDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/ValueDef/FullValueDescription:1.0"; +public final class FullValueDescriptionHelper { + private static String _id = "IDL:omg.org/CORBA/ValueDef/FullValueDescription:1.0"; - public FullValueDescriptionHelper() - { + public FullValueDescriptionHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [15]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean); - _members0[2] = new org.omg.CORBA.StructMember ( - "is_abstract", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean); - _members0[3] = new org.omg.CORBA.StructMember ( - "is_custom", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[4] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[5] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.OperationDescriptionHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.OpDescriptionSeqHelper.id (), "OpDescriptionSeq", _tcOf_members0); - _members0[6] = new org.omg.CORBA.StructMember ( - "operations", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.AttributeDescriptionHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.id (), "AttrDescriptionSeq", _tcOf_members0); - _members0[7] = new org.omg.CORBA.StructMember ( - "attributes", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.ValueMemberHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ValueMemberSeqHelper.id (), "ValueMemberSeq", _tcOf_members0); - _members0[8] = new org.omg.CORBA.StructMember ( - "members", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.InitializerHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.InitializerSeqHelper.id (), "InitializerSeq", _tcOf_members0); - _members0[9] = new org.omg.CORBA.StructMember ( - "initializers", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id (), "RepositoryIdSeq", _tcOf_members0); - _members0[10] = new org.omg.CORBA.StructMember ( - "supported_interfaces", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id (), "RepositoryIdSeq", _tcOf_members0); - _members0[11] = new org.omg.CORBA.StructMember ( - "abstract_base_values", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean); - _members0[12] = new org.omg.CORBA.StructMember ( - "is_truncatable", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[13] = new org.omg.CORBA.StructMember ( - "base_value", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[14] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.id (), "FullValueDescription", _members0); - __active = false; - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[15]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _members0[0] = new org.omg.CORBA.StructMember("name", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[1] = new org.omg.CORBA.StructMember("id", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean); + _members0[2] = new org.omg.CORBA.StructMember("is_abstract", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean); + _members0[3] = new org.omg.CORBA.StructMember("is_custom", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[4] = new org.omg.CORBA.StructMember("defined_in", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.VersionSpecHelper.id(), "VersionSpec", + _tcOf_members0); + _members0[5] = new org.omg.CORBA.StructMember("version", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.OperationDescriptionHelper.type(); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.OpDescriptionSeqHelper.id(), + "OpDescriptionSeq", _tcOf_members0); + _members0[6] = new org.omg.CORBA.StructMember("operations", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.AttributeDescriptionHelper.type(); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.id(), + "AttrDescriptionSeq", _tcOf_members0); + _members0[7] = new org.omg.CORBA.StructMember("attributes", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.ValueMemberHelper.type(); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ValueMemberSeqHelper.id(), + "ValueMemberSeq", _tcOf_members0); + _members0[8] = new org.omg.CORBA.StructMember("members", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.InitializerHelper.type(); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.InitializerSeqHelper.id(), + "InitializerSeq", _tcOf_members0); + _members0[9] = new org.omg.CORBA.StructMember("initializers", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id(), + "RepositoryIdSeq", _tcOf_members0); + _members0[10] = new org.omg.CORBA.StructMember("supported_interfaces", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id(), + "RepositoryIdSeq", _tcOf_members0); + _members0[11] = new org.omg.CORBA.StructMember("abstract_base_values", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean); + _members0[12] = new org.omg.CORBA.StructMember("is_truncatable", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[13] = new org.omg.CORBA.StructMember("base_value", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode); + _members0[14] = new org.omg.CORBA.StructMember("type", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc( + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.id(), "FullValueDescription", _members0); + __active = false; + } } + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription value = new com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.is_abstract = istream.read_boolean (); - value.is_custom = istream.read_boolean (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.operations = com.sun.org.omg.CORBA.OpDescriptionSeqHelper.read (istream); - value.attributes = com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.read (istream); - value.members = com.sun.org.omg.CORBA.ValueMemberSeqHelper.read (istream); - value.initializers = com.sun.org.omg.CORBA.InitializerSeqHelper.read (istream); - value.supported_interfaces = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (istream); - value.abstract_base_values = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (istream); - value.is_truncatable = istream.read_boolean (); - value.base_value = istream.read_string (); - value.type = istream.read_TypeCode (); + public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription read(org.omg.CORBA.portable.InputStream istream) { + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription value = new com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription(); + value.name = istream.read_string(); + value.id = istream.read_string(); + value.is_abstract = istream.read_boolean(); + value.is_custom = istream.read_boolean(); + value.defined_in = istream.read_string(); + value.version = istream.read_string(); + value.operations = com.sun.org.omg.CORBA.OpDescriptionSeqHelper.read(istream); + value.attributes = com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.read(istream); + value.members = com.sun.org.omg.CORBA.ValueMemberSeqHelper.read(istream); + value.initializers = com.sun.org.omg.CORBA.InitializerSeqHelper.read(istream); + value.supported_interfaces = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read(istream); + value.abstract_base_values = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read(istream); + value.is_truncatable = istream.read_boolean(); + value.base_value = istream.read_string(); + value.type = istream.read_TypeCode(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_boolean (value.is_abstract); - ostream.write_boolean (value.is_custom); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - com.sun.org.omg.CORBA.OpDescriptionSeqHelper.write (ostream, value.operations); - com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.write (ostream, value.attributes); - com.sun.org.omg.CORBA.ValueMemberSeqHelper.write (ostream, value.members); - com.sun.org.omg.CORBA.InitializerSeqHelper.write (ostream, value.initializers); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (ostream, value.supported_interfaces); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (ostream, value.abstract_base_values); - ostream.write_boolean (value.is_truncatable); - ostream.write_string (value.base_value); - ostream.write_TypeCode (value.type); + public static void write(org.omg.CORBA.portable.OutputStream ostream, + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription value) { + ostream.write_string(value.name); + ostream.write_string(value.id); + ostream.write_boolean(value.is_abstract); + ostream.write_boolean(value.is_custom); + ostream.write_string(value.defined_in); + ostream.write_string(value.version); + com.sun.org.omg.CORBA.OpDescriptionSeqHelper.write(ostream, value.operations); + com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.write(ostream, value.attributes); + com.sun.org.omg.CORBA.ValueMemberSeqHelper.write(ostream, value.members); + com.sun.org.omg.CORBA.InitializerSeqHelper.write(ostream, value.initializers); + com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write(ostream, value.supported_interfaces); + com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write(ostream, value.abstract_base_values); + ostream.write_boolean(value.is_truncatable); + ostream.write_string(value.base_value); + ostream.write_TypeCode(value.type); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueMemberHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueMemberHelper.java index 2d949fda0..729d65411 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueMemberHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueMemberHelper.java @@ -19,139 +19,110 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ValueMemberHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ + * com/sun/org/omg/CORBA/ValueMemberHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:44 AM PDT + */ // This file has been _CHANGED_ -public final class ValueMemberHelper -{ - private static String _id = "IDL:omg.org/CORBA/ValueMember:1.0"; +public final class ValueMemberHelper { + private static String _id = "IDL:omg.org/CORBA/ValueMember:1.0"; - public ValueMemberHelper() - { + public ValueMemberHelper() { } // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueMember that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.ValueMember that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + // public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueMember that) + public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.ValueMember that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } // _CHANGED_ - //public static com.sun.org.omg.CORBA.ValueMember extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.ValueMember extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + // public static com.sun.org.omg.CORBA.ValueMember extract (org.omg.CORBA.Any a) + public static org.omg.CORBA.ValueMember extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [7]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type (); - _members0[5] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VisibilityHelper.id (), "Visibility", _tcOf_members0); - _members0[6] = new org.omg.CORBA.StructMember ( - "access", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.ValueMemberHelper.id (), "ValueMember", _members0); - __active = false; - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + synchronized (org.omg.CORBA.TypeCode.class) { + if (__typeCode == null) { + if (__active) { + return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } + __active = true; + org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[7]; + org.omg.CORBA.TypeCode _tcOf_members0 = null; + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.IdentifierHelper.id(), "Identifier", + _tcOf_members0); + _members0[0] = new org.omg.CORBA.StructMember("name", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[1] = new org.omg.CORBA.StructMember("id", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.RepositoryIdHelper.id(), "RepositoryId", + _tcOf_members0); + _members0[2] = new org.omg.CORBA.StructMember("defined_in", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.VersionSpecHelper.id(), "VersionSpec", + _tcOf_members0); + _members0[3] = new org.omg.CORBA.StructMember("version", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode); + _members0[4] = new org.omg.CORBA.StructMember("type", _tcOf_members0, null); + _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type(); + _members0[5] = new org.omg.CORBA.StructMember("type_def", _tcOf_members0, null); + _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_short); + _tcOf_members0 = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.VisibilityHelper.id(), "Visibility", + _tcOf_members0); + _members0[6] = new org.omg.CORBA.StructMember("access", _tcOf_members0, null); + __typeCode = org.omg.CORBA.ORB.init().create_struct_tc(com.sun.org.omg.CORBA.ValueMemberHelper.id(), "ValueMember", + _members0); + __active = false; + } } + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } // _CHANGED_ - //public static com.sun.org.omg.CORBA.ValueMember read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.ValueMember read (org.omg.CORBA.portable.InputStream istream) - { + // public static com.sun.org.omg.CORBA.ValueMember read (org.omg.CORBA.portable.InputStream istream) + public static org.omg.CORBA.ValueMember read(org.omg.CORBA.portable.InputStream istream) { // _CHANGED_ - //com.sun.org.omg.CORBA.ValueMember value = new com.sun.org.omg.CORBA.ValueMember (); - org.omg.CORBA.ValueMember value = new org.omg.CORBA.ValueMember (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.type = istream.read_TypeCode (); - value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read (istream); - value.access = istream.read_short (); + // com.sun.org.omg.CORBA.ValueMember value = new com.sun.org.omg.CORBA.ValueMember (); + org.omg.CORBA.ValueMember value = new org.omg.CORBA.ValueMember(); + value.name = istream.read_string(); + value.id = istream.read_string(); + value.defined_in = istream.read_string(); + value.version = istream.read_string(); + value.type = istream.read_TypeCode(); + value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read(istream); + value.access = istream.read_short(); return value; } // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueMember value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ValueMember value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.type); - com.sun.org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); - ostream.write_short (value.access); + // public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueMember value) + public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ValueMember value) { + ostream.write_string(value.name); + ostream.write_string(value.id); + ostream.write_string(value.defined_in); + ostream.write_string(value.version); + ostream.write_TypeCode(value.type); + com.sun.org.omg.CORBA.IDLTypeHelper.write(ostream, value.type_def); + ostream.write_short(value.access); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java index d5041616f..1a791056d 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java @@ -19,81 +19,71 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/ValueMemberSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ + * com/sun/org/omg/CORBA/ValueMemberSeqHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:44 AM PDT + */ // This file has been _CHANGED_ -public final class ValueMemberSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ValueMemberSeq:1.0"; +public final class ValueMemberSeqHelper { + private static String _id = "IDL:omg.org/CORBA/ValueMemberSeq:1.0"; - public ValueMemberSeqHelper() - { + public ValueMemberSeqHelper() { } // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueMember[] that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.ValueMember[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + // public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueMember[] that) + public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.ValueMember[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } // _CHANGED_ - //public static com.sun.org.omg.CORBA.ValueMember[] extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.ValueMember[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + // public static com.sun.org.omg.CORBA.ValueMember[] extract (org.omg.CORBA.Any a) + public static org.omg.CORBA.ValueMember[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.ValueMemberHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ValueMemberSeqHelper.id (), "ValueMemberSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = com.sun.org.omg.CORBA.ValueMemberHelper.type(); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.ValueMemberSeqHelper.id(), "ValueMemberSeq", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } // _CHANGED_ - //public static com.sun.org.omg.CORBA.ValueMember[] read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.ValueMember[] read (org.omg.CORBA.portable.InputStream istream) - { + // public static com.sun.org.omg.CORBA.ValueMember[] read (org.omg.CORBA.portable.InputStream istream) + public static org.omg.CORBA.ValueMember[] read(org.omg.CORBA.portable.InputStream istream) { // _CHANGED_ - //com.sun.org.omg.CORBA.ValueMember value[] = null; + // com.sun.org.omg.CORBA.ValueMember value[] = null; org.omg.CORBA.ValueMember value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); // _CHANGED_ - //value = new com.sun.org.omg.CORBA.ValueMember[_len0]; + // value = new com.sun.org.omg.CORBA.ValueMember[_len0]; value = new org.omg.CORBA.ValueMember[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ValueMemberHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.ValueMemberHelper.read(istream); return value; } // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueMember[] value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ValueMember[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ValueMemberHelper.write (ostream, value[_i0]); + // public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueMember[] value) + public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ValueMember[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.ValueMemberHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/VersionSpecHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/VersionSpecHelper.java index ca37d7149..2e4f763d8 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/VersionSpecHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/VersionSpecHelper.java @@ -19,61 +19,50 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/VersionSpecHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:43 AM PDT -*/ + * com/sun/org/omg/CORBA/VersionSpecHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:43 AM PDT + */ -public final class VersionSpecHelper -{ - private static String _id = "IDL:omg.org/CORBA/VersionSpec:1.0"; +public final class VersionSpecHelper { + private static String _id = "IDL:omg.org/CORBA/VersionSpec:1.0"; - public VersionSpecHelper() - { + public VersionSpecHelper() { } - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, String that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static String extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.VersionSpecHelper.id(), "VersionSpec", __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static String read (org.omg.CORBA.portable.InputStream istream) - { + public static String read(org.omg.CORBA.portable.InputStream istream) { String value = null; - value = istream.read_string (); + value = istream.read_string(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); + public static void write(org.omg.CORBA.portable.OutputStream ostream, String value) { + ostream.write_string(value); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/VisibilityHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/VisibilityHelper.java index 683cfdd4b..87d1bff7c 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/VisibilityHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/VisibilityHelper.java @@ -19,63 +19,51 @@ package com.sun.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/VisibilityHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - + * com/sun/org/omg/CORBA/VisibilityHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * ir.idl Thursday, May 6, 1999 1:51:44 AM PDT + */ // orbos 98-01-18: Objects By Value -- begin -public final class VisibilityHelper -{ - private static String _id = "IDL:omg.org/CORBA/Visibility:1.0"; +public final class VisibilityHelper { + private static String _id = "IDL:omg.org/CORBA/Visibility:1.0"; - public VisibilityHelper() - { + public VisibilityHelper() { } - public static void insert (org.omg.CORBA.Any a, short that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, short that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static short extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static short extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VisibilityHelper.id (), "Visibility", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_short); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.CORBA.VisibilityHelper.id(), "Visibility", __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static short read (org.omg.CORBA.portable.InputStream istream) - { - short value = (short)0; - value = istream.read_short (); + public static short read(org.omg.CORBA.portable.InputStream istream) { + short value = (short) 0; + value = istream.read_short(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, short value) - { - ostream.write_short (value); + public static void write(org.omg.CORBA.portable.OutputStream ostream, short value) { + ostream.write_short(value); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/CORBA/portable/ValueHelper.java b/orbmain/src/main/java/com/sun/org/omg/CORBA/portable/ValueHelper.java index df60a5363..75155d714 100644 --- a/orbmain/src/main/java/com/sun/org/omg/CORBA/portable/ValueHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/CORBA/portable/ValueHelper.java @@ -23,16 +23,17 @@ import org.omg.CORBA.portable.BoxedValueHelper; /** - * An interface that is implemented by valuetype helper classes. - * This interface appeared in CORBA 2.3 drafts but was removed from - * the published CORBA 2.3 specification. + * An interface that is implemented by valuetype helper classes. This interface appeared in CORBA 2.3 drafts but was + * removed from the published CORBA 2.3 specification. *

    + * * @deprecated Deprecated by CORBA 2.3. */ @Deprecated public interface ValueHelper extends BoxedValueHelper { Class get_class(); + String[] get_truncatable_base_ids(); + TypeCode get_type(); } - diff --git a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBase.java b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBase.java index a60588e3f..d04295212 100644 --- a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBase.java +++ b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBase.java @@ -19,16 +19,12 @@ package com.sun.org.omg.SendingContext; - /** -* com/sun/org/omg/SendingContext/CodeBase.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ + * com/sun/org/omg/SendingContext/CodeBase.java Generated by the IDL-to-Java compiler (portable), version "3.0" from + * rt.idl Thursday, May 6, 1999 1:52:08 AM PDT + */ // Edited to leave RunTime in org.omg.CORBA -public interface CodeBase extends CodeBaseOperations, org.omg.SendingContext.RunTime, org.omg.CORBA.portable.IDLEntity -{ +public interface CodeBase extends CodeBaseOperations, org.omg.SendingContext.RunTime, org.omg.CORBA.portable.IDLEntity { } // interface CodeBase diff --git a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBaseHelper.java b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBaseHelper.java index 068b244cc..4b8afa58f 100644 --- a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBaseHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBaseHelper.java @@ -19,73 +19,60 @@ package com.sun.org.omg.SendingContext; - /** -* com/sun/org/omg/SendingContext/CodeBaseHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ + * com/sun/org/omg/SendingContext/CodeBaseHelper.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from rt.idl Thursday, May 6, 1999 1:52:08 AM PDT + */ -public final class CodeBaseHelper -{ - private static String _id = "IDL:omg.org/SendingContext/CodeBase:1.0"; +public final class CodeBaseHelper { + private static String _id = "IDL:omg.org/SendingContext/CodeBase:1.0"; - public CodeBaseHelper() - { + public CodeBaseHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.SendingContext.CodeBase that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.SendingContext.CodeBase that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.SendingContext.CodeBase extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.SendingContext.CodeBase extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (com.sun.org.omg.SendingContext.CodeBaseHelper.id (), "CodeBase"); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_interface_tc(com.sun.org.omg.SendingContext.CodeBaseHelper.id(), "CodeBase"); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.SendingContext.CodeBase read (org.omg.CORBA.portable.InputStream istream) - { - return narrow (istream.read_Object (_CodeBaseStub.class)); + public static com.sun.org.omg.SendingContext.CodeBase read(org.omg.CORBA.portable.InputStream istream) { + return narrow(istream.read_Object(_CodeBaseStub.class)); } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.SendingContext.CodeBase value) - { - ostream.write_Object ((org.omg.CORBA.Object) value); + public static void write(org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.SendingContext.CodeBase value) { + ostream.write_Object((org.omg.CORBA.Object) value); } - public static com.sun.org.omg.SendingContext.CodeBase narrow (org.omg.CORBA.Object obj) - { + public static com.sun.org.omg.SendingContext.CodeBase narrow(org.omg.CORBA.Object obj) { if (obj == null) return null; else if (obj instanceof com.sun.org.omg.SendingContext.CodeBase) - return (com.sun.org.omg.SendingContext.CodeBase)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - else - { - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); - return new com.sun.org.omg.SendingContext._CodeBaseStub (delegate); - } + return (com.sun.org.omg.SendingContext.CodeBase) obj; + else if (!obj._is_a(id())) + throw new org.omg.CORBA.BAD_PARAM(); + else { + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate(); + return new com.sun.org.omg.SendingContext._CodeBaseStub(delegate); + } } } diff --git a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBaseOperations.java b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBaseOperations.java index fd5828147..187dfdd88 100644 --- a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBaseOperations.java +++ b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBaseOperations.java @@ -19,30 +19,28 @@ package com.sun.org.omg.SendingContext; - /** -* com/sun/org/omg/SendingContext/CodeBaseOperations.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ + * com/sun/org/omg/SendingContext/CodeBaseOperations.java Generated by the IDL-to-Java compiler (portable), version + * "3.0" from rt.idl Thursday, May 6, 1999 1:52:08 AM PDT + */ // Edited to leave RunTime in org.omg.CORBA -public interface CodeBaseOperations extends org.omg.SendingContext.RunTimeOperations -{ +public interface CodeBaseOperations extends org.omg.SendingContext.RunTimeOperations { // Operation to obtain the IR from the sending context - com.sun.org.omg.CORBA.Repository get_ir (); + com.sun.org.omg.CORBA.Repository get_ir(); // Operations to obtain a URL to the implementation code - String implementation (String x); - String[] implementations (String[] x); + String implementation(String x); + + String[] implementations(String[] x); // the same information - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription meta (String x); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] metas (String[] x); + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription meta(String x); + + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] metas(String[] x); // information - String[] bases (String x); + String[] bases(String x); } // interface CodeBaseOperations diff --git a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java index 76d01b492..ff5d568f1 100644 --- a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java @@ -19,61 +19,51 @@ package com.sun.org.omg.SendingContext.CodeBasePackage; - /** -* com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ + * com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java Generated by the IDL-to-Java compiler (portable), + * version "3.0" from rt.idl Thursday, May 6, 1999 1:52:08 AM PDT + */ -public final class URLHelper -{ - private static String _id = "IDL:omg.org/SendingContext/CodeBase/URL:1.0"; +public final class URLHelper { + private static String _id = "IDL:omg.org/SendingContext/CodeBase/URL:1.0"; - public URLHelper() - { + public URLHelper() { } - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, String that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static String extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.id (), "URL", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.id(), "URL", + __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static String read (org.omg.CORBA.portable.InputStream istream) - { + public static String read(org.omg.CORBA.portable.InputStream istream) { String value = null; - value = istream.read_string (); + value = istream.read_string(); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); + public static void write(org.omg.CORBA.portable.OutputStream ostream, String value) { + ostream.write_string(value); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java index f949d2ffc..a8c058bf4 100644 --- a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java @@ -19,68 +19,59 @@ package com.sun.org.omg.SendingContext.CodeBasePackage; - /** -* com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ + * com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java Generated by the IDL-to-Java compiler (portable), + * version "3.0" from rt.idl Thursday, May 6, 1999 1:52:08 AM PDT + */ -public final class URLSeqHelper -{ - private static String _id = "IDL:omg.org/SendingContext/CodeBase/URLSeq:1.0"; +public final class URLSeqHelper { + private static String _id = "IDL:omg.org/SendingContext/CodeBase/URLSeq:1.0"; - public URLSeqHelper() - { + public URLSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, String[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, String[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static String[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static String[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.id (), "URL", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.id (), "URLSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.id(), "URL", + __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.id(), + "URLSeq", __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static String[] read (org.omg.CORBA.portable.InputStream istream) - { + public static String[] read(org.omg.CORBA.portable.InputStream istream) { String value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new String[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, String[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java index 4134a1b3a..5e7d9b806 100644 --- a/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java +++ b/orbmain/src/main/java/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java @@ -19,67 +19,58 @@ package com.sun.org.omg.SendingContext.CodeBasePackage; - /** -* com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ + * com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java Generated by the IDL-to-Java compiler + * (portable), version "3.0" from rt.idl Thursday, May 6, 1999 1:52:08 AM PDT + */ -public final class ValueDescSeqHelper -{ - private static String _id = "IDL:omg.org/SendingContext/CodeBase/ValueDescSeq:1.0"; +public final class ValueDescSeqHelper { + private static String _id = "IDL:omg.org/SendingContext/CodeBase/ValueDescSeq:1.0"; - public ValueDescSeqHelper() - { + public ValueDescSeqHelper() { } - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); + public static void insert(org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] that) { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); } - public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); + public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] extract(org.omg.CORBA.Any a) { + return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper.id (), "ValueDescSeq", __typeCode); - } + + synchronized public static org.omg.CORBA.TypeCode type() { + if (__typeCode == null) { + __typeCode = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.type(); + __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode); + __typeCode = org.omg.CORBA.ORB.init().create_alias_tc(com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper.id(), + "ValueDescSeq", __typeCode); + } return __typeCode; } - public static String id () - { + public static String id() { return _id; } - public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] read (org.omg.CORBA.portable.InputStream istream) - { + public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] read(org.omg.CORBA.portable.InputStream istream) { com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription value[] = null; - int _len0 = istream.read_long (); + int _len0 = istream.read_long(); value = new com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.read (istream); + for (int _o1 = 0; _o1 < value.length; ++_o1) + value[_o1] = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.read(istream); return value; } - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.write (ostream, value[_i0]); + public static void write(org.omg.CORBA.portable.OutputStream ostream, + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] value) { + ostream.write_long(value.length); + for (int _i0 = 0; _i0 < value.length; ++_i0) + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.write(ostream, value[_i0]); } } diff --git a/orbmain/src/main/java/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java b/orbmain/src/main/java/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java index 023e0e439..c18054b4f 100644 --- a/orbmain/src/main/java/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java +++ b/orbmain/src/main/java/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java @@ -19,124 +19,107 @@ package com.sun.org.omg.SendingContext; - /** -* com/sun/org/omg/SendingContext/_CodeBaseImplBase.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ + * com/sun/org/omg/SendingContext/_CodeBaseImplBase.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from rt.idl Thursday, May 6, 1999 1:52:08 AM PDT + */ public abstract class _CodeBaseImplBase extends org.omg.CORBA.portable.ObjectImpl - implements com.sun.org.omg.SendingContext.CodeBase, org.omg.CORBA.portable.InvokeHandler -{ + implements com.sun.org.omg.SendingContext.CodeBase, org.omg.CORBA.portable.InvokeHandler { // Constructors - public _CodeBaseImplBase () - { + public _CodeBaseImplBase() { } - private static java.util.Map _methods = - new java.util.HashMap (); - - static - { - _methods.put ("get_ir", 0); - _methods.put ("implementation", 1 ) ; - _methods.put ("implementations", 2 ) ; - _methods.put ("meta", 3 ) ; - _methods.put ("metas", 4 ) ; - _methods.put ("bases", 5 ) ; + private static java.util.Map _methods = new java.util.HashMap(); + + static { + _methods.put("get_ir", 0); + _methods.put("implementation", 1); + _methods.put("implementations", 2); + _methods.put("meta", 3); + _methods.put("metas", 4); + _methods.put("bases", 5); } - public org.omg.CORBA.portable.OutputStream _invoke (String method, - org.omg.CORBA.portable.InputStream in, - org.omg.CORBA.portable.ResponseHandler rh) - { + public org.omg.CORBA.portable.OutputStream _invoke(String method, org.omg.CORBA.portable.InputStream in, + org.omg.CORBA.portable.ResponseHandler rh) { org.omg.CORBA.portable.OutputStream out = rh.createReply(); - java.lang.Integer __method = _methods.get (method); + java.lang.Integer __method = _methods.get(method); if (__method == null) - throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - - switch (__method.intValue ()) - { - - // Operation to obtain the IR from the sending context - case 0: // SendingContext/CodeBase/get_ir - { - com.sun.org.omg.CORBA.Repository __result = null; - __result = this.get_ir (); - com.sun.org.omg.CORBA.RepositoryHelper.write (out, __result); - break; - } - - - // Operations to obtain a URL to the implementation code - case 1: // SendingContext/CodeBase/implementation - { - String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read (in); - String __result = null; - __result = this.implementation (x); - out.write_string (__result); - break; - } - - case 2: // SendingContext/CodeBase/implementations - { - String x[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (in); - String __result[] = null; - __result = this.implementations (x); - com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.write (out, __result); - break; - } - - - // the same information - case 3: // SendingContext/CodeBase/meta - { - String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read (in); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result = null; - __result = this.meta (x); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.write (out, __result); - break; - } - - case 4: // SendingContext/CodeBase/metas - { - String x[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (in); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result[] = null; - __result = this.metas (x); - com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper.write (out, __result); - break; - } - - - // information - case 5: // SendingContext/CodeBase/bases - { - String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read (in); - String __result[] = null; - __result = this.bases (x); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (out, __result); - break; - } - - default: - throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - } + throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); + + switch (__method.intValue()) { + + // Operation to obtain the IR from the sending context + case 0: // SendingContext/CodeBase/get_ir + { + com.sun.org.omg.CORBA.Repository __result = null; + __result = this.get_ir(); + com.sun.org.omg.CORBA.RepositoryHelper.write(out, __result); + break; + } + + // Operations to obtain a URL to the implementation code + case 1: // SendingContext/CodeBase/implementation + { + String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read(in); + String __result = null; + __result = this.implementation(x); + out.write_string(__result); + break; + } + + case 2: // SendingContext/CodeBase/implementations + { + String x[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read(in); + String __result[] = null; + __result = this.implementations(x); + com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.write(out, __result); + break; + } + + // the same information + case 3: // SendingContext/CodeBase/meta + { + String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read(in); + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result = null; + __result = this.meta(x); + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.write(out, __result); + break; + } + + case 4: // SendingContext/CodeBase/metas + { + String x[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read(in); + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result[] = null; + __result = this.metas(x); + com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper.write(out, __result); + break; + } + + // information + case 5: // SendingContext/CodeBase/bases + { + String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read(in); + String __result[] = null; + __result = this.bases(x); + com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write(out, __result); + break; + } + + default: + throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); + } return out; } // _invoke // Type-specific CORBA::Object operations - private final static String[] __ids = { - "IDL:omg.org/SendingContext/CodeBase:1.0", - "IDL:omg.org/SendingContext/RunTime:1.0"}; + private final static String[] __ids = { "IDL:omg.org/SendingContext/CodeBase:1.0", "IDL:omg.org/SendingContext/RunTime:1.0" }; - public String[] _ids () - { + public String[] _ids() { return __ids.clone(); } - } // class _CodeBaseImplBase diff --git a/orbmain/src/main/java/com/sun/org/omg/SendingContext/_CodeBaseStub.java b/orbmain/src/main/java/com/sun/org/omg/SendingContext/_CodeBaseStub.java index b1b580ff2..a347d5868 100644 --- a/orbmain/src/main/java/com/sun/org/omg/SendingContext/_CodeBaseStub.java +++ b/orbmain/src/main/java/com/sun/org/omg/SendingContext/_CodeBaseStub.java @@ -19,185 +19,166 @@ package com.sun.org.omg.SendingContext; - /** -* com/sun/org/omg/SendingContext/_CodeBaseStub.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ + * com/sun/org/omg/SendingContext/_CodeBaseStub.java Generated by the IDL-to-Java compiler (portable), version "3.0" + * from rt.idl Thursday, May 6, 1999 1:52:08 AM PDT + */ -public class _CodeBaseStub extends org.omg.CORBA.portable.ObjectImpl implements com.sun.org.omg.SendingContext.CodeBase -{ +public class _CodeBaseStub extends org.omg.CORBA.portable.ObjectImpl implements com.sun.org.omg.SendingContext.CodeBase { // Constructors - // NOTE: If the default constructor is used, the - // object is useless until _set_delegate (...) - // is called. - public _CodeBaseStub () - { - super (); + // NOTE: If the default constructor is used, the + // object is useless until _set_delegate (...) + // is called. + public _CodeBaseStub() { + super(); } - public _CodeBaseStub (org.omg.CORBA.portable.Delegate delegate) - { - super (); - _set_delegate (delegate); + public _CodeBaseStub(org.omg.CORBA.portable.Delegate delegate) { + super(); + _set_delegate(delegate); } - // Operation to obtain the IR from the sending context - public com.sun.org.omg.CORBA.Repository get_ir () - { + public com.sun.org.omg.CORBA.Repository get_ir() { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("get_ir", true); - _in = _invoke (_out); - com.sun.org.omg.CORBA.Repository __result = com.sun.org.omg.CORBA.RepositoryHelper.read (_in); + org.omg.CORBA.portable.OutputStream _out = _request("get_ir", true); + _in = _invoke(_out); + com.sun.org.omg.CORBA.Repository __result = com.sun.org.omg.CORBA.RepositoryHelper.read(_in); return __result; } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return get_ir (); + return get_ir(); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // get_ir - // Operations to obtain a URL to the implementation code - public String implementation (String x) - { + public String implementation(String x) { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("implementation", true); - com.sun.org.omg.CORBA.RepositoryIdHelper.write (_out, x); - _in = _invoke (_out); - String __result = com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.read (_in); + org.omg.CORBA.portable.OutputStream _out = _request("implementation", true); + com.sun.org.omg.CORBA.RepositoryIdHelper.write(_out, x); + _in = _invoke(_out); + String __result = com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.read(_in); return __result; } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return implementation (x); + return implementation(x); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // implementation - public String[] implementations (String[] x) - { + public String[] implementations(String[] x) { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("implementations", true); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (_out, x); - _in = _invoke (_out); - String __result[] = com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.read (_in); + org.omg.CORBA.portable.OutputStream _out = _request("implementations", true); + com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write(_out, x); + _in = _invoke(_out); + String __result[] = com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.read(_in); return __result; } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return implementations (x); + return implementations(x); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // implementations - // the same information - public com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription meta (String x) - { + public com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription meta(String x) { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("meta", true); - com.sun.org.omg.CORBA.RepositoryIdHelper.write (_out, x); - _in = _invoke (_out); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.read (_in); + org.omg.CORBA.portable.OutputStream _out = _request("meta", true); + com.sun.org.omg.CORBA.RepositoryIdHelper.write(_out, x); + _in = _invoke(_out); + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper + .read(_in); return __result; } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return meta (x); + return meta(x); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // meta - public com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] metas (String[] x) - { + public com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] metas(String[] x) { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("metas", true); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (_out, x); - _in = _invoke (_out); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result[] = com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper.read (_in); + org.omg.CORBA.portable.OutputStream _out = _request("metas", true); + com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write(_out, x); + _in = _invoke(_out); + com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result[] = com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper + .read(_in); return __result; } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return metas (x); + return metas(x); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // metas - // information - public String[] bases (String x) - { + public String[] bases(String x) { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("bases", true); - com.sun.org.omg.CORBA.RepositoryIdHelper.write (_out, x); - _in = _invoke (_out); - String __result[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (_in); + org.omg.CORBA.portable.OutputStream _out = _request("bases", true); + com.sun.org.omg.CORBA.RepositoryIdHelper.write(_out, x); + _in = _invoke(_out); + String __result[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read(_in); return __result; } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return bases (x); + return bases(x); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // bases // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:omg.org/SendingContext/CodeBase:1.0", - "IDL:omg.org/SendingContext/RunTime:1.0"}; + private static String[] __ids = { "IDL:omg.org/SendingContext/CodeBase:1.0", "IDL:omg.org/SendingContext/RunTime:1.0" }; - public String[] _ids () - { - return (String[])__ids.clone (); + public String[] _ids() { + return (String[]) __ids.clone(); } - private void readObject (java.io.ObjectInputStream s) - { - try - { - String str = s.readUTF (); - org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str); - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); - _set_delegate (delegate); - } catch (java.io.IOException e) {} + private void readObject(java.io.ObjectInputStream s) { + try { + String str = s.readUTF(); + org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init().string_to_object(str); + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate(); + _set_delegate(delegate); + } catch (java.io.IOException e) { + } } - private void writeObject (java.io.ObjectOutputStream s) - { - try - { - String str = org.omg.CORBA.ORB.init ().object_to_string (this); - s.writeUTF (str); - } catch (java.io.IOException e) {} + private void writeObject(java.io.ObjectOutputStream s) { + try { + String str = org.omg.CORBA.ORB.init().object_to_string(this); + s.writeUTF(str); + } catch (java.io.IOException e) { + } } } // class _CodeBaseStub diff --git a/orbmain/src/main/java/org/glassfish/corba/BridgePermission.java b/orbmain/src/main/java/org/glassfish/corba/BridgePermission.java index 48d7fbc65..35114aa89 100644 --- a/orbmain/src/main/java/org/glassfish/corba/BridgePermission.java +++ b/orbmain/src/main/java/org/glassfish/corba/BridgePermission.java @@ -19,39 +19,32 @@ package org.glassfish.corba; -import java.security.BasicPermission ; +import java.security.BasicPermission; -/** Permission class used to protect access to the sun.corba.Bridge - * object. The only name valid here is "getBridge". The - * BridgePermission("getBridge") permission must be held by the - * caller of sun.corba.Bridge.get(). +/** + * Permission class used to protect access to the sun.corba.Bridge object. The only name valid here is "getBridge". The + * BridgePermission("getBridge") permission must be held by the caller of sun.corba.Bridge.get(). */ -public final class BridgePermission extends BasicPermission -{ +public final class BridgePermission extends BasicPermission { /** - * Creates a new BridgePermission with the specified name. - * The name is the symbolic name of the BridgePermission. - * The only valid name here is "getBridge". + * Creates a new BridgePermission with the specified name. The name is the symbolic name of the BridgePermission. The + * only valid name here is "getBridge". * * @param name the name of the BridgePermission. */ - public BridgePermission(String name) - { + public BridgePermission(String name) { super(name); } /** - * Creates a new BridgePermission object with the specified name. - * The name is the symbolic name of the BridgePermission, and the - * actions String is currently unused and should be null. - * The only valid name here is "getBridge". + * Creates a new BridgePermission object with the specified name. The name is the symbolic name of the BridgePermission, + * and the actions String is currently unused and should be null. The only valid name here is "getBridge". * * @param name the name of the BridgePermission. * @param actions should be null. */ - public BridgePermission(String name, String actions) - { + public BridgePermission(String name, String actions) { super(name, actions); } } diff --git a/orbmain/src/main/java/org/glassfish/corba/org/omg/CORBA/_IDLTypeStub.java b/orbmain/src/main/java/org/glassfish/corba/org/omg/CORBA/_IDLTypeStub.java index 0d3de74db..30c54305b 100644 --- a/orbmain/src/main/java/org/glassfish/corba/org/omg/CORBA/_IDLTypeStub.java +++ b/orbmain/src/main/java/org/glassfish/corba/org/omg/CORBA/_IDLTypeStub.java @@ -19,125 +19,109 @@ package org.glassfish.corba.org.omg.CORBA; - /** -* com/sun/org/omg/CORBA/_IDLTypeStub.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:45 AM PDT -*/ + * com/sun/org/omg/CORBA/_IDLTypeStub.java Generated by the IDL-to-Java compiler (portable), version "3.0" from ir.idl + * Thursday, May 6, 1999 1:51:45 AM PDT + */ // This file has been manually _CHANGED_ // _CHANGED_ //public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements com.sun.org.omg.CORBA.IDLType -public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.IDLType -{ +public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.IDLType { // Constructors - // NOTE: If the default constructor is used, the - // object is useless until _set_delegate (...) - // is called. - public _IDLTypeStub () - { - super (); + // NOTE: If the default constructor is used, the + // object is useless until _set_delegate (...) + // is called. + public _IDLTypeStub() { + super(); } - public _IDLTypeStub (org.omg.CORBA.portable.Delegate delegate) - { - super (); - _set_delegate (delegate); + public _IDLTypeStub(org.omg.CORBA.portable.Delegate delegate) { + super(); + _set_delegate(delegate); } - public org.omg.CORBA.TypeCode type () - { + public org.omg.CORBA.TypeCode type() { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("_get_type", true); - _in = _invoke (_out); - org.omg.CORBA.TypeCode __result = _in.read_TypeCode (); + org.omg.CORBA.portable.OutputStream _out = _request("_get_type", true); + _in = _invoke(_out); + org.omg.CORBA.TypeCode __result = _in.read_TypeCode(); return __result; } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return type (); + return type(); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // type - // read interface // _CHANGED_ - //public com.sun.org.omg.CORBA.DefinitionKind def_kind () - public org.omg.CORBA.DefinitionKind def_kind () - { + // public com.sun.org.omg.CORBA.DefinitionKind def_kind () + public org.omg.CORBA.DefinitionKind def_kind() { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("_get_def_kind", true); - _in = _invoke (_out); + org.omg.CORBA.portable.OutputStream _out = _request("_get_def_kind", true); + _in = _invoke(_out); // _CHANGED_ - //com.sun.org.omg.CORBA.DefinitionKind __result = com.sun.org.omg.CORBA.DefinitionKindHelper.read (_in); - org.omg.CORBA.DefinitionKind __result = com.sun.org.omg.CORBA.DefinitionKindHelper.read (_in); + // com.sun.org.omg.CORBA.DefinitionKind __result = com.sun.org.omg.CORBA.DefinitionKindHelper.read (_in); + org.omg.CORBA.DefinitionKind __result = com.sun.org.omg.CORBA.DefinitionKindHelper.read(_in); return __result; } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return def_kind (); + return def_kind(); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // def_kind - // write interface - public void destroy () - { + public void destroy() { org.omg.CORBA.portable.InputStream _in = null; try { - org.omg.CORBA.portable.OutputStream _out = _request ("destroy", true); - _in = _invoke (_out); + org.omg.CORBA.portable.OutputStream _out = _request("destroy", true); + _in = _invoke(_out); } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); + _in = _ex.getInputStream(); + String _id = _ex.getId(); + throw new org.omg.CORBA.MARSHAL(_id); } catch (org.omg.CORBA.portable.RemarshalException _rm) { - destroy (); + destroy(); } finally { - _releaseReply (_in); + _releaseReply(_in); } } // destroy // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:omg.org/CORBA/IDLType:1.0", - "IDL:omg.org/CORBA/IRObject:1.0"}; + private static String[] __ids = { "IDL:omg.org/CORBA/IDLType:1.0", "IDL:omg.org/CORBA/IRObject:1.0" }; - public String[] _ids () - { - return (String[])__ids.clone (); + public String[] _ids() { + return (String[]) __ids.clone(); } - private void readObject (java.io.ObjectInputStream s) - { - try - { - String str = s.readUTF (); - org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str); - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); - _set_delegate (delegate); - } catch (java.io.IOException e) {} + private void readObject(java.io.ObjectInputStream s) { + try { + String str = s.readUTF(); + org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init().string_to_object(str); + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate(); + _set_delegate(delegate); + } catch (java.io.IOException e) { + } } - private void writeObject (java.io.ObjectOutputStream s) - { - try - { - String str = org.omg.CORBA.ORB.init ().object_to_string (this); - s.writeUTF (str); - } catch (java.io.IOException e) {} + private void writeObject(java.io.ObjectOutputStream s) { + try { + String str = org.omg.CORBA.ORB.init().object_to_string(this); + s.writeUTF(str); + } catch (java.io.IOException e) { + } } } // class _IDLTypeStub diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNBindingEnumeration.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNBindingEnumeration.java index 491965b27..82dc065ed 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNBindingEnumeration.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNBindingEnumeration.java @@ -27,35 +27,33 @@ import org.omg.CosNaming.*; /** - * Implements the JNDI NamingEnumeration interface for COS - * Naming. Gets hold of a list of bindings from the COS Naming Server - * and allows the client to iterate through them. - * - * @author Raj Krishnamurthy - * @author Rosanna Lee - */ + * Implements the JNDI NamingEnumeration interface for COS Naming. Gets hold of a list of bindings from the COS Naming + * Server and allows the client to iterate through them. + * + * @author Raj Krishnamurthy + * @author Rosanna Lee + */ -final class CNBindingEnumeration - implements NamingEnumeration { +final class CNBindingEnumeration implements NamingEnumeration { private static final int DEFAULT_BATCHSIZE = 100; private BindingListHolder _bindingList; // list of bindings - private BindingIterator _bindingIter; // iterator for getting list of bindings - private int counter; // pointer in _bindingList - private int batchsize = DEFAULT_BATCHSIZE; // how many to ask for each time - private CNCtx _ctx; // ctx to list - private Hashtable _env; // environment for getObjectInstance - private boolean more = false; // iterator done? - private boolean isLookedUpCtx = false; // iterating on a context beneath this context ? + private BindingIterator _bindingIter; // iterator for getting list of bindings + private int counter; // pointer in _bindingList + private int batchsize = DEFAULT_BATCHSIZE; // how many to ask for each time + private CNCtx _ctx; // ctx to list + private Hashtable _env; // environment for getObjectInstance + private boolean more = false; // iterator done? + private boolean isLookedUpCtx = false; // iterating on a context beneath this context ? /** * Creates a CNBindingEnumeration object. + * * @param ctx Context to enumerate */ - CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable env) { + CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable env) { // Get batch size to use - String batch = (env != null ? - (String)env.get(javax.naming.Context.BATCHSIZE) : null); + String batch = (env != null ? (String) env.get(javax.naming.Context.BATCHSIZE) : null); if (batch != null) { try { batchsize = Integer.parseInt(batch); @@ -87,6 +85,7 @@ final class CNBindingEnumeration /** * Returns the next binding in the list. + * * @exception NamingException any naming exception. */ @@ -103,11 +102,11 @@ public javax.naming.Binding next() throws NamingException { } } - /** - * Returns true or false depending on whether there are more bindings. - * @return boolean value - */ + * Returns true or false depending on whether there are more bindings. + * + * @return boolean value + */ public boolean hasMore() throws NamingException { // If there's more, check whether current bindingList has been exhausted, @@ -117,8 +116,9 @@ public boolean hasMore() throws NamingException { } /** - * Returns true or false depending on whether there are more bindings. - * Need to define this to satisfy the Enumeration api requirement. + * Returns true or false depending on whether there are more bindings. Need to define this to satisfy the Enumeration + * api requirement. + * * @return boolean value */ @@ -131,10 +131,10 @@ public boolean hasMoreElements() { } /** - * Returns the next binding in the list. - * @exception NoSuchElementException Thrown when the end of the - * list is reached. - */ + * Returns the next binding in the list. + * + * @exception NoSuchElementException Thrown when the end of the list is reached. + */ public javax.naming.Binding nextElement() { try { @@ -154,8 +154,8 @@ public void close() throws NamingException { _ctx.decEnumCount(); /** - * context was obtained by CNCtx, the user doesn't have a handle to - * it, close it as we are done enumerating through the context + * context was obtained by CNCtx, the user doesn't have a handle to it, close it as we are done enumerating through the + * context */ if (isLookedUpCtx) { _ctx.close(); @@ -181,8 +181,7 @@ private boolean getMore() throws NamingException { counter = 0; // reset } catch (Exception e) { more = false; - NamingException ne = new NamingException( - "Problem getting binding list"); + NamingException ne = new NamingException("Problem getting binding list"); ne.setRootCause(e); throw ne; } @@ -190,16 +189,15 @@ private boolean getMore() throws NamingException { } /** - * Constructs a JNDI Binding object from the COS Naming binding - * object. - * @exception NameNotFound No objects under the name. - * @exception CannotProceed Unable to obtain a continuation context - * @exception InvalidName Name not understood. - * @exception NamingException One of the above. - */ - - private javax.naming.Binding mapBinding(org.omg.CosNaming.Binding bndg) - throws NamingException { + * Constructs a JNDI Binding object from the COS Naming binding object. + * + * @exception NameNotFound No objects under the name. + * @exception CannotProceed Unable to obtain a continuation context + * @exception InvalidName Name not understood. + * @exception NamingException One of the above. + */ + + private javax.naming.Binding mapBinding(org.omg.CosNaming.Binding bndg) throws NamingException { java.lang.Object obj = _ctx.callResolve(bndg.binding_name); Name cname = CNNameParser.cosNameToName(bndg.binding_name); @@ -209,8 +207,7 @@ private javax.naming.Binding mapBinding(org.omg.CosNaming.Binding bndg) } catch (NamingException e) { throw e; } catch (Exception e) { - NamingException ne = new NamingException( - "problem generating object using object factory"); + NamingException ne = new NamingException("problem generating object using object factory"); ne.setRootCause(e); throw ne; } diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNCtx.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNCtx.java index fd7b26ef2..ed15547ca 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNCtx.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNCtx.java @@ -45,27 +45,25 @@ // Needed for creating default ORB /** - * Provides a bridge to the CosNaming server provided by - * JavaIDL. This class provides the InitialContext from CosNaming. - * - */ + * Provides a bridge to the CosNaming server provided by JavaIDL. This class provides the InitialContext from CosNaming. + * + */ public class CNCtx implements javax.naming.Context { private final static boolean debug = false; /* - * Implement one shared ORB among all CNCtx. However, there is a public constructor - * accepting an ORB, so we need the option of using a given ORB. + * Implement one shared ORB among all CNCtx. However, there is a public constructor accepting an ORB, so we need the + * option of using a given ORB. */ private static ORB _defaultOrb; - ORB _orb; // used by ExceptionMapper and RMI/IIOP factory - public NamingContext _nc; // public for accessing underlying NamingContext + ORB _orb; // used by ExceptionMapper and RMI/IIOP factory + public NamingContext _nc; // public for accessing underlying NamingContext private synchronized static ORB getDefaultOrb() { if (_defaultOrb == null) { - _defaultOrb = CorbaUtils.getOrb(null, -1, - new Hashtable()); + _defaultOrb = CorbaUtils.getOrb(null, -1, new Hashtable()); } return _defaultOrb; } @@ -84,19 +82,18 @@ private synchronized static ORB getDefaultOrb() { boolean isCloseCalled = false; /** - * Create a CNCtx object. Gets the initial naming - * reference for the COS Naming Service from the ORB. - * The ORB can be passed in via the java.naming.corba.orb property - * or be created using properties in the environment properties. - * @param env Environment properties for initializing name service. - * @exception NamingException Cannot initialize ORB or naming context. - */ + * Create a CNCtx object. Gets the initial naming reference for the COS Naming Service from the ORB. The ORB can be + * passed in via the java.naming.corba.orb property or be created using properties in the environment properties. + * + * @param env Environment properties for initializing name service. + * @exception NamingException Cannot initialize ORB or naming context. + */ @SuppressWarnings("unchecked") - CNCtx(Hashtable env) throws NamingException { + CNCtx(Hashtable env) throws NamingException { if (env != null) { - env = (Hashtable)env.clone(); + env = (Hashtable) env.clone(); } - _env = (Hashtable)env; + _env = (Hashtable) env; federation = "true".equals(env != null ? env.get(FED_PROP) : null); initOrbAndRootContext(env); } @@ -108,18 +105,13 @@ private CNCtx() { * This method is used by the iiop and iiopname URL Context factories. */ @SuppressWarnings("unchecked") - public static ResolveResult createUsingURL(String url, Hashtable env) - throws NamingException { + public static ResolveResult createUsingURL(String url, Hashtable env) throws NamingException { CNCtx ctx = new CNCtx(); if (env != null) { - env = (Hashtable) env.clone(); + env = (Hashtable) env.clone(); } - ctx._env = (Hashtable)env; - String rest = ctx.initUsingUrl( - env != null ? - (org.omg.CORBA.ORB) env.get("java.naming.corba.orb") - : null, - url, env); + ctx._env = (Hashtable) env; + String rest = ctx.initUsingUrl(env != null ? (org.omg.CORBA.ORB) env.get("java.naming.corba.orb") : null, url, env); // rest is the INS name // Return the parsed form to prevent subsequent lookup @@ -131,37 +123,34 @@ public static ResolveResult createUsingURL(String url, Hashtable env) } /** - * Creates a CNCtx object which supports the javax.naming - * apis given a COS Naming Context object. - * @param orb The ORB used by this context - * @param tracker The ORB reuse tracker for tracking references to the - * orb object - * @param nctx The COS NamingContext object associated with this context - * @param name The name of this context relative to the root - */ - - CNCtx(ORB orb, OrbReuseTracker tracker, NamingContext nctx, - Hashtable env, NameComponent[]name) - throws NamingException { - if (orb == null || nctx == null) - throw new ConfigurationException( - "Must supply ORB or NamingContext"); - if (orb != null) { - _orb = orb; - } else { - _orb = getDefaultOrb(); - } - _nc = nctx; - _env = env; - _name = name; - federation = "true".equals(env != null ? env.get(FED_PROP) : null); + * Creates a CNCtx object which supports the javax.naming apis given a COS Naming Context object. + * + * @param orb The ORB used by this context + * @param tracker The ORB reuse tracker for tracking references to the orb object + * @param nctx The COS NamingContext object associated with this context + * @param name The name of this context relative to the root + */ + + CNCtx(ORB orb, OrbReuseTracker tracker, NamingContext nctx, Hashtable env, NameComponent[] name) + throws NamingException { + if (orb == null || nctx == null) + throw new ConfigurationException("Must supply ORB or NamingContext"); + if (orb != null) { + _orb = orb; + } else { + _orb = getDefaultOrb(); + } + _nc = nctx; + _env = env; + _name = name; + federation = "true".equals(env != null ? env.get(FED_PROP) : null); } NameComponent[] makeFullName(NameComponent[] child) { if (_name == null || _name.length == 0) { return child; } - NameComponent[] answer = new NameComponent[_name.length+child.length]; + NameComponent[] answer = new NameComponent[_name.length + child.length]; // parent System.arraycopy(_name, 0, answer, 0, _name.length); @@ -171,7 +160,6 @@ NameComponent[] makeFullName(NameComponent[] child) { return answer; } - public String getNameInNamespace() throws NamingException { if (_name == null || _name.length == 0) { return ""; @@ -180,46 +168,32 @@ public String getNameInNamespace() throws NamingException { } /** - * These are the URL schemes that need to be processed. - * IOR and corbaloc URLs can be passed directly to ORB.string_to_object() + * These are the URL schemes that need to be processed. IOR and corbaloc URLs can be passed directly to + * ORB.string_to_object() */ private static boolean isCorbaUrl(String url) { - return url.startsWith("iiop://") - || url.startsWith("iiopname://") - || url.startsWith("corbaname:") - ; + return url.startsWith("iiop://") || url.startsWith("iiopname://") || url.startsWith("corbaname:"); } /** - * Initializes the COS Naming Service. - * This method initializes the three instance fields: - * _nc : The root naming context. - * _orb: The ORB to use for connecting RMI/IIOP stubs and for - * getting the naming context (_nc) if one was not specified - * explicitly via PROVIDER_URL. - * _name: The name of the root naming context. - *

    - * _orb is obtained from java.naming.corba.orb if it has been set. - * Otherwise, _orb is created using the host/port from PROVIDER_URL - * (if it contains an "iiop" or "iiopname" URL), or from initialization - * properties specified in env. - *

    - * _nc is obtained from the IOR stored in PROVIDER_URL if it has been - * set and does not contain an "iiop" or "iiopname" URL. It can be - * a stringified IOR, "corbaloc" URL, "corbaname" URL, - * or a URL (such as file/http/ftp) to a location - * containing a stringified IOR. If PROVIDER_URL has not been - * set in this way, it is obtained from the result of - * ORB.resolve_initial_reference("NameService"); - *

    - * _name is obtained from the "iiop", "iiopname", or "corbaname" URL. - * It is the empty name by default. - * - * @param env Environment The possibly null environment. - * @exception NamingException When an error occurs while initializing the - * ORB or the naming context. - */ - private void initOrbAndRootContext(Hashtable env) throws NamingException { + * Initializes the COS Naming Service. This method initializes the three instance fields: _nc : The root naming context. + * _orb: The ORB to use for connecting RMI/IIOP stubs and for getting the naming context (_nc) if one was not specified + * explicitly via PROVIDER_URL. _name: The name of the root naming context. + *

    + * _orb is obtained from java.naming.corba.orb if it has been set. Otherwise, _orb is created using the host/port from + * PROVIDER_URL (if it contains an "iiop" or "iiopname" URL), or from initialization properties specified in env. + *

    + * _nc is obtained from the IOR stored in PROVIDER_URL if it has been set and does not contain an "iiop" or "iiopname" + * URL. It can be a stringified IOR, "corbaloc" URL, "corbaname" URL, or a URL (such as file/http/ftp) to a location + * containing a stringified IOR. If PROVIDER_URL has not been set in this way, it is obtained from the result of + * ORB.resolve_initial_reference("NameService"); + *

    + * _name is obtained from the "iiop", "iiopname", or "corbaname" URL. It is the empty name by default. + * + * @param env Environment The possibly null environment. + * @exception NamingException When an error occurs while initializing the ORB or the naming context. + */ + private void initOrbAndRootContext(Hashtable env) throws NamingException { org.omg.CORBA.ORB inOrb = null; String ncIor = null; @@ -233,7 +207,7 @@ private void initOrbAndRootContext(Hashtable env) throws NamingException { // Extract PROVIDER_URL from environment String provUrl = null; if (env != null) { - provUrl = (String)env.get(javax.naming.Context.PROVIDER_URL); + provUrl = (String) env.get(javax.naming.Context.PROVIDER_URL); } if (provUrl != null && !isCorbaUrl(provUrl)) { @@ -253,12 +227,10 @@ private void initOrbAndRootContext(Hashtable env) throws NamingException { org.omg.CORBA.Object obj = _nc.resolve(_name); _nc = NamingContextHelper.narrow(obj); if (_nc == null) { - throw new ConfigurationException(insName + - " does not name a NamingContext"); + throw new ConfigurationException(insName + " does not name a NamingContext"); } } catch (org.omg.CORBA.BAD_PARAM e) { - throw new ConfigurationException(insName + - " does not name a NamingContext"); + throw new ConfigurationException(insName + " does not name a NamingContext"); } catch (Exception e) { throw ExceptionMapper.mapException(e, this, _name); } @@ -268,13 +240,11 @@ private void initOrbAndRootContext(Hashtable env) throws NamingException { if (debug) { System.err.println("Getting default ORB: " + inOrb + env); } - setOrbAndRootContext(inOrb, (String)null); + setOrbAndRootContext(inOrb, (String) null); } } - - private String initUsingUrl(ORB orb, String url, Hashtable env) - throws NamingException { + private String initUsingUrl(ORB orb, String url, Hashtable env) throws NamingException { if (url.startsWith("iiop://") || url.startsWith("iiopname://")) { return initUsingIiopUrl(orb, url, env); } else { @@ -285,8 +255,7 @@ private String initUsingUrl(ORB orb, String url, Hashtable env) /** * Handles "iiop" and "iiopname" URLs (INS 98-10-11) */ - private String initUsingIiopUrl(ORB defOrb, String url, Hashtable env) - throws NamingException { + private String initUsingIiopUrl(ORB defOrb, String url, Hashtable env) throws NamingException { if (defOrb == null) defOrb = getDefaultOrb(); @@ -300,25 +269,23 @@ private String initUsingIiopUrl(ORB defOrb, String url, Hashtable env) try { try { - String tmpUrl = "corbaloc:iiop:" + addr.host - + ":" + addr.port + "/NameService"; + String tmpUrl = "corbaloc:iiop:" + addr.host + ":" + addr.port + "/NameService"; if (debug) { System.err.println("Using url: " + tmpUrl); } - org.omg.CORBA.Object rootCtx = - defOrb.string_to_object(tmpUrl); + org.omg.CORBA.Object rootCtx = defOrb.string_to_object(tmpUrl); setOrbAndRootContext(defOrb, rootCtx); return parsedUrl.getStringName(); - } catch (Exception e) {} // keep going + } catch (Exception e) { + } // keep going // Get ORB if (debug) { - System.err.println("Getting ORB for " + addr.host - + " and port " + addr.port); + System.err.println("Getting ORB for " + addr.host + " and port " + addr.port); } // Assign to fields - setOrbAndRootContext(defOrb, (String)null); + setOrbAndRootContext(defOrb, (String) null); return parsedUrl.getStringName(); } catch (NamingException ne) { @@ -338,11 +305,10 @@ private String initUsingIiopUrl(ORB defOrb, String url, Hashtable env) /** * Initializes using "corbaname" URL (INS 99-12-03) */ - private String initUsingCorbanameUrl(ORB orb, String url, Hashtable env) - throws NamingException { + private String initUsingCorbanameUrl(ORB orb, String url, Hashtable env) throws NamingException { if (orb == null) - orb = getDefaultOrb(); + orb = getDefaultOrb(); try { CorbanameUrl parsedUrl = new CorbanameUrl(url); @@ -358,8 +324,7 @@ private String initUsingCorbanameUrl(ORB orb, String url, Hashtable env) } } - private void setOrbAndRootContext(ORB orb, String ncIor) - throws NamingException { + private void setOrbAndRootContext(ORB orb, String ncIor) throws NamingException { _orb = orb; try { org.omg.CORBA.Object ncRef; @@ -377,49 +342,39 @@ private void setOrbAndRootContext(ORB orb, String ncIor) _nc = NamingContextHelper.narrow(ncRef); if (_nc == null) { if (ncIor != null) { - throw new ConfigurationException( - "Cannot convert IOR to a NamingContext: " + ncIor); + throw new ConfigurationException("Cannot convert IOR to a NamingContext: " + ncIor); } else { - throw new ConfigurationException( -"ORB.resolve_initial_references(\"NameService\") does not return a NamingContext"); + throw new ConfigurationException("ORB.resolve_initial_references(\"NameService\") does not return a NamingContext"); } } } catch (org.omg.CORBA.ORBPackage.InvalidName in) { - NamingException ne = - new ConfigurationException( -"COS Name Service not registered with ORB under the name 'NameService'"); + NamingException ne = new ConfigurationException("COS Name Service not registered with ORB under the name 'NameService'"); ne.setRootCause(in); throw ne; } catch (org.omg.CORBA.COMM_FAILURE e) { - NamingException ne = - new CommunicationException("Cannot connect to ORB"); + NamingException ne = new CommunicationException("Cannot connect to ORB"); ne.setRootCause(e); throw ne; } catch (org.omg.CORBA.BAD_PARAM e) { - NamingException ne = new ConfigurationException( - "Invalid URL or IOR: " + ncIor); + NamingException ne = new ConfigurationException("Invalid URL or IOR: " + ncIor); ne.setRootCause(e); throw ne; } catch (org.omg.CORBA.INV_OBJREF e) { - NamingException ne = new ConfigurationException( - "Invalid object reference: " + ncIor); + NamingException ne = new ConfigurationException("Invalid object reference: " + ncIor); ne.setRootCause(e); throw ne; } } - private void setOrbAndRootContext(ORB orb, org.omg.CORBA.Object ncRef) - throws NamingException { + private void setOrbAndRootContext(ORB orb, org.omg.CORBA.Object ncRef) throws NamingException { _orb = orb; try { _nc = NamingContextHelper.narrow(ncRef); if (_nc == null) { - throw new ConfigurationException( - "Cannot convert object reference to NamingContext: " + ncRef); + throw new ConfigurationException("Cannot convert object reference to NamingContext: " + ncRef); } } catch (org.omg.CORBA.COMM_FAILURE e) { - NamingException ne = - new CommunicationException("Cannot connect to ORB"); + NamingException ne = new CommunicationException("Cannot connect to ORB"); ne.setRootCause(e); throw ne; } @@ -434,8 +389,7 @@ private String getStringifiedIor(String url) throws NamingException { URL u = new URL(url); in = u.openStream(); if (in != null) { - BufferedReader bufin = - new BufferedReader(new InputStreamReader(in, "8859_1")); + BufferedReader bufin = new BufferedReader(new InputStreamReader(in, "8859_1")); String str; while ((str = bufin.readLine()) != null) { if (str.startsWith("IOR:")) { @@ -444,8 +398,7 @@ private String getStringifiedIor(String url) throws NamingException { } } } catch (IOException e) { - NamingException ne = - new ConfigurationException("Invalid URL: " + url); + NamingException ne = new ConfigurationException("Invalid URL: " + url); ne.setRootCause(e); throw ne; } finally { @@ -454,8 +407,7 @@ private String getStringifiedIor(String url) throws NamingException { in.close(); } } catch (IOException e) { - NamingException ne = - new ConfigurationException("Invalid URL: " + url); + NamingException ne = new ConfigurationException("Invalid URL: " + url); ne.setRootCause(e); throw ne; } @@ -464,48 +416,42 @@ private String getStringifiedIor(String url) throws NamingException { } } - /** - * Does the job of calling the COS Naming API, - * resolve, and performs the exception mapping. If the resolved - * object is a COS Naming Context (sub-context), then this function - * returns a new JNDI naming context object. - * @param path the NameComponent[] object. - * @exception NotFound No objects under the name. - * @exception CannotProceed Unable to obtain a continuation context - * @exception InvalidName Name not understood. - * @return Resolved object returned by the COS Name Server. - */ - java.lang.Object callResolve(NameComponent[] path) - throws NamingException { + * Does the job of calling the COS Naming API, resolve, and performs the exception mapping. If the resolved object is a + * COS Naming Context (sub-context), then this function returns a new JNDI naming context object. + * + * @param path the NameComponent[] object. + * @exception NotFound No objects under the name. + * @exception CannotProceed Unable to obtain a continuation context + * @exception InvalidName Name not understood. + * @return Resolved object returned by the COS Name Server. + */ + java.lang.Object callResolve(NameComponent[] path) throws NamingException { + try { + org.omg.CORBA.Object obj = _nc.resolve(path); try { - org.omg.CORBA.Object obj = _nc.resolve(path); - try { - NamingContext nc = - NamingContextHelper.narrow(obj); - if (nc != null) { - return new CNCtx(_orb, orbTracker, nc, _env, - makeFullName(path)); - } else { - return obj; - } - } catch (org.omg.CORBA.SystemException e) { + NamingContext nc = NamingContextHelper.narrow(obj); + if (nc != null) { + return new CNCtx(_orb, orbTracker, nc, _env, makeFullName(path)); + } else { return obj; } - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, path); + } catch (org.omg.CORBA.SystemException e) { + return obj; } + } catch (Exception e) { + throw ExceptionMapper.mapException(e, this, path); + } } /** - * Converts the "String" name into a CompositeName - * returns the object resolved by the COS Naming api, - * resolve. Returns the current context if the name is empty. - * Returns either an org.omg.CORBA.Object or javax.naming.Context object. - * @param name string used to resolve the object. - * @exception NamingException See callResolve. - * @return the resolved object - */ + * Converts the "String" name into a CompositeName returns the object resolved by the COS Naming api, resolve. Returns + * the current context if the name is empty. Returns either an org.omg.CORBA.Object or javax.naming.Context object. + * + * @param name string used to resolve the object. + * @exception NamingException See callResolve. + * @return the resolved object + */ public java.lang.Object lookup(String name) throws NamingException { if (debug) { System.out.println("Looking up: " + name); @@ -514,140 +460,126 @@ public java.lang.Object lookup(String name) throws NamingException { } /** - * Converts the "Name" name into a NameComponent[] object and - * returns the object resolved by the COS Naming api, - * resolve. Returns the current context if the name is empty. - * Returns either an org.omg.CORBA.Object or javax.naming.Context object. - * @param name JNDI Name used to resolve the object. - * @exception NamingException See callResolve. - * @return the resolved object - */ - public java.lang.Object lookup(Name name) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - if (name.size() == 0 ) - return this; // %%% should clone() so that env can be changed - NameComponent[] path = CNNameParser.nameToCosName(name); + * Converts the "Name" name into a NameComponent[] object and returns the object resolved by the COS Naming api, + * resolve. Returns the current context if the name is empty. Returns either an org.omg.CORBA.Object or + * javax.naming.Context object. + * + * @param name JNDI Name used to resolve the object. + * @exception NamingException See callResolve. + * @return the resolved object + */ + public java.lang.Object lookup(Name name) throws NamingException { + if (_nc == null) + throw new ConfigurationException("Context does not have a corresponding NamingContext"); + if (name.size() == 0) + return this; // %%% should clone() so that env can be changed + NameComponent[] path = CNNameParser.nameToCosName(name); - try { - java.lang.Object answer = callResolve(path); + try { + java.lang.Object answer = callResolve(path); - try { - return NamingManager.getObjectInstance(answer, name, this, _env); - } catch (NamingException e) { - throw e; - } catch (Exception e) { - NamingException ne = new NamingException( - "problem generating object using object factory"); - ne.setRootCause(e); - throw ne; - } - } catch (CannotProceedException cpe) { - javax.naming.Context cctx = getContinuationContext(cpe); - return cctx.lookup(cpe.getRemainingName()); + try { + return NamingManager.getObjectInstance(answer, name, this, _env); + } catch (NamingException e) { + throw e; + } catch (Exception e) { + NamingException ne = new NamingException("problem generating object using object factory"); + ne.setRootCause(e); + throw ne; } + } catch (CannotProceedException cpe) { + javax.naming.Context cctx = getContinuationContext(cpe); + return cctx.lookup(cpe.getRemainingName()); + } } /** - * Performs bind or rebind in the context depending on whether the - * flag rebind is set. The only objects allowed to be bound are of - * types org.omg.CORBA.Object, org.omg.CosNaming.NamingContext. - * You can use a state factory to turn other objects (such as - * Remote) into these acceptable forms. - * - * Uses the COS Naming apis bind/rebind or - * bind_context/rebind_context. - * @param pth NameComponent[] object - * @param obj Object to be bound. - * @param rebind perform rebind ? if true performs a rebind. - * @exception NotFound No objects under the name. - * @exception CannotProceed Unable to obtain a continuation context - * @exception AlreadyBound An object is already bound to this name. - */ - private void callBindOrRebind(NameComponent[] pth, Name name, - java.lang.Object obj, boolean rebind) throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - try { - // Call state factories to convert - obj = NamingManager.getStateToBind(obj, name, this, _env); + * Performs bind or rebind in the context depending on whether the flag rebind is set. The only objects allowed to be + * bound are of types org.omg.CORBA.Object, org.omg.CosNaming.NamingContext. You can use a state factory to turn other + * objects (such as Remote) into these acceptable forms. + * + * Uses the COS Naming apis bind/rebind or bind_context/rebind_context. + * + * @param pth NameComponent[] object + * @param obj Object to be bound. + * @param rebind perform rebind ? if true performs a rebind. + * @exception NotFound No objects under the name. + * @exception CannotProceed Unable to obtain a continuation context + * @exception AlreadyBound An object is already bound to this name. + */ + private void callBindOrRebind(NameComponent[] pth, Name name, java.lang.Object obj, boolean rebind) throws NamingException { + if (_nc == null) + throw new ConfigurationException("Context does not have a corresponding NamingContext"); + try { + // Call state factories to convert + obj = NamingManager.getStateToBind(obj, name, this, _env); - if (obj instanceof CNCtx) { - // Use naming context object reference - obj = ((CNCtx)obj)._nc; - } + if (obj instanceof CNCtx) { + // Use naming context object reference + obj = ((CNCtx) obj)._nc; + } - if ( obj instanceof org.omg.CosNaming.NamingContext) { - NamingContext nobj = - NamingContextHelper.narrow((org.omg.CORBA.Object)obj); - if (rebind) - _nc.rebind_context(pth,nobj); - else - _nc.bind_context(pth,nobj); - - } else if (obj instanceof org.omg.CORBA.Object) { - if (rebind) - _nc.rebind(pth,(org.omg.CORBA.Object)obj); - else - _nc.bind(pth,(org.omg.CORBA.Object)obj); - } + if (obj instanceof org.omg.CosNaming.NamingContext) { + NamingContext nobj = NamingContextHelper.narrow((org.omg.CORBA.Object) obj); + if (rebind) + _nc.rebind_context(pth, nobj); else - throw new IllegalArgumentException( - "Only instances of org.omg.CORBA.Object can be bound"); - } catch (BAD_PARAM e) { - // probably narrow() failed? - NamingException ne = new NotContextException(name.toString()); - ne.setRootCause(e); - throw ne; - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, pth); - } + _nc.bind_context(pth, nobj); + + } else if (obj instanceof org.omg.CORBA.Object) { + if (rebind) + _nc.rebind(pth, (org.omg.CORBA.Object) obj); + else + _nc.bind(pth, (org.omg.CORBA.Object) obj); + } else + throw new IllegalArgumentException("Only instances of org.omg.CORBA.Object can be bound"); + } catch (BAD_PARAM e) { + // probably narrow() failed? + NamingException ne = new NotContextException(name.toString()); + ne.setRootCause(e); + throw ne; + } catch (Exception e) { + throw ExceptionMapper.mapException(e, this, pth); + } } /** - * Converts the "Name" name into a NameComponent[] object and - * performs the bind operation. Uses callBindOrRebind. Throws an - * invalid name exception if the name is empty. We need a name to - * bind the object even when we work within the current context. - * @param name JNDI Name object - * @param obj Object to be bound. - * @exception NamingException See callBindOrRebind - */ - public void bind(Name name, java.lang.Object obj) - throws NamingException { - if (name.size() == 0 ) { - throw new InvalidNameException("Name is empty"); - } + * Converts the "Name" name into a NameComponent[] object and performs the bind operation. Uses callBindOrRebind. Throws + * an invalid name exception if the name is empty. We need a name to bind the object even when we work within the + * current context. + * + * @param name JNDI Name object + * @param obj Object to be bound. + * @exception NamingException See callBindOrRebind + */ + public void bind(Name name, java.lang.Object obj) throws NamingException { + if (name.size() == 0) { + throw new InvalidNameException("Name is empty"); + } - if (debug) { - System.out.println("Bind: " + name); - } - NameComponent[] path = CNNameParser.nameToCosName(name); + if (debug) { + System.out.println("Bind: " + name); + } + NameComponent[] path = CNNameParser.nameToCosName(name); - try { - callBindOrRebind(path, name, obj, false); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - cctx.bind(e.getRemainingName(), obj); - } + try { + callBindOrRebind(path, name, obj, false); + } catch (CannotProceedException e) { + javax.naming.Context cctx = getContinuationContext(e); + cctx.bind(e.getRemainingName(), obj); + } } - static private javax.naming.Context - getContinuationContext(CannotProceedException cpe) - throws NamingException { + static private javax.naming.Context getContinuationContext(CannotProceedException cpe) throws NamingException { try { return NamingManager.getContinuationContext(cpe); } catch (CannotProceedException e) { java.lang.Object resObj = e.getResolvedObj(); if (resObj instanceof Reference) { - Reference ref = (Reference)resObj; + Reference ref = (Reference) resObj; RefAddr addr = ref.get("nns"); if (addr.getContent() instanceof javax.naming.Context) { - NamingException ne = new NameNotFoundException( - "No object reference bound for specified name"); + NamingException ne = new NameNotFoundException("No object reference bound for specified name"); ne.setRootCause(cpe.getRootCause()); ne.setRemainingName(cpe.getRemainingName()); throw ne; @@ -658,81 +590,76 @@ public void bind(Name name, java.lang.Object obj) } /** - * Converts the "String" name into a CompositeName object and - * performs the bind operation. Uses callBindOrRebind. Throws an - * invalid name exception if the name is empty. - * @param name string - * @param obj Object to be bound. - * @exception NamingException See callBindOrRebind - */ + * Converts the "String" name into a CompositeName object and performs the bind operation. Uses callBindOrRebind. Throws + * an invalid name exception if the name is empty. + * + * @param name string + * @param obj Object to be bound. + * @exception NamingException See callBindOrRebind + */ public void bind(String name, java.lang.Object obj) throws NamingException { bind(new CompositeName(name), obj); } /** - * Converts the "Name" name into a NameComponent[] object and - * performs the rebind operation. Uses callBindOrRebind. Throws an - * invalid name exception if the name is empty. We must have a name - * to rebind the object to even if we are working within the current - * context. - * @param name string - * @param obj Object to be bound. - * @exception NamingException See callBindOrRebind - */ - public void rebind(Name name, java.lang.Object obj) - throws NamingException { - if (name.size() == 0 ) { - throw new InvalidNameException("Name is empty"); - } - NameComponent[] path = CNNameParser.nameToCosName(name); - try { - callBindOrRebind(path, name, obj, true); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - cctx.rebind(e.getRemainingName(), obj); - } + * Converts the "Name" name into a NameComponent[] object and performs the rebind operation. Uses callBindOrRebind. + * Throws an invalid name exception if the name is empty. We must have a name to rebind the object to even if we are + * working within the current context. + * + * @param name string + * @param obj Object to be bound. + * @exception NamingException See callBindOrRebind + */ + public void rebind(Name name, java.lang.Object obj) throws NamingException { + if (name.size() == 0) { + throw new InvalidNameException("Name is empty"); + } + NameComponent[] path = CNNameParser.nameToCosName(name); + try { + callBindOrRebind(path, name, obj, true); + } catch (CannotProceedException e) { + javax.naming.Context cctx = getContinuationContext(e); + cctx.rebind(e.getRemainingName(), obj); + } } /** - * Converts the "String" name into a CompositeName object and - * performs the rebind operation. Uses callBindOrRebind. Throws an - * invalid name exception if the name is an empty string. - * @param name string - * @param obj Object to be bound. - * @exception NamingException See callBindOrRebind - */ - public void rebind(String name, java.lang.Object obj) - throws NamingException { - rebind(new CompositeName(name), obj); + * Converts the "String" name into a CompositeName object and performs the rebind operation. Uses callBindOrRebind. + * Throws an invalid name exception if the name is an empty string. + * + * @param name string + * @param obj Object to be bound. + * @exception NamingException See callBindOrRebind + */ + public void rebind(String name, java.lang.Object obj) throws NamingException { + rebind(new CompositeName(name), obj); } /** - * Calls the unbind api of COS Naming and uses the exception mapper - * class to map the exceptions - * @param path NameComponent[] object - * @exception NotFound No objects under the name. If leaf - * is not found, that's OK according to the JNDI spec - * @exception CannotProceed Unable to obtain a continuation context - * @exception InvalidName Name not understood. - */ + * Calls the unbind api of COS Naming and uses the exception mapper class to map the exceptions + * + * @param path NameComponent[] object + * @exception NotFound No objects under the name. If leaf is not found, that's OK according to the JNDI spec + * @exception CannotProceed Unable to obtain a continuation context + * @exception InvalidName Name not understood. + */ private void callUnbind(NameComponent[] path) throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - try { - _nc.unbind(path); - } catch (NotFound e) { - // If leaf is the one missing, return success - // as per JNDI spec + if (_nc == null) + throw new ConfigurationException("Context does not have a corresponding NamingContext"); + try { + _nc.unbind(path); + } catch (NotFound e) { + // If leaf is the one missing, return success + // as per JNDI spec - if (leafNotFound(e, path[path.length-1])) { - // do nothing - } else { - throw ExceptionMapper.mapException(e, this, path); - } - } catch (Exception e) { + if (leafNotFound(e, path[path.length - 1])) { + // do nothing + } else { throw ExceptionMapper.mapException(e, this, path); } + } catch (Exception e) { + throw ExceptionMapper.mapException(e, this, path); + } } private boolean leafNotFound(NotFound e, NameComponent leaf) { @@ -743,374 +670,351 @@ private boolean leafNotFound(NotFound e, NameComponent leaf) { // the leaf (e.g. aa/aa/aa, which one is missing?) NameComponent rest; - return e.why.value() == NotFoundReason._missing_node && - e.rest_of_name.length == 1 && - (rest=e.rest_of_name[0]).id.equals(leaf.id) && - (rest.kind == leaf.kind || - (rest.kind != null && rest.kind.equals(leaf.kind))); + return e.why.value() == NotFoundReason._missing_node && e.rest_of_name.length == 1 && (rest = e.rest_of_name[0]).id.equals(leaf.id) + && (rest.kind == leaf.kind || (rest.kind != null && rest.kind.equals(leaf.kind))); } /** - * Converts the "String" name into a CompositeName object and - * performs the unbind operation. Uses callUnbind. If the name is - * empty, throws an invalid name exception. Do we unbind the - * current context (JNDI spec says work with the current context if - * the name is empty) ? - * @param name string - * @exception NamingException See callUnbind - */ - public void unbind(String name) throws NamingException { + * Converts the "String" name into a CompositeName object and performs the unbind operation. Uses callUnbind. If the + * name is empty, throws an invalid name exception. Do we unbind the current context (JNDI spec says work with the + * current context if the name is empty) ? + * + * @param name string + * @exception NamingException See callUnbind + */ + public void unbind(String name) throws NamingException { unbind(new CompositeName(name)); } /** - * Converts the "Name" name into a NameComponent[] object and - * performs the unbind operation. Uses callUnbind. Throws an - * invalid name exception if the name is empty. - * @param name string - * @exception NamingException See callUnbind - */ - public void unbind(Name name) - throws NamingException { - if (name.size() == 0 ) - throw new InvalidNameException("Name is empty"); - NameComponent[] path = CNNameParser.nameToCosName(name); - try { - callUnbind(path); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - cctx.unbind(e.getRemainingName()); - } + * Converts the "Name" name into a NameComponent[] object and performs the unbind operation. Uses callUnbind. Throws an + * invalid name exception if the name is empty. + * + * @param name string + * @exception NamingException See callUnbind + */ + public void unbind(Name name) throws NamingException { + if (name.size() == 0) + throw new InvalidNameException("Name is empty"); + NameComponent[] path = CNNameParser.nameToCosName(name); + try { + callUnbind(path); + } catch (CannotProceedException e) { + javax.naming.Context cctx = getContinuationContext(e); + cctx.unbind(e.getRemainingName()); + } } /** - * Renames an object. Since COS Naming does not support a rename - * api, this method unbinds the object with the "oldName" and - * creates a new binding. - * @param oldName string, existing name for the binding. - * @param newName string, name used to replace. - * @exception NamingException See bind - */ - public void rename(String oldName,String newName) - throws NamingException { - rename(new CompositeName(oldName), new CompositeName(newName)); + * Renames an object. Since COS Naming does not support a rename api, this method unbinds the object with the "oldName" + * and creates a new binding. + * + * @param oldName string, existing name for the binding. + * @param newName string, name used to replace. + * @exception NamingException See bind + */ + public void rename(String oldName, String newName) throws NamingException { + rename(new CompositeName(oldName), new CompositeName(newName)); } /** - * Renames an object. Since COS Naming does not support a rename - * api, this method unbinds the object with the "oldName" and - * creates a new binding. - * @param oldName JNDI Name, existing name for the binding. - * @param newName JNDI Name, name used to replace. - * @exception NamingException See bind - */ - public void rename(Name oldName,Name newName) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - if (oldName.size() == 0 || newName.size() == 0) - throw new InvalidNameException("One or both names empty"); - java.lang.Object obj = lookup(oldName); - bind(newName,obj); - unbind(oldName); + * Renames an object. Since COS Naming does not support a rename api, this method unbinds the object with the "oldName" + * and creates a new binding. + * + * @param oldName JNDI Name, existing name for the binding. + * @param newName JNDI Name, name used to replace. + * @exception NamingException See bind + */ + public void rename(Name oldName, Name newName) throws NamingException { + if (_nc == null) + throw new ConfigurationException("Context does not have a corresponding NamingContext"); + if (oldName.size() == 0 || newName.size() == 0) + throw new InvalidNameException("One or both names empty"); + java.lang.Object obj = lookup(oldName); + bind(newName, obj); + unbind(oldName); } /** - * Returns a NameClassEnumeration object which has a list of name - * class pairs. Lists the current context if the name is empty. - * @param name string - * @exception NamingException All exceptions thrown by lookup - * with a non-null argument - * @return a list of name-class objects as a NameClassEnumeration. - */ - public NamingEnumeration list(String name) throws NamingException { - return list(new CompositeName(name)); + * Returns a NameClassEnumeration object which has a list of name class pairs. Lists the current context if the name is + * empty. + * + * @param name string + * @exception NamingException All exceptions thrown by lookup with a non-null argument + * @return a list of name-class objects as a NameClassEnumeration. + */ + public NamingEnumeration list(String name) throws NamingException { + return list(new CompositeName(name)); } /** - * Returns a NameClassEnumeration object which has a list of name - * class pairs. Lists the current context if the name is empty. - * @param name JNDI Name - * @exception NamingException All exceptions thrown by lookup - * @return a list of name-class objects as a NameClassEnumeration. - */ + * Returns a NameClassEnumeration object which has a list of name class pairs. Lists the current context if the name is + * empty. + * + * @param name JNDI Name + * @exception NamingException All exceptions thrown by lookup + * @return a list of name-class objects as a NameClassEnumeration. + */ @SuppressWarnings("unchecked") - public NamingEnumeration list(Name name) - throws NamingException { - return (NamingEnumeration)listBindings(name); + public NamingEnumeration list(Name name) throws NamingException { + return (NamingEnumeration) listBindings(name); } /** - * Returns a BindingEnumeration object which has a list of name - * object pairs. Lists the current context if the name is empty. - * @param name string - * @exception NamingException all exceptions returned by lookup - * @return a list of bindings as a BindingEnumeration. - */ - public NamingEnumeration listBindings(String name) - throws NamingException { - return listBindings(new CompositeName(name)); + * Returns a BindingEnumeration object which has a list of name object pairs. Lists the current context if the name is + * empty. + * + * @param name string + * @exception NamingException all exceptions returned by lookup + * @return a list of bindings as a BindingEnumeration. + */ + public NamingEnumeration listBindings(String name) throws NamingException { + return listBindings(new CompositeName(name)); } /** - * Returns a BindingEnumeration object which has a list of name - * class pairs. Lists the current context if the name is empty. - * @param name JNDI Name - * @exception NamingException all exceptions returned by lookup. - * @return a list of bindings as a BindingEnumeration. - */ - public NamingEnumeration listBindings(Name name) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - if (name.size() > 0) { - try { - java.lang.Object obj = lookup(name); - if (obj instanceof CNCtx) { - return new CNBindingEnumeration( - (CNCtx) obj, true, _env); - } else { - throw new NotContextException(name.toString()); - } - } catch (NamingException ne) { - throw ne; - } catch (BAD_PARAM e) { - NamingException ne = - new NotContextException(name.toString()); - ne.setRootCause(e); - throw ne; + * Returns a BindingEnumeration object which has a list of name class pairs. Lists the current context if the name is + * empty. + * + * @param name JNDI Name + * @exception NamingException all exceptions returned by lookup. + * @return a list of bindings as a BindingEnumeration. + */ + public NamingEnumeration listBindings(Name name) throws NamingException { + if (_nc == null) + throw new ConfigurationException("Context does not have a corresponding NamingContext"); + if (name.size() > 0) { + try { + java.lang.Object obj = lookup(name); + if (obj instanceof CNCtx) { + return new CNBindingEnumeration((CNCtx) obj, true, _env); + } else { + throw new NotContextException(name.toString()); } + } catch (NamingException ne) { + throw ne; + } catch (BAD_PARAM e) { + NamingException ne = new NotContextException(name.toString()); + ne.setRootCause(e); + throw ne; } - return new CNBindingEnumeration(this, false, _env); + } + return new CNBindingEnumeration(this, false, _env); } /** - * Calls the destroy on the COS Naming Server - * @param nc The NamingContext object to use. - * @exception NotEmpty when the context is not empty and cannot be destroyed. - */ - private void callDestroy(NamingContext nc) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - try { - nc.destroy(); - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, null); - } + * Calls the destroy on the COS Naming Server + * + * @param nc The NamingContext object to use. + * @exception NotEmpty when the context is not empty and cannot be destroyed. + */ + private void callDestroy(NamingContext nc) throws NamingException { + if (_nc == null) + throw new ConfigurationException("Context does not have a corresponding NamingContext"); + try { + nc.destroy(); + } catch (Exception e) { + throw ExceptionMapper.mapException(e, this, null); + } } /** - * Uses the callDestroy function to destroy the context. If name is - * empty destroys the current context. - * @param name string - * @exception OperationNotSupportedException when list is invoked - * with a non-null argument - */ - public void destroySubcontext(String name) throws NamingException { + * Uses the callDestroy function to destroy the context. If name is empty destroys the current context. + * + * @param name string + * @exception OperationNotSupportedException when list is invoked with a non-null argument + */ + public void destroySubcontext(String name) throws NamingException { destroySubcontext(new CompositeName(name)); } /** - * Uses the callDestroy function to destroy the context. Destroys - * the current context if name is empty. - * @param name JNDI Name - * @exception OperationNotSupportedException when list is invoked - * with a non-null argument - */ - public void destroySubcontext(Name name) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - NamingContext the_nc = _nc; - NameComponent[] path = CNNameParser.nameToCosName(name); - if ( name.size() > 0) { - try { - javax.naming.Context ctx = - (javax.naming.Context) callResolve(path); - CNCtx cnc = (CNCtx)ctx; - the_nc = cnc._nc; - cnc.close(); //remove the reference to the context - } catch (ClassCastException e) { - throw new NotContextException(name.toString()); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - cctx.destroySubcontext(e.getRemainingName()); - return; - } catch (NameNotFoundException e) { - // If leaf is the one missing, return success - // as per JNDI spec - - if (e.getRootCause() instanceof NotFound && - leafNotFound((NotFound)e.getRootCause(), - path[path.length-1])) { - return; // leaf missing OK - } - throw e; - } catch (NamingException e) { - throw e; + * Uses the callDestroy function to destroy the context. Destroys the current context if name is empty. + * + * @param name JNDI Name + * @exception OperationNotSupportedException when list is invoked with a non-null argument + */ + public void destroySubcontext(Name name) throws NamingException { + if (_nc == null) + throw new ConfigurationException("Context does not have a corresponding NamingContext"); + NamingContext the_nc = _nc; + NameComponent[] path = CNNameParser.nameToCosName(name); + if (name.size() > 0) { + try { + javax.naming.Context ctx = (javax.naming.Context) callResolve(path); + CNCtx cnc = (CNCtx) ctx; + the_nc = cnc._nc; + cnc.close(); // remove the reference to the context + } catch (ClassCastException e) { + throw new NotContextException(name.toString()); + } catch (CannotProceedException e) { + javax.naming.Context cctx = getContinuationContext(e); + cctx.destroySubcontext(e.getRemainingName()); + return; + } catch (NameNotFoundException e) { + // If leaf is the one missing, return success + // as per JNDI spec + + if (e.getRootCause() instanceof NotFound && leafNotFound((NotFound) e.getRootCause(), path[path.length - 1])) { + return; // leaf missing OK } + throw e; + } catch (NamingException e) { + throw e; } - callDestroy(the_nc); - callUnbind(path); + } + callDestroy(the_nc); + callUnbind(path); } /** - * Calls the bind_new_context COS naming api to create a new subcontext. - * @param path NameComponent[] object - * @exception NotFound No objects under the name. - * @exception CannotProceed Unable to obtain a continuation context - * @exception InvalidName Name not understood. - * @exception AlreadyBound An object is already bound to this name. - * @return the new context object. - */ - private javax.naming.Context callBindNewContext(NameComponent[] path) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - try { - NamingContext nctx = _nc.bind_new_context(path); - return new CNCtx(_orb, orbTracker, nctx, _env, - makeFullName(path)); - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, path); - } + * Calls the bind_new_context COS naming api to create a new subcontext. + * + * @param path NameComponent[] object + * @exception NotFound No objects under the name. + * @exception CannotProceed Unable to obtain a continuation context + * @exception InvalidName Name not understood. + * @exception AlreadyBound An object is already bound to this name. + * @return the new context object. + */ + private javax.naming.Context callBindNewContext(NameComponent[] path) throws NamingException { + if (_nc == null) + throw new ConfigurationException("Context does not have a corresponding NamingContext"); + try { + NamingContext nctx = _nc.bind_new_context(path); + return new CNCtx(_orb, orbTracker, nctx, _env, makeFullName(path)); + } catch (Exception e) { + throw ExceptionMapper.mapException(e, this, path); + } } /** - * Uses the callBindNewContext convenience function to create a new - * context. Throws an invalid name exception if the name is empty. - * @param name string - * @exception NamingException See callBindNewContext - * @return the new context object. - */ - public javax.naming.Context createSubcontext(String name) - throws NamingException { - return createSubcontext(new CompositeName(name)); + * Uses the callBindNewContext convenience function to create a new context. Throws an invalid name exception if the + * name is empty. + * + * @param name string + * @exception NamingException See callBindNewContext + * @return the new context object. + */ + public javax.naming.Context createSubcontext(String name) throws NamingException { + return createSubcontext(new CompositeName(name)); } /** - * Uses the callBindNewContext convenience function to create a new - * context. Throws an invalid name exception if the name is empty. - * @param name string - * @exception NamingException See callBindNewContext - * @return the new context object. - */ - public javax.naming.Context createSubcontext(Name name) - throws NamingException { - if (name.size() == 0 ) - throw new InvalidNameException("Name is empty"); - NameComponent[] path = CNNameParser.nameToCosName(name); - try { - return callBindNewContext(path); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - return cctx.createSubcontext(e.getRemainingName()); - } + * Uses the callBindNewContext convenience function to create a new context. Throws an invalid name exception if the + * name is empty. + * + * @param name string + * @exception NamingException See callBindNewContext + * @return the new context object. + */ + public javax.naming.Context createSubcontext(Name name) throws NamingException { + if (name.size() == 0) + throw new InvalidNameException("Name is empty"); + NameComponent[] path = CNNameParser.nameToCosName(name); + try { + return callBindNewContext(path); + } catch (CannotProceedException e) { + javax.naming.Context cctx = getContinuationContext(e); + return cctx.createSubcontext(e.getRemainingName()); + } } /** - * Is mapped to resolve in the COS Naming api. - * @param name string - * @exception NamingException See lookup. - * @return the resolved object. - */ - public java.lang.Object lookupLink(String name) throws NamingException { - return lookupLink(new CompositeName(name)); + * Is mapped to resolve in the COS Naming api. + * + * @param name string + * @exception NamingException See lookup. + * @return the resolved object. + */ + public java.lang.Object lookupLink(String name) throws NamingException { + return lookupLink(new CompositeName(name)); } /** - * Is mapped to resolve in the COS Naming api. - * @param name string - * @exception NamingException See lookup. - * @return the resolved object. - */ - public java.lang.Object lookupLink(Name name) throws NamingException { - return lookup(name); + * Is mapped to resolve in the COS Naming api. + * + * @param name string + * @exception NamingException See lookup. + * @return the resolved object. + */ + public java.lang.Object lookupLink(Name name) throws NamingException { + return lookup(name); } /** - * Allow access to the name parser object. - * @param name JNDI name, is ignored since there is only one Name - * Parser object. - * @exception NamingException -- - * @return NameParser object - */ - public NameParser getNameParser(String name) throws NamingException { + * Allow access to the name parser object. + * + * @param name JNDI name, is ignored since there is only one Name Parser object. + * @exception NamingException -- + * @return NameParser object + */ + public NameParser getNameParser(String name) throws NamingException { return parser; } /** - * Allow access to the name parser object. - * @param name JNDI name, is ignored since there is only one Name - * Parser object. - * @exception NamingException -- - * @return NameParser object - */ - public NameParser getNameParser(Name name) throws NamingException { + * Allow access to the name parser object. + * + * @param name JNDI name, is ignored since there is only one Name Parser object. + * @exception NamingException -- + * @return NameParser object + */ + public NameParser getNameParser(Name name) throws NamingException { return parser; } /** - * Returns the current environment. - * @return Environment. - */ + * Returns the current environment. + * + * @return Environment. + */ @SuppressWarnings("unchecked") - public Hashtable getEnvironment() throws NamingException { + public Hashtable getEnvironment() throws NamingException { if (_env == null) { return new Hashtable<>(5, 0.75f); } else { - return (Hashtable)_env.clone(); + return (Hashtable) _env.clone(); } } public String composeName(String name, String prefix) throws NamingException { - return composeName(new CompositeName(name), - new CompositeName(prefix)).toString(); + return composeName(new CompositeName(name), new CompositeName(prefix)).toString(); } public Name composeName(Name name, Name prefix) throws NamingException { - Name result = (Name)prefix.clone(); + Name result = (Name) prefix.clone(); return result.addAll(name); } /** - * Adds to the environment for the current context. - * Record change but do not reinitialize ORB. - * - * @param propName The property name. - * @param propValue The ORB. - * @return the previous value of this property if any. - */ + * Adds to the environment for the current context. Record change but do not reinitialize ORB. + * + * @param propName The property name. + * @param propValue The ORB. + * @return the previous value of this property if any. + */ @SuppressWarnings("unchecked") - public java.lang.Object addToEnvironment(String propName, - java.lang.Object propValue) - throws NamingException { - if (_env == null) { - _env = new Hashtable<>(7, 0.75f); - } else { - // copy-on-write - _env = (Hashtable)_env.clone(); - } + public java.lang.Object addToEnvironment(String propName, java.lang.Object propValue) throws NamingException { + if (_env == null) { + _env = new Hashtable<>(7, 0.75f); + } else { + // copy-on-write + _env = (Hashtable) _env.clone(); + } - return _env.put(propName, propValue); + return _env.put(propName, propValue); } // Record change but do not reinitialize ORB @SuppressWarnings("unchecked") - public java.lang.Object removeFromEnvironment(String propName) - throws NamingException { - if (_env != null && _env.get(propName) != null) { - // copy-on-write - _env = (Hashtable)_env.clone(); - return _env.remove(propName); - } - return null; + public java.lang.Object removeFromEnvironment(String propName) throws NamingException { + if (_env != null && _env.get(propName) != null) { + // copy-on-write + _env = (Hashtable) _env.clone(); + return _env.remove(propName); + } + return null; } synchronized public void incEnumCount() { @@ -1120,12 +1024,10 @@ synchronized public void incEnumCount() { } } - synchronized public void decEnumCount() - throws NamingException { + synchronized public void decEnumCount() throws NamingException { enumCount--; if (debug) { - System.out.println("decEnumCount, new count:" + enumCount + - " isCloseCalled:" + isCloseCalled); + System.out.println("decEnumCount, new count:" + enumCount + " isCloseCalled:" + isCloseCalled); } if ((enumCount == 0) && isCloseCalled) { close(); diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNCtxFactory.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNCtxFactory.java index dac3899d6..bba3d1ae7 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNCtxFactory.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNCtxFactory.java @@ -24,21 +24,21 @@ import java.util.Hashtable; /** - * Implements the JNDI SPI InitialContextFactory interface used to - * create the InitialContext objects. - * - * @author Raj Krishnamurthy - */ + * Implements the JNDI SPI InitialContextFactory interface used to create the InitialContext objects. + * + * @author Raj Krishnamurthy + */ public class CNCtxFactory implements InitialContextFactory { - /** - * Creates the InitialContext object. Properties parameter should - * should contain the ORB object for the value jndi.corba.orb. - * @param env Properties object - */ + /** + * Creates the InitialContext object. Properties parameter should should contain the ORB object for the value + * jndi.corba.orb. + * + * @param env Properties object + */ - public Context getInitialContext(Hashtable env) throws NamingException { - return new CNCtx(env); - } + public Context getInitialContext(Hashtable env) throws NamingException { + return new CNCtx(env); + } } diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNNameParser.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNNameParser.java index 81e120254..611b0a422 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNNameParser.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CNNameParser.java @@ -26,14 +26,12 @@ import org.omg.CosNaming.NameComponent; /** - * Parsing routines for NameParser as well as COS Naming stringified names. - * This is used by CNCtx to create a NameComponent[] object and vice versa. - * It follows Section 4.5 of Interoperable Naming Service (INS) 98-10-11. - * In summary, the stringified form is a left-to-right, forward-slash - * separated name. id and kinds are separated by '.'. backslash is the - * escape character. - * - */ + * Parsing routines for NameParser as well as COS Naming stringified names. This is used by CNCtx to create a + * NameComponent[] object and vice versa. It follows Section 4.5 of Interoperable Naming Service (INS) 98-10-11. In + * summary, the stringified form is a left-to-right, forward-slash separated name. id and kinds are separated by '.'. + * backslash is the escape character. + * + */ final public class CNNameParser implements NameParser { @@ -43,69 +41,66 @@ final public class CNNameParser implements NameParser { private static final char escapeChar = '\\'; static { mySyntax.put("jndi.syntax.direction", "left_to_right"); - mySyntax.put("jndi.syntax.separator", ""+compSeparator); - mySyntax.put("jndi.syntax.escape", ""+escapeChar); + mySyntax.put("jndi.syntax.separator", "" + compSeparator); + mySyntax.put("jndi.syntax.escape", "" + escapeChar); }; - /** - * Constructs a new name parser for parsing names in INS syntax. - */ + /** + * Constructs a new name parser for parsing names in INS syntax. + */ public CNNameParser() { } - /** - * Returns a CompoundName given a string in INS syntax. - * @param name The non-null string representation of the name. - * @return a non-null CompoundName - */ + /** + * Returns a CompoundName given a string in INS syntax. + * + * @param name The non-null string representation of the name. + * @return a non-null CompoundName + */ public Name parse(String name) throws NamingException { Vector comps = insStringToStringifiedComps(name); return new CNCompoundName(comps.elements()); } /** - * Creates a NameComponent[] from a Name structure. - * Used by CNCtx to convert the input Name arg into a NameComponent[]. - * @param a CompoundName or a CompositeName; - * each component must be the stringified form of a NameComponent. + * Creates a NameComponent[] from a Name structure. Used by CNCtx to convert the input Name arg into a NameComponent[]. + * + * @param a CompoundName or a CompositeName; each component must be the stringified form of a NameComponent. */ - static NameComponent[] nameToCosName(Name name) - throws InvalidNameException { - int len = name.size(); - if (len == 0) { - return new NameComponent[0]; - } + static NameComponent[] nameToCosName(Name name) throws InvalidNameException { + int len = name.size(); + if (len == 0) { + return new NameComponent[0]; + } - NameComponent[] answer = new NameComponent[len]; - for (int i = 0; i < len; i++) { - answer[i] = parseComponent(name.get(i)); - } - return answer; + NameComponent[] answer = new NameComponent[len]; + for (int i = 0; i < len; i++) { + answer[i] = parseComponent(name.get(i)); + } + return answer; } /** - * Returns the INS stringified form of a NameComponent[]. - * Used by CNCtx.getNameInNamespace(), CNCompoundName.toString(). + * Returns the INS stringified form of a NameComponent[]. Used by CNCtx.getNameInNamespace(), CNCompoundName.toString(). */ static String cosNameToInsString(NameComponent[] cname) { - StringBuilder str = new StringBuilder(); - for ( int i = 0; i < cname.length; i++) { - if ( i > 0) { - str.append(compSeparator); - } - str.append(stringifyComponent(cname[i])); - } - return str.toString(); + StringBuilder str = new StringBuilder(); + for (int i = 0; i < cname.length; i++) { + if (i > 0) { + str.append(compSeparator); + } + str.append(stringifyComponent(cname[i])); + } + return str.toString(); } /** - * Creates a CompositeName from a NameComponent[]. - * Used by ExceptionMapper and CNBindingEnumeration to convert - * a NameComponent[] into a composite name. + * Creates a CompositeName from a NameComponent[]. Used by ExceptionMapper and CNBindingEnumeration to convert a + * NameComponent[] into a composite name. */ static Name cosNameToName(NameComponent[] cname) { Name nm = new CompositeName(); - for ( int i = 0; cname != null && i < cname.length; i++) { + for (int i = 0; cname != null && i < cname.length; i++) { try { nm.add(stringifyComponent(cname[i])); } catch (InvalidNameException e) { @@ -116,12 +111,10 @@ static Name cosNameToName(NameComponent[] cname) { } /** - * Converts an INS-syntax string name into a Vector in which - * each element of the vector contains a stringified form of - * a NameComponent. + * Converts an INS-syntax string name into a Vector in which each element of the vector contains a stringified form of a + * NameComponent. */ - private static Vector insStringToStringifiedComps(String str) - throws InvalidNameException { + private static Vector insStringToStringifiedComps(String str) throws InvalidNameException { int len = str.length(); Vector components = new Vector<>(10); @@ -129,18 +122,17 @@ private static Vector insStringToStringifiedComps(String str) char[] kind = new char[len]; int idCount, kindCount; boolean idMode; - for (int i = 0; i < len; ) { + for (int i = 0; i < len;) { idCount = kindCount = 0; // reset for new component - idMode = true; // always start off parsing id + idMode = true; // always start off parsing id while (i < len) { if (str.charAt(i) == compSeparator) { break; } else if (str.charAt(i) == escapeChar) { if (i + 1 >= len) { - throw new InvalidNameException(str + - ": unescaped \\ at end of component"); - } else if (isMeta(str.charAt(i+1))) { + throw new InvalidNameException(str + ": unescaped \\ at end of component"); + } else if (isMeta(str.charAt(i + 1))) { ++i; // skip escape and let meta through if (idMode) { id[idCount++] = str.charAt(i++); @@ -148,8 +140,7 @@ private static Vector insStringToStringifiedComps(String str) kind[kindCount++] = str.charAt(i++); } } else { - throw new InvalidNameException(str + - ": invalid character being escaped"); + throw new InvalidNameException(str + ": invalid character being escaped"); } } else if (idMode && str.charAt(i) == kindSeparator) { @@ -165,9 +156,7 @@ private static Vector insStringToStringifiedComps(String str) } } } - components.addElement(stringifyComponent( - new NameComponent(new String(id, 0, idCount), - new String(kind, 0, kindCount)))); + components.addElement(stringifyComponent(new NameComponent(new String(id, 0, idCount), new String(kind, 0, kindCount)))); if (i < len) { ++i; // skip separator @@ -180,8 +169,7 @@ private static Vector insStringToStringifiedComps(String str) /** * Return a NameComponent given its stringified form. */ - private static NameComponent parseComponent(String compStr) - throws InvalidNameException { + private static NameComponent parseComponent(String compStr) throws InvalidNameException { NameComponent comp = new NameComponent(); int kindSep = -1; int len = compStr.length(); @@ -197,13 +185,11 @@ private static NameComponent parseComponent(String compStr) escaped = false; } else if (compStr.charAt(i) == escapeChar) { if (i + 1 >= len) { - throw new InvalidNameException(compStr + - ": unescaped \\ at end of component"); - } else if (isMeta(compStr.charAt(i+1))) { + throw new InvalidNameException(compStr + ": unescaped \\ at end of component"); + } else if (isMeta(compStr.charAt(i + 1))) { escaped = true; } else { - throw new InvalidNameException(compStr + - ": invalid character being escaped"); + throw new InvalidNameException(compStr + ": invalid character being escaped"); } } else if (compStr.charAt(i) == kindSeparator) { kindSep = i; @@ -217,24 +203,22 @@ private static NameComponent parseComponent(String compStr) // Set kind if (kindSep < 0) { - comp.kind = ""; // no kind separator + comp.kind = ""; // no kind separator } else { // unescape kind j = 0; escaped = false; - for (int i = kindSep+1; i < len; i++) { + for (int i = kindSep + 1; i < len; i++) { if (escaped) { newStr[j++] = compStr.charAt(i); escaped = false; } else if (compStr.charAt(i) == escapeChar) { if (i + 1 >= len) { - throw new InvalidNameException(compStr + - ": unescaped \\ at end of component"); - } else if (isMeta(compStr.charAt(i+1))) { + throw new InvalidNameException(compStr + ": unescaped \\ at end of component"); + } else if (isMeta(compStr.charAt(i + 1))) { escaped = true; } else { - throw new InvalidNameException(compStr + - ": invalid character being escaped"); + throw new InvalidNameException(compStr + ": invalid character being escaped"); } } else { newStr[j++] = compStr.charAt(i); @@ -251,28 +235,25 @@ private static String stringifyComponent(NameComponent comp) { one.append(kindSeparator).append(escape(comp.kind)); } if (one.length() == 0) { - return ""+kindSeparator; // if neither id nor kind specified + return "" + kindSeparator; // if neither id nor kind specified } else { return one.toString(); } } /** - * Returns a string with '.', '\', '/' escaped. Used when - * stringifying the name into its INS stringified form. + * Returns a string with '.', '\', '/' escaped. Used when stringifying the name into its INS stringified form. */ private static String escape(String str) { - if (str.indexOf(kindSeparator) < 0 && - str.indexOf(compSeparator) < 0 && - str.indexOf(escapeChar) < 0) { - return str; // no meta characters to escape + if (str.indexOf(kindSeparator) < 0 && str.indexOf(compSeparator) < 0 && str.indexOf(escapeChar) < 0) { + return str; // no meta characters to escape } else { int len = str.length(); int j = 0; - char[] newStr = new char[len+len]; + char[] newStr = new char[len + len]; for (int i = 0; i < len; i++) { if (isMeta(str.charAt(i))) { - newStr[j++] = escapeChar; // escape meta character + newStr[j++] = escapeChar; // escape meta character } newStr[j++] = str.charAt(i); } @@ -294,8 +275,7 @@ private static boolean isMeta(char ch) { } /** - * An implementation of CompoundName that bypasses the parsing - * and stringifying code of the default CompoundName. + * An implementation of CompoundName that bypasses the parsing and stringifying code of the default CompoundName. */ static final class CNCompoundName extends CompoundName { CNCompoundName(Enumeration enum_) { @@ -329,164 +309,57 @@ public String toString() { } // for testing only -/* - private static void print(String input) { - try { - System.out.println("\n >>>>>> input: " + input); - - System.out.println("--Compound Name: "); - NameParser parser = new CNNameParser(); - Name name = parser.parse(input); - for (int i = 0; i < name.size(); i++) { - System.out.println("\t" + i + ": " + name.get(i)); - NameComponent cp = parseComponent(name.get(i)); - System.out.println("\t\t" + "id: " + cp.id + ";kind: " + cp.kind); - } - System.out.println("\t" + name.toString()); - - System.out.println("--Composite Name: "); - Name composite = new CompositeName(input); - for (int i = 0; i < composite.size(); i++) { - System.out.println("\t" + i+": " + composite.get(i)); - } - System.out.println("\t" + composite.toString()); - - System.out.println("--Composite To NameComponent"); - NameComponent[] names = nameToCosName(composite); - for (int i = 0; i < composite.size(); i++) { - System.out.println("\t" + i+": id: " + names[i].id + "; kind: " + names[i].kind); - } - System.out.println("\t" + cosNameToInsString(names)); - } catch (NamingException e) { - System.out.println(e); - } - } - - private static void checkName(Name name, String[] comps) throws Exception { - if (name.size() != comps.length) { - throw new Exception( - "test failed; incorrect component count in " + name + "; " + - "expecting " + comps.length + " got " + name.size()); - } - for (int i = 0; i < name.size(); i++) { - if (!comps[i].equals(name.get(i))) { - throw new Exception ( - "test failed; invalid component in " + name + "; " + - "expecting '" + comps[i] + "' got '" + name.get(i) + "'"); - } - } - } - - private static void checkCompound(NameParser parser, - String input, String[] comps) throws Exception { - checkName(parser.parse(input), comps); - } - - private static void checkComposite(String input, String[] comps) - throws Exception { - checkName(new CompositeName(input), comps); - } - - private static String[] compounds = { - "a/b/c", - "a.b/c.d", - "a", - ".", - "a.", - "c.d", - ".e", - "a/x\\/y\\/z/b", - "a\\.b.c\\.d/e.f", - "a/b\\\\/c", - "x\\\\.y", - "x\\.y", - "x.\\\\y", - "x.y\\\\", - "\\\\x.y", - "a.b\\.c/d" - }; - private static String[][] compoundComps = { - {"a", "b", "c"}, - {"a.b", "c.d"}, - {"a"}, - {"."}, - {"a"}, - {"c.d"}, - {".e"}, - {"a", "x\\/y\\/z", "b"}, - {"a\\.b.c\\.d", "e.f"}, - {"a", "b\\\\", "c"}, - {"x\\\\.y"}, - {"x\\.y"}, - {"x.\\\\y"}, - {"x.y\\\\"}, - {"\\\\x.y"}, - {"a.b\\.c", "d"}, - }; - - private static String[] composites = { - "a/b/c", - "a.b/c.d", - "a", - ".", - "a.", - "c.d", - ".e", - "a/x\\\\\\/y\\\\\\/z/b", - "a\\\\.b.c\\\\.d/e.f", - "a/b\\\\\\\\/c", - "x\\\\\\.y", - "x\\\\.y", - "x.\\\\\\\\y", - "x.y\\\\\\\\", - "\\\\\\\\x.y" - }; - - private static String[][] compositeComps = { - {"a", "b", "c"}, - {"a.b", "c.d"}, - {"a"}, - {"."}, - {"a."}, // unlike compound, kind sep is not consumed - {"c.d"}, - {".e"}, - {"a", "x\\/y\\/z", "b"}, - {"a\\.b.c\\.d", "e.f"}, - {"a", "b\\\\", "c"}, - {"x\\\\.y"}, - {"x\\.y"}, - {"x.\\\\y"}, - {"x.y\\\\"}, - {"\\\\x.y"} - }; - - public static void main(String[] args) throws Exception { - if (args.length > 0) { - for (int i = 0; i < args.length; i++) { - print(args[0]); - } - } else { - print("x\\\\.y"); - print("x\\.y"); - print("x.\\\\y"); - print("x.y\\\\"); - print("\\\\x.y"); - } - - NameParser parser = new com.sun.jndi.cosnaming.CNNameParser(); - for (int i = 0; i < compounds.length; i++) { - checkCompound(parser, compounds[i], compoundComps[i]); - } - for (int i = 0; i < composites.length; i++) { - checkComposite(composites[i], compositeComps[i]); - } - - System.out.println("hardwire"); - NameComponent[] foo = new NameComponent[1]; - foo[0] = new NameComponent("foo\\", "bar"); - - System.out.println(cosNameToInsString(foo)); - System.out.println(cosNameToName(foo)); - } -*/ + /* + * private static void print(String input) { try { System.out.println("\n >>>>>> input: " + input); + * + * System.out.println("--Compound Name: "); NameParser parser = new CNNameParser(); Name name = parser.parse(input); for + * (int i = 0; i < name.size(); i++) { System.out.println("\t" + i + ": " + name.get(i)); NameComponent cp = + * parseComponent(name.get(i)); System.out.println("\t\t" + "id: " + cp.id + ";kind: " + cp.kind); } + * System.out.println("\t" + name.toString()); + * + * System.out.println("--Composite Name: "); Name composite = new CompositeName(input); for (int i = 0; i < + * composite.size(); i++) { System.out.println("\t" + i+": " + composite.get(i)); } System.out.println("\t" + + * composite.toString()); + * + * System.out.println("--Composite To NameComponent"); NameComponent[] names = nameToCosName(composite); for (int i = 0; + * i < composite.size(); i++) { System.out.println("\t" + i+": id: " + names[i].id + "; kind: " + names[i].kind); } + * System.out.println("\t" + cosNameToInsString(names)); } catch (NamingException e) { System.out.println(e); } } + * + * private static void checkName(Name name, String[] comps) throws Exception { if (name.size() != comps.length) { throw + * new Exception( "test failed; incorrect component count in " + name + "; " + "expecting " + comps.length + " got " + + * name.size()); } for (int i = 0; i < name.size(); i++) { if (!comps[i].equals(name.get(i))) { throw new Exception ( + * "test failed; invalid component in " + name + "; " + "expecting '" + comps[i] + "' got '" + name.get(i) + "'"); } } } + * + * private static void checkCompound(NameParser parser, String input, String[] comps) throws Exception { + * checkName(parser.parse(input), comps); } + * + * private static void checkComposite(String input, String[] comps) throws Exception { checkName(new + * CompositeName(input), comps); } + * + * private static String[] compounds = { "a/b/c", "a.b/c.d", "a", ".", "a.", "c.d", ".e", "a/x\\/y\\/z/b", + * "a\\.b.c\\.d/e.f", "a/b\\\\/c", "x\\\\.y", "x\\.y", "x.\\\\y", "x.y\\\\", "\\\\x.y", "a.b\\.c/d" }; private static + * String[][] compoundComps = { {"a", "b", "c"}, {"a.b", "c.d"}, {"a"}, {"."}, {"a"}, {"c.d"}, {".e"}, {"a", + * "x\\/y\\/z", "b"}, {"a\\.b.c\\.d", "e.f"}, {"a", "b\\\\", "c"}, {"x\\\\.y"}, {"x\\.y"}, {"x.\\\\y"}, {"x.y\\\\"}, + * {"\\\\x.y"}, {"a.b\\.c", "d"}, }; + * + * private static String[] composites = { "a/b/c", "a.b/c.d", "a", ".", "a.", "c.d", ".e", "a/x\\\\\\/y\\\\\\/z/b", + * "a\\\\.b.c\\\\.d/e.f", "a/b\\\\\\\\/c", "x\\\\\\.y", "x\\\\.y", "x.\\\\\\\\y", "x.y\\\\\\\\", "\\\\\\\\x.y" }; + * + * private static String[][] compositeComps = { {"a", "b", "c"}, {"a.b", "c.d"}, {"a"}, {"."}, {"a."}, // unlike + * compound, kind sep is not consumed {"c.d"}, {".e"}, {"a", "x\\/y\\/z", "b"}, {"a\\.b.c\\.d", "e.f"}, {"a", + * "b\\\\", "c"}, {"x\\\\.y"}, {"x\\.y"}, {"x.\\\\y"}, {"x.y\\\\"}, {"\\\\x.y"} }; + * + * public static void main(String[] args) throws Exception { if (args.length > 0) { for (int i = 0; i < args.length; + * i++) { print(args[0]); } } else { print("x\\\\.y"); print("x\\.y"); print("x.\\\\y"); print("x.y\\\\"); + * print("\\\\x.y"); } + * + * NameParser parser = new com.sun.jndi.cosnaming.CNNameParser(); for (int i = 0; i < compounds.length; i++) { + * checkCompound(parser, compounds[i], compoundComps[i]); } for (int i = 0; i < composites.length; i++) { + * checkComposite(composites[i], compositeComps[i]); } + * + * System.out.println("hardwire"); NameComponent[] foo = new NameComponent[1]; foo[0] = new + * NameComponent("foo\\", "bar"); + * + * System.out.println(cosNameToInsString(foo)); System.out.println(cosNameToName(foo)); } + */ } diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CorbanameUrl.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CorbanameUrl.java index e57b382a0..933e13674 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CorbanameUrl.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/CorbanameUrl.java @@ -28,6 +28,7 @@ * Extract components of a "corbaname" URL. * * The format of an corbaname URL is defined in INS 99-12-03 as follows. + * *

    {@code
      * corbaname url = "corbaname:"  ["#" ]
      * corbaloc_obj  =  ["/" ]
    @@ -35,27 +36,29 @@
      * key_string    = as defined in a corbaloc URL
      * string_name   = stringified COS name | empty_string
      * }
    - * Characters in {@code } are escaped as follows. - * US-ASCII alphanumeric characters are not escaped. Any characters outside - * of this range are escaped except for the following: + * + * Characters in {@code } are escaped as follows. US-ASCII alphanumeric characters are not escaped. Any + * characters outside of this range are escaped except for the following: + * *
    {@code
      *        ; / : ? @ & = + $ , - _ . ! ~ * ; ( )
      * }
    - * Escaped characters is escaped by using a % followed by its 2 hexadecimal - * numbers representing the octet. + * + * Escaped characters is escaped by using a % followed by its 2 hexadecimal numbers representing the octet. *

    - * The corbaname URL is parsed into two parts: a corbaloc URL and a COS name. - * The corbaloc URL is constructed by concatenation {@code "corbaloc:"} with - * {@code }. - * The COS name is {@code } with the escaped characters resolved. + * The corbaname URL is parsed into two parts: a corbaloc URL and a COS name. The corbaloc URL is constructed by + * concatenation {@code "corbaloc:"} with {@code }. The COS name is {@code } with the escaped + * characters resolved. *

    * A corbaname URL is resolved by: *

      *
    1. Construct a corbaloc URL by concatenating {@code "corbaloc:"} and {@code }. *
    2. Resolve the corbaloc URL to a NamingContext by using + * *
      {@code
      - *     nctx = ORB.string_to_object(corbalocUrl);
      + * nctx = ORB.string_to_object(corbalocUrl);
        * }
      + * *
    3. Resolve {@code } in the NamingContext. *
    * @@ -66,8 +69,7 @@ public final class CorbanameUrl { private String location; /** - * Returns a possibly empty but non-null string that is the "string_name" - * portion of the URL. + * Returns a possibly empty but non-null string that is the "string_name" portion of the URL. */ public String getStringName() { return stringName; @@ -87,38 +89,31 @@ public CorbanameUrl(String url) throws MalformedURLException { throw new MalformedURLException("Invalid corbaname URL: " + url); } - int addrStart = 10; // "corbaname:" + int addrStart = 10; // "corbaname:" int addrEnd = url.indexOf('#', addrStart); if (addrEnd < 0) { addrEnd = url.length(); stringName = ""; } else { - stringName = CorbaUtils.decode(url.substring(addrEnd+1)); + stringName = CorbaUtils.decode(url.substring(addrEnd + 1)); } location = url.substring(addrStart, addrEnd); int keyStart = location.indexOf('/'); if (keyStart >= 0) { // Has key string - if (keyStart == (location.length() -1)) { + if (keyStart == (location.length() - 1)) { location += "NameService"; } } else { location += "/NameService"; } } -/* - // for testing only - public static void main(String[] args) { - try { - CorbanameUrl url = new CorbanameUrl(args[0]); - - System.out.println("location: " + url.getLocation()); - System.out.println("string name: " + url.getStringName()); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } -*/ + /* + * // for testing only public static void main(String[] args) { try { CorbanameUrl url = new CorbanameUrl(args[0]); + * + * System.out.println("location: " + url.getLocation()); System.out.println("string name: " + url.getStringName()); } + * catch (MalformedURLException e) { e.printStackTrace(); } } + */ } diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/ExceptionMapper.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/ExceptionMapper.java index f966ea79c..eb29b1efe 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/ExceptionMapper.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/ExceptionMapper.java @@ -27,27 +27,28 @@ import org.omg.CORBA.*; /** - * A convenience class to map the COS Naming exceptions to the JNDI exceptions. - */ + * A convenience class to map the COS Naming exceptions to the JNDI exceptions. + */ public final class ExceptionMapper { - private ExceptionMapper() {} // ensure no instance + private ExceptionMapper() { + } // ensure no instance + private static final boolean debug = false; - public static final NamingException mapException(Exception e, - CNCtx ctx, NameComponent[] inputName) throws NamingException { + public static final NamingException mapException(Exception e, CNCtx ctx, NameComponent[] inputName) throws NamingException { if (e instanceof NamingException) { - return (NamingException)e; + return (NamingException) e; } if (e instanceof RuntimeException) { - throw (RuntimeException)e; + throw (RuntimeException) e; } NamingException ne; if (e instanceof NotFound) { if (ctx.federation) { - return tryFed((NotFound)e, ctx, inputName); + return tryFed((NotFound) e, ctx, inputName); } else { ne = new NameNotFoundException(); @@ -63,15 +64,12 @@ public static final NamingException mapException(Exception e, // Don't' know if that is a good assumption, given // NotFound doesn't set rest as expected. -RL if (inputName != null && (inputName.length > rest.length)) { - NameComponent[] resolvedName = - new NameComponent[inputName.length - rest.length]; + NameComponent[] resolvedName = new NameComponent[inputName.length - rest.length]; System.arraycopy(inputName, 0, resolvedName, 0, resolvedName.length); // Wrap resolved NamingContext inside a CNCtx // Guess that its name (which is relative to ctx) // is the part of inputName minus rest_of_name - ne.setResolvedObj(new CNCtx(ctx._orb, ctx.orbTracker, nc, - ctx._env, - ctx.makeFullName(resolvedName))); + ne.setResolvedObj(new CNCtx(ctx._orb, ctx.orbTracker, nc, ctx._env, ctx.makeFullName(resolvedName))); } else { ne.setResolvedObj(ctx); } @@ -92,8 +90,7 @@ public static final NamingException mapException(Exception e, return ne; } - private static final NamingException tryFed(NotFound e, CNCtx ctx, - NameComponent[] inputName) throws NamingException { + private static final NamingException tryFed(NotFound e, CNCtx ctx, NameComponent[] inputName) throws NamingException { NameComponent[] rest = e.rest_of_name; if (debug) { @@ -107,10 +104,8 @@ private static final NamingException tryFed(NotFound e, CNCtx ctx, // If one of those is not found, you get "aa" as 'rest'. if (rest.length == 1 && inputName != null) { // Check that we're not talking to 1.2/1.3 Sun tnameserv - NameComponent lastIn = inputName[inputName.length-1]; - if (rest[0].id.equals(lastIn.id) && - rest[0].kind != null && - rest[0].kind.equals(lastIn.kind)) { + NameComponent lastIn = inputName[inputName.length - 1]; + if (rest[0].id.equals(lastIn.id) && rest[0].kind != null && rest[0].kind.equals(lastIn.kind)) { // Might be legit ; } else { @@ -138,7 +133,7 @@ private static final NamingException tryFed(NotFound e, CNCtx ctx, // No more remaining rest = null; } else { - NameComponent[] tmp = new NameComponent[rest.length-1]; + NameComponent[] tmp = new NameComponent[rest.length - 1]; System.arraycopy(rest, 1, tmp, 0, tmp.length); rest = tmp; } @@ -165,8 +160,7 @@ private static final NamingException tryFed(NotFound e, CNCtx ctx, } // Lookup resolved name to get resolved object - final java.lang.Object resolvedObj = - (resolvedName != null) ? ctx.callResolve(resolvedName) : ctx; + final java.lang.Object resolvedObj = (resolvedName != null) ? ctx.callResolve(resolvedName) : ctx; if (resolvedObj instanceof javax.naming.Context) { // obj is a context and child is not found @@ -176,8 +170,8 @@ private static final NamingException tryFed(NotFound e, CNCtx ctx, public java.lang.Object getContent() { return resolvedObj; } - private static final long serialVersionUID = - 669984699392133792L; + + private static final long serialVersionUID = 669984699392133792L; }; Reference ref = new Reference("java.lang.Object", addr); @@ -187,7 +181,7 @@ public java.lang.Object getContent() { cpe.setResolvedObj(ref); cpe.setAltName(cname); - cpe.setAltNameCtx((javax.naming.Context)resolvedObj); + cpe.setAltNameCtx((javax.naming.Context) resolvedObj); return cpe; } else { @@ -196,13 +190,11 @@ public java.lang.Object getContent() { Name cname = CNNameParser.cosNameToName(resolvedName); java.lang.Object resolvedObj2; try { - resolvedObj2 = NamingManager.getObjectInstance(resolvedObj, - cname, ctx, ctx._env); + resolvedObj2 = NamingManager.getObjectInstance(resolvedObj, cname, ctx, ctx._env); } catch (NamingException ge) { throw ge; } catch (Exception ge) { - NamingException ne = new NamingException( - "problem generating object using object factory"); + NamingException ne = new NamingException("problem generating object using object factory"); ne.setRootCause(ge); throw ne; } @@ -221,8 +213,8 @@ public java.lang.Object getContent() { public java.lang.Object getContent() { return rf2; } - private static final long serialVersionUID = - -785132553978269772L; + + private static final long serialVersionUID = -785132553978269772L; }; Reference ref = new Reference("java.lang.Object", addr); cpe.setResolvedObj(ref); diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/IiopUrl.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/IiopUrl.java index cda09113e..6e9ebeb17 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/IiopUrl.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/IiopUrl.java @@ -43,20 +43,21 @@ * string_name = stringified name | empty_string * * - * The default port is 9999. The default version is "1.0" - * US-ASCII alphanumeric characters are not escaped. Any characters outside - * of this range are escaped except for the following: + * The default port is 9999. The default version is "1.0" US-ASCII alphanumeric characters are not escaped. Any + * characters outside of this range are escaped except for the following: + * *
    {@code
      * ; / : ? : @ & = + $ , - _ . ! ~ *  ' ( )
      * }
    - * Escaped characters is escaped by using a % followed by its 2 hexadecimal - * numbers representing the octet. + * + * Escaped characters is escaped by using a % followed by its 2 hexadecimal numbers representing the octet. * - * For backward compatibility, the "iiop" URL as defined in INS 97-6-6 - * is also supported: + * For backward compatibility, the "iiop" URL as defined in INS 97-6-6 is also supported: + * *
    {@code
      * iiop url     = "iiop://" [host [":" port]] ["/" string_name]
      * }
    + * * The default port is 900. * */ @@ -73,8 +74,7 @@ public static class Address { public int major, minor; public String host; - public Address(String hostPortVers, boolean oldFormat) - throws MalformedURLException { + public Address(String hostPortVers, boolean oldFormat) throws MalformedURLException { // [version host [":" port]] int start; @@ -83,21 +83,19 @@ public Address(String hostPortVers, boolean oldFormat) if (oldFormat || (at = hostPortVers.indexOf('@')) < 0) { major = 1; minor = 0; - start = 0; // start at the beginning + start = 0; // start at the beginning } else { int dot = hostPortVers.indexOf('.'); if (dot < 0) { - throw new MalformedURLException( - "invalid version: " + hostPortVers); + throw new MalformedURLException("invalid version: " + hostPortVers); } try { major = Integer.parseInt(hostPortVers.substring(0, dot)); - minor = Integer.parseInt(hostPortVers.substring(dot+1, at)); + minor = Integer.parseInt(hostPortVers.substring(dot + 1, at)); } catch (NumberFormatException e) { - throw new MalformedURLException( - "Nonnumeric version: " + hostPortVers); + throw new MalformedURLException("Nonnumeric version: " + hostPortVers); } - start = at + 1; // skip '@' sign + start = at + 1; // skip '@' sign } // Parse host and port @@ -105,43 +103,37 @@ public Address(String hostPortVers, boolean oldFormat) if (slash < 0) { slash = hostPortVers.length(); } - if (hostPortVers.startsWith("[", start)) { // at IPv6 literal + if (hostPortVers.startsWith("[", start)) { // at IPv6 literal int brac = hostPortVers.indexOf(']', start + 1); if (brac < 0 || brac > slash) { - throw new IllegalArgumentException( - "IiopURL: name is an Invalid URL: " + hostPortVers); + throw new IllegalArgumentException("IiopURL: name is an Invalid URL: " + hostPortVers); } // include brackets host = hostPortVers.substring(start, brac + 1); start = brac + 1; - } else { // at hostname or IPv4 + } else { // at hostname or IPv4 int colon = hostPortVers.indexOf(':', start); - int hostEnd = (colon < 0 || colon > slash) - ? slash - : colon; + int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (start < hostEnd) { host = hostPortVers.substring(start, hostEnd); } - start = hostEnd; // skip past host + start = hostEnd; // skip past host } if ((start + 1 < slash)) { - if ( hostPortVers.startsWith(":", start)) { // parse port - start++; // skip past ":" - port = Integer.parseInt(hostPortVers. - substring(start, slash)); + if (hostPortVers.startsWith(":", start)) { // parse port + start++; // skip past ":" + port = Integer.parseInt(hostPortVers.substring(start, slash)); } else { - throw new IllegalArgumentException( - "IiopURL: name is an Invalid URL: " + hostPortVers); + throw new IllegalArgumentException("IiopURL: name is an Invalid URL: " + hostPortVers); } } start = slash; if ("".equals(host) || host == null) { - host = DEFAULT_HOST ; + host = DEFAULT_HOST; } if (port == -1) { - port = (oldFormat ? DEFAULT_IIOP_PORT : - DEFAULT_IIOPNAME_PORT); + port = (oldFormat ? DEFAULT_IIOP_PORT : DEFAULT_IIOPNAME_PORT); } } } @@ -151,8 +143,7 @@ public Vector
    getAddresses() { } /** - * Returns a possibly empty but non-null string that is the "string_name" - * portion of the URL. + * Returns a possibly empty but non-null string that is the "string_name" portion of the URL. */ public String getStringName() { return stringName; @@ -180,16 +171,14 @@ public IiopUrl(String url) throws MalformedURLException { addrEnd = url.length(); stringName = ""; } else { - stringName = CorbaUtils.decode(url.substring(addrEnd+1)); + stringName = CorbaUtils.decode(url.substring(addrEnd + 1)); } addresses = new Vector<>(3); if (oldFormat) { // Only one host:port part, not multiple - addresses.addElement( - new Address(url.substring(addrStart, addrEnd), oldFormat)); + addresses.addElement(new Address(url.substring(addrStart, addrEnd), oldFormat)); } else { - StringTokenizer tokens = - new StringTokenizer(url.substring(addrStart, addrEnd), ","); + StringTokenizer tokens = new StringTokenizer(url.substring(addrStart, addrEnd), ","); while (tokens.hasMoreTokens()) { addresses.addElement(new Address(tokens.nextToken(), oldFormat)); } @@ -200,21 +189,12 @@ public IiopUrl(String url) throws MalformedURLException { } // for testing only - /*public static void main(String[] args) { - try { - IiopUrl url = new IiopUrl(args[0]); - Vector addrs = url.getAddresses(); - String name = url.getStringName(); - - for (int i = 0; i < addrs.size(); i++) { - Address addr = (Address)addrs.elementAt(i); - System.out.println("host: " + addr.host); - System.out.println("port: " + addr.port); - System.out.println("version: " + addr.major + " " + addr.minor); - } - System.out.println("name: " + name); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } */ + /* + * public static void main(String[] args) { try { IiopUrl url = new IiopUrl(args[0]); Vector addrs = url.getAddresses(); + * String name = url.getStringName(); + * + * for (int i = 0; i < addrs.size(); i++) { Address addr = (Address)addrs.elementAt(i); System.out.println("host: " + + * addr.host); System.out.println("port: " + addr.port); System.out.println("version: " + addr.major + " " + + * addr.minor); } System.out.println("name: " + name); } catch (MalformedURLException e) { e.printStackTrace(); } } + */ } diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/OrbReuseTracker.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/OrbReuseTracker.java index fd16b8e5d..e60e86f1c 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/OrbReuseTracker.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/OrbReuseTracker.java @@ -21,10 +21,8 @@ import org.omg.CORBA.ORB; /** - * This class keeps track of references to the shared ORB object - * and destroys it when no more references are made to the ORB - * object. This object is created for each ORB object that CNCtx - * creates. + * This class keeps track of references to the shared ORB object and destroys it when no more references are made to the + * ORB object. This object is created for each ORB object that CNCtx creates. */ class OrbReuseTracker { @@ -37,21 +35,21 @@ class OrbReuseTracker { this.orb = orb; referenceCnt++; if (debug) { - System.out.println("New OrbReuseTracker created"); + System.out.println("New OrbReuseTracker created"); } } synchronized void incRefCount() { referenceCnt++; if (debug) { - System.out.println("Increment orb ref count to:" + referenceCnt); + System.out.println("Increment orb ref count to:" + referenceCnt); } } synchronized void decRefCount() { referenceCnt--; if (debug) { - System.out.println("Decrement orb ref count to:" + referenceCnt); + System.out.println("Decrement orb ref count to:" + referenceCnt); } if ((referenceCnt == 0)) { if (debug) { diff --git a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/RemoteToCorba.java b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/RemoteToCorba.java index 8bd013577..d0f88e747 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/cosnaming/RemoteToCorba.java +++ b/orbmain/src/main/java/org/glassfish/jndi/cosnaming/RemoteToCorba.java @@ -22,54 +22,50 @@ import javax.naming.spi.StateFactory; import java.util.Hashtable; - import java.rmi.Remote; -import org.glassfish.jndi.toolkit.corba.CorbaUtils; // for RMI-IIOP +import org.glassfish.jndi.toolkit.corba.CorbaUtils; // for RMI-IIOP /** - * StateFactory that turns java.rmi.Remote objects to org.omg.CORBA.Object. - * - */ + * StateFactory that turns java.rmi.Remote objects to org.omg.CORBA.Object. + * + */ public class RemoteToCorba implements StateFactory { public RemoteToCorba() { } /** - * Returns the CORBA object for a Remote object. - * If input is not a Remote object, or if Remote object uses JRMP, return null. - * If the RMI-IIOP library is not available, throw ConfigurationException. + * Returns the CORBA object for a Remote object. If input is not a Remote object, or if Remote object uses JRMP, return + * null. If the RMI-IIOP library is not available, throw ConfigurationException. * - * @param orig The object to turn into a CORBA object. If not Remote, - * or if is a JRMP stub or impl, return null. + * @param orig The object to turn into a CORBA object. If not Remote, or if is a JRMP stub or impl, return null. * @param name Ignored * @param ctx The non-null CNCtx whose ORB to use. * @param env Ignored * @return The CORBA object for {@code orig} or null. - * @exception ConfigurationException If the CORBA object cannot be obtained - * due to configuration problems, for instance, if RMI-IIOP not available. - * @exception NamingException If some other problem prevented a CORBA - * object from being obtained from the Remote object. + * @exception ConfigurationException If the CORBA object cannot be obtained due to configuration problems, for instance, + * if RMI-IIOP not available. + * @exception NamingException If some other problem prevented a CORBA object from being obtained from the Remote object. */ - public Object getStateToBind(Object orig, Name name, Context ctx, - Hashtable env) throws NamingException { - try { - if (orig instanceof org.omg.CORBA.Object) { - // Already a CORBA object, just use it - return null; - } + public Object getStateToBind(Object orig, Name name, Context ctx, Hashtable env) throws NamingException { + try { + if (orig instanceof org.omg.CORBA.Object) { + // Already a CORBA object, just use it + return null; + } - if (orig instanceof Remote) { - // Turn remote object into org.omg.CORBA.Object - // Returns null if JRMP; let next factory try - // CNCtx will eventually throw IllegalArgumentException if - // no CORBA object gotten - return CorbaUtils.remoteToCorba((Remote)orig, ((CNCtx)ctx)._orb); - } - }catch(Exception e){ - e.printStackTrace(); - }; + if (orig instanceof Remote) { + // Turn remote object into org.omg.CORBA.Object + // Returns null if JRMP; let next factory try + // CNCtx will eventually throw IllegalArgumentException if + // no CORBA object gotten + return CorbaUtils.remoteToCorba((Remote) orig, ((CNCtx) ctx)._orb); + } + } catch (Exception e) { + e.printStackTrace(); + } + ; return null; // pass and let next state factory try } } diff --git a/orbmain/src/main/java/org/glassfish/jndi/toolkit/corba/CorbaUtils.java b/orbmain/src/main/java/org/glassfish/jndi/toolkit/corba/CorbaUtils.java index 61e95ae56..820de3351 100644 --- a/orbmain/src/main/java/org/glassfish/jndi/toolkit/corba/CorbaUtils.java +++ b/orbmain/src/main/java/org/glassfish/jndi/toolkit/corba/CorbaUtils.java @@ -17,7 +17,6 @@ * Classpath-exception-2.0 */ - package org.glassfish.jndi.toolkit.corba; // Needed for RMI/IIOP @@ -41,98 +40,93 @@ import java.net.URLDecoder; /** - * Contains utilities for performing CORBA-related tasks: - * 1. Get the org.omg.CORBA.Object for a java.rmi.Remote object. - * 2. Create an ORB to use for a given host/port, and environment properties. - * ... - * - * @author Simon Nash - * @author Bryan Atsatt - */ + * Contains utilities for performing CORBA-related tasks: 1. Get the org.omg.CORBA.Object for a java.rmi.Remote object. + * 2. Create an ORB to use for a given host/port, and environment properties. ... + * + * @author Simon Nash + * @author Bryan Atsatt + */ public class CorbaUtils { /** - * Returns the CORBA object reference associated with a Remote - * object by using the javax.rmi.CORBA package. - *

    - * This method effective does the following: - *

    -      * java.lang.Object stub;
    -      * try {
    -      *     stub = PortableRemoteObject.toStub(remoteObj);
    -      * } catch (Exception e) {
    -      *     throw new ConfigurationException("Object not exported or not found");
    -      * }
    -      * if (!(stub instanceof javax.rmi.CORBA.Stub)) {
    -      *     return null; // JRMP impl or JRMP stub
    -      * }
    -      * try {
    -      *     ((javax.rmi.CORBA.Stub)stub).connect(orb);  // try to connect IIOP stub
    -      * } catch (RemoteException e) {
    -      *     // ignore 'already connected' error
    -      * }
    -      * return (javax.rmi.CORBA.Stub)stub;
    -      * 
    - * - * @param remoteObj The non-null remote object for - * @param orb The non-null ORB to connect the remote object to - * @return The CORBA Object for remoteObj; null if {@code remoteObj} - * is a JRMP implementation or JRMP stub. - * @exception ConfigurationException The CORBA Object cannot be obtained - * because of configuration problems. - */ - public static org.omg.CORBA.Object remoteToCorba(Remote remoteObj, ORB orb) - throws ConfigurationException { + * Returns the CORBA object reference associated with a Remote object by using the javax.rmi.CORBA package. + *

    + * This method effective does the following:

    + * + *
    +     * java.lang.Object stub;
    +     * try {
    +     *     stub = PortableRemoteObject.toStub(remoteObj);
    +     * } catch (Exception e) {
    +     *     throw new ConfigurationException("Object not exported or not found");
    +     * }
    +     * if (!(stub instanceof javax.rmi.CORBA.Stub)) {
    +     *     return null; // JRMP impl or JRMP stub
    +     * }
    +     * try {
    +     *     ((javax.rmi.CORBA.Stub) stub).connect(orb); // try to connect IIOP stub
    +     * } catch (RemoteException e) {
    +     *     // ignore 'already connected' error
    +     * }
    +     * return (javax.rmi.CORBA.Stub) stub;
    +     * 
    + * + *
    + * + * @param remoteObj The non-null remote object for + * @param orb The non-null ORB to connect the remote object to + * @return The CORBA Object for remoteObj; null if {@code remoteObj} is a JRMP implementation or JRMP stub. + * @exception ConfigurationException The CORBA Object cannot be obtained because of configuration problems. + */ + public static org.omg.CORBA.Object remoteToCorba(Remote remoteObj, ORB orb) throws ConfigurationException { // First, get remoteObj's stub - // javax.rmi.CORBA.Stub stub = PortableRemoteObject.toStub(remoteObj); + // javax.rmi.CORBA.Stub stub = PortableRemoteObject.toStub(remoteObj); - Remote stub; + Remote stub; - try { - stub = PortableRemoteObject.toStub(remoteObj); - } catch (Throwable t) { - ConfigurationException ce = new ConfigurationException( - "Problem with PortableRemoteObject.toStub(); object not exported or stub not found"); - ce.setRootCause(t); - throw ce; - } + try { + stub = PortableRemoteObject.toStub(remoteObj); + } catch (Throwable t) { + ConfigurationException ce = new ConfigurationException( + "Problem with PortableRemoteObject.toStub(); object not exported or stub not found"); + ce.setRootCause(t); + throw ce; + } // Next, make sure that the stub is javax.rmi.CORBA.Stub - if (!(stub instanceof Stub)) { - return null; // JRMP implementation or JRMP stub - } + if (!(stub instanceof Stub)) { + return null; // JRMP implementation or JRMP stub + } // Next, make sure that the stub is connected - try { - ((Stub) stub).connect(orb); - } catch (RemoteException e) { - // ignore RemoteException because stub might have already - // been connected - } catch (Throwable t) { - ConfigurationException ce = new ConfigurationException( - "Problem invoking javax.rmi.CORBA.Stub.connect()"); - ce.setRootCause(t); - throw ce; - } + try { + ((Stub) stub).connect(orb); + } catch (RemoteException e) { + // ignore RemoteException because stub might have already + // been connected + } catch (Throwable t) { + ConfigurationException ce = new ConfigurationException("Problem invoking javax.rmi.CORBA.Stub.connect()"); + ce.setRootCause(t); + throw ce; + } // Finally, return stub - return (org.omg.CORBA.Object)stub; + return (org.omg.CORBA.Object) stub; } /** * Get ORB using given server and port number, and properties from environment. * - * @param server Possibly null server; if null means use default; - * For applet, it is the applet host; for app, it is localhost. - * @param port Port number, -1 means default port - * @param env Possibly null environment. Contains environment properties. - * Could contain ORB itself; or applet used for initializing ORB. - * Use all String properties from env for initializing ORB + * @param server Possibly null server; if null means use default; For applet, it is the applet host; for app, it is + * localhost. + * @param port Port number, -1 means default port + * @param env Possibly null environment. Contains environment properties. Could contain ORB itself; or applet used for + * initializing ORB. Use all String properties from env for initializing ORB * @return A non-null ORB. */ - public static ORB getOrb(String server, int port, Hashtable env) { + public static ORB getOrb(String server, int port, Hashtable env) { // See if we can get info from environment Properties orbProp; @@ -146,7 +140,7 @@ public static ORB getOrb(String server, int port, Hashtable env) { Enumeration envProp; orbProp = new Properties(); for (envProp = env.keys(); envProp.hasMoreElements();) { - String key = (String)envProp.nextElement(); + String key = (String) envProp.nextElement(); Object val = env.get(key); if (val instanceof String) { orbProp.put(key, val); @@ -161,7 +155,7 @@ public static ORB getOrb(String server, int port, Hashtable env) { orbProp.put("org.omg.CORBA.ORBInitialHost", server); } if (port >= 0) { - orbProp.put("org.omg.CORBA.ORBInitialPort", ""+port); + orbProp.put("org.omg.CORBA.ORBInitialPort", "" + port); } // Get Applet from environment @@ -169,7 +163,7 @@ public static ORB getOrb(String server, int port, Hashtable env) { @SuppressWarnings("deprecation") Applet applet = (Applet) env.get(Context.APPLET); if (applet != null) { - // Create ORBs using applet and orbProp + // Create ORBs using applet and orbProp return ORB.init(applet, orbProp); } } @@ -192,14 +186,12 @@ public static final String decode(String s) throws MalformedURLException { /** * Decode a URI string (according to RFC 2396). * - * Three-character sequences '%xy', where 'xy' is the two-digit - * hexadecimal representation of the lower 8-bits of a character, - * are decoded into the character itself. + * Three-character sequences '%xy', where 'xy' is the two-digit hexadecimal representation of the lower 8-bits of a + * character, are decoded into the character itself. * * The string is subsequently converted using the specified encoding */ - public static final String decode(String s, String enc) - throws MalformedURLException, UnsupportedEncodingException { + public static final String decode(String s, String enc) throws MalformedURLException, UnsupportedEncodingException { try { return URLDecoder.decode(s, enc); } catch (IllegalArgumentException iae) { diff --git a/orbmain/src/test/java/com/sun/corba/ee/StandardClassesTest.java b/orbmain/src/test/java/com/sun/corba/ee/StandardClassesTest.java index c060d3f82..b105fa803 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/StandardClassesTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/StandardClassesTest.java @@ -27,77 +27,78 @@ import static com.sun.corba.ee.StandardClassesTest.StandardClassMatcher.isConcreteImplementationOf; import static org.hamcrest.MatcherAssert.assertThat; - public class StandardClassesTest { - private final static String LEGACY_UTIL_CLASS = "com.sun.corba.ee.impl.javax.rmi.CORBA.Util"; - private final static String LEGACY_STUB_CLASS = "com.sun.corba.ee.impl.javax.rmi.CORBA.StubDelegateImpl"; - private final static String LEGACY_PRO_CLASS = "com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject"; - private final static String LEGACY_ORB_CLASS = "com.sun.corba.ee.impl.orb.ORBImpl"; - private final static String LEGACY_SINGLETON = "com.sun.corba.ee.impl.orb.ORBSingleton"; - - @Test - public void orbSupportsLegacyUtilClass() { - assertThat(LEGACY_UTIL_CLASS, isConcreteImplementationOf(javax.rmi.CORBA.UtilDelegate.class)); - } - - @Test - public void orbSupportsLegacyStubClass() { - assertThat(LEGACY_STUB_CLASS, isConcreteImplementationOf(javax.rmi.CORBA.StubDelegate.class)); - } - - @Test - public void orbSupportsLegacyPortableRemoteObjectClass() { - assertThat(LEGACY_PRO_CLASS, isConcreteImplementationOf(javax.rmi.CORBA.PortableRemoteObjectDelegate.class)); - } - - @Test - public void orbSupportsLegacyORBClass() { - assertThat(LEGACY_ORB_CLASS, isConcreteImplementationOf(org.omg.CORBA_2_3.ORB.class)); - } - - @Test - public void orbSupportsLegacyORBSingletonClass() { - assertThat(LEGACY_SINGLETON, isConcreteImplementationOf(org.omg.CORBA_2_3.ORB.class)); - } - - static class StandardClassMatcher extends org.hamcrest.TypeSafeDiagnosingMatcher { - private Class requiredInterface; - - private StandardClassMatcher(Class requiredInterface) { - this.requiredInterface = requiredInterface; + private final static String LEGACY_UTIL_CLASS = "com.sun.corba.ee.impl.javax.rmi.CORBA.Util"; + private final static String LEGACY_STUB_CLASS = "com.sun.corba.ee.impl.javax.rmi.CORBA.StubDelegateImpl"; + private final static String LEGACY_PRO_CLASS = "com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject"; + private final static String LEGACY_ORB_CLASS = "com.sun.corba.ee.impl.orb.ORBImpl"; + private final static String LEGACY_SINGLETON = "com.sun.corba.ee.impl.orb.ORBSingleton"; + + @Test + public void orbSupportsLegacyUtilClass() { + assertThat(LEGACY_UTIL_CLASS, isConcreteImplementationOf(javax.rmi.CORBA.UtilDelegate.class)); } - public static StandardClassMatcher isConcreteImplementationOf(Class requiredInterface) { - return new StandardClassMatcher(requiredInterface); + @Test + public void orbSupportsLegacyStubClass() { + assertThat(LEGACY_STUB_CLASS, isConcreteImplementationOf(javax.rmi.CORBA.StubDelegate.class)); } - @Override - protected boolean matchesSafely(String className, Description description) { - try { - Class theClass = Class.forName(className); - return isConcrete(theClass, description) && hasRequiredInterface(theClass, description); - } catch (ClassNotFoundException e) { - description.appendText("is undefined class"); - return false; - } + @Test + public void orbSupportsLegacyPortableRemoteObjectClass() { + assertThat(LEGACY_PRO_CLASS, isConcreteImplementationOf(javax.rmi.CORBA.PortableRemoteObjectDelegate.class)); } - private boolean isConcrete(Class theClass, Description description) { - if (!Modifier.isAbstract(theClass.getModifiers())) return true; - description.appendText("is abstract class"); - return false; + @Test + public void orbSupportsLegacyORBClass() { + assertThat(LEGACY_ORB_CLASS, isConcreteImplementationOf(org.omg.CORBA_2_3.ORB.class)); } - private boolean hasRequiredInterface(Class theClass, Description description) { - if (requiredInterface.isAssignableFrom(theClass)) return true; - description.appendText("does not implement ").appendText(requiredInterface.getName()); - return false; + @Test + public void orbSupportsLegacyORBSingletonClass() { + assertThat(LEGACY_SINGLETON, isConcreteImplementationOf(org.omg.CORBA_2_3.ORB.class)); } - @Override - public void describeTo(Description description) { - description.appendText("concrete implementation of ").appendText(requiredInterface.getName()); + static class StandardClassMatcher extends org.hamcrest.TypeSafeDiagnosingMatcher { + private Class requiredInterface; + + private StandardClassMatcher(Class requiredInterface) { + this.requiredInterface = requiredInterface; + } + + public static StandardClassMatcher isConcreteImplementationOf(Class requiredInterface) { + return new StandardClassMatcher(requiredInterface); + } + + @Override + protected boolean matchesSafely(String className, Description description) { + try { + Class theClass = Class.forName(className); + return isConcrete(theClass, description) && hasRequiredInterface(theClass, description); + } catch (ClassNotFoundException e) { + description.appendText("is undefined class"); + return false; + } + } + + private boolean isConcrete(Class theClass, Description description) { + if (!Modifier.isAbstract(theClass.getModifiers())) + return true; + description.appendText("is abstract class"); + return false; + } + + private boolean hasRequiredInterface(Class theClass, Description description) { + if (requiredInterface.isAssignableFrom(theClass)) + return true; + description.appendText("does not implement ").appendText(requiredInterface.getName()); + return false; + } + + @Override + public void describeTo(Description description) { + description.appendText("concrete implementation of ").appendText(requiredInterface.getName()); + } } - } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/corba/AnyEqualityTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/corba/AnyEqualityTest.java index 4109b7bb0..0646a5469 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/corba/AnyEqualityTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/corba/AnyEqualityTest.java @@ -47,11 +47,12 @@ public void setUp() throws Exception { any = orb.create_any(); any1 = orb.create_any(); any2 = orb.create_any(); - } + } @After public void tearDown() throws Exception { - for (Memento memento : mementos) memento.revert(); + for (Memento memento : mementos) + memento.revert(); } @Test diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/corba/Enum1.java b/orbmain/src/test/java/com/sun/corba/ee/impl/corba/Enum1.java index 15a50df33..8ad68fff9 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/corba/Enum1.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/corba/Enum1.java @@ -20,18 +20,17 @@ package com.sun.corba.ee.impl.corba; public final class Enum1 implements org.omg.CORBA.portable.IDLEntity { - public static final int _zeroth = 0, - _first = 1, - _second = 2, - _third = 3; + public static final int _zeroth = 0, _first = 1, _second = 2, _third = 3; public static final Enum1 zeroth = new Enum1(_zeroth); public static final Enum1 first = new Enum1(_first); public static final Enum1 second = new Enum1(_second); public static final Enum1 third = new Enum1(_third); + public int value() { return _value; } - public static final Enum1 from_int(int i) throws org.omg.CORBA.BAD_PARAM { + + public static final Enum1 from_int(int i) throws org.omg.CORBA.BAD_PARAM { switch (i) { case _zeroth: return zeroth; @@ -45,8 +44,10 @@ public static final Enum1 from_int(int i) throws org.omg.CORBA.BAD_PARAM { throw new org.omg.CORBA.BAD_PARAM(); } } - private Enum1(int _value){ + + private Enum1(int _value) { this._value = _value; } + private int _value; } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/corba/Enum1Helper.java b/orbmain/src/test/java/com/sun/corba/ee/impl/corba/Enum1Helper.java index 4a0c1af7e..7ba7d4afb 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/corba/Enum1Helper.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/corba/Enum1Helper.java @@ -21,36 +21,38 @@ public class Enum1Helper { // It is useless to have instances of this class - private Enum1Helper() { } + private Enum1Helper() { + } - public static void write(org.omg.CORBA.portable.OutputStream out, Enum1 that) { + public static void write(org.omg.CORBA.portable.OutputStream out, Enum1 that) { out.write_long(that.value()); } - public static Enum1 read(org.omg.CORBA.portable.InputStream in) { + + public static Enum1 read(org.omg.CORBA.portable.InputStream in) { return Enum1.from_int(in.read_long()); } + public static Enum1 extract(org.omg.CORBA.Any a) { org.omg.CORBA.portable.InputStream in = a.create_input_stream(); return read(in); } + public static void insert(org.omg.CORBA.Any a, Enum1 that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); write(out, that); a.read_value(out.create_input_stream(), type()); } + private static org.omg.CORBA.TypeCode _tc; private static final int _memberCount = 4; - private static String[] _members = { - "zeroth", - "first", - "second", - "third" - }; + private static String[] _members = { "zeroth", "first", "second", "third" }; + synchronized public static org.omg.CORBA.TypeCode type() { if (_tc == null) _tc = org.omg.CORBA.ORB.init().create_enum_tc(id(), "enum1", _members); return _tc; } + public static String id() { return "IDL:anytest/enum1:1.0"; } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/corba/javax/TestTransactionRemoteException.java b/orbmain/src/test/java/com/sun/corba/ee/impl/corba/javax/TestTransactionRemoteException.java index 2719a9d37..fdad63d35 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/corba/javax/TestTransactionRemoteException.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/corba/javax/TestTransactionRemoteException.java @@ -34,25 +34,25 @@ * @author steve */ public class TestTransactionRemoteException { - + @Test public void canLoadTransactionException() { - + SystemException se = new TRANSACTION_ROLLEDBACK(); RemoteException re = Util.mapSystemException(se); assertTrue(re.getClass().getName().endsWith("TransactionRolledbackException")); assertTrue(re.getCause().equals(se)); - + se = new TRANSACTION_REQUIRED(); re = Util.mapSystemException(se); assertTrue(re.getClass().getName().endsWith("TransactionRequiredException")); - assertTrue(re.getCause().equals(se)); - + assertTrue(re.getCause().equals(se)); + se = new INVALID_TRANSACTION(); re = Util.mapSystemException(se); assertTrue(re.getClass().getName().endsWith("InvalidTransactionException")); - assertTrue(re.getCause().equals(se)); - + assertTrue(re.getCause().equals(se)); + } - + } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/AllTypesFields.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/AllTypesFields.java index a8ee92daa..625738f21 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/AllTypesFields.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/AllTypesFields.java @@ -27,124 +27,118 @@ import java.io.Serializable; class AllTypesFields implements Serializable { - private boolean aBooleanField; - private byte aByteField; - private char aCharField; - private short aShortField; - private int anIntField; - private long aLongField; - private float aFloatField; - private double aDoubleField; - private String aStringField; - - private static final ObjectStreamField[] serialPersistentFields = { - new ObjectStreamField("aBoolean", boolean.class), - new ObjectStreamField("aByte", byte.class), - new ObjectStreamField("aChar", char.class), - new ObjectStreamField("aShort", short.class), - new ObjectStreamField("anInt", int.class), - new ObjectStreamField("aLong", long.class), - new ObjectStreamField("aFloat", float.class), - new ObjectStreamField("aDouble", double.class), - new ObjectStreamField("aString", String.class) - }; - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - final ObjectInputStream.GetField fields = in.readFields(); - aBooleanField = fields.get("aBoolean", false); - aByteField = fields.get("aByte", (byte) 0xff); - aCharField = fields.get("aChar", 'z'); - aShortField = fields.get("aShort", Short.MIN_VALUE); - anIntField = fields.get("anInt", Integer.MIN_VALUE); - aLongField = fields.get("aLong", Long.MIN_VALUE); - aFloatField = fields.get("aFloat", Float.MIN_VALUE); - aDoubleField = fields.get("aDouble", Double.MIN_VALUE); - aStringField = (String) fields.get("aString", "nothing here"); - } - - private void writeObject(ObjectOutputStream out) throws IOException { - final ObjectOutputStream.PutField fields = out.putFields(); - fields.put("aBoolean", aBooleanField); - fields.put("aByte", aByteField); - fields.put("aChar", aCharField); - fields.put("aShort", aShortField); - fields.put("anInt", anIntField); - fields.put("aLong", aLongField); - fields.put("aFloat", aFloatField); - fields.put("aDouble", aDoubleField); - fields.put("aString", aStringField); - out.writeFields(); - } - - boolean getBooleanField() { - return aBooleanField; - } - - void setBooleanField(boolean aBooleanField) { - this.aBooleanField = aBooleanField; - } - - byte getByteField() { - return aByteField; - } - - void setByteField(byte aByteField) { - this.aByteField = aByteField; - } - - char getCharField() { - return aCharField; - } - - void setCharField(char aCharField) { - this.aCharField = aCharField; - } - - short getShortField() { - return aShortField; - } - - void setShortField(short aShortField) { - this.aShortField = aShortField; - } - - int getIntField() { - return anIntField; - } - - void setIntField(int anIntField) { - this.anIntField = anIntField; - } - - long getLongField() { - return aLongField; - } - - void setLongField(long aLongField) { - this.aLongField = aLongField; - } - - float getFloatField() { - return aFloatField; - } - - void setFloatField(float aFloatField) { - this.aFloatField = aFloatField; - } - - double getDoubleField() { - return aDoubleField; - } - - void setDoubleField(double aDoubleField) { - this.aDoubleField = aDoubleField; - } - - String getStringField() { - return aStringField; - } - - void setStringField(String aStringField) { - this.aStringField = aStringField; - } + private boolean aBooleanField; + private byte aByteField; + private char aCharField; + private short aShortField; + private int anIntField; + private long aLongField; + private float aFloatField; + private double aDoubleField; + private String aStringField; + + private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("aBoolean", boolean.class), + new ObjectStreamField("aByte", byte.class), new ObjectStreamField("aChar", char.class), + new ObjectStreamField("aShort", short.class), new ObjectStreamField("anInt", int.class), + new ObjectStreamField("aLong", long.class), new ObjectStreamField("aFloat", float.class), + new ObjectStreamField("aDouble", double.class), new ObjectStreamField("aString", String.class) }; + + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { + final ObjectInputStream.GetField fields = in.readFields(); + aBooleanField = fields.get("aBoolean", false); + aByteField = fields.get("aByte", (byte) 0xff); + aCharField = fields.get("aChar", 'z'); + aShortField = fields.get("aShort", Short.MIN_VALUE); + anIntField = fields.get("anInt", Integer.MIN_VALUE); + aLongField = fields.get("aLong", Long.MIN_VALUE); + aFloatField = fields.get("aFloat", Float.MIN_VALUE); + aDoubleField = fields.get("aDouble", Double.MIN_VALUE); + aStringField = (String) fields.get("aString", "nothing here"); + } + + private void writeObject(ObjectOutputStream out) throws IOException { + final ObjectOutputStream.PutField fields = out.putFields(); + fields.put("aBoolean", aBooleanField); + fields.put("aByte", aByteField); + fields.put("aChar", aCharField); + fields.put("aShort", aShortField); + fields.put("anInt", anIntField); + fields.put("aLong", aLongField); + fields.put("aFloat", aFloatField); + fields.put("aDouble", aDoubleField); + fields.put("aString", aStringField); + out.writeFields(); + } + + boolean getBooleanField() { + return aBooleanField; + } + + void setBooleanField(boolean aBooleanField) { + this.aBooleanField = aBooleanField; + } + + byte getByteField() { + return aByteField; + } + + void setByteField(byte aByteField) { + this.aByteField = aByteField; + } + + char getCharField() { + return aCharField; + } + + void setCharField(char aCharField) { + this.aCharField = aCharField; + } + + short getShortField() { + return aShortField; + } + + void setShortField(short aShortField) { + this.aShortField = aShortField; + } + + int getIntField() { + return anIntField; + } + + void setIntField(int anIntField) { + this.anIntField = anIntField; + } + + long getLongField() { + return aLongField; + } + + void setLongField(long aLongField) { + this.aLongField = aLongField; + } + + float getFloatField() { + return aFloatField; + } + + void setFloatField(float aFloatField) { + this.aFloatField = aFloatField; + } + + double getDoubleField() { + return aDoubleField; + } + + void setDoubleField(double aDoubleField) { + this.aDoubleField = aDoubleField; + } + + String getStringField() { + return aStringField; + } + + void setStringField(String aStringField) { + this.aStringField = aStringField; + } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRInputTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRInputTest.java index 8f4ea2ac7..7d6d4d716 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRInputTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRInputTest.java @@ -126,13 +126,8 @@ public void whenCDRInputObjectCreated_canReadOctet() throws IOException { @Test public void can_read_integers() { - setMessageBody(0x04, pad(), /* short*/ FF, (byte) 0xf2, - /* short */ 0x00, 0x03, - pad(), pad(), - /* long1 */ 0, 1, 2, (byte) 0x83, - /* long2 */ FF, FF, (byte) 0xfd, 0x71, - pad(), pad(), pad(), pad(), - /* long long */ 0, 0, 1, 0, 0, (byte) 0x80, 1, 7, + setMessageBody(0x04, pad(), /* short */ FF, (byte) 0xf2, /* short */ 0x00, 0x03, pad(), pad(), /* long1 */ 0, 1, 2, (byte) 0x83, + /* long2 */ FF, FF, (byte) 0xfd, 0x71, pad(), pad(), pad(), pad(), /* long long */ 0, 0, 1, 0, 0, (byte) 0x80, 1, 7, /* long long */ 0, 0, 1, 0, 0, 0, 1, 2); assertEquals("Octet value", 4, getInputObject().read_octet()); @@ -146,14 +141,8 @@ public void can_read_integers() { @Test public void can_read_little_endian_integers() { - setMessageBody(0x04, pad(), - /* short*/ 0xf2, FF, - /* ushort */ 0x03, 0x00, - /* for long */ pad(), pad(), - /* long */ 0x83, 2, 1, 0, - /* ulong */ 0x71, 0xfd, FF, FF, - /* for long_long */ pad(), pad(), pad(), pad(), - /* long long */ 7, 1, 0x80, 0, 0, 1, 0, 0); + setMessageBody(0x04, pad(), /* short */ 0xf2, FF, /* ushort */ 0x03, 0x00, /* for long */ pad(), pad(), /* long */ 0x83, 2, 1, 0, + /* ulong */ 0x71, 0xfd, FF, FF, /* for long_long */ pad(), pad(), pad(), pad(), /* long long */ 7, 1, 0x80, 0, 0, 1, 0, 0); useLittleEndian(); assertEquals("Octet value", 4, getInputObject().read_octet()); @@ -166,8 +155,7 @@ public void can_read_little_endian_integers() { @Test public void can_read_floats() { - setMessageBody(0x3f, 0x80, 0, 0, - 0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55); + setMessageBody(0x3f, 0x80, 0, 0, 0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55); assertEquals("Float", 1, getInputObject().read_float(), 0.001); assertEquals("Double", 0.33333, getInputObject().read_double(), 0.001); @@ -175,25 +163,22 @@ public void can_read_floats() { @Test public void can_read_float_arrays() { - setMessageBody(0x3f, 0x80, 0, 0, - 0x46, 0x40, 0xE4, 0x7E); + setMessageBody(0x3f, 0x80, 0, 0, 0x46, 0x40, 0xE4, 0x7E); float[] actual = new float[2]; getInputObject().read_float_array(actual, 0, 2); - assertEquals("Float 1", 1, actual[0], 0.001); + assertEquals("Float 1", 1, actual[0], 0.001); assertEquals("Float 2", 12345.12346f, actual[1], 0.001); } @Test public void can_read_double_arrays() { - setMessageBody(pad(), pad(), pad(), pad(), - 0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x40, 0, 0, 0, 0, 0, 0, 0); + setMessageBody(pad(), pad(), pad(), pad(), 0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x40, 0, 0, 0, 0, 0, 0, 0); double[] actual = new double[2]; getInputObject().read_double_array(actual, 0, 2); assertEquals("Double 1", 0.33333, actual[0], 0.001); - assertEquals("Double 2", 2, actual[1], 0.001); + assertEquals("Double 2", 2, actual[1], 0.001); } @Test @@ -231,7 +216,7 @@ public void canReadStringFromOldOrbAcrossFragment() { public void canReadStringFromOldOrbWithTerminatorInNextFragment() { useV1_1(); setOrbVersion(ORBVersionFactory.getOLD()); - setMessageBody(0, 0, 0, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' ); + setMessageBody(0, 0, 0, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'); addFragment(0, 'x'); assertEquals("abcdefgh", getInputObject().read_string()); assertEquals('x', getInputObject().read_char()); @@ -240,8 +225,7 @@ public void canReadStringFromOldOrbWithTerminatorInNextFragment() { @Test(expected = MARSHAL.class) public void whenUsingV1_0_cannotReadWCharString() { useV1_0(); - int[] data = {0, 0, 0, 22, FE, FF, - 0, 'T', 0, 'h', 0, 'i', 0, 's', 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!'}; + int[] data = { 0, 0, 0, 22, FE, FF, 0, 'T', 0, 'h', 0, 'i', 0, 's', 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!' }; setMessageBody(data); assertEquals("Wide string value", "This, too!", getInputObject().read_wstring()); } @@ -249,12 +233,8 @@ public void whenUsingV1_0_cannotReadWCharString() { @Test public void whenUsingV1_1_canReadCharAndWCharStrings() { useV1_1(); - int[] data = {0, 0, 0, 11, 't', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'k', 's', 0, - pad(), - 0, 0, 0, 11, - 0, 'T', 0, 'h', 0, 'i', 0, 's', 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!', - 0, 0, - pad(), pad(), 0, 0, 0, 0}; + int[] data = { 0, 0, 0, 11, 't', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'k', 's', 0, pad(), 0, 0, 0, 11, 0, 'T', 0, 'h', 0, 'i', 0, 's', + 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!', 0, 0, pad(), pad(), 0, 0, 0, 0 }; setMessageBody(data); assertEquals("String value", "this works", getInputObject().read_string()); @@ -266,11 +246,8 @@ public void whenUsingV1_1_canReadCharAndWCharStrings() { @Test public void whenUsingV1_2_canReadCharAndWCharStrings() { useV1_2(); - int[] data = {0, 0, 0, 11, 't', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'k', 's', 0, - pad(), - 0, 0, 0, 22, FE, FF, - 0, 'T', 0, 'h', 0, 'i', 0, 's', 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!', - pad(), pad(), 0, 0, 0, 0}; + int[] data = { 0, 0, 0, 11, 't', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'k', 's', 0, pad(), 0, 0, 0, 22, FE, FF, 0, 'T', 0, 'h', 0, 'i', + 0, 's', 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!', pad(), pad(), 0, 0, 0, 0 }; setMessageBody(data); assertEquals("String value", "this works", getInputObject().read_string()); @@ -280,8 +257,8 @@ public void whenUsingV1_2_canReadCharAndWCharStrings() { @Test public void can_read_boolean_array() throws Exception { - final int[] data = {1, FF, 0, 7, 0}; - final boolean[] expected = {true, true, false, true, false}; + final int[] data = { 1, FF, 0, 7, 0 }; + final boolean[] expected = { true, true, false, true, false }; setMessageBody(data); readAndVerifyBooleanArray(expected); } @@ -298,8 +275,8 @@ private void readAndVerifyBooleanArray(boolean[] expected) { @Test public void can_read_octet_array() throws Exception { - final int[] data = {0, 1, 2, 3, -1, -1}; - final byte[] expected = {0, 1, 2, 3, -1, -1}; + final int[] data = { 0, 1, 2, 3, -1, -1 }; + final byte[] expected = { 0, 1, 2, 3, -1, -1 }; setMessageBody(data); readAndVerifyOctetArray(expected); } @@ -307,8 +284,8 @@ public void can_read_octet_array() throws Exception { @Test public void can_read_octet_array_acrossFragments() throws Exception { useV1_2(); - final int[] data = {0, 1, 2, 3}; - final byte[] expected = {0, 1, 2, 3, -1, -1}; + final int[] data = { 0, 1, 2, 3 }; + final byte[] expected = { 0, 1, 2, 3, -1, -1 }; setMessageBody(data); addFragment(-1, -1); readAndVerifyOctetArray(expected); @@ -321,11 +298,10 @@ private void readAndVerifyOctetArray(byte[] expected) { assertArrayEquals("Octet array", expected, actual); } - @Test public void can_read_short_array() throws Exception { - final int[] data = {0, 1, 2, 3, -1, -1}; - final short[] expected = {1, 515, -1}; + final int[] data = { 0, 1, 2, 3, -1, -1 }; + final short[] expected = { 1, 515, -1 }; setMessageBody(data); readAndVerifyShortArray(expected); } @@ -337,11 +313,10 @@ private void readAndVerifyShortArray(short[] expected) { assertArrayEquals(expected, actual); } - @Test public void can_read_ushort_array() throws Exception { - final int[] data = {0, 1, 2, 3}; - final short[] expected = {1, 515}; + final int[] data = { 0, 1, 2, 3 }; + final short[] expected = { 1, 515 }; setMessageBody(data); readAndVerifyUshortArray(expected); } @@ -353,11 +328,10 @@ private void readAndVerifyUshortArray(short[] expected) { assertArrayEquals(expected, actual); } - @Test public void can_read_long_array() throws Exception { - final int[] data = {0, 1, 2, 3, -1, -1, -3, 30}; - final int[] expected = {66051, -738}; + final int[] data = { 0, 1, 2, 3, -1, -1, -3, 30 }; + final int[] expected = { 66051, -738 }; setMessageBody(data); readAndVerifyLongArray(expected); } @@ -369,11 +343,10 @@ private void readAndVerifyLongArray(int[] expected) { assertArrayEquals(expected, actual); } - @Test public void can_read_ulong_array() throws Exception { - final int[] data = {0, 1, 2, 3, -1, -1, -3, 30}; - final int[] expected = {66051, -738}; + final int[] data = { 0, 1, 2, 3, -1, -1, -3, 30 }; + final int[] expected = { 66051, -738 }; setMessageBody(data); readAndVerifyULongArray(expected); } @@ -388,8 +361,8 @@ private void readAndVerifyULongArray(int[] expected) { @Test public void can_read_longlong_array() throws Exception { - final int[] data = {pad(), pad(), pad(), pad(), 0, 0, 1, 0, 0, 0, 1, 7, -1, -1, -1, -1, -1, -1, -3, -20}; - final long[] expected = {1099511628039L, -532}; + final int[] data = { pad(), pad(), pad(), pad(), 0, 0, 1, 0, 0, 0, 1, 7, -1, -1, -1, -1, -1, -1, -3, -20 }; + final long[] expected = { 1099511628039L, -532 }; setMessageBody(data); readAndVerifyLongLongArray(expected); @@ -405,8 +378,8 @@ private void readAndVerifyLongLongArray(long[] expected) { @Test public void can_read_ulonglong_array() throws Exception { - final int[] data = {pad(), pad(), pad(), pad(), 0, 0, 1, 0, 0, 0, 1, 7, FF, FF, FF, FF, FF, FF, -3, -20}; - final long[] expected = {1099511628039L, -532}; + final int[] data = { pad(), pad(), pad(), pad(), 0, 0, 1, 0, 0, 0, 1, 7, FF, FF, FF, FF, FF, FF, -3, -20 }; + final long[] expected = { 1099511628039L, -532 }; setMessageBody(data); readAndVerifyULongLongArray(expected); } @@ -423,8 +396,8 @@ private void readAndVerifyULongLongArray(long[] expected) { @Test public void can_read_char_array() throws Exception { - final int[] data = {'b', 'u', 'c', 'k', 'l', 'e', 'u', 'p'}; - final char[] expected = {'b', 'u', 'c', 'k', 'l', 'e', 'u', 'p'}; + final int[] data = { 'b', 'u', 'c', 'k', 'l', 'e', 'u', 'p' }; + final char[] expected = { 'b', 'u', 'c', 'k', 'l', 'e', 'u', 'p' }; setMessageBody(data); readAndVerifyCharArray(expected); } @@ -440,8 +413,8 @@ private void readAndVerifyCharArray(char[] expected) { @Test public void can_read_wchar_array() throws Exception { useV1_2(); - final int[] data = {4, FE, FF, 0, 'b', 4, FE, FF, 0, 'u', 4, FF, FE, 't', 0}; - final char[] expected = {'b', 'u', 't'}; + final int[] data = { 4, FE, FF, 0, 'b', 4, FE, FF, 0, 'u', 4, FF, FE, 't', 0 }; + final char[] expected = { 'b', 'u', 't' }; setMessageBody(data); readAndVerifyWCharArray(expected); } @@ -464,9 +437,7 @@ public void whenUsingV1_0_throwExceptionOnUnexpectedEndOfData() { @Test public void whenUsingV1_2_headerPaddingForces8ByteAlignmentOnce() { useV1_2(); - setMessageBody(pad(), pad(), pad(), pad(), - 0, 0, 1, 0, - FF, FF, FF, FF); + setMessageBody(pad(), pad(), pad(), pad(), 0, 0, 1, 0, FF, FF, FF, FF); getInputObject().setHeaderPadding(true); assertEquals(256, getInputObject().read_long()); @@ -574,6 +545,7 @@ public void whenUsingV1_2_interruptedThreadDoesNotCauseTimeout() { whileWaitingForFragmentsDo(new AsynchronousAction() { int iteration = 0; + public void exec() { if (iteration++ == 0) Thread.currentThread().interrupt(); @@ -604,14 +576,14 @@ public void exec() { @Test public void whenTypeCodeHasNoBody_readKindOnly() { - setMessageBody( 0, 0, 0, 6); + setMessageBody(0, 0, 0, 6); TypeCode typeCode = getInputObject().read_TypeCode(); assertEquals(TCKind.tk_float, typeCode.kind()); } @Test public void whenTypeCodeIsString_readLength() throws BadKind { - setMessageBody( 0, 0, 0, 18, 0, 0, 1, 0); + setMessageBody(0, 0, 0, 18, 0, 0, 1, 0); TypeCode typeCode = getInputObject().read_TypeCode(); assertEquals(TCKind.tk_string, typeCode.kind()); assertEquals(256, typeCode.length()); @@ -619,7 +591,7 @@ public void whenTypeCodeIsString_readLength() throws BadKind { @Test public void whenTypeCodeIsFixed_readDigitsAndScale() throws BadKind { - setMessageBody( 0, 0, 0, 28, 0, 10, 0, 6); + setMessageBody(0, 0, 0, 28, 0, 10, 0, 6); TypeCode typeCode = getInputObject().read_TypeCode(); assertEquals(TCKind.tk_fixed, typeCode.kind()); assertEquals(10, typeCode.fixed_digits()); diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRInputValueTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRInputValueTest.java index d528aa276..a0bcb0852 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRInputValueTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRInputValueTest.java @@ -43,7 +43,6 @@ public class CDRInputValueTest extends ValueTestBase { - @Test public void canReadStringValue() throws IOException { writeValueTag(ONE_REPID_ID); @@ -118,7 +117,7 @@ public void canReadSerializedEnum() throws IOException { writeString(Enum1.strange.toString()); Enum1 enum1 = readValueFromGeneratedBody(Enum1.class); - assertEquals( Enum1.strange, enum1); + assertEquals(Enum1.strange, enum1); } @Test @@ -126,7 +125,7 @@ public void canReadEnumArray() throws IOException { writeValueTag(ONE_REPID_ID); writeRepId(RepositoryId.createForJavaType(Enum1[].class)); - writeInt(3); // array size + writeInt(3); // array size writeValueTag(ONE_REPID_ID); int repIdLocation = getCurrentLocation(); writeRepId(RepositoryId.createForJavaType(Enum1.class)); @@ -166,7 +165,7 @@ public void canReadSerializedValueWithIndirection() throws IOException { writeInt(3); writeIndirectionTo(location); - setMessageBody( getGeneratedBody() ); + setMessageBody(getGeneratedBody()); Object object1 = getInputObject().read_value(); Object object2 = getInputObject().read_value(); @@ -184,7 +183,7 @@ public void canReadSerializedValueWithIndirection_in1_1() throws IOException { writeInt(3); writeIndirectionTo(location); - setMessageBody( getGeneratedBody() ); + setMessageBody(getGeneratedBody()); Object object1 = getInputObject().read_value(); Object object2 = getInputObject().read_value(); @@ -204,12 +203,12 @@ public void canReadSerializedValueWithIndirection_in1_0() throws IOException { writeInt(3); writeIndirectionTo(location); - setMessageBody( getGeneratedBody() ); + setMessageBody(getGeneratedBody()); Object object1 = getInputObject().read_value(); Object object2 = getInputObject().read_value(); assertSame(object1, object2); - assertEquals( 'x', ((Value1) object1).aChar); + assertEquals('x', ((Value1) object1).aChar); } @Test @@ -265,7 +264,7 @@ public void canReadSerializedValueWithNestedValue() throws IOException { writeEndTag(-1); Value2 value2 = readValueFromGeneratedBody(Value2.class); - assertEquals(750,value2.aLong); + assertEquals(750, value2.aLong); assertEquals('x', value2.aValue.aChar); assertEquals(3, value2.aValue.anInt); } @@ -309,7 +308,7 @@ public void whenTalkingtoLegacyORBAndEndTagTooSmall_ignoreIt() throws IOExceptio writeEndTag(-1); Value2 value2 = readValueFromGeneratedBody(Value2.class); - assertEquals(750,value2.aLong); + assertEquals(750, value2.aLong); assertEquals('x', value2.aValue.aChar); assertEquals(3, value2.aValue.anInt); } @@ -322,7 +321,7 @@ public void canReadSerializedValueUsingDefaultFactory() throws IOException { writeWchar_1_2('x'); - setMessageBody( getGeneratedBody() ); + setMessageBody(getGeneratedBody()); Object object = getInputObject().read_value(Value1.REPID); assertTrue(object instanceof Value1); @@ -334,7 +333,7 @@ public void canReadSerializedValueUsingDefaultFactory() throws IOException { @Test public void canReadNullValueUsingDefaultFactory() throws IOException { writeNull(); - setMessageBody( getGeneratedBody() ); + setMessageBody(getGeneratedBody()); assertNull(getInputObject().read_value(Value1.REPID)); } @@ -342,7 +341,7 @@ public void canReadNullValueUsingDefaultFactory() throws IOException { @Test(expected = IndirectionException.class) public void whenIndirectionHasNoAntecedent_throwExceptionWhenUsingRepId() throws IOException { writeIndirectionTo(0); - setMessageBody( getGeneratedBody() ); + setMessageBody(getGeneratedBody()); getInputObject().read_value(Value1.REPID); } @@ -359,19 +358,18 @@ public void canReadSerializedValueUsingDefaultFactoryAndIndirection() throws IOE writeIndirectionTo(location); - setMessageBody( getGeneratedBody() ); + setMessageBody(getGeneratedBody()); Object object1 = getInputObject().read_value(Value1.REPID); Object object2 = getInputObject().read_value(Value1.REPID); assertSame(object1, object2); } - @Test public void whenObjectImplementsReadResolve_resultingValueMatchesOriginal() throws Exception { writeValueTag(ONE_REPID_ID); writeRepId(Gender.REPID); - writeInt(0); // the serialized form of the MALE constant, produced by writeReplace + writeInt(0); // the serialized form of the MALE constant, produced by writeReplace setMessageBody(getGeneratedBody()); assertThat(getInputObject().read_value(), sameInstance(Gender.MALE)); @@ -381,16 +379,16 @@ public void whenObjectImplementsReadResolve_resultingValueMatchesOriginal() thro public void whenInaccessibleObjectImplementsReadResolve_resultingValueEqualToOriginal() throws Exception { String InetAddressRepId = "RMI:java.net.InetAddress:C156A93A2ABC4FAF:2D9B57AF9FE3EBDB"; - writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk + writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk writeRepId(InetAddressRepId); startChunk(); writeInt(0x01010000); - writeInt(0x7F000001); // 127.0.0.1 + writeInt(0x7F000001); // 127.0.0.1 writeInt(0x00000002); endChunk(); - writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk + writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk writeRepId("IDL:omg.org/CORBA/WStringValue:1.0"); startChunk(); writeStringValue_1_2("localhost"); @@ -404,7 +402,7 @@ public void whenInaccessibleObjectImplementsReadResolve_resultingValueEqualToOri @Test public void whenObjectExternalizable_callReadExternal() throws Exception { - writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk + writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk writeRepId(Profession.REPID); startChunk(); @@ -439,7 +437,6 @@ public void readJDK11DateInstance() throws IOException { Date date = readDateInstance(true); assertThat(date.getTime(), equalTo(MSEC)); } - private Date readDateInstance(boolean defaultWriteObjectCalled) throws IOException { useStreamFormatVersion2(); @@ -472,9 +469,9 @@ public void canReadDerivedValueUsingDefaultMarshalling() throws IOException { writeWchar_1_2('x'); writeInt(3); - writeByte(0x34); // Note that default serialization expects - writeShort((short) 24); // the primitive fields to be written - writeByte(1); // in alphabetical order + writeByte(0x34); // Note that default serialization expects + writeShort((short) 24); // the primitive fields to be written + writeByte(1); // in alphabetical order DerivedValue value = readValueFromGeneratedBody(DerivedValue.class); @@ -493,14 +490,13 @@ public void canReadValueWithCustomMarshaling() throws IOException { writeValueTag(ONE_REPID_ID); writeRepId(CUSTOM_VALUE_REPID); startCustomMarshalingFormat(true); - writeDouble(12.34); // Note that default serialization - writeFloat(127.0F); // expects the primitive fields to be written - writeValueTag(ONE_REPID_ID); // in alphabetical order, followed by the object fields + writeDouble(12.34); // Note that default serialization + writeFloat(127.0F); // expects the primitive fields to be written + writeValueTag(ONE_REPID_ID); // in alphabetical order, followed by the object fields writeRepId(Value1.REPID); writeWchar_1_2('x'); writeInt(3); - writeDouble(12.0); CustomMarshalledValue value = readValueFromGeneratedBody(CustomMarshalledValue.class); @@ -514,28 +510,28 @@ public void canReadValueWithCustomMarshaling() throws IOException { @Test public void canReadValueWithCustomWriteMarshaling() throws IOException { - useStreamFormatVersion1(); - writeValueTag(ONE_REPID_ID); - writeRepId(RepositoryId.createForJavaType(CustomWriteClass.class)); - startCustomMarshalingFormat(true); - writeInt(73); + useStreamFormatVersion1(); + writeValueTag(ONE_REPID_ID); + writeRepId(RepositoryId.createForJavaType(CustomWriteClass.class)); + startCustomMarshalingFormat(true); + writeInt(73); - CustomWriteClass value = readValueFromGeneratedBody(CustomWriteClass.class); + CustomWriteClass value = readValueFromGeneratedBody(CustomWriteClass.class); - assertEquals(73, value.aPositiveValue); + assertEquals(73, value.aPositiveValue); } @Test public void canReadValueWithCustomReadMarshaling() throws IOException { - useStreamFormatVersion1(); - writeValueTag(ONE_REPID_ID); - writeRepId(RepositoryId.createForJavaType(CustomReadClass.class)); - startCustomMarshalingFormat(false); - writeInt(-73); + useStreamFormatVersion1(); + writeValueTag(ONE_REPID_ID); + writeRepId(RepositoryId.createForJavaType(CustomReadClass.class)); + startCustomMarshalingFormat(false); + writeInt(-73); - CustomReadClass value = readValueFromGeneratedBody(CustomReadClass.class); + CustomReadClass value = readValueFromGeneratedBody(CustomReadClass.class); - assertEquals(1, value.aPositiveValue); + assertEquals(1, value.aPositiveValue); } static final String CUSTOM_VALUE_REPID = RepositoryId.createForJavaType(CustomMarshalledValue.class); diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRMemoryManagementTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRMemoryManagementTest.java index 2df4f3068..e4e9eec3b 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRMemoryManagementTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDRMemoryManagementTest.java @@ -74,7 +74,6 @@ public void whenStartReadingNextFragmentWhileMarkActive_releasePreviousFragmentO assertEquals(1, getNumBuffersReleased()); } - @Test public void whenFragmentAddedAfterMarkActive_releaseSubsequentFragmentOnClose() throws IOException { setMessageBody(0, 0, 0, 1); diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDROutputTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDROutputTest.java index a6175b66f..15a8ff1cb 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDROutputTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDROutputTest.java @@ -38,13 +38,12 @@ public class CDROutputTest extends EncodingTestBase { - @Test public void whenCDROutputObjectCreated_canWriteBoolean() throws IOException { getOutputObject().write_boolean(false); getOutputObject().write_boolean(true); - expectByteArray(new byte[]{0, 1}); + expectByteArray(new byte[] { 0, 1 }); } @Test @@ -109,39 +108,32 @@ public void canWriteIntegers() { getOutputObject().write_longlong(1099520016647L); getOutputObject().write_ulonglong(1099511628034L); - expectByteArray(0x04, PAD, FF, (byte) 0xf2, - 0x00, 0x03, // short - PAD, PAD, - 0, 1, 2, (byte) 0x83, // long1 - FF, FF, (byte) 0xfd, 0x71, // long2 - PAD, PAD, PAD, PAD, - 0, 0, 1, 0, 0, (byte) 0x80, 1, 7, // longlong1 - 0, 0, 1, 0, 0, 0, 1, 2); // ulonglong2 + expectByteArray(0x04, PAD, FF, (byte) 0xf2, 0x00, 0x03, // short + PAD, PAD, 0, 1, 2, (byte) 0x83, // long1 + FF, FF, (byte) 0xfd, 0x71, // long2 + PAD, PAD, PAD, PAD, 0, 0, 1, 0, 0, (byte) 0x80, 1, 7, // longlong1 + 0, 0, 1, 0, 0, 0, 1, 2); // ulonglong2 } @Test public void canWritefloats() { getOutputObject().write_float(1); getOutputObject().write_double(0.25); - expectByteArray(0x3f, 0x80, 0, 0, - 0x3f, 0xd0, 0, 0, 0, 0, 0, 0); + expectByteArray(0x3f, 0x80, 0, 0, 0x3f, 0xd0, 0, 0, 0, 0, 0, 0); } @Test public void can_write_float_arrays() { - getOutputObject().write_float_array(new float[]{1, .0625f}, 0, 2); + getOutputObject().write_float_array(new float[] { 1, .0625f }, 0, 2); - expectByteArray(0x3f, 0x80, 0, 0, - 0x3d, 0x80, 0, 0); + expectByteArray(0x3f, 0x80, 0, 0, 0x3d, 0x80, 0, 0); } @Test public void can_write_double_arrays() { - getOutputObject().write_double_array(new double[]{0.25, 2}, 0, 2); + getOutputObject().write_double_array(new double[] { 0.25, 2 }, 0, 2); - expectByteArray(PAD, PAD, PAD, PAD, - 0x3f, 0xd0, 0, 0, 0, 0, 0, 0, - 0x40, 0, 0, 0, 0, 0, 0, 0); + expectByteArray(PAD, PAD, PAD, PAD, 0x3f, 0xd0, 0, 0, 0, 0, 0, 0, 0x40, 0, 0, 0, 0, 0, 0, 0); } @Test @@ -187,8 +179,7 @@ public void whenUsingV1_0WithLegacyOrb_canReadWCharString() { setOrbVersion(ORBVersionFactory.getOLD()); getOutputObject().write_wstring("This works"); - expectByteArray(0, 0, 0, 11, - 0, 'T', 0, 'h', 0, 'i', 0, 's', 0, ' ', 0, 'w', 0, 'o', 0, 'r', 0, 'k', 0, 's', 0, 0); + expectByteArray(0, 0, 0, 11, 0, 'T', 0, 'h', 0, 'i', 0, 's', 0, ' ', 0, 'w', 0, 'o', 0, 'r', 0, 'k', 0, 's', 0, 0); } @Test @@ -196,11 +187,8 @@ public void whenUsingV1_1_canWriteCharAndWCharStrings() { useV1_1(); getOutputObject().write_string("this works"); getOutputObject().write_wstring("This, too!"); - expectByteArray(0, 0, 0, 11, 't', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'k', 's', 0, - PAD, - 0, 0, 0, 11, - 0, 'T', 0, 'h', 0, 'i', 0, 's', 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!', - 0, 0); + expectByteArray(0, 0, 0, 11, 't', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'k', 's', 0, PAD, 0, 0, 0, 11, 0, 'T', 0, 'h', 0, 'i', 0, 's', + 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!', 0, 0); } @Test @@ -208,22 +196,20 @@ public void whenUsingV1_2_canWriteCharAndWCharStrings() { useV1_2(); getOutputObject().write_string("this works"); getOutputObject().write_wstring("This, too!"); - expectByteArray(0, 0, 0, 11, 't', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'k', 's', 0, - PAD, - 0, 0, 0, 22, FE, FF, - 0, 'T', 0, 'h', 0, 'i', 0, 's', 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!'); + expectByteArray(0, 0, 0, 11, 't', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'k', 's', 0, PAD, 0, 0, 0, 22, FE, FF, 0, 'T', 0, 'h', 0, 'i', + 0, 's', 0, ',', 0, ' ', 0, 't', 0, 'o', 0, 'o', 0, '!'); } @Test public void canWriteBooleanArray() { - getOutputObject().write_boolean_array(new boolean[]{true, true, false, true, false}, 0, 4); + getOutputObject().write_boolean_array(new boolean[] { true, true, false, true, false }, 0, 4); expectByteArray(1, 1, 0, 1); } @Test public void canWriteOctetArray() { - getOutputObject().write_octet_array(new byte[]{2, -3, 6, 2}, 0, 4); + getOutputObject().write_octet_array(new byte[] { 2, -3, 6, 2 }, 0, 4); expectByteArray(2, -3, 6, 2); } @@ -231,9 +217,9 @@ public void canWriteOctetArray() { @Test public void writingEmptyOctetArray_doesNotDoEightByteAlign() { getOutputObject().setHeaderPadding(true); - getOutputObject().write_octet_array(new byte[]{}, 0, 0); + getOutputObject().write_octet_array(new byte[] {}, 0, 0); - expectByteArray( new byte[0] ); + expectByteArray(new byte[0]); } @Test(expected = BAD_PARAM.class) @@ -243,56 +229,56 @@ public void whenWritingNullArray_anExceptionIsThrown() { @Test public void canWriteShortArray() { - getOutputObject().write_short_array(new short[]{-3, 1, 515, -1}, 1, 3); + getOutputObject().write_short_array(new short[] { -3, 1, 515, -1 }, 1, 3); expectByteArray(0, 1, 2, 3, -1, -1); } @Test public void canWriteUShortArray() { - getOutputObject().write_short_array(new short[] {-3, 1, 515, -1}, 0, 2); + getOutputObject().write_short_array(new short[] { -3, 1, 515, -1 }, 0, 2); expectByteArray(FF, 0xfd, 0, 1); } @Test public void canWriteLongArray() { - getOutputObject().write_long_array(new int[]{66051, -738}, 0, 2); + getOutputObject().write_long_array(new int[] { 66051, -738 }, 0, 2); expectByteArray(0, 1, 2, 3, -1, -1, -3, 30); } @Test public void canWriteULongArray() { - getOutputObject().write_ulong_array(new int[]{66051, -738}, 0, 2); + getOutputObject().write_ulong_array(new int[] { 66051, -738 }, 0, 2); expectByteArray(0, 1, 2, 3, -1, -1, -3, 30); } @Test public void canWriteLongLongArray() { - getOutputObject().write_longlong_array(new long[]{1099511628039L, -532}, 0, 2); + getOutputObject().write_longlong_array(new long[] { 1099511628039L, -532 }, 0, 2); expectByteArray(PAD, PAD, PAD, PAD, 0, 0, 1, 0, 0, 0, 1, 7, -1, -1, -1, -1, -1, -1, -3, -20); } @Test public void canWriteULongLongArray() { - getOutputObject().write_ulonglong_array(new long[]{1099511628039L, -532}, 0, 2); + getOutputObject().write_ulonglong_array(new long[] { 1099511628039L, -532 }, 0, 2); expectByteArray(PAD, PAD, PAD, PAD, 0, 0, 1, 0, 0, 0, 1, 7, -1, -1, -1, -1, -1, -1, -3, -20); } @Test public void canWriteCharArray() { - getOutputObject().write_char_array(new char[]{'b', 'u', 'c', 'k', 'l', 'e', 'u', 'p'}, 0, 8); + getOutputObject().write_char_array(new char[] { 'b', 'u', 'c', 'k', 'l', 'e', 'u', 'p' }, 0, 8); expectByteArray('b', 'u', 'c', 'k', 'l', 'e', 'u', 'p'); } @Test public void canWriteWCharArray() { - getOutputObject().write_wchar_array(new char[]{'b', 'u', 't'}, 0, 3); + getOutputObject().write_wchar_array(new char[] { 'b', 'u', 't' }, 0, 3); expectByteArray(4, FE, FF, 0, 'b', 4, FE, FF, 0, 'u', 4, FE, FF, 0, 't'); } @@ -313,12 +299,11 @@ public void canWriteStringTypeCode() { @Test public void canWriteSerializableTypeCode() { - String KNOWN_TYPE_CODE = "0000001D000000CE0000000000000067524D493A636F6D2E73756E2E636F7262612E65652E696D706C" + - "2E656E636F64696E672E4344524F7574707574546573745C553030323453657269616C697A65644461" + - "74613A323837394346383133394444433741463A393031343243313746444330444632410000000000" + - "3C636F6D2E73756E2E636F7262612E65652E696D706C2E656E636F64696E672E4344524F7574707574" + - "546573742453657269616C697A65644461746100000000000000000000000001000000066142797465" + - "0000000000000A0000"; + String KNOWN_TYPE_CODE = "0000001D000000CE0000000000000067524D493A636F6D2E73756E2E636F7262612E65652E696D706C" + + "2E656E636F64696E672E4344524F7574707574546573745C553030323453657269616C697A65644461" + + "74613A323837394346383133394444433741463A393031343243313746444330444632410000000000" + + "3C636F6D2E73756E2E636F7262612E65652E696D706C2E656E636F64696E672E4344524F7574707574" + + "546573742453657269616C697A65644461746100000000000000000000000001000000066142797465" + "0000000000000A0000"; TypeCode typeCode = AnyImpl.createTypeCodeForClass(SerializedData.class, getOrb()); getOutputObject().write_TypeCode(typeCode); @@ -331,10 +316,9 @@ static class SerializedData implements Serializable { private byte[] hexStringToByteArray(String s) { int len = s.length(); - byte[] data = new byte[len/2]; - for (int i = 0; i < len; i+=2) { - data[i/2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) - + Character.digit(s.charAt(i+1), 16)); + byte[] data = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16)); } return data; } @@ -343,7 +327,7 @@ private byte[] hexStringToByteArray(String s) { public void canWriteObjRefTypeCode() { getOutputObject().write_TypeCode(new TypeCodeImpl((ORB) getOutputObject().orb(), TCKind._tk_objref, "aa", "bb")); - expectByteArray(0,0,0,14, 0,0,0,19, 0,0,0,0, 0,0,0,3, 'a','a',0,0, 0,0,0,3, 'b','b',0 ); + expectByteArray(0, 0, 0, 14, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 3, 'a', 'a', 0, 0, 0, 0, 0, 3, 'b', 'b', 0); } @Test @@ -383,9 +367,9 @@ public void WhenInputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce() throws @Test public void WhenEncapsOutputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce() throws IOException { - EncapsOutputStream os = new EncapsOutputStream( getOrb() ); + EncapsOutputStream os = new EncapsOutputStream(getOrb()); os.write_ulong(123); - InputStream is = (InputStream)(os.create_input_stream() ); + InputStream is = (InputStream) (os.create_input_stream()); assertEquals(123, is.read_ulong()); os.close(); is.close(); @@ -395,9 +379,9 @@ public void WhenEncapsOutputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce() @Test public void WhenEncapsInputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce() throws IOException { - EncapsOutputStream os = new EncapsOutputStream( getOrb() ); + EncapsOutputStream os = new EncapsOutputStream(getOrb()); os.write_ulong(123); - InputStream is = (InputStream)(os.create_input_stream() ); + InputStream is = (InputStream) (os.create_input_stream()); assertEquals(123, is.read_ulong()); is.close(); os.close(); @@ -407,9 +391,9 @@ public void WhenEncapsInputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce() @Test public void WhenTypeCodeOutputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce() throws IOException { - TypeCodeOutputStream os = new TypeCodeOutputStream( getOrb() ); + TypeCodeOutputStream os = new TypeCodeOutputStream(getOrb()); os.write_ulong(123); - InputStream is = (InputStream)(os.create_input_stream() ); + InputStream is = (InputStream) (os.create_input_stream()); assertEquals(123, is.read_ulong()); os.close(); is.close(); @@ -419,9 +403,9 @@ public void WhenTypeCodeOutputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce @Test public void WhenTypeCodeInputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce() throws IOException { - TypeCodeOutputStream os = new TypeCodeOutputStream( getOrb() ); + TypeCodeOutputStream os = new TypeCodeOutputStream(getOrb()); os.write_ulong(123); - InputStream is = (InputStream)(os.create_input_stream() ); + InputStream is = (InputStream) (os.create_input_stream()); assertEquals(123, is.read_ulong()); is.close(); os.close(); @@ -430,187 +414,83 @@ public void WhenTypeCodeInputStreamClosedFirst_sharedBuffersAreOnlyReleasedOnce( } /* - - @Test(expected = MARSHAL.class) - public void whenUsingV1_0_throwExceptionOnUnexpectedEndOfData() { - useV1_0(); - setMessageBody(0, 0); - getInputObject().read_long(); - } - - @Test - public void whenUsingV1_2_headerPaddingForces8ByteAlignmentOnce() { - useV1_2(); - setMessageBody(pad(), pad(), pad(), pad(), - 0, 0, 1, 0, - FF, FF, FF, FF); - - getInputObject().setHeaderPadding(true); - assertEquals(256, getInputObject().read_long()); - assertEquals(-1, getInputObject().read_long()); - } - - @Test - public void whenMarkIsSetInV1_0_restoreAllowsReread() { - useV1_0(); - setMessageBody(0, 0, 1, 23, 'x'); - getInputObject().mark(0); - assertEquals(0, getInputObject().read_short()); - getInputObject().reset(); - assertEquals(279, getInputObject().read_long()); - } - - @Test - public void whenMarkIsSetInV1_2_restoreAllowsReread() { - useV1_2(); - setMessageBody(0, 0, 1, 23, 'x'); - getInputObject().mark(0); - assertEquals(0, getInputObject().read_short()); - getInputObject().reset(); - assertEquals(279, getInputObject().read_long()); - } - - @Test - public void whenUsingV1_2_continueReadingOnToFragment() { - useV1_2(); - setMessageBody(0, 0, 1, 23); - addFragment(0, 7); - getInputObject().read_long(); - assertEquals(7, getInputObject().read_short()); - } - - @Test - public void whenUsingV1_2_skipPaddingBeforeReadingNextFragment() { - useV1_2(); - setMessageBody(0, 23, pad(), pad()); - addFragment(0, 0, 0, 7); - getInputObject().read_short(); - assertEquals(7, getInputObject().read_long()); - } - - @Test - public void whenUsingV1_1_skipOptionalPaddingBeforeReadingNextFragment() { - useV1_1(); - setMessageBody(0, 23, pad(), pad()); - addFragment(0, 0, 0, 7); - getInputObject().read_short(); - assertEquals(7, getInputObject().read_long()); - } - - @Test - public void whenUsingV1_1_alignToStartOfNextFragment() { - useV1_1(); - setMessageBody(0, 23); - addFragment(0, 0, 0, 7); - getInputObject().read_short(); - assertEquals(7, getInputObject().read_long()); - } - - @Test(expected = RequestCanceledException.class) - public void whenUsingV1_2_throwExceptionIfCanceled() { - useV1_2(); - setMessageBody(0, 23, pad(), pad()); - getInputObject().read_short(); - getInputObject().cancelProcessing(0); - getInputObject().read_long(); - } - - @Test(expected = MARSHAL.class) - public void whenUsingV1_2_throwExceptionOnReadPastEnd() { - useV1_2(); - setMessageBody(0, 23, pad(), pad()); - getInputObject().read_short(); - getInputObject().read_long(); - } - - @Test(expected = COMM_FAILURE.class) - public void whenUsingV1_2_throwExceptionOnTimeout() { - useV1_2(); - expectMoreFragments(); - setMessageBody(0, 23, pad(), pad()); - getInputObject().read_short(); - getInputObject().read_long(); - } - - @Test(expected = RequestCanceledException.class) - public void whenUsingV1_2_throwExceptionWhenCanceledDuringWait() { - useV1_2(); - setMessageBody(0, 23, pad(), pad()); - expectMoreFragments(); - - whileWaitingForFragmentsDo(new AsynchronousAction() { - public void exec() { - addFragment(0, 0, 0, 7); - getInputObject().cancelProcessing(0); - } - }); - getInputObject().read_short(); - getInputObject().read_long(); - } - - @Test - public void whenValueIsZero_returnNull() { - setMessageBody(0, 0, 0, 0); - assertNull(getInputObject().read_value()); - } - - @Test - public void whenCloneEncapsInputStream_readFromClone() { - setMessageBody(); - EncapsInputStream inputStream1 = createEncapsulatedInputStream(0, 0, 1, 5); - EncapsInputStream inputStream2 = new EncapsInputStream(inputStream1); - assertEquals(261, inputStream2.read_long()); - } - - @Test - public void canWriteLittleEndianUTF16CharIn_1_0WithLegacyORB() throws IOException { - useV1_0(); - useLittleEndian(); - setOrbVersion(ORBVersionFactory.getOLD()); - setWCharEncoding(UTF_16); - - getOutputObject().write_wchar('\u5634'); - expectByteArray(0x34, 0x56); - } - - @Test - public void can_read_little_endian_integers() { - setMessageBody(0x04, pad(), - 0xf2, FF,// short - 0x03, 0x00,// ushort - pad(), pad(),// for long - 0x83, 2, 1, 0,// long - 0x71, 0xfd, FF, FF,// ulong - pad(), pad(), pad(), pad(),// for long_long - 7, 1, 0x80, 0, 0, 1, 0, 0);// long long - useLittleEndian(); - - assertEquals("Octet value", 4, getInputObject().read_octet()); - assertEquals("Signed short value", -14, getInputObject().read_short()); - assertEquals("Standard unsigned short value", 3, getInputObject().read_ushort()); - assertEquals("Unsigned long value", 66179, getInputObject().read_ulong()); - assertEquals("Long value", -655, getInputObject().read_long()); - assertEquals("Long long value", 1099520016647L, getInputObject().read_longlong()); - } - - @Test - public void canReadStringFromOldOrbAcrossFragment() { - useV1_1(); - setOrbVersion(ORBVersionFactory.getOLD()); - setMessageBody(0, 0, 0, 9, 'a', 'b', 'c', 'd'); - addFragment('e', 'f', 'g', 'h', 0); - assertEquals("abcdefgh", getInputObject().read_string()); - } - - @Test - public void can_read_octet_array_acrossFragments() throws Exception { - useV1_2(); - final int[] data = {0, 1, 2, 3}; - final byte[] expected = {0, 1, 2, 3, -1, -1}; - setMessageBody(data); - addFragment(-1, -1); - readAndVerifyOctetArray(expected); - } - - /**/ + * + * @Test(expected = MARSHAL.class) public void whenUsingV1_0_throwExceptionOnUnexpectedEndOfData() { useV1_0(); + * setMessageBody(0, 0); getInputObject().read_long(); } + * + * @Test public void whenUsingV1_2_headerPaddingForces8ByteAlignmentOnce() { useV1_2(); setMessageBody(pad(), pad(), + * pad(), pad(), 0, 0, 1, 0, FF, FF, FF, FF); + * + * getInputObject().setHeaderPadding(true); assertEquals(256, getInputObject().read_long()); assertEquals(-1, + * getInputObject().read_long()); } + * + * @Test public void whenMarkIsSetInV1_0_restoreAllowsReread() { useV1_0(); setMessageBody(0, 0, 1, 23, 'x'); + * getInputObject().mark(0); assertEquals(0, getInputObject().read_short()); getInputObject().reset(); assertEquals(279, + * getInputObject().read_long()); } + * + * @Test public void whenMarkIsSetInV1_2_restoreAllowsReread() { useV1_2(); setMessageBody(0, 0, 1, 23, 'x'); + * getInputObject().mark(0); assertEquals(0, getInputObject().read_short()); getInputObject().reset(); assertEquals(279, + * getInputObject().read_long()); } + * + * @Test public void whenUsingV1_2_continueReadingOnToFragment() { useV1_2(); setMessageBody(0, 0, 1, 23); + * addFragment(0, 7); getInputObject().read_long(); assertEquals(7, getInputObject().read_short()); } + * + * @Test public void whenUsingV1_2_skipPaddingBeforeReadingNextFragment() { useV1_2(); setMessageBody(0, 23, pad(), + * pad()); addFragment(0, 0, 0, 7); getInputObject().read_short(); assertEquals(7, getInputObject().read_long()); } + * + * @Test public void whenUsingV1_1_skipOptionalPaddingBeforeReadingNextFragment() { useV1_1(); setMessageBody(0, 23, + * pad(), pad()); addFragment(0, 0, 0, 7); getInputObject().read_short(); assertEquals(7, getInputObject().read_long()); + * } + * + * @Test public void whenUsingV1_1_alignToStartOfNextFragment() { useV1_1(); setMessageBody(0, 23); addFragment(0, 0, 0, + * 7); getInputObject().read_short(); assertEquals(7, getInputObject().read_long()); } + * + * @Test(expected = RequestCanceledException.class) public void whenUsingV1_2_throwExceptionIfCanceled() { useV1_2(); + * setMessageBody(0, 23, pad(), pad()); getInputObject().read_short(); getInputObject().cancelProcessing(0); + * getInputObject().read_long(); } + * + * @Test(expected = MARSHAL.class) public void whenUsingV1_2_throwExceptionOnReadPastEnd() { useV1_2(); + * setMessageBody(0, 23, pad(), pad()); getInputObject().read_short(); getInputObject().read_long(); } + * + * @Test(expected = COMM_FAILURE.class) public void whenUsingV1_2_throwExceptionOnTimeout() { useV1_2(); + * expectMoreFragments(); setMessageBody(0, 23, pad(), pad()); getInputObject().read_short(); + * getInputObject().read_long(); } + * + * @Test(expected = RequestCanceledException.class) public void whenUsingV1_2_throwExceptionWhenCanceledDuringWait() { + * useV1_2(); setMessageBody(0, 23, pad(), pad()); expectMoreFragments(); + * + * whileWaitingForFragmentsDo(new AsynchronousAction() { public void exec() { addFragment(0, 0, 0, 7); + * getInputObject().cancelProcessing(0); } }); getInputObject().read_short(); getInputObject().read_long(); } + * + * @Test public void whenValueIsZero_returnNull() { setMessageBody(0, 0, 0, 0); + * assertNull(getInputObject().read_value()); } + * + * @Test public void whenCloneEncapsInputStream_readFromClone() { setMessageBody(); EncapsInputStream inputStream1 = + * createEncapsulatedInputStream(0, 0, 1, 5); EncapsInputStream inputStream2 = new EncapsInputStream(inputStream1); + * assertEquals(261, inputStream2.read_long()); } + * + * @Test public void canWriteLittleEndianUTF16CharIn_1_0WithLegacyORB() throws IOException { useV1_0(); + * useLittleEndian(); setOrbVersion(ORBVersionFactory.getOLD()); setWCharEncoding(UTF_16); + * + * getOutputObject().write_wchar('\u5634'); expectByteArray(0x34, 0x56); } + * + * @Test public void can_read_little_endian_integers() { setMessageBody(0x04, pad(), 0xf2, FF,// short 0x03, 0x00,// + * ushort pad(), pad(),// for long 0x83, 2, 1, 0,// long 0x71, 0xfd, FF, FF,// ulong pad(), pad(), pad(), pad(),// for + * long_long 7, 1, 0x80, 0, 0, 1, 0, 0);// long long useLittleEndian(); + * + * assertEquals("Octet value", 4, getInputObject().read_octet()); assertEquals("Signed short value", -14, + * getInputObject().read_short()); assertEquals("Standard unsigned short value", 3, getInputObject().read_ushort()); + * assertEquals("Unsigned long value", 66179, getInputObject().read_ulong()); assertEquals("Long value", -655, + * getInputObject().read_long()); assertEquals("Long long value", 1099520016647L, getInputObject().read_longlong()); } + * + * @Test public void canReadStringFromOldOrbAcrossFragment() { useV1_1(); setOrbVersion(ORBVersionFactory.getOLD()); + * setMessageBody(0, 0, 0, 9, 'a', 'b', 'c', 'd'); addFragment('e', 'f', 'g', 'h', 0); assertEquals("abcdefgh", + * getInputObject().read_string()); } + * + * @Test public void can_read_octet_array_acrossFragments() throws Exception { useV1_2(); final int[] data = {0, 1, 2, + * 3}; final byte[] expected = {0, 1, 2, 3, -1, -1}; setMessageBody(data); addFragment(-1, -1); + * readAndVerifyOctetArray(expected); } + * + * / + **/ } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDROutputValueTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDROutputValueTest.java index 979c18759..aa7027128 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDROutputValueTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CDROutputValueTest.java @@ -63,8 +63,9 @@ public void canWriteSerializedValue() throws IOException { } /** - * ArrayLists always use chunking because they have custom marshalling. The Value1 type does not, normally. - * When a Value1 instance is contained in an ArrayList, it must use chunking to comply with the CORBA spec. + * ArrayLists always use chunking because they have custom marshalling. The Value1 type does not, normally. When a + * Value1 instance is contained in an ArrayList, it must use chunking to comply with the CORBA spec. + * * @throws IOException */ @Test @@ -73,10 +74,10 @@ public void valuesNestedUnderChunkedValuesAreChunked() throws IOException { writeRepId(ARRAY_LIST_REPID); startChunk(); - writeByte(1); // array header - writeByte(1); // true: overriding write object + writeByte(1); // array header + writeByte(1); // true: overriding write object writeInt(1); - writeInt(1); // size of array list + writeInt(1); // size of array list writeByte(0); endChunk(); @@ -100,6 +101,7 @@ public void valuesNestedUnderChunkedValuesAreChunked() throws IOException { /** * A ComplexValue does not need chunking; however, it contains an ArrayList which does. The next field is a Value1, * which should not use chunking. + * * @throws IOException */ @Test @@ -107,16 +109,16 @@ public void valuesFollowingChunkedValuesNeedNotBeChunked() throws IOException { setFragmentSize(500); writeValueTag(ONE_REPID_ID); writeRepId(ComplexValue.REPID); - writeInt(3); // anInt + writeInt(3); // anInt writeValueTag(ONE_REPID_ID | USE_CHUNKING); writeRepId(ARRAY_LIST_REPID); startChunk(); - writeByte(1); // array header + writeByte(1); // array header writeByte(1); writeInt(1); - writeInt(1); // ArrayList size + writeInt(1); // ArrayList size writeByte(0); endChunk(); @@ -248,8 +250,8 @@ public void canWriteCustomValueInChunk_withCompactedEndTags() throws IOException getOutputObject().end_value(); getOutputObject().end_value(); - expectByteArrays(new byte[] {0x7F,FF,FF,0x0A, 0,0,0,4, 'I','D','1',0, 0,0,0,4, 0,0,0,73, - 0x7F,FF,FF,0x0A, 0,0,0,4, 'I','D','2',0, 0,0,0,4, 0,0,0,37, FF,FF,FF,FF }); + expectByteArrays(new byte[] { 0x7F, FF, FF, 0x0A, 0, 0, 0, 4, 'I', 'D', '1', 0, 0, 0, 0, 4, 0, 0, 0, 73, 0x7F, FF, FF, 0x0A, 0, 0, + 0, 4, 'I', 'D', '2', 0, 0, 0, 0, 4, 0, 0, 0, 37, FF, FF, FF, FF }); } @Test @@ -259,7 +261,7 @@ public void whenBufferFull_sendFragment() { getOutputObject().write_short((short) 2); getOutputObject().write_long(3); - expectByteArrays(new byte[] {0,0,0,1, 0,2, 0,0}, new byte[] {0,0,0,3}); + expectByteArrays(new byte[] { 0, 0, 0, 1, 0, 2, 0, 0 }, new byte[] { 0, 0, 0, 3 }); } @Test @@ -270,7 +272,7 @@ public void whenBufferFullInV1_1_sendFragment() { getOutputObject().write_short((short) 2); getOutputObject().write_long(3); - expectByteArrays(new byte[] {0,0,0,1, 0,2}, new byte[] {0,0,0,3}); + expectByteArrays(new byte[] { 0, 0, 0, 1, 0, 2 }, new byte[] { 0, 0, 0, 3 }); } @Test @@ -281,7 +283,7 @@ public void whenBufferFullInV1_0_expandIt() { getOutputObject().write_short((short) 2); getOutputObject().write_long(3); - expectByteArray(0,0,0,1, 0,2, 0,0, 0,0,0,3); + expectByteArray(0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 3); } @Test @@ -296,18 +298,20 @@ public void whenBufferFullWhileWritingPrimitive_generateContinuationAfterFirstPr getOutputObject().write_long(9); getOutputObject().end_block(); - expectByteArrays(new byte[] {0,0,0,16, 0,0,0,1, 0,0,0,2, 0,0,0,3}, new byte[] {0,0,0,5, 0,0,0,8, 0,0,0,6, 0,0,0,9}); + expectByteArrays(new byte[] { 0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3 }, + new byte[] { 0, 0, 0, 5, 0, 0, 0, 8, 0, 0, 0, 6, 0, 0, 0, 9 }); } @Test public void whenBufferFullWhileMidChunkAndWritingArray_generateContinuationAfterArray() { setFragmentSize(Message.GIOPMessageHeaderLength + 16); getOutputObject().start_block(); - getOutputObject().write_long_array(new int[] {1, 2, 3, 5, 6}, 0, 5); + getOutputObject().write_long_array(new int[] { 1, 2, 3, 5, 6 }, 0, 5); getOutputObject().write_long(9); getOutputObject().end_block(); - expectByteArrays(new byte[] {0,0,0,20, 0,0,0,1, 0,0,0,2, 0,0,0,3}, new byte[] {0,0,0,5, 0,0,0,6, 0,0,0,4, 0,0,0,9}); + expectByteArrays(new byte[] { 0, 0, 0, 20, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3 }, + new byte[] { 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 9 }); } @Test @@ -315,7 +319,7 @@ public void whenObjectImplementsWriteReplace_outputStreamContainsReplacementValu writeValueTag(ONE_REPID_ID); writeRepId(Gender.REPID); - writeInt(0); // the serialized form of the MALE constant, produced by writeReplace + writeInt(0); // the serialized form of the MALE constant, produced by writeReplace getOutputObject().write_value(Gender.MALE); @@ -328,16 +332,16 @@ public void whenInaccessibleObjectImplementsWriteReplace_outputStreamContainsRep String InetAddressRepId = "RMI:java.net.InetAddress:C156A93A2ABC4FAF:2D9B57AF9FE3EBDB"; InetAddress loopbackAddress = InetAddress.getLoopbackAddress(); - writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk + writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk writeRepId(InetAddressRepId); startChunk(); writeInt(0x01010000); - writeInt(0x7F000001); // 127.0.0.1 + writeInt(0x7F000001); // 127.0.0.1 writeInt(0x00000002); endChunk(); - writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk + writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk writeRepId("IDL:omg.org/CORBA/WStringValue:1.0"); startChunk(); writeStringValue_1_2("localhost"); @@ -354,12 +358,12 @@ public void whenInaccessibleObjectImplementsWriteReplace_outputStreamContainsRep public void whenExternalizableObjectWritten_invokeWriteExternalMethod() throws Exception { Profession profession = Profession.DOCTOR; getOutputObject().write_value(profession); - - writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk + + writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk writeRepId(Profession.REPID); startChunk(); - writeByte(1); // serial format version + writeByte(1); // serial format version writeInt(4); endChunk(); writeEndTag(-1); @@ -367,111 +371,66 @@ public void whenExternalizableObjectWritten_invokeWriteExternalMethod() throws E setMessageBody(getGeneratedBody()); expectByteArray(getGeneratedBody()); } -/* - -// write codebase - - @Test - public void canReadSerializedValueWithContinuationChunk() throws IOException { - writeValueTag(ONE_REPID_ID | USE_CHUNKING); - writeRepId(Value1.REPID); - - startChunk(); - writeWchar_1_2('x'); - endChunk(); - - startChunk(); - writeInt(3); - endChunk(); - writeEndTag(-1); - - setMessageBody( getGeneratedBody() ); - - Object object = getInputObject().read_value(); - assertTrue(object instanceof Value1); - Value1 value1 = (Value1) object; - assertEquals('x', value1.aChar); - assertEquals(3, value1.anInt); - } - - @Test - public void canReadSerializedValueWithNestedValue() throws IOException { - writeValueTag(ONE_REPID_ID | USE_CHUNKING); - writeRepId(Value2.REPID); - - startChunk(); - writeLong(750); - endChunk(); - - writeValueTag(ONE_REPID_ID | USE_CHUNKING); - writeRepId(Value1.REPID); - startChunk(); - writeWchar_1_2('x'); - writeInt(3); - endChunk(); - writeEndTag(-1); - - setMessageBody( getGeneratedBody() ); - - Object object = getInputObject().read_value(); - assertTrue(object instanceof Value2); - Value2 value2 = (Value2) object; - assertEquals(750,value2.aLong); - assertEquals('x', value2.aValue.aChar); - assertEquals(3, value2.aValue.anInt); - } - - @Test - public void canReadSerializedValueUsingDefaultFactory() throws IOException { - writeValueTag(ONE_REPID_ID | USE_CODEBASE); - writeCodebase("http://localhost/myClasses"); - writeRepId(Value1.REPID); - - writeWchar_1_2('x'); - - setMessageBody( getGeneratedBody() ); - - Object object = getInputObject().read_value(Value1.REPID); - assertTrue(object instanceof Value1); - Value1 value1 = (Value1) object; - assertEquals('x', value1.aChar); - assertEquals('x', value1.anInt); - } - - @Test - public void canReadNullValueUsingDefaultFactory() throws IOException { - writeNull(); - setMessageBody( getGeneratedBody() ); - - assertNull(getInputObject().read_value(Value1.REPID)); - } - - @Test(expected = IndirectionException.class) - public void whenIndirectionHasNoAntecedent_throwExceptionWhenUsingRepId() throws IOException { - writeIndirectionTo(0); - setMessageBody( getGeneratedBody() ); - getInputObject().read_value(Value1.REPID); - } - - @Test - public void canReadSerializedValueUsingDefaultFactoryAndIndirection() throws IOException { - int location = getCurrentLocation(); - - writeValueTag(ONE_REPID_ID | USE_CHUNKING); - writeRepId(Value1.REPID); - startChunk(); - writeWchar_1_2('x'); - endChunk(); - writeEndTag(-1); - - writeIndirectionTo(location); - - setMessageBody( getGeneratedBody() ); - - Object object1 = getInputObject().read_value(Value1.REPID); - Object object2 = getInputObject().read_value(Value1.REPID); - assertSame(object1, object2); - } - -*/ + /* + * + * // write codebase + * + * @Test public void canReadSerializedValueWithContinuationChunk() throws IOException { writeValueTag(ONE_REPID_ID | + * USE_CHUNKING); writeRepId(Value1.REPID); + * + * startChunk(); writeWchar_1_2('x'); endChunk(); + * + * startChunk(); writeInt(3); endChunk(); writeEndTag(-1); + * + * setMessageBody( getGeneratedBody() ); + * + * Object object = getInputObject().read_value(); assertTrue(object instanceof Value1); Value1 value1 = (Value1) object; + * assertEquals('x', value1.aChar); assertEquals(3, value1.anInt); } + * + * @Test public void canReadSerializedValueWithNestedValue() throws IOException { writeValueTag(ONE_REPID_ID | + * USE_CHUNKING); writeRepId(Value2.REPID); + * + * startChunk(); writeLong(750); endChunk(); + * + * writeValueTag(ONE_REPID_ID | USE_CHUNKING); writeRepId(Value1.REPID); startChunk(); writeWchar_1_2('x'); writeInt(3); + * endChunk(); writeEndTag(-1); + * + * setMessageBody( getGeneratedBody() ); + * + * Object object = getInputObject().read_value(); assertTrue(object instanceof Value2); Value2 value2 = (Value2) object; + * assertEquals(750,value2.aLong); assertEquals('x', value2.aValue.aChar); assertEquals(3, value2.aValue.anInt); } + * + * @Test public void canReadSerializedValueUsingDefaultFactory() throws IOException { writeValueTag(ONE_REPID_ID | + * USE_CODEBASE); writeCodebase("http://localhost/myClasses"); writeRepId(Value1.REPID); + * + * writeWchar_1_2('x'); + * + * setMessageBody( getGeneratedBody() ); + * + * Object object = getInputObject().read_value(Value1.REPID); assertTrue(object instanceof Value1); Value1 value1 = + * (Value1) object; assertEquals('x', value1.aChar); assertEquals('x', value1.anInt); } + * + * @Test public void canReadNullValueUsingDefaultFactory() throws IOException { writeNull(); setMessageBody( + * getGeneratedBody() ); + * + * assertNull(getInputObject().read_value(Value1.REPID)); } + * + * @Test(expected = IndirectionException.class) public void + * whenIndirectionHasNoAntecedent_throwExceptionWhenUsingRepId() throws IOException { writeIndirectionTo(0); + * setMessageBody( getGeneratedBody() ); getInputObject().read_value(Value1.REPID); } + * + * @Test public void canReadSerializedValueUsingDefaultFactoryAndIndirection() throws IOException { int location = + * getCurrentLocation(); + * + * writeValueTag(ONE_REPID_ID | USE_CHUNKING); writeRepId(Value1.REPID); startChunk(); writeWchar_1_2('x'); endChunk(); + * writeEndTag(-1); + * + * writeIndirectionTo(location); + * + * setMessageBody( getGeneratedBody() ); + * + * Object object1 = getInputObject().read_value(Value1.REPID); Object object2 = + * getInputObject().read_value(Value1.REPID); assertSame(object1, object2); } + * + */ } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/ComplexValue.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/ComplexValue.java index 03cc1fac3..9eebef84b 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/ComplexValue.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/ComplexValue.java @@ -33,7 +33,7 @@ public class ComplexValue implements Serializable { this.anInt = anInt; arrayList.add(new Value1(aChar, anInt)); char nextChar = Character.toUpperCase(aChar); - value = new Value1(nextChar, anInt+1); + value = new Value1(nextChar, anInt + 1); } ComplexValue() { diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomMarshalledValue.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomMarshalledValue.java index 5cc5de558..f46c8ea68 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomMarshalledValue.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomMarshalledValue.java @@ -28,18 +28,18 @@ * A serializable class that implements both readObject and writeObject for custom marshalling. */ class CustomMarshalledValue implements Serializable { - transient double customDouble; - double aDouble; - Value1 value1; - float aFloat; + transient double customDouble; + double aDouble; + Value1 value1; + float aFloat; - private void readObject(ObjectInputStream aInputStream) throws ClassNotFoundException, IOException { - aInputStream.defaultReadObject(); - customDouble = aInputStream.readDouble(); - } + private void readObject(ObjectInputStream aInputStream) throws ClassNotFoundException, IOException { + aInputStream.defaultReadObject(); + customDouble = aInputStream.readDouble(); + } - private void writeObject(ObjectOutputStream aOutputStream) throws IOException { - aOutputStream.defaultWriteObject(); - aOutputStream.writeDouble(customDouble); - } + private void writeObject(ObjectOutputStream aOutputStream) throws IOException { + aOutputStream.defaultWriteObject(); + aOutputStream.writeDouble(customDouble); + } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomReadClass.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomReadClass.java index 7e8c48782..92934bd81 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomReadClass.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomReadClass.java @@ -27,11 +27,11 @@ * A serializable class that implements readObject for custom marshalling but uses the standard write object. */ public class CustomReadClass implements Serializable { - int aPositiveValue; + int aPositiveValue; - private void readObject(ObjectInputStream anInputStream) throws IOException, ClassNotFoundException { - anInputStream.defaultReadObject(); - aPositiveValue = Math.max(aPositiveValue, 1); - } + private void readObject(ObjectInputStream anInputStream) throws IOException, ClassNotFoundException { + anInputStream.defaultReadObject(); + aPositiveValue = Math.max(aPositiveValue, 1); + } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomWriteClass.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomWriteClass.java index 3a5654817..b882fe473 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomWriteClass.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/CustomWriteClass.java @@ -27,12 +27,11 @@ * A serializable class that implements writeObject for custom marshalling but uses the standard read object. */ public class CustomWriteClass implements Serializable { - int aPositiveValue; + int aPositiveValue; - - private void writeObject(ObjectOutputStream aOutputStream) throws IOException { - aPositiveValue = Math.min(aPositiveValue, 1); - aOutputStream.defaultWriteObject(); - } + private void writeObject(ObjectOutputStream aOutputStream) throws IOException { + aPositiveValue = Math.min(aPositiveValue, 1); + aOutputStream.defaultWriteObject(); + } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/DerivedValue.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/DerivedValue.java index ff1532d2e..74341b824 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/DerivedValue.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/DerivedValue.java @@ -23,7 +23,7 @@ * A derived class that can be serialized. */ class DerivedValue extends Value1 { - boolean ready; - byte aByte; - short aShort; + boolean ready; + byte aByte; + short aShort; } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/EncodingTestBase.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/EncodingTestBase.java index 90255ffc2..15aead2b4 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/EncodingTestBase.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/EncodingTestBase.java @@ -67,7 +67,7 @@ public class EncodingTestBase { protected static final int UTF_16 = OSFCodeSetRegistry.UTF_16.getNumber(); protected static final byte FE = -2; protected static final byte FF = -1; - protected static final int PAD = 0; // use for output tests only, to make comparison possible + protected static final int PAD = 0; // use for output tests only, to make comparison possible private ORBDataFake orbData = createStrictStub(ORBDataFake.class); private ORBFake orb = createStrictStub(ORBFake.class); @@ -86,8 +86,10 @@ public class EncodingTestBase { static byte flags(Endian endian, Fragments fragments) { byte result = 0; - if (endian == little_endian) result |= 0x01; - if (fragments == more_fragments) result |= 0x02; + if (endian == little_endian) + result |= 0x01; + if (fragments == more_fragments) + result |= 0x02; return result; } @@ -276,12 +278,11 @@ protected final void expectByteArrays(byte[]... expected) { } private byte[] subBuffer(byte[] input, int start) { - byte[] result = new byte[input.length-start]; + byte[] result = new byte[input.length - start]; System.arraycopy(input, start, result, 0, result.length); return result; } - protected final void expectByteArray(int... expected) { byte[] bytes = new byte[expected.length]; for (int i = 0; i < expected.length; i++) @@ -289,16 +290,19 @@ protected final void expectByteArray(int... expected) { expectByteArray(bytes); } - enum Endian {big_endian, little_endian} + enum Endian { + big_endian, little_endian + } - enum Fragments {no_more_fragments, more_fragments} + enum Fragments { + no_more_fragments, more_fragments + } interface AsynchronousAction { void exec(); } - - //--------------------------------- fake implementation of a TransportManager -------------------------------------- + // --------------------------------- fake implementation of a TransportManager -------------------------------------- static abstract class TransportManagerFake implements TransportManager { @Override @@ -307,7 +311,7 @@ public MessageTraceManager getMessageTraceManager() { } } - //-------------------------------------- fake implementation of an ORBData ----------------------------------------- + // -------------------------------------- fake implementation of an ORBData ----------------------------------------- static abstract class ORBDataFake implements ORBData { private AsynchronousAction asynchronousAction; @@ -365,7 +369,7 @@ public int getGIOPFragmentSize() { } } - //----------------------------------- fake implementation of a ByteBufferPool -------------------------------------- + // ----------------------------------- fake implementation of a ByteBufferPool -------------------------------------- static abstract class ByteBufferPoolFake implements ByteBufferPool { private List buffers = new ArrayList(); @@ -385,7 +389,7 @@ public ByteBuffer getByteBuffer(int theSize) { } } - //---------------------------------------- fake implementation of the ORB ------------------------------------------ + // ---------------------------------------- fake implementation of the ORB ------------------------------------------ static abstract class ORBFake extends ORBImpl { private ORBDataFake orbData; @@ -435,7 +439,7 @@ public TransportManager getTransportManager() { } } - //-------------------------------------- fake implementation of a Codebase ----------------------------------------- + // -------------------------------------- fake implementation of a Codebase ----------------------------------------- static abstract class CodeBaseFake implements CodeBase { @Override @@ -449,7 +453,7 @@ public FullValueDescription meta(String x) { } } - //------------------------------------- fake implementation of a Connection ---------------------------------------- + // ------------------------------------- fake implementation of a Connection ---------------------------------------- static abstract class ConnectionFake implements Connection { int char_encoding = ISO_8859_1; @@ -499,7 +503,8 @@ public void writeUnlock() { @Override public void sendWithoutLock(CDROutputObject outputObject) { try { - if (!locked) fail("sendWithoutLock called while connection is not locked"); + if (!locked) + fail("sendWithoutLock called while connection is not locked"); outputObject.writeTo(this); } catch (IOException e) { fail("Connection reported: " + e); @@ -515,7 +520,7 @@ public void write(ByteBuffer byteBuffer) throws IOException { } - //---------------------------------- fake implementation of a Message Mediator ------------------------------------- + // ---------------------------------- fake implementation of a Message Mediator ------------------------------------- static abstract class MessageMediatorFake implements MessageMediator { @@ -553,7 +558,7 @@ public CDROutputObject getOutputObject() { } } - //--------------------------------------- fake implementation of a Message ----------------------------------------- + // --------------------------------------- fake implementation of a Message ----------------------------------------- static abstract class MessageFake implements FragmentMessage { Endian endian = big_endian; @@ -567,9 +572,11 @@ static abstract class MessageFake implements FragmentMessage { private boolean startedNewMessage; byte[] getMessageData() { - if (data != null) return data; + if (data != null) + return data; - if (body == null) throw new RuntimeException("No message body defined"); + if (body == null) + throw new RuntimeException("No message body defined"); data = new byte[body.length + getHeaderLength()]; System.arraycopy(body, 0, data, getHeaderLength(), body.length); copyToHeader((byte) 'G', (byte) 'I', (byte) 'O', (byte) 'P'); @@ -598,7 +605,7 @@ public int getHeaderLength() { @Override public int getSize() { - return sizeInHeader >=0 ? sizeInHeader : getMessageData().length; + return sizeInHeader >= 0 ? sizeInHeader : getMessageData().length; } @Override diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FVDBuilder.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FVDBuilder.java index 43f6138fb..8b1eaefad 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FVDBuilder.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FVDBuilder.java @@ -41,213 +41,217 @@ import java.util.Optional; /** - * This class uses the fluent builder pattern (see https://dzone.com/articles/fluent-builder-pattern) - * to create a FullValueDescription (FVD) object for use in a unit test. It also serves as a cache for created - * FVDs. See CORBA 3.1 section 14.5.31 + * This class uses the fluent builder pattern (see https://dzone.com/articles/fluent-builder-pattern) to create a + * FullValueDescription (FVD) object for use in a unit test. It also serves as a cache for created FVDs. See CORBA 3.1 + * section 14.5.31 */ public class FVDBuilder { - private static Map metas; - private static ORB orb; - - private String repId; - private boolean customMarshalled; - private List fields = new ArrayList<>(); - private String baseRepId; - - private FVDBuilder(String repId) { - this.repId = repId; - } - - /** - * Initializes this class for a new unit test. This clears any existing FVDs and specifies the ORB to be used - * to create new ones. - * @param orb an ORB used to create TypeCodes. - */ - static void initialize(ORB orb) { - FVDBuilder.orb = orb; - metas = new HashMap<>(); - } - - /** - * Obtains the FVD for the specified repository ID. - * @param repositoryID the repository ID to look up - * @throws RuntimeException if a FVD has not been defined for the repository ID - * @return the matching FVD - */ - static FullValueDescription getMeta(String repositoryID) { - return Optional.ofNullable(metas.get(repositoryID)) - .orElseThrow(() -> new RuntimeException("No FVD defined for " + repositoryID)); - } - - /** - * Creates a builder for a FVD, specifying the CORBA repository ID - * @param repId the respository ID - * @return the new builder - */ - static FVDBuilder defineFullValueDescription(String repId) { - return new FVDBuilder(repId); - } - - /** - * Modifies this builder to set the is_custom flag of the FVD it will create. - * @return this object - */ - FVDBuilder withCustomMarshalling() { - customMarshalled = true; - return this; - } - - /** - * Modifies this builder to specify a base class, using its repository iD. This will set the baseValue flag - * of the create FVD. - * @param repId the repository ID of the base class - * @return this object - */ - FVDBuilder withBaseRepId(String repId) { - baseRepId = repId; - return this; - } - - /** - * Modifies this builder to add a primitive or String member field. This will add an entry to the members entry - * of the created FVD. - * @param fieldName the name of the field - * @param fieldClass the class that will be used to select a repository ID for the member - * @return this object - */ - FVDBuilder withMember(String fieldName, Class fieldClass) { - if (!fieldClass.equals(String.class) && !fieldClass.isPrimitive()) - throw new RuntimeException(String.format("%s field %s is not primitive; define it with its repository ID", fieldClass.getName(), fieldName)); - - fields.add(new PrimitiveFieldBuilder(fieldName, fieldClass)); - return this; - } - - /** - * Modifies this builder to add a member field of a Java class type. This will add an entry to the members entry - * of the created FVD. - * @param fieldName the name of the field - * @param repId the repository ID for the field - * @return this object - */ - FVDBuilder withMember(String fieldName, String repId) { - fields.add(new ValueFieldBuilder(fieldName, repId)); - return this; - } - - /** - * Creates a FullValueDescription from the builder configuration, and caches it. Callers may obtain the - * FVD by invoking {@link #getMeta(String)}. - */ - public void build() { - FullValueDescription fvd = new FullValueDescription("", repId, isAbstract(), isCustom(), "", "", - new OperationDescription[0], new AttributeDescription[0], createMembers(), new Initializer[0], - new String[0], new String[0], isTruncatable(), baseRepId, createTypeCode(orb)); - metas.put(repId, fvd); - } - - private boolean isCustom() { - return customMarshalled; - } - - private boolean isAbstract() { - return false; - } - - private boolean isTruncatable() { - return false; - } - - private TypeCode createTypeCode(ORB orb) { - return new TypeCodeImpl(orb, TCKind._tk_value, repId, getClassName(repId), getTypeModifier(), getTypeCode(baseRepId), createMembers()); - } - - private String getClassName(String repId) { - return repId.split(":")[1]; - } - - private TypeCode getTypeCode(String repId) { - return Optional.ofNullable(repId).map(FVDBuilder::getMeta).map(f -> f.type).orElse(null); - } - - public short getTypeModifier() { - return isCustom() ? VM_CUSTOM.value : - isTruncatable() ? VM_TRUNCATABLE.value : - isAbstract() ? VM_ABSTRACT.value : VM_NONE.value; - } - - private ValueMember[] createMembers() { - return fields.stream().map(FieldBuilder::build).toArray(ValueMember[]::new); - } - - private static TypeCode fromType(ORB orb, Class type) { - if (type.equals(char.class)) - return new TypeCodeImpl(orb, TCKind._tk_wchar); - else if (type.equals(boolean.class)) - return new TypeCodeImpl(orb, TCKind._tk_boolean); - else if (type.equals(byte.class)) - return new TypeCodeImpl(orb, TCKind._tk_octet); - else if (type.equals(short.class)) - return new TypeCodeImpl(orb, TCKind._tk_short); - else if (type.equals(int.class)) - return new TypeCodeImpl(orb, TCKind._tk_long); - else if (type.equals(float.class)) - return new TypeCodeImpl(orb, TCKind._tk_float); - else if (type.equals(double.class)) - return new TypeCodeImpl(orb, TCKind._tk_double); - else if (type.equals(String.class)) - return new TypeCodeImpl(orb, TCKind._tk_value); - else if (type.equals(long.class)) - return new TypeCodeImpl(orb, TCKind._tk_longlong); - else - throw new RuntimeException("Test doesn't support type codes for " + type); - } - - private static abstract class FieldBuilder { - final String fieldName; - - public FieldBuilder(String fieldName) { - this.fieldName = fieldName; - } - - public abstract ValueMember build(); - } - - private static class PrimitiveFieldBuilder extends FieldBuilder { - - final Class fieldClass; - - PrimitiveFieldBuilder(String fieldName, Class fieldClass) { - super(fieldName); - this.fieldClass = fieldClass; - } - - @Override - public ValueMember build() { - return new ValueMember(fieldName, getRepositoryId(), "", "", fromType(orb, fieldClass), null, (short) 0); - } - - private String getRepositoryId() { - return fieldClass.equals(String.class) - ? RepositoryId.kWStringValueRepID - : RepositoryId.createForJavaType(fieldClass); + private static Map metas; + private static ORB orb; + + private String repId; + private boolean customMarshalled; + private List fields = new ArrayList<>(); + private String baseRepId; + + private FVDBuilder(String repId) { + this.repId = repId; + } + + /** + * Initializes this class for a new unit test. This clears any existing FVDs and specifies the ORB to be used to create + * new ones. + * + * @param orb an ORB used to create TypeCodes. + */ + static void initialize(ORB orb) { + FVDBuilder.orb = orb; + metas = new HashMap<>(); + } + + /** + * Obtains the FVD for the specified repository ID. + * + * @param repositoryID the repository ID to look up + * @throws RuntimeException if a FVD has not been defined for the repository ID + * @return the matching FVD + */ + static FullValueDescription getMeta(String repositoryID) { + return Optional.ofNullable(metas.get(repositoryID)).orElseThrow(() -> new RuntimeException("No FVD defined for " + repositoryID)); } - } - private static class ValueFieldBuilder extends FieldBuilder { + /** + * Creates a builder for a FVD, specifying the CORBA repository ID + * + * @param repId the respository ID + * @return the new builder + */ + static FVDBuilder defineFullValueDescription(String repId) { + return new FVDBuilder(repId); + } + + /** + * Modifies this builder to set the is_custom flag of the FVD it will create. + * + * @return this object + */ + FVDBuilder withCustomMarshalling() { + customMarshalled = true; + return this; + } - private final String repositoryID; + /** + * Modifies this builder to specify a base class, using its repository iD. This will set the baseValue flag of the + * create FVD. + * + * @param repId the repository ID of the base class + * @return this object + */ + FVDBuilder withBaseRepId(String repId) { + baseRepId = repId; + return this; + } + + /** + * Modifies this builder to add a primitive or String member field. This will add an entry to the members entry of the + * created FVD. + * + * @param fieldName the name of the field + * @param fieldClass the class that will be used to select a repository ID for the member + * @return this object + */ + FVDBuilder withMember(String fieldName, Class fieldClass) { + if (!fieldClass.equals(String.class) && !fieldClass.isPrimitive()) + throw new RuntimeException( + String.format("%s field %s is not primitive; define it with its repository ID", fieldClass.getName(), fieldName)); + + fields.add(new PrimitiveFieldBuilder(fieldName, fieldClass)); + return this; + } - public ValueFieldBuilder(String fieldName, String repositoryID) { - super(fieldName); - this.repositoryID = repositoryID; + /** + * Modifies this builder to add a member field of a Java class type. This will add an entry to the members entry of the + * created FVD. + * + * @param fieldName the name of the field + * @param repId the repository ID for the field + * @return this object + */ + FVDBuilder withMember(String fieldName, String repId) { + fields.add(new ValueFieldBuilder(fieldName, repId)); + return this; } - @Override - public ValueMember build() { - return new ValueMember(fieldName, repositoryID, "", "", getMeta(repositoryID).type, null, (short) 0); + /** + * Creates a FullValueDescription from the builder configuration, and caches it. Callers may obtain the FVD by invoking + * {@link #getMeta(String)}. + */ + public void build() { + FullValueDescription fvd = new FullValueDescription("", repId, isAbstract(), isCustom(), "", "", new OperationDescription[0], + new AttributeDescription[0], createMembers(), new Initializer[0], new String[0], new String[0], isTruncatable(), baseRepId, + createTypeCode(orb)); + metas.put(repId, fvd); } - } + private boolean isCustom() { + return customMarshalled; + } + + private boolean isAbstract() { + return false; + } + + private boolean isTruncatable() { + return false; + } + + private TypeCode createTypeCode(ORB orb) { + return new TypeCodeImpl(orb, TCKind._tk_value, repId, getClassName(repId), getTypeModifier(), getTypeCode(baseRepId), + createMembers()); + } + + private String getClassName(String repId) { + return repId.split(":")[1]; + } + + private TypeCode getTypeCode(String repId) { + return Optional.ofNullable(repId).map(FVDBuilder::getMeta).map(f -> f.type).orElse(null); + } + + public short getTypeModifier() { + return isCustom() ? VM_CUSTOM.value : isTruncatable() ? VM_TRUNCATABLE.value : isAbstract() ? VM_ABSTRACT.value : VM_NONE.value; + } + + private ValueMember[] createMembers() { + return fields.stream().map(FieldBuilder::build).toArray(ValueMember[]::new); + } + + private static TypeCode fromType(ORB orb, Class type) { + if (type.equals(char.class)) + return new TypeCodeImpl(orb, TCKind._tk_wchar); + else if (type.equals(boolean.class)) + return new TypeCodeImpl(orb, TCKind._tk_boolean); + else if (type.equals(byte.class)) + return new TypeCodeImpl(orb, TCKind._tk_octet); + else if (type.equals(short.class)) + return new TypeCodeImpl(orb, TCKind._tk_short); + else if (type.equals(int.class)) + return new TypeCodeImpl(orb, TCKind._tk_long); + else if (type.equals(float.class)) + return new TypeCodeImpl(orb, TCKind._tk_float); + else if (type.equals(double.class)) + return new TypeCodeImpl(orb, TCKind._tk_double); + else if (type.equals(String.class)) + return new TypeCodeImpl(orb, TCKind._tk_value); + else if (type.equals(long.class)) + return new TypeCodeImpl(orb, TCKind._tk_longlong); + else + throw new RuntimeException("Test doesn't support type codes for " + type); + } + + private static abstract class FieldBuilder { + final String fieldName; + + public FieldBuilder(String fieldName) { + this.fieldName = fieldName; + } + + public abstract ValueMember build(); + } + + private static class PrimitiveFieldBuilder extends FieldBuilder { + + final Class fieldClass; + + PrimitiveFieldBuilder(String fieldName, Class fieldClass) { + super(fieldName); + this.fieldClass = fieldClass; + } + + @Override + public ValueMember build() { + return new ValueMember(fieldName, getRepositoryId(), "", "", fromType(orb, fieldClass), null, (short) 0); + } + + private String getRepositoryId() { + return fieldClass.equals(String.class) ? RepositoryId.kWStringValueRepID : RepositoryId.createForJavaType(fieldClass); + } + } + + private static class ValueFieldBuilder extends FieldBuilder { + + private final String repositoryID; + + public ValueFieldBuilder(String fieldName, String repositoryID) { + super(fieldName); + this.repositoryID = repositoryID; + } + + @Override + public ValueMember build() { + return new ValueMember(fieldName, repositoryID, "", "", getMeta(repositoryID).type, null, (short) 0); + } + + } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FVDInputValueTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FVDInputValueTest.java index ce035b247..1d48f65d0 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FVDInputValueTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FVDInputValueTest.java @@ -36,449 +36,393 @@ public class FVDInputValueTest extends ValueTestBase { - private static final int INT_TO_IGNORE = 7; - - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - defineOriginalValue1FVD(); - defineEvolvedValue1FVD(); - } - - private void defineOriginalValue1FVD() { - defineFullValueDescription(Value1.REPID) - .withMember("aChar", char.class) - .withMember("anInt", int.class) - .build(); - } - - private void defineEvolvedValue1FVD() { - defineFullValueDescription(VALUE1_REPID2) - .withMember("aChar", char.class) - .withMember("ignoreMe", int.class) - .withMember("anInt", int.class) - .build(); - } - - static final String VALUE1_REPID2 = getVariantRepId(Value1.REPID); - - private static String getVariantRepId(String localRepId) { - final String[] split = localRepId.split(":", 4); - split[2] = reverse(split[2]); - return String.join(":", split); - } - - private static String reverse(String s) { - return new StringBuilder(s).reverse().toString(); - } - - @Test - public void canReadSerializedValueWithMismatchedRepIDAndExtraFields() throws IOException { - writeValueTag(ONE_REPID_ID); - writeRepId(VALUE1_REPID2); - - writeWchar_1_2('x'); - writeInt(7); - writeInt(3); - - Value1 value1 = readValueFromGeneratedBody(Value1.class); - assertEquals('x', value1.aChar); - assertEquals(3, value1.anInt); - } - - @Test - public void canReadDerivedValueWithExtraFields() throws IOException { - defineDerivedValueFVD(); - - writeValueTag(ONE_REPID_ID); - writeRepId(DERIVED_VALUE_REPID); - - writeWchar_1_2('x'); - writeInt(7); - writeInt(3); - - writeByte(1); - writeByte(0x34); - writeFloat(0.25f); - writeShort((short) 24); - - DerivedValue value = readValueFromGeneratedBody(DerivedValue.class); - - assertEquals('x', value.aChar); - assertEquals(3, value.anInt); - assertTrue(value.ready); - assertEquals(0x34, value.aByte); - assertEquals(24, value.aShort); - } - - private void defineDerivedValueFVD() { - defineFullValueDescription(DERIVED_VALUE_REPID) - .withBaseRepId(VALUE1_REPID2) - .withMember("ready", boolean.class) - .withMember("aByte", byte.class) - .withMember("extra", float.class) - .withMember("aShort", short.class) - .build(); - } - - static final String DERIVED_VALUE_REPID = getVariantRepId(RepositoryId.createForJavaType(DerivedValue.class)); - - @Test - public void canReadDerivedValue_whenSenderHasAdditionalSuperclasses() throws IOException { - defineDerivedWithDefaultMarshalledGhostSuperclassesFVD(); - - writeValueTag(ONE_REPID_ID); - writeRepId(DERIVED_VALUE_REPID); - - writeInt(72); // skipped - writeByte(0); // members - writeShort((short) -5); // of - writeLong(987654L); // ghost superclass 1 - - writeByte(0); - writeWchar_1_2('y'); - writeFloat(123.45F); - writeDouble(987.654); - - writeWchar_1_2('x'); - writeInt(7); - writeInt(3); - - writeByte(1); - writeByte(0x34); - writeFloat(0.25f); - writeShort((short) 24); - - DerivedValue value = readValueFromGeneratedBody(DerivedValue.class); - - assertEquals('x', value.aChar); - assertEquals(3, value.anInt); - assertTrue(value.ready); - assertEquals(0x34, value.aByte); - assertEquals(24, value.aShort); - } - - private static final String UNKNOWN_CLASS_PATTERN = "RMI:%s:AC117E28FE36587A:686A81014B597419"; - - private static String createUnknownClassRepId(String className) { - return String.format(UNKNOWN_CLASS_PATTERN, className); - } - private static final String GHOST_SUPERCLASS_1_REPID = createUnknownClassRepId("no.such.class.1"); - private static final String GHOST_SUPERCLASS_2_REPID = createUnknownClassRepId("no.such.class.2"); - - private void defineDerivedWithDefaultMarshalledGhostSuperclassesFVD() { - defineValue1FvdWithGhostSuperclasses(); - defineFullValueDescription(DERIVED_VALUE_REPID) - .withBaseRepId(VALUE1_REPID2) - .withMember("ready", boolean.class) - .withMember("aByte", byte.class) - .withMember("extra", int.class) - .withMember("aShort", short.class) - .build(); - } - - - private void defineValue1FvdWithGhostSuperclasses() { - defineGhostSuperclass2FVD(); - defineFullValueDescription(VALUE1_REPID2) - .withBaseRepId(GHOST_SUPERCLASS_2_REPID) - .withMember("aChar", char.class) - .withMember("extra", float.class) - .withMember("anInt", int.class) - .build(); - } - - - private void defineGhostSuperclass2FVD() { - defineGhostSuperclass1FVD(); - defineFullValueDescription(GHOST_SUPERCLASS_2_REPID) - .withBaseRepId(GHOST_SUPERCLASS_1_REPID) - .withMember("noSuchBoolean", boolean.class) - .withMember("noSuchChar", char.class) - .withMember("noSuchFloat", float.class) - .withMember("noSuchDouble", double.class) - .build(); - - } - private void defineGhostSuperclass1FVD() { - defineFullValueDescription(GHOST_SUPERCLASS_1_REPID) - .withMember("noSuchInt", int.class) - .withMember("noSuchByte", byte.class) - .withMember("noSuchShort", short.class) - .withMember("noSuchLong", long.class) - .build(); - } - - final boolean BAD_STATE_MACHINE=true; - - @Test - public void canReadDerivedValue_whenSenderHasUnknownCustomMarshalledSuperclass() throws IOException { - assumeFalse(BAD_STATE_MACHINE); - checkReadDerivedValueWithUnknownCustomMarshalledSuperclass(false); - } - - @Test - public void canReadDerivedValue_whenSenderHasUnknownCustomMarshalledSuperclassCallingDefaultWrite() throws IOException { - checkReadDerivedValueWithUnknownCustomMarshalledSuperclass(true); - } - - private void checkReadDerivedValueWithUnknownCustomMarshalledSuperclass(boolean defaultWriteObjectCalled) throws IOException { - defineValue1FvdWithCustomMarshalledGhostSuperclass(); - - useStreamFormatVersion1(); - writeValueTag(ONE_REPID_ID); - writeRepId(VALUE1_REPID2); - startCustomMarshalingFormat(defaultWriteObjectCalled); - - writeShort((short) -5); // skipped members of - writeLong(987654L); // ghost superclass - - writeWchar_1_2('x'); - writeInt(7); - writeInt(3); - - Value1 value = readValueFromGeneratedBody(Value1.class); - - assertEquals('x', value.aChar); - assertEquals(3, value.anInt); - } - - private void defineValue1FvdWithCustomMarshalledGhostSuperclass() { - defineCustomMarshalledGhostSuperclassFVD(); - defineFullValueDescription(VALUE1_REPID2) - .withBaseRepId(GHOST_SUPERCLASS_1_REPID) - .withMember("aChar", char.class) - .withMember("extra", float.class) - .withMember("anInt", int.class) - .build(); - } - - private void defineCustomMarshalledGhostSuperclassFVD() { - defineFullValueDescription(GHOST_SUPERCLASS_1_REPID) - .withCustomMarshalling() - .withMember("noSuchShort", short.class) - .withMember("noSuchLong", long.class) - .build(); - } - - - @Test @Ignore("There is code that is supposed to handle this, but it appears to be wrong") - public void canReadDerivedValue_whenSenderHasUnknownCustomMarshalledSuperclassSfv2() throws IOException { - defineValue1FvdWithCustomMarshalledGhostSuperclass(); - - useStreamFormatVersion2(); - writeValueTag(ONE_REPID_ID | USE_CHUNKING); - writeRepId(VALUE1_REPID2); - - startChunk(); - startCustomMarshalingFormat(true); - writeShort((short) -5); // skipped members of - writeLong(987654L); // ghost superclass - - writeWchar_1_2('x'); - writeInt(7); - writeInt(3); - endChunk(); - startChunk(); - writeInt(0); // no optional data - endChunk(); - - writeValueTag(ONE_REPID_ID | USE_CHUNKING); - writeCustomRepId(VALUE1_REPID2); - startChunk(); - writeLong(0); - endChunk(); - writeEndTag(-1); - - dumpBuffer(); - - Value1 value = readValueFromGeneratedBody(Value1.class); - - assertEquals('x', value.aChar); - assertEquals(3, value.anInt); - } - - @Test - public void canReadCompoundValueWithExtraFields() throws IOException { - final long long_value = 1234567890L; - defineValue2Fvd(); - - writeValueTag(ONE_REPID_ID); - writeRepId(VALUE2_REPID2); - - writeLong(long_value); - writeFloat(73.0F); - writeValueTag(ONE_REPID_ID + USE_CHUNKING); - writeRepId(VALUE1_REPID2); - startChunk(); - writeWchar_1_2('x'); - writeInt(INT_TO_IGNORE); - writeInt(3); - endChunk(); - writeEndTag(-1); - - Value2 value = readValueFromGeneratedBody(Value2.class); - - assertEquals('x', value.aValue.aChar); - assertEquals(3, value.aValue.anInt); - assertEquals(long_value, value.aLong); - } - - private void defineValue2Fvd() { - defineFullValueDescription(VALUE2_REPID2) - .withMember("aLong", long.class) - .withMember("extra", float.class) - .withMember("aValue", VALUE1_REPID2) - .build(); - } - - static final String VALUE2_REPID2 = getVariantRepId(Value2.REPID); - - @Test - public void canReadValueWithCustomMarshaling() throws IOException { - defineCustomMarshalledValueFvd(); - - useStreamFormatVersion1(); - writeValueTag(ONE_REPID_ID); - writeRepId(CUSTOM_VALUE_REPID); - startCustomMarshalingFormat(true); - writeDouble(12.34); - - writeValueTag(ONE_REPID_ID); - writeRepId(Value1.REPID); - writeWchar_1_2('x'); - writeInt(3); - - writeInt(INT_TO_IGNORE); - writeFloat(127.0F); - - writeDouble(12.0); - - CustomMarshalledValue value = readValueFromGeneratedBody(CustomMarshalledValue.class); - - assertEquals('x', value.value1.aChar); - assertEquals(3, value.value1.anInt); - assertEquals(12.34, value.aDouble, 0.01); - assertEquals(127.0F, value.aFloat, 0.01); - assertEquals(12.0, value.customDouble, 0.01); - } - - private void defineCustomMarshalledValueFvd() { - defineFullValueDescription(CUSTOM_VALUE_REPID) - .withCustomMarshalling() - .withMember("aDouble", double.class) - .withMember("value1", Value1.REPID) - .withMember("extra", int.class) - .withMember("aFloat", float.class) - .build(); - } - - static final String CUSTOM_VALUE_REPID = getVariantRepId(RepositoryId.createForJavaType(CustomMarshalledValue.class)); - - @Test - public void canReadValueWithCustomWriteMarshaling() throws IOException { - defineCustomWriteValueFvd(); - - useStreamFormatVersion1(); - writeValueTag(ONE_REPID_ID); - writeRepId(CUSTOM_WRITE_VALUE_REPID); - startCustomMarshalingFormat(true); - writeInt(INT_TO_IGNORE); - writeInt(73); - - CustomWriteClass value = readValueFromGeneratedBody(CustomWriteClass.class); - - assertEquals(73, value.aPositiveValue); - } - - private void defineCustomWriteValueFvd() { - defineFullValueDescription(CUSTOM_WRITE_VALUE_REPID) - .withCustomMarshalling() - .withMember("extra", int.class) - .withMember("aPositiveValue", int.class) - .build(); - } - - static final String CUSTOM_WRITE_VALUE_REPID = getVariantRepId(RepositoryId.createForJavaType(CustomWriteClass.class)); - - @Test - public void canReadValueWithCustomReadMarshaling() throws IOException { - defineCustomReadValueFvd(); - - useStreamFormatVersion1(); - writeValueTag(ONE_REPID_ID); - writeRepId(CUSTOM_READ_VALUE_REPID); - startCustomMarshalingFormat(false); - writeInt(INT_TO_IGNORE); - writeInt(-73); - - CustomReadClass value = readValueFromGeneratedBody(CustomReadClass.class); - - assertEquals(1, value.aPositiveValue); - } - - private void defineCustomReadValueFvd() { - defineFullValueDescription(CUSTOM_READ_VALUE_REPID) - .withMember("extra", int.class) - .withMember("aPositiveValue", int.class) - .build(); - } - - static final String CUSTOM_READ_VALUE_REPID = getVariantRepId(RepositoryId.createForJavaType(CustomReadClass.class)); - - @Test - public void canReadValueUsingFields() throws IOException { - defineCustomAllTypesFieldsFvd(); - - useStreamFormatVersion1(); - writeValueTag(ONE_REPID_ID); - writeRepId(CUSTOM_ALL_FIELDS_REPID); - startCustomMarshalingFormat(true); - - writeByte(1); - writeByte(14); - writeWchar_1_2('a'); - writeShort((short) 13); - writeInt(357); - writeLong(234567L); - writeFloat(2.56F); - writeDouble(204.8); - - writeValueTag(ONE_REPID_ID); - writeRepId(RepositoryId.kWStringValueRepID); - writeStringValue_1_2("And this"); - - AllTypesFields object = readValueFromGeneratedBody(AllTypesFields.class); - - assertThat(object.getBooleanField(), is(true)); - assertThat(object.getByteField(), equalTo((byte) 14)); - assertThat(object.getCharField(), equalTo('a')); - assertThat(object.getDoubleField(), equalTo(204.8)); - assertThat(object.getFloatField(), equalTo(2.56F)); - assertThat(object.getLongField(), equalTo(234567L)); - assertThat(object.getIntField(), equalTo(357)); - assertThat(object.getShortField(), equalTo((short) 13)); - assertThat(object.getStringField(), equalTo("And this")); - } - - private void defineCustomAllTypesFieldsFvd() { - defineFullValueDescription(CUSTOM_ALL_FIELDS_REPID) - .withCustomMarshalling() - .withMember("aBoolean", boolean.class) - .withMember("aByte", byte.class) - .withMember("aChar", char.class) - .withMember("aShort", short.class) - .withMember("anInt", int.class) - .withMember("aLong", long.class) - .withMember("aFloat", float.class) - .withMember("aDouble", double.class) - .withMember("aString", String.class) - .build(); - - } - static final String CUSTOM_ALL_FIELDS_REPID = getVariantRepId(RepositoryId.createForJavaType(AllTypesFields.class)); - - // todo serial version 1: custom marshalling, more field types - // todo serial version 2: ordinary class. serializable super class, nested class, custom marshalling + private static final int INT_TO_IGNORE = 7; + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + defineOriginalValue1FVD(); + defineEvolvedValue1FVD(); + } + + private void defineOriginalValue1FVD() { + defineFullValueDescription(Value1.REPID).withMember("aChar", char.class).withMember("anInt", int.class).build(); + } + + private void defineEvolvedValue1FVD() { + defineFullValueDescription(VALUE1_REPID2).withMember("aChar", char.class).withMember("ignoreMe", int.class) + .withMember("anInt", int.class).build(); + } + + static final String VALUE1_REPID2 = getVariantRepId(Value1.REPID); + + private static String getVariantRepId(String localRepId) { + final String[] split = localRepId.split(":", 4); + split[2] = reverse(split[2]); + return String.join(":", split); + } + + private static String reverse(String s) { + return new StringBuilder(s).reverse().toString(); + } + + @Test + public void canReadSerializedValueWithMismatchedRepIDAndExtraFields() throws IOException { + writeValueTag(ONE_REPID_ID); + writeRepId(VALUE1_REPID2); + + writeWchar_1_2('x'); + writeInt(7); + writeInt(3); + + Value1 value1 = readValueFromGeneratedBody(Value1.class); + assertEquals('x', value1.aChar); + assertEquals(3, value1.anInt); + } + + @Test + public void canReadDerivedValueWithExtraFields() throws IOException { + defineDerivedValueFVD(); + + writeValueTag(ONE_REPID_ID); + writeRepId(DERIVED_VALUE_REPID); + + writeWchar_1_2('x'); + writeInt(7); + writeInt(3); + + writeByte(1); + writeByte(0x34); + writeFloat(0.25f); + writeShort((short) 24); + + DerivedValue value = readValueFromGeneratedBody(DerivedValue.class); + + assertEquals('x', value.aChar); + assertEquals(3, value.anInt); + assertTrue(value.ready); + assertEquals(0x34, value.aByte); + assertEquals(24, value.aShort); + } + + private void defineDerivedValueFVD() { + defineFullValueDescription(DERIVED_VALUE_REPID).withBaseRepId(VALUE1_REPID2).withMember("ready", boolean.class) + .withMember("aByte", byte.class).withMember("extra", float.class).withMember("aShort", short.class).build(); + } + + static final String DERIVED_VALUE_REPID = getVariantRepId(RepositoryId.createForJavaType(DerivedValue.class)); + + @Test + public void canReadDerivedValue_whenSenderHasAdditionalSuperclasses() throws IOException { + defineDerivedWithDefaultMarshalledGhostSuperclassesFVD(); + + writeValueTag(ONE_REPID_ID); + writeRepId(DERIVED_VALUE_REPID); + + writeInt(72); // skipped + writeByte(0); // members + writeShort((short) -5); // of + writeLong(987654L); // ghost superclass 1 + + writeByte(0); + writeWchar_1_2('y'); + writeFloat(123.45F); + writeDouble(987.654); + + writeWchar_1_2('x'); + writeInt(7); + writeInt(3); + + writeByte(1); + writeByte(0x34); + writeFloat(0.25f); + writeShort((short) 24); + + DerivedValue value = readValueFromGeneratedBody(DerivedValue.class); + + assertEquals('x', value.aChar); + assertEquals(3, value.anInt); + assertTrue(value.ready); + assertEquals(0x34, value.aByte); + assertEquals(24, value.aShort); + } + + private static final String UNKNOWN_CLASS_PATTERN = "RMI:%s:AC117E28FE36587A:686A81014B597419"; + + private static String createUnknownClassRepId(String className) { + return String.format(UNKNOWN_CLASS_PATTERN, className); + } + + private static final String GHOST_SUPERCLASS_1_REPID = createUnknownClassRepId("no.such.class.1"); + private static final String GHOST_SUPERCLASS_2_REPID = createUnknownClassRepId("no.such.class.2"); + + private void defineDerivedWithDefaultMarshalledGhostSuperclassesFVD() { + defineValue1FvdWithGhostSuperclasses(); + defineFullValueDescription(DERIVED_VALUE_REPID).withBaseRepId(VALUE1_REPID2).withMember("ready", boolean.class) + .withMember("aByte", byte.class).withMember("extra", int.class).withMember("aShort", short.class).build(); + } + + private void defineValue1FvdWithGhostSuperclasses() { + defineGhostSuperclass2FVD(); + defineFullValueDescription(VALUE1_REPID2).withBaseRepId(GHOST_SUPERCLASS_2_REPID).withMember("aChar", char.class) + .withMember("extra", float.class).withMember("anInt", int.class).build(); + } + + private void defineGhostSuperclass2FVD() { + defineGhostSuperclass1FVD(); + defineFullValueDescription(GHOST_SUPERCLASS_2_REPID).withBaseRepId(GHOST_SUPERCLASS_1_REPID) + .withMember("noSuchBoolean", boolean.class).withMember("noSuchChar", char.class).withMember("noSuchFloat", float.class) + .withMember("noSuchDouble", double.class).build(); + + } + + private void defineGhostSuperclass1FVD() { + defineFullValueDescription(GHOST_SUPERCLASS_1_REPID).withMember("noSuchInt", int.class).withMember("noSuchByte", byte.class) + .withMember("noSuchShort", short.class).withMember("noSuchLong", long.class).build(); + } + + final boolean BAD_STATE_MACHINE = true; + + @Test + public void canReadDerivedValue_whenSenderHasUnknownCustomMarshalledSuperclass() throws IOException { + assumeFalse(BAD_STATE_MACHINE); + checkReadDerivedValueWithUnknownCustomMarshalledSuperclass(false); + } + + @Test + public void canReadDerivedValue_whenSenderHasUnknownCustomMarshalledSuperclassCallingDefaultWrite() throws IOException { + checkReadDerivedValueWithUnknownCustomMarshalledSuperclass(true); + } + + private void checkReadDerivedValueWithUnknownCustomMarshalledSuperclass(boolean defaultWriteObjectCalled) throws IOException { + defineValue1FvdWithCustomMarshalledGhostSuperclass(); + + useStreamFormatVersion1(); + writeValueTag(ONE_REPID_ID); + writeRepId(VALUE1_REPID2); + startCustomMarshalingFormat(defaultWriteObjectCalled); + + writeShort((short) -5); // skipped members of + writeLong(987654L); // ghost superclass + + writeWchar_1_2('x'); + writeInt(7); + writeInt(3); + + Value1 value = readValueFromGeneratedBody(Value1.class); + + assertEquals('x', value.aChar); + assertEquals(3, value.anInt); + } + + private void defineValue1FvdWithCustomMarshalledGhostSuperclass() { + defineCustomMarshalledGhostSuperclassFVD(); + defineFullValueDescription(VALUE1_REPID2).withBaseRepId(GHOST_SUPERCLASS_1_REPID).withMember("aChar", char.class) + .withMember("extra", float.class).withMember("anInt", int.class).build(); + } + + private void defineCustomMarshalledGhostSuperclassFVD() { + defineFullValueDescription(GHOST_SUPERCLASS_1_REPID).withCustomMarshalling().withMember("noSuchShort", short.class) + .withMember("noSuchLong", long.class).build(); + } + + @Test + @Ignore("There is code that is supposed to handle this, but it appears to be wrong") + public void canReadDerivedValue_whenSenderHasUnknownCustomMarshalledSuperclassSfv2() throws IOException { + defineValue1FvdWithCustomMarshalledGhostSuperclass(); + + useStreamFormatVersion2(); + writeValueTag(ONE_REPID_ID | USE_CHUNKING); + writeRepId(VALUE1_REPID2); + + startChunk(); + startCustomMarshalingFormat(true); + writeShort((short) -5); // skipped members of + writeLong(987654L); // ghost superclass + + writeWchar_1_2('x'); + writeInt(7); + writeInt(3); + endChunk(); + startChunk(); + writeInt(0); // no optional data + endChunk(); + + writeValueTag(ONE_REPID_ID | USE_CHUNKING); + writeCustomRepId(VALUE1_REPID2); + startChunk(); + writeLong(0); + endChunk(); + writeEndTag(-1); + + dumpBuffer(); + + Value1 value = readValueFromGeneratedBody(Value1.class); + + assertEquals('x', value.aChar); + assertEquals(3, value.anInt); + } + + @Test + public void canReadCompoundValueWithExtraFields() throws IOException { + final long long_value = 1234567890L; + defineValue2Fvd(); + + writeValueTag(ONE_REPID_ID); + writeRepId(VALUE2_REPID2); + + writeLong(long_value); + writeFloat(73.0F); + writeValueTag(ONE_REPID_ID + USE_CHUNKING); + writeRepId(VALUE1_REPID2); + startChunk(); + writeWchar_1_2('x'); + writeInt(INT_TO_IGNORE); + writeInt(3); + endChunk(); + writeEndTag(-1); + + Value2 value = readValueFromGeneratedBody(Value2.class); + + assertEquals('x', value.aValue.aChar); + assertEquals(3, value.aValue.anInt); + assertEquals(long_value, value.aLong); + } + + private void defineValue2Fvd() { + defineFullValueDescription(VALUE2_REPID2).withMember("aLong", long.class).withMember("extra", float.class) + .withMember("aValue", VALUE1_REPID2).build(); + } + + static final String VALUE2_REPID2 = getVariantRepId(Value2.REPID); + + @Test + public void canReadValueWithCustomMarshaling() throws IOException { + defineCustomMarshalledValueFvd(); + + useStreamFormatVersion1(); + writeValueTag(ONE_REPID_ID); + writeRepId(CUSTOM_VALUE_REPID); + startCustomMarshalingFormat(true); + writeDouble(12.34); + + writeValueTag(ONE_REPID_ID); + writeRepId(Value1.REPID); + writeWchar_1_2('x'); + writeInt(3); + + writeInt(INT_TO_IGNORE); + writeFloat(127.0F); + + writeDouble(12.0); + + CustomMarshalledValue value = readValueFromGeneratedBody(CustomMarshalledValue.class); + + assertEquals('x', value.value1.aChar); + assertEquals(3, value.value1.anInt); + assertEquals(12.34, value.aDouble, 0.01); + assertEquals(127.0F, value.aFloat, 0.01); + assertEquals(12.0, value.customDouble, 0.01); + } + + private void defineCustomMarshalledValueFvd() { + defineFullValueDescription(CUSTOM_VALUE_REPID).withCustomMarshalling().withMember("aDouble", double.class) + .withMember("value1", Value1.REPID).withMember("extra", int.class).withMember("aFloat", float.class).build(); + } + + static final String CUSTOM_VALUE_REPID = getVariantRepId(RepositoryId.createForJavaType(CustomMarshalledValue.class)); + + @Test + public void canReadValueWithCustomWriteMarshaling() throws IOException { + defineCustomWriteValueFvd(); + + useStreamFormatVersion1(); + writeValueTag(ONE_REPID_ID); + writeRepId(CUSTOM_WRITE_VALUE_REPID); + startCustomMarshalingFormat(true); + writeInt(INT_TO_IGNORE); + writeInt(73); + + CustomWriteClass value = readValueFromGeneratedBody(CustomWriteClass.class); + + assertEquals(73, value.aPositiveValue); + } + + private void defineCustomWriteValueFvd() { + defineFullValueDescription(CUSTOM_WRITE_VALUE_REPID).withCustomMarshalling().withMember("extra", int.class) + .withMember("aPositiveValue", int.class).build(); + } + + static final String CUSTOM_WRITE_VALUE_REPID = getVariantRepId(RepositoryId.createForJavaType(CustomWriteClass.class)); + + @Test + public void canReadValueWithCustomReadMarshaling() throws IOException { + defineCustomReadValueFvd(); + + useStreamFormatVersion1(); + writeValueTag(ONE_REPID_ID); + writeRepId(CUSTOM_READ_VALUE_REPID); + startCustomMarshalingFormat(false); + writeInt(INT_TO_IGNORE); + writeInt(-73); + + CustomReadClass value = readValueFromGeneratedBody(CustomReadClass.class); + + assertEquals(1, value.aPositiveValue); + } + + private void defineCustomReadValueFvd() { + defineFullValueDescription(CUSTOM_READ_VALUE_REPID).withMember("extra", int.class).withMember("aPositiveValue", int.class).build(); + } + + static final String CUSTOM_READ_VALUE_REPID = getVariantRepId(RepositoryId.createForJavaType(CustomReadClass.class)); + + @Test + public void canReadValueUsingFields() throws IOException { + defineCustomAllTypesFieldsFvd(); + + useStreamFormatVersion1(); + writeValueTag(ONE_REPID_ID); + writeRepId(CUSTOM_ALL_FIELDS_REPID); + startCustomMarshalingFormat(true); + + writeByte(1); + writeByte(14); + writeWchar_1_2('a'); + writeShort((short) 13); + writeInt(357); + writeLong(234567L); + writeFloat(2.56F); + writeDouble(204.8); + + writeValueTag(ONE_REPID_ID); + writeRepId(RepositoryId.kWStringValueRepID); + writeStringValue_1_2("And this"); + + AllTypesFields object = readValueFromGeneratedBody(AllTypesFields.class); + + assertThat(object.getBooleanField(), is(true)); + assertThat(object.getByteField(), equalTo((byte) 14)); + assertThat(object.getCharField(), equalTo('a')); + assertThat(object.getDoubleField(), equalTo(204.8)); + assertThat(object.getFloatField(), equalTo(2.56F)); + assertThat(object.getLongField(), equalTo(234567L)); + assertThat(object.getIntField(), equalTo(357)); + assertThat(object.getShortField(), equalTo((short) 13)); + assertThat(object.getStringField(), equalTo("And this")); + } + + private void defineCustomAllTypesFieldsFvd() { + defineFullValueDescription(CUSTOM_ALL_FIELDS_REPID).withCustomMarshalling().withMember("aBoolean", boolean.class) + .withMember("aByte", byte.class).withMember("aChar", char.class).withMember("aShort", short.class) + .withMember("anInt", int.class).withMember("aLong", long.class).withMember("aFloat", float.class) + .withMember("aDouble", double.class).withMember("aString", String.class).build(); + + } + + static final String CUSTOM_ALL_FIELDS_REPID = getVariantRepId(RepositoryId.createForJavaType(AllTypesFields.class)); + + // todo serial version 1: custom marshalling, more field types + // todo serial version 2: ordinary class. serializable super class, nested class, custom marshalling } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FieldsIOValueTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FieldsIOValueTest.java index 2475da0a3..e32f185ca 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FieldsIOValueTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/FieldsIOValueTest.java @@ -30,94 +30,93 @@ public class FieldsIOValueTest extends ValueTestBase { + @Test + public void whenFieldsWrittenWithFormatVersion1_includeInSingleValue() throws IOException { + useStreamFormatVersion1(); + BigInteger bigInteger = new BigInteger("12345"); + getOutputObject().write_value(bigInteger); + + serializeDefaultData(bigInteger); + writeEndTag(-1); - @Test - public void whenFieldsWrittenWithFormatVersion1_includeInSingleValue() throws IOException { - useStreamFormatVersion1(); - BigInteger bigInteger = new BigInteger("12345"); - getOutputObject().write_value(bigInteger); - - serializeDefaultData(bigInteger); - writeEndTag(-1); - - setMessageBody(getGeneratedBody()); - expectByteArray(getGeneratedBody()); - } - - /** - * Write all but the end tag(s) for the Big Integer. - * - * @param bigInteger the value to write - * @throws IOException if something goes wrong - */ - private void serializeDefaultData(BigInteger bigInteger) throws IOException { - writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk - writeRepId(RepositoryId.createForJavaType(BigInteger.class)); - startChunk(); - startCustomMarshalingFormat(true); - writeInt(BIG_INTEGER_BIT_COUNT); - writeInt(BIG_INTEGER_BIT_LENGTH); - writeInt(BIG_INTEGER_FIRST_NONZERO_BYTE_NUM); - writeInt(BIG_INTEGER_LOWEST_SET_BIT); - writeInt(1); // sign value - endChunk(); - - writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk - writeRepId(RepositoryId.createForJavaType(byte[].class)); - startChunk(); - writeByteArray(bigInteger.toByteArray()); - endChunk(); - } - - // legacy values - final static int BIG_INTEGER_BIT_COUNT = -1; - final static int BIG_INTEGER_BIT_LENGTH = -1; - final static int BIG_INTEGER_FIRST_NONZERO_BYTE_NUM = -2; - final static int BIG_INTEGER_LOWEST_SET_BIT = -2; - - @Test - public void whenFieldsWrittenWithFormatVersion2_writeNullOptionalData() throws IOException { - useStreamFormatVersion2(); - BigInteger bigInteger = new BigInteger("123450"); - getOutputObject().write_value(bigInteger); - - serializeDefaultData(bigInteger); - writeEndTag(-2); - - startChunk(); - writeInt(0); // null to indicate no optional data is present (format version 2 only) - endChunk(); - writeEndTag(-1); - setMessageBody(getGeneratedBody()); - expectByteArray(getGeneratedBody()); - } + setMessageBody(getGeneratedBody()); + expectByteArray(getGeneratedBody()); + } + + /** + * Write all but the end tag(s) for the Big Integer. + * + * @param bigInteger the value to write + * @throws IOException if something goes wrong + */ + private void serializeDefaultData(BigInteger bigInteger) throws IOException { + writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk + writeRepId(RepositoryId.createForJavaType(BigInteger.class)); + startChunk(); + startCustomMarshalingFormat(true); + writeInt(BIG_INTEGER_BIT_COUNT); + writeInt(BIG_INTEGER_BIT_LENGTH); + writeInt(BIG_INTEGER_FIRST_NONZERO_BYTE_NUM); + writeInt(BIG_INTEGER_LOWEST_SET_BIT); + writeInt(1); // sign value + endChunk(); + + writeValueTag(ONE_REPID_ID | USE_CHUNKING); // custom marshalling requires a chunk + writeRepId(RepositoryId.createForJavaType(byte[].class)); + startChunk(); + writeByteArray(bigInteger.toByteArray()); + endChunk(); + } + + // legacy values + final static int BIG_INTEGER_BIT_COUNT = -1; + final static int BIG_INTEGER_BIT_LENGTH = -1; + final static int BIG_INTEGER_FIRST_NONZERO_BYTE_NUM = -2; + final static int BIG_INTEGER_LOWEST_SET_BIT = -2; + + @Test + public void whenFieldsWrittenWithFormatVersion2_writeNullOptionalData() throws IOException { + useStreamFormatVersion2(); + BigInteger bigInteger = new BigInteger("123450"); + getOutputObject().write_value(bigInteger); + + serializeDefaultData(bigInteger); + writeEndTag(-2); + + startChunk(); + writeInt(0); // null to indicate no optional data is present (format version 2 only) + endChunk(); + writeEndTag(-1); + setMessageBody(getGeneratedBody()); + expectByteArray(getGeneratedBody()); + } @Test public void whenFieldsWrittenWithFormatVersion1_ignoreOptionalData() throws IOException { - useStreamFormatVersion1(); - BigInteger bigInteger = new BigInteger("123450"); + useStreamFormatVersion1(); + BigInteger bigInteger = new BigInteger("123450"); - serializeDefaultData(bigInteger); - writeEndTag(-1); + serializeDefaultData(bigInteger); + writeEndTag(-1); - BigInteger value = readValueFromGeneratedBody(BigInteger.class); - assertThat(value, equalTo(bigInteger)); + BigInteger value = readValueFromGeneratedBody(BigInteger.class); + assertThat(value, equalTo(bigInteger)); } @Test public void whenFieldsWrittenWithFormatVersion2_readNullOptionalData() throws IOException { - useStreamFormatVersion2(); - BigInteger bigInteger = new BigInteger("123450"); + useStreamFormatVersion2(); + BigInteger bigInteger = new BigInteger("123450"); - serializeDefaultData(bigInteger); - writeEndTag(-2); + serializeDefaultData(bigInteger); + writeEndTag(-2); - startChunk(); - writeInt(0); // null to indicate no optional data is present (format version 2 only) - endChunk(); - writeEndTag(-1); + startChunk(); + writeInt(0); // null to indicate no optional data is present (format version 2 only) + endChunk(); + writeEndTag(-1); - BigInteger value = readValueFromGeneratedBody(BigInteger.class); - assertThat(value, equalTo(bigInteger)); + BigInteger value = readValueFromGeneratedBody(BigInteger.class); + assertThat(value, equalTo(bigInteger)); } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Gender.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Gender.java index bf0d4c4dc..19abab24d 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Gender.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Gender.java @@ -27,7 +27,7 @@ */ class Gender implements Serializable { private static final long serialVersionUID = 0x34789521D52D7FF2L; - + final static String REPID = "RMI:com.sun.corba.ee.impl.encoding.Gender\\U0024SerializedForm:F85634868214EB9C:34789521D52D7FF2"; final static Gender MALE = new Gender("Male"); final static Gender FEMALE = new Gender("Female"); @@ -40,9 +40,7 @@ private Gender(String name) { @Override public String toString() { - return "Gender{" + - "name='" + name + '\'' + - '}'; + return "Gender{" + "name='" + name + '\'' + '}'; } private Object writeReplace() throws ObjectStreamException { diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Profession.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Profession.java index 88b41c09f..928836fa6 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Profession.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Profession.java @@ -29,9 +29,10 @@ */ public class Profession implements Externalizable { private static final long serialVersionUID = 0x7123456789ABCDEFL; - public static final String REPID = "RMI:" + Profession.class.getName() + ":0000000000000001:" + Long.toHexString(serialVersionUID).toUpperCase(); + public static final String REPID = "RMI:" + Profession.class.getName() + ":0000000000000001:" + + Long.toHexString(serialVersionUID).toUpperCase(); - private static final String STRINGS[] = {"Rich Man", "Poor Man", "Beggar Man", "Thief", "Doctor", "Lawyer", "Indian Chief"}; + private static final String STRINGS[] = { "Rich Man", "Poor Man", "Beggar Man", "Thief", "Doctor", "Lawyer", "Indian Chief" }; static final Profession DOCTOR = new Profession("Doctor"); private static final int NOT_FOUND = -1; @@ -53,12 +54,14 @@ String getProfession() { public void writeExternal(ObjectOutput out) throws IOException { int i = getProfessionIndex(); out.writeInt(i); - if (i == NOT_FOUND) out.writeObject(profession); + if (i == NOT_FOUND) + out.writeObject(profession); } private int getProfessionIndex() { for (int i = 0; i < STRINGS.length; i++) - if (STRINGS[i].equalsIgnoreCase(profession)) return i; + if (STRINGS[i].equalsIgnoreCase(profession)) + return i; return NOT_FOUND; } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Value1Helper.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Value1Helper.java index 0b2aaa680..285bea73a 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Value1Helper.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/Value1Helper.java @@ -53,7 +53,6 @@ public String get_id() { } } - abstract class Value1Type extends TypeCode { short modifier; diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/ValueTestBase.java b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/ValueTestBase.java index ef48b0282..cd6f9c619 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/ValueTestBase.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/encoding/ValueTestBase.java @@ -113,7 +113,7 @@ protected void endChunk() throws IOException { } protected void writeStringValue_1_2(String value) throws IOException { - writeInt(2 + 2*value.length()); + writeInt(2 + 2 * value.length()); writeBigEndianMarker(); for (char aChar : value.toCharArray()) { out.write(0); @@ -179,11 +179,11 @@ protected void writeIndirectionTo(int location) throws IOException { @SuppressWarnings("unchecked") protected T readValueFromGeneratedBody(Class valueClass) { - setMessageBody(getGeneratedBody()); + setMessageBody(getGeneratedBody()); - Object object = getInputObject().read_value(); - assertTrue(valueClass.isInstance(object)); - return (T) object; + Object object = getInputObject().read_value(); + assertTrue(valueClass.isInstance(object)); + return (T) object; } static class DataByteOutputStream extends DataOutputStream { diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/folb/GroupManagerServiceInterceptorsTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/folb/GroupManagerServiceInterceptorsTest.java index 91b0974b2..51a4e7b00 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/folb/GroupManagerServiceInterceptorsTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/folb/GroupManagerServiceInterceptorsTest.java @@ -62,8 +62,8 @@ public class GroupManagerServiceInterceptorsTest implements GroupInfoServiceObse private final TestClientRequestInfo clientRequestInfo = createStrictStub(TestClientRequestInfo.class); private final TestContactInfo contactInfo = createStrictStub(TestContactInfo.class); - private static final byte[] COMPONENT_DATA_1 = new byte[]{0, 1, 2, 5, 6}; - private static final byte[] COMPONENT_DATA_2 = new byte[]{9, 3, 3}; + private static final byte[] COMPONENT_DATA_1 = new byte[] { 0, 1, 2, 5, 6 }; + private static final byte[] COMPONENT_DATA_2 = new byte[] { 9, 3, 3 }; private int numMembershipChanges; private IOR locatedIOR; @@ -102,7 +102,7 @@ public void whenClientGroupManagerInitialized_registerForCallbacks() { @Test public void whenRequestIORContainsNoFolbMembershipComponent_doNothing() throws ForwardRequest { - defineFolbMembershipTaggedComponents(); // No components defined + defineFolbMembershipTaggedComponents(); // No components defined sendRequest(); @@ -149,25 +149,24 @@ public void whenReceiveReplyWithFolbServiceContext_issueCallback() throws Forwar receiveReply(); assertEquals(1, numMembershipChanges); - assertEquals(ior,locatedIOR); + assertEquals(ior, locatedIOR); } private void setFolbIorUpdateContext(TestIOR ior) { - byte[] encodedIOR = {1,1,1,1}; - clientGroupManager.setIORWithEncoding(ior,encodedIOR); + byte[] encodedIOR = { 1, 1, 1, 1 }; + clientGroupManager.setIORWithEncoding(ior, encodedIOR); clientRequestInfo.setReplyServiceContext(new ServiceContext(ORBConstants.FOLB_IOR_UPDATE_SERVICE_CONTEXT_ID, encodedIOR)); } - public void clientInterceptorOnReceive_addsNewIORForListeners() { // when we receive a reply, if it has a service context of type ORBConstants.FOLB_IOR_UPDATE_SERVICE_CONTEXT_ID, // extract a forwarding IOR and notify any listeners. // (need this for receive_request, receive_exception, and receive_other) } - private void assertEqualData( byte[] expected, byte[] actual) { + private void assertEqualData(byte[] expected, byte[] actual) { if (!Arrays.equals(expected, actual)) - fail( "expected " + Arrays.toString(expected) + " but was " + Arrays.toString(actual)); + fail("expected " + Arrays.toString(expected) + " but was " + Arrays.toString(actual)); } private ServiceContext getFolbMembershipServiceContext() { @@ -210,7 +209,6 @@ private static TestIOR createIORWithFolbMembershipTaggedComponents(byte[]... com return TestIOR.createIORWithTaggedComponents(ORBConstants.FOLB_MEMBERSHIP_LABEL_TAGGED_COMPONENT_ID, taggedComponents); } - abstract static class TestORBInitInfo extends StubCorbaObject implements ORBInitInfo { List clientRequestInterceptors = new ArrayList(); @@ -222,13 +220,12 @@ public void add_client_request_interceptor(ClientRequestInterceptor interceptor) class TestClientGroupManager extends ClientGroupManager { - private TestIOR ior; private byte[] encodedIOR; @Override protected IOR extractIOR(byte[] data) { - assertEqualData(encodedIOR,data); + assertEqualData(encodedIOR, data); return ior; } @@ -273,7 +270,6 @@ public void setIIOPPrimaryToContactInfo(IIOPPrimaryToContactInfo IIOPPrimaryToCo } } - abstract static class TestORB extends ORB { private ORBData ORBData; private Map initialReferences = new HashMap(); @@ -295,12 +291,11 @@ public Object resolve_initial_references(String id) throws InvalidName { } } - abstract static public class TestClientRequestInfo implements ClientRequestInfo { private Object effectiveTarget; private String operation = ""; - private Map requestServiceContexts = new HashMap(); - private Map replyServiceContexts = new HashMap(); + private Map requestServiceContexts = new HashMap(); + private Map replyServiceContexts = new HashMap(); public Object effective_target() { return effectiveTarget; @@ -341,5 +336,4 @@ public int getPort() { } } - } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/folb/TestIOR.java b/orbmain/src/test/java/com/sun/corba/ee/impl/folb/TestIOR.java index 9de818412..ec5f53e8a 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/folb/TestIOR.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/folb/TestIOR.java @@ -84,7 +84,7 @@ abstract static class TestIIOPProfileTemplate implements IIOPProfileTemplate { private Map> taggedComponents = new HashMap>(); public void addTaggedComponent(int id, org.omg.IOP.TaggedComponent component) { - getTaggedComponentList(id).add(new TestTaggedComponent(id,component)); + getTaggedComponentList(id).add(new TestTaggedComponent(id, component)); } public Iterator iteratorById(int id) { @@ -123,5 +123,3 @@ public void write(OutputStream outputStream) { } } } - - diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/interceptors/CodecFactoryImplTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/interceptors/CodecFactoryImplTest.java index 7a82cd09e..f8db25b0d 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/interceptors/CodecFactoryImplTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/interceptors/CodecFactoryImplTest.java @@ -47,273 +47,282 @@ public class CodecFactoryImplTest extends EncodingTestBase { - private static final int GIOP_MAJOR_VERSION = 1; - private static final int MAX_GIOP_MINOR_VERSION = 2; - private static final double TOLERANCE = 0.01; - private static final BigDecimal FIXED_TOLERANCE = new BigDecimal(".001"); - - private ORB orb = getOrb(); - private CodecFactory codecFactory = new CodecFactoryImpl(orb); - private Any any = createAny(); - private Codec codec; - - @Before - public void setUpCodec() throws Exception { - codec = createCodec(GIOP_MAJOR_VERSION, MAX_GIOP_MINOR_VERSION); - } - - private Any createAny() { - return new AnyImpl(orb); - } - - @Test - public void supportCodecsForAllVersions() throws UnknownEncoding { - for (int minor = 0; minor <= MAX_GIOP_MINOR_VERSION; minor++) { - createCodec(GIOP_MAJOR_VERSION, minor); + private static final int GIOP_MAJOR_VERSION = 1; + private static final int MAX_GIOP_MINOR_VERSION = 2; + private static final double TOLERANCE = 0.01; + private static final BigDecimal FIXED_TOLERANCE = new BigDecimal(".001"); + + private ORB orb = getOrb(); + private CodecFactory codecFactory = new CodecFactoryImpl(orb); + private Any any = createAny(); + private Codec codec; + + @Before + public void setUpCodec() throws Exception { + codec = createCodec(GIOP_MAJOR_VERSION, MAX_GIOP_MINOR_VERSION); } - } - - private Codec createCodec(int major, int minor) throws UnknownEncoding { - return codecFactory.create_codec(createEncoding(major, minor)); - } - - private Encoding createEncoding(int majorVersion, int minor_version) { - return new Encoding(ENCODING_CDR_ENCAPS.value, (byte) majorVersion, (byte) minor_version); - } - - @Test (expected = UnknownEncoding.class) - public void codecNotSupportedFor_minorVersionTooHigh() throws UnknownEncoding { - createCodec(GIOP_MAJOR_VERSION, MAX_GIOP_MINOR_VERSION + 1); - } - - @Test (expected = UnknownEncoding.class) - public void codecNotSupportedFor_majorVersionTooHigh() throws UnknownEncoding { - createCodec(GIOP_MAJOR_VERSION + 1, 0); - } - - @Test - public void encodeDecodeNull() throws InvalidTypeForEncoding, FormatMismatch { - assertThat(codec.encode(any).length, equalTo(8)); - assertThat(codec.encode_value(any).length, equalTo(1)); - assertThat(encodeDecode().type().kind(), equalTo(TCKind.tk_null)); - } - - private Any encodeDecode() throws InvalidTypeForEncoding, FormatMismatch { - final byte[] bytes = codec.encode(any); - return codec.decode(bytes); - } - - @Test - public void encodeDecodeBoolean() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - any.insert_boolean(true); - - assertThat(codec.encode(any).length, equalTo(9)); - assertThat(codec.encode_value(any).length, equalTo(2)); - assertThat(encodeDecode().extract_boolean(), is(true)); - assertThat(encodeDecodeValue().extract_boolean(), is(true)); - } - - private Any encodeDecodeValue() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - final Codec codec = createCodec(GIOP_MAJOR_VERSION, MAX_GIOP_MINOR_VERSION); - final byte[] bytes = codec.encode_value(any); - return codec.decode_value(bytes, any.type()); - } - - @Test - public void encodeDecodeByte() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - any.insert_octet((byte) 123); - - assertThat(codec.encode(any).length, equalTo(9)); - assertThat(codec.encode_value(any).length, equalTo(2)); - assertThat(encodeDecode().extract_octet(), equalTo((byte) 123)); - assertThat(encodeDecodeValue().extract_octet(), equalTo((byte) 123)); - } - - @Test - public void encodeDecodeChar() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - any.insert_char('w'); - - assertThat(codec.encode(any).length, equalTo(9)); - assertThat(codec.encode_value(any).length, equalTo(2)); - assertThat(encodeDecode().extract_char(), equalTo('w')); - assertThat(encodeDecodeValue().extract_char(), equalTo('w')); - } - - @Test - public void encodeDecodeShort() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - any.insert_short((short) 123); - - assertThat(codec.encode(any).length, equalTo(10)); - assertThat(codec.encode_value(any).length, equalTo(4)); - assertThat(encodeDecode().extract_short(), equalTo((short) 123)); - assertThat(encodeDecodeValue().extract_short(), equalTo((short) 123)); - } - - @Test - public void encodeDecodeInt() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - any.insert_long(4520); - - assertThat(codec.encode(any).length, equalTo(12)); - assertThat(codec.encode_value(any).length, equalTo(8)); - assertThat(encodeDecode().extract_long(), equalTo(4520)); - assertThat(encodeDecodeValue().extract_long(), equalTo(4520)); - } - - @Test - public void encodeDecodeLong() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - any.insert_longlong(45203456L); - - assertThat(codec.encode(any).length, equalTo(16)); - assertThat(codec.encode_value(any).length, equalTo(16)); - assertThat(encodeDecode().extract_longlong(), equalTo(45203456L)); - assertThat(encodeDecodeValue().extract_longlong(), equalTo(45203456L)); - } - - @Test - public void encodeDecodeFloat() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - any.insert_float(78.234f); - - assertThat(codec.encode(any).length, equalTo(12)); - assertThat(codec.encode_value(any).length, equalTo(8)); - assertThat((double) encodeDecode().extract_float(), is(closeTo(78.234, TOLERANCE))); - assertThat((double) encodeDecodeValue().extract_float(), is(closeTo(78.234, TOLERANCE))); - } - - @Test - public void encodeDecodeDouble() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - any.insert_double(12378.234); - - assertThat(codec.encode(any).length, equalTo(16)); - assertThat(codec.encode_value(any).length, equalTo(16)); - assertThat(encodeDecode().extract_double(), is(closeTo(12378.234, TOLERANCE))); - assertThat(encodeDecodeValue().extract_double(), is(closeTo(12378.234, TOLERANCE))); - } - - @Test - public void encodeBigDecimal() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - final BigDecimal value = new BigDecimal("1234.5678"); - any.insert_fixed(value); - - assertThat(codec.encode(any).length, equalTo(17)); - assertThat(codec.encode_value(any).length, equalTo(6)); - assertThat(encodeDecode().extract_fixed(), is(closeTo(value, FIXED_TOLERANCE))); - assertThat(encodeDecodeValue().extract_fixed(), is(closeTo(value, FIXED_TOLERANCE))); - } - - @Test - public void encodeString() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - final String value = "hello, world"; - any.insert_string(value); - - assertThat(codec.encode(any).length, equalTo(29)); - assertThat(codec.encode_value(any).length, equalTo(21)); - assertThat(encodeDecode().extract_string(), equalTo(value)); - assertThat(encodeDecodeValue().extract_string(), equalTo(value)); - } - - @Test - public void encodeWideString() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - final String value = "hello, world"; - any.insert_wstring(value); - - assertThat(codec.encode(any).length, equalTo(40)); - assertThat(codec.encode_value(any).length, equalTo(32)); - assertThat(encodeDecode().extract_wstring(), equalTo(value)); - assertThat(encodeDecodeValue().extract_wstring(), equalTo(value)); - } - - @Test - public void encodeStruct() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - TestStruct testStruct = new TestStruct( (short) 10, (short) 20 ); - TestStructHelper.insert(any, testStruct); - - assertThat(codec.encode(any).length, equalTo(100)); - assertThat(codec.encode_value(any).length, equalTo(6)); - assertThat(TestStructHelper.extract(encodeDecode()), equalStruct(testStruct)); - assertThat(TestStructHelper.extract(encodeDecodeValue()), equalStruct(testStruct)); - } - - @SuppressWarnings("unused") - static class TestStructMatcher extends TypeSafeDiagnosingMatcher { - private TestStruct expected; - - private TestStructMatcher(TestStruct expected) { - this.expected = expected; + + private Any createAny() { + return new AnyImpl(orb); + } + + @Test + public void supportCodecsForAllVersions() throws UnknownEncoding { + for (int minor = 0; minor <= MAX_GIOP_MINOR_VERSION; minor++) { + createCodec(GIOP_MAJOR_VERSION, minor); + } + } + + private Codec createCodec(int major, int minor) throws UnknownEncoding { + return codecFactory.create_codec(createEncoding(major, minor)); + } + + private Encoding createEncoding(int majorVersion, int minor_version) { + return new Encoding(ENCODING_CDR_ENCAPS.value, (byte) majorVersion, (byte) minor_version); + } + + @Test(expected = UnknownEncoding.class) + public void codecNotSupportedFor_minorVersionTooHigh() throws UnknownEncoding { + createCodec(GIOP_MAJOR_VERSION, MAX_GIOP_MINOR_VERSION + 1); + } + + @Test(expected = UnknownEncoding.class) + public void codecNotSupportedFor_majorVersionTooHigh() throws UnknownEncoding { + createCodec(GIOP_MAJOR_VERSION + 1, 0); + } + + @Test + public void encodeDecodeNull() throws InvalidTypeForEncoding, FormatMismatch { + assertThat(codec.encode(any).length, equalTo(8)); + assertThat(codec.encode_value(any).length, equalTo(1)); + assertThat(encodeDecode().type().kind(), equalTo(TCKind.tk_null)); + } + + private Any encodeDecode() throws InvalidTypeForEncoding, FormatMismatch { + final byte[] bytes = codec.encode(any); + return codec.decode(bytes); + } + + @Test + public void encodeDecodeBoolean() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + any.insert_boolean(true); + + assertThat(codec.encode(any).length, equalTo(9)); + assertThat(codec.encode_value(any).length, equalTo(2)); + assertThat(encodeDecode().extract_boolean(), is(true)); + assertThat(encodeDecodeValue().extract_boolean(), is(true)); + } + + private Any encodeDecodeValue() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + final Codec codec = createCodec(GIOP_MAJOR_VERSION, MAX_GIOP_MINOR_VERSION); + final byte[] bytes = codec.encode_value(any); + return codec.decode_value(bytes, any.type()); } - public static TestStructMatcher equalStruct(TestStruct expected) { - return new TestStructMatcher(expected); + @Test + public void encodeDecodeByte() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + any.insert_octet((byte) 123); + + assertThat(codec.encode(any).length, equalTo(9)); + assertThat(codec.encode_value(any).length, equalTo(2)); + assertThat(encodeDecode().extract_octet(), equalTo((byte) 123)); + assertThat(encodeDecodeValue().extract_octet(), equalTo((byte) 123)); + } + + @Test + public void encodeDecodeChar() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + any.insert_char('w'); + + assertThat(codec.encode(any).length, equalTo(9)); + assertThat(codec.encode_value(any).length, equalTo(2)); + assertThat(encodeDecode().extract_char(), equalTo('w')); + assertThat(encodeDecodeValue().extract_char(), equalTo('w')); + } + + @Test + public void encodeDecodeShort() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + any.insert_short((short) 123); + + assertThat(codec.encode(any).length, equalTo(10)); + assertThat(codec.encode_value(any).length, equalTo(4)); + assertThat(encodeDecode().extract_short(), equalTo((short) 123)); + assertThat(encodeDecodeValue().extract_short(), equalTo((short) 123)); + } + + @Test + public void encodeDecodeInt() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + any.insert_long(4520); + + assertThat(codec.encode(any).length, equalTo(12)); + assertThat(codec.encode_value(any).length, equalTo(8)); + assertThat(encodeDecode().extract_long(), equalTo(4520)); + assertThat(encodeDecodeValue().extract_long(), equalTo(4520)); } - @Override - protected boolean matchesSafely(TestStruct testStruct, Description description) { - if (testStruct.x == expected.x && testStruct.y == expected.y) return true; - description.appendText(toString(testStruct)); - return false; + @Test + public void encodeDecodeLong() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + any.insert_longlong(45203456L); + + assertThat(codec.encode(any).length, equalTo(16)); + assertThat(codec.encode_value(any).length, equalTo(16)); + assertThat(encodeDecode().extract_longlong(), equalTo(45203456L)); + assertThat(encodeDecodeValue().extract_longlong(), equalTo(45203456L)); } - @Override - public void describeTo(Description description) { - description.appendText(toString(expected)); + @Test + public void encodeDecodeFloat() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + any.insert_float(78.234f); + + assertThat(codec.encode(any).length, equalTo(12)); + assertThat(codec.encode_value(any).length, equalTo(8)); + assertThat((double) encodeDecode().extract_float(), is(closeTo(78.234, TOLERANCE))); + assertThat((double) encodeDecodeValue().extract_float(), is(closeTo(78.234, TOLERANCE))); } - private String toString(TestStruct o) { - return String.format("TestStruct[ x=%d, y=%d ]", o.x, o.y); + @Test + public void encodeDecodeDouble() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + any.insert_double(12378.234); + + assertThat(codec.encode(any).length, equalTo(16)); + assertThat(codec.encode_value(any).length, equalTo(16)); + assertThat(encodeDecode().extract_double(), is(closeTo(12378.234, TOLERANCE))); + assertThat(encodeDecodeValue().extract_double(), is(closeTo(12378.234, TOLERANCE))); } - } - - @Test - public void encodeUnion() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { - TestUnion testUnion = new TestUnion(); - testUnion.f(3.45f); - TestUnionHelper.insert(any, testUnion); - - assertThat(codec.encode(any).length, equalTo(120)); - assertThat(codec.encode_value(any).length, equalTo(8)); - assertThat(TestUnionHelper.extract(encodeDecode()), equalUnion(testUnion)); - assertThat(TestUnionHelper.extract(encodeDecodeValue()), equalUnion(testUnion)); - } - - @SuppressWarnings("unused") - static class TestUnionMatcher extends TypeSafeDiagnosingMatcher { - private TestUnion expected; - - private TestUnionMatcher(TestUnion expected) { - this.expected = expected; + + @Test + public void encodeBigDecimal() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + final BigDecimal value = new BigDecimal("1234.5678"); + any.insert_fixed(value); + + assertThat(codec.encode(any).length, equalTo(17)); + assertThat(codec.encode_value(any).length, equalTo(6)); + assertThat(encodeDecode().extract_fixed(), is(closeTo(value, FIXED_TOLERANCE))); + assertThat(encodeDecodeValue().extract_fixed(), is(closeTo(value, FIXED_TOLERANCE))); } - public static TestUnionMatcher equalUnion(TestUnion expected) { - return new TestUnionMatcher(expected); + @Test + public void encodeString() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + final String value = "hello, world"; + any.insert_string(value); + + assertThat(codec.encode(any).length, equalTo(29)); + assertThat(codec.encode_value(any).length, equalTo(21)); + assertThat(encodeDecode().extract_string(), equalTo(value)); + assertThat(encodeDecodeValue().extract_string(), equalTo(value)); } - @Override - protected boolean matchesSafely(TestUnion TestUnion, Description description) { - if (equals(TestUnion, expected)) return true; - description.appendText(toString(TestUnion)); - return false; + @Test + public void encodeWideString() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + final String value = "hello, world"; + any.insert_wstring(value); + + assertThat(codec.encode(any).length, equalTo(40)); + assertThat(codec.encode_value(any).length, equalTo(32)); + assertThat(encodeDecode().extract_wstring(), equalTo(value)); + assertThat(encodeDecodeValue().extract_wstring(), equalTo(value)); } - private boolean equals(TestUnion first, TestUnion second) { - if (first.discriminator() != second.discriminator()) return false; + @Test + public void encodeStruct() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + TestStruct testStruct = new TestStruct((short) 10, (short) 20); + TestStructHelper.insert(any, testStruct); - switch (first.discriminator()) { - case 1: return first.d() == second.d(); - case 2: return first.f() == second.f(); - default: return false; - } + assertThat(codec.encode(any).length, equalTo(100)); + assertThat(codec.encode_value(any).length, equalTo(6)); + assertThat(TestStructHelper.extract(encodeDecode()), equalStruct(testStruct)); + assertThat(TestStructHelper.extract(encodeDecodeValue()), equalStruct(testStruct)); } - @Override - public void describeTo(Description description) { - description.appendText(toString(expected)); + @SuppressWarnings("unused") + static class TestStructMatcher extends TypeSafeDiagnosingMatcher { + private TestStruct expected; + + private TestStructMatcher(TestStruct expected) { + this.expected = expected; + } + + public static TestStructMatcher equalStruct(TestStruct expected) { + return new TestStructMatcher(expected); + } + + @Override + protected boolean matchesSafely(TestStruct testStruct, Description description) { + if (testStruct.x == expected.x && testStruct.y == expected.y) + return true; + description.appendText(toString(testStruct)); + return false; + } + + @Override + public void describeTo(Description description) { + description.appendText(toString(expected)); + } + + private String toString(TestStruct o) { + return String.format("TestStruct[ x=%d, y=%d ]", o.x, o.y); + } + } + + @Test + public void encodeUnion() throws UnknownEncoding, InvalidTypeForEncoding, FormatMismatch, TypeMismatch { + TestUnion testUnion = new TestUnion(); + testUnion.f(3.45f); + TestUnionHelper.insert(any, testUnion); + + assertThat(codec.encode(any).length, equalTo(120)); + assertThat(codec.encode_value(any).length, equalTo(8)); + assertThat(TestUnionHelper.extract(encodeDecode()), equalUnion(testUnion)); + assertThat(TestUnionHelper.extract(encodeDecodeValue()), equalUnion(testUnion)); } - private String toString(TestUnion o) { - switch (o.discriminator()) { - case 1: return String.format("TestUnion[ d = %f.3 ]", o.d()); - case 2: return String.format("TestUnion[ f = %f.3 ]", o.f()); - default: return "not initialized"; - } + @SuppressWarnings("unused") + static class TestUnionMatcher extends TypeSafeDiagnosingMatcher { + private TestUnion expected; + + private TestUnionMatcher(TestUnion expected) { + this.expected = expected; + } + + public static TestUnionMatcher equalUnion(TestUnion expected) { + return new TestUnionMatcher(expected); + } + + @Override + protected boolean matchesSafely(TestUnion TestUnion, Description description) { + if (equals(TestUnion, expected)) + return true; + description.appendText(toString(TestUnion)); + return false; + } + + private boolean equals(TestUnion first, TestUnion second) { + if (first.discriminator() != second.discriminator()) + return false; + + switch (first.discriminator()) { + case 1: + return first.d() == second.d(); + case 2: + return first.f() == second.f(); + default: + return false; + } + } + + @Override + public void describeTo(Description description) { + description.appendText(toString(expected)); + } + + private String toString(TestUnion o) { + switch (o.discriminator()) { + case 1: + return String.format("TestUnion[ d = %f.3 ]", o.d()); + case 2: + return String.format("TestUnion[ f = %f.3 ]", o.f()); + default: + return "not initialized"; + } + } } - } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/io/ValueHandlerTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/io/ValueHandlerTest.java index a95f55785..547623369 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/io/ValueHandlerTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/io/ValueHandlerTest.java @@ -37,82 +37,83 @@ public class ValueHandlerTest extends ValueTestBase { - ValueHandler valueHandler = ValueHandlerImpl.getInstance(); - - /** - * Ensures that value handler impl is final - */ - @Test - public void testValueHandlerImplIsFinal() { - int mods = ValueHandlerImpl.class.getModifiers(); - - Assert.assertTrue(Modifier.isFinal(mods)); - } - - /** - * Ensures the SharedSecrets class works - */ - @Test - public void testSharedSecrets() { - Assert.assertNotNull(SharedSecrets.getJavaCorbaAccess()); - } - - @Test - public void canReadStringValue() throws IOException { - writeStringValue_1_2("This, too!"); - - assertThat(readWithValueHandler(String.class), equalTo("This, too!")); - } - - @SuppressWarnings("unchecked") - private T readWithValueHandler(Class theClass) { - setMessageBody(getGeneratedBody()); - InputStream inputStream = getInputObject(); - Serializable value = valueHandler.readValue(inputStream, 0, theClass, - RepositoryId.createForJavaType(theClass), getInputObject().getCodeBase()); - assertThat(value, instanceOf(theClass)); - return (T) value; - } - - @Test - public void canReadSerializedEnum() throws IOException { - writeValueTag(ONE_REPID_ID); - writeRepId(RepositoryId.kWStringValueRepID); - writeStringValue_1_2(Enum1.strange.toString()); - - assertThat(readWithValueHandler(Enum1.class), equalTo(Enum1.strange)); - } - - @Test - public void canReadSerializedEnumWithAbstractMethod() throws IOException { - writeValueTag(ONE_REPID_ID); - writeRepId(RepositoryId.kWStringValueRepID); - writeStringValue_1_2("second"); - - assertThat(readWithValueHandler(EnumWithAbstractMethod.class).getValue(), equalTo(2)); - } - - - - static enum EnumWithAbstractMethod { - - first { - @Override - int getValue() { - return 1; - } - }, second { - @Override - int getValue() { - return 2; - } - }, third { - @Override - int getValue() { - return 3; - } - }; - abstract int getValue(); - } + ValueHandler valueHandler = ValueHandlerImpl.getInstance(); + + /** + * Ensures that value handler impl is final + */ + @Test + public void testValueHandlerImplIsFinal() { + int mods = ValueHandlerImpl.class.getModifiers(); + + Assert.assertTrue(Modifier.isFinal(mods)); + } + + /** + * Ensures the SharedSecrets class works + */ + @Test + public void testSharedSecrets() { + Assert.assertNotNull(SharedSecrets.getJavaCorbaAccess()); + } + + @Test + public void canReadStringValue() throws IOException { + writeStringValue_1_2("This, too!"); + + assertThat(readWithValueHandler(String.class), equalTo("This, too!")); + } + + @SuppressWarnings("unchecked") + private T readWithValueHandler(Class theClass) { + setMessageBody(getGeneratedBody()); + InputStream inputStream = getInputObject(); + Serializable value = valueHandler.readValue(inputStream, 0, theClass, RepositoryId.createForJavaType(theClass), + getInputObject().getCodeBase()); + assertThat(value, instanceOf(theClass)); + return (T) value; + } + + @Test + public void canReadSerializedEnum() throws IOException { + writeValueTag(ONE_REPID_ID); + writeRepId(RepositoryId.kWStringValueRepID); + writeStringValue_1_2(Enum1.strange.toString()); + + assertThat(readWithValueHandler(Enum1.class), equalTo(Enum1.strange)); + } + + @Test + public void canReadSerializedEnumWithAbstractMethod() throws IOException { + writeValueTag(ONE_REPID_ID); + writeRepId(RepositoryId.kWStringValueRepID); + writeStringValue_1_2("second"); + + assertThat(readWithValueHandler(EnumWithAbstractMethod.class).getValue(), equalTo(2)); + } + + static enum EnumWithAbstractMethod { + + first { + @Override + int getValue() { + return 1; + } + }, + second { + @Override + int getValue() { + return 2; + } + }, + third { + @Override + int getValue() { + return 3; + } + }; + + abstract int getValue(); + } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/ior/IORImplTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/ior/IORImplTest.java index deb2e7dcc..63633edc5 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/ior/IORImplTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/ior/IORImplTest.java @@ -30,6 +30,6 @@ public class IORImplTest extends EncodingTestBase { @Test public void stringifyIncludesTypeId() { IOR ior = new IORImpl(getOrb(), "TestType"); - assertEquals("IOR:" + "00000000" + "00000009" + "54657374" + "54797065" +"0000000000000000", ior.stringify()); + assertEquals("IOR:" + "00000000" + "00000009" + "54657374" + "54797065" + "0000000000000000", ior.stringify()); } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileTemplateImplTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileTemplateImplTest.java index 4ec019ed4..7d1ea83aa 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileTemplateImplTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/ior/iiop/IIOPProfileTemplateImplTest.java @@ -31,40 +31,40 @@ import static org.hamcrest.Matchers.equalTo; public class IIOPProfileTemplateImplTest { - private static final String HOST = "testhost"; - private static final int PORT = 1234; + private static final String HOST = "testhost"; + private static final int PORT = 1234; - private ORB orb = createStrictStub(ORB.class); - private GIOPVersion version = new GIOPVersion(1, 2); - private IIOPAddress primary = new IIOPAddressImpl(HOST, PORT); - private IIOPProfileTemplate impl = new IIOPProfileTemplateImpl(orb, version, primary); + private ORB orb = createStrictStub(ORB.class); + private GIOPVersion version = new GIOPVersion(1, 2); + private IIOPAddress primary = new IIOPAddressImpl(HOST, PORT); + private IIOPProfileTemplate impl = new IIOPProfileTemplateImpl(orb, version, primary); - @Test - public void socketHostAndAddress_matchPrimaryAddress() { - assertThat(impl.getPrimarySocketInfo().getHost(), equalTo(HOST)); - assertThat(impl.getPrimarySocketInfo().getPort(), equalTo(PORT)); - } + @Test + public void socketHostAndAddress_matchPrimaryAddress() { + assertThat(impl.getPrimarySocketInfo().getHost(), equalTo(HOST)); + assertThat(impl.getPrimarySocketInfo().getPort(), equalTo(PORT)); + } - @Test - public void whenNoTaggedComponents_socketTypeIsPlainText() { - assertThat(impl.getPrimarySocketInfo().getType(), equalTo(SocketInfo.IIOP_CLEAR_TEXT)); - } + @Test + public void whenNoTaggedComponents_socketTypeIsPlainText() { + assertThat(impl.getPrimarySocketInfo().getType(), equalTo(SocketInfo.IIOP_CLEAR_TEXT)); + } - @Test - public void whenContainsHttpJavaCodebaseComponent_socketTypeIsPlainText() { - addJavaCodebase("http://localhost:1401/base"); + @Test + public void whenContainsHttpJavaCodebaseComponent_socketTypeIsPlainText() { + addJavaCodebase("http://localhost:1401/base"); - assertThat(impl.getPrimarySocketInfo().getType(), equalTo(SocketInfo.IIOP_CLEAR_TEXT)); - } + assertThat(impl.getPrimarySocketInfo().getType(), equalTo(SocketInfo.IIOP_CLEAR_TEXT)); + } - @Test - public void whenContainsHttpsJavaCodebaseComponent_socketTypeIsSsl() { - addJavaCodebase("https://localhost:1402/base"); + @Test + public void whenContainsHttpsJavaCodebaseComponent_socketTypeIsSsl() { + addJavaCodebase("https://localhost:1402/base"); - assertThat(impl.getPrimarySocketInfo().getType(), equalTo(SocketInfo.SSL_PREFIX)); - } + assertThat(impl.getPrimarySocketInfo().getType(), equalTo(SocketInfo.SSL_PREFIX)); + } - private void addJavaCodebase(String urls) { - impl.add(new JavaCodebaseComponentImpl(urls)); - } + private void addJavaCodebase(String urls) { + impl.add(new JavaCodebaseComponentImpl(urls)); + } } \ No newline at end of file diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/JNDIStateFactoryImplTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/JNDIStateFactoryImplTest.java index cf9e325d9..cb570a59b 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/JNDIStateFactoryImplTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/JNDIStateFactoryImplTest.java @@ -47,7 +47,7 @@ public class JNDIStateFactoryImplTest { private JNDIStateFactoryImpl impl = new JNDIStateFactoryImpl(); private final Remote remote = createStrictStub(Remote.class); - private Hashtable env = new Hashtable<>(); + private Hashtable env = new Hashtable<>(); private ORB orb = createStrictStub(JndiOrb.class); private List mementos = new ArrayList<>(); @@ -56,7 +56,8 @@ public class JNDIStateFactoryImplTest { @After public void tearDown() throws Exception { - for (Memento memento : mementos) memento.revert(); + for (Memento memento : mementos) + memento.revert(); } @Before diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/StubInvocationHandlerImplTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/StubInvocationHandlerImplTest.java index 618c82ba5..95428b763 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/StubInvocationHandlerImplTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/StubInvocationHandlerImplTest.java @@ -72,7 +72,7 @@ public void whenColocatedCallThrowsException_exceptionHasStackTrace() throws Thr static class CalledObject extends ObjectImpl { private Delegate delegate = createStrictStub(ClientDelegateFake.class, this); - @SuppressWarnings({"WeakerAccess", "unused"}) + @SuppressWarnings({ "WeakerAccess", "unused" }) public void throwException() throws Exception { throw new TestException("thrown in test"); } @@ -156,10 +156,8 @@ static abstract class ORBFake extends com.sun.corba.ee.spi.orb.ORB { private OAInvocationInfo invocationInfo = new OAInvocationInfo(null, new byte[0]); public ORBFake() { - invocationInfo.setCopierFactory( - CopyobjectDefaults.makeFallbackObjectCopierFactory( - CopyobjectDefaults.makeReflectObjectCopierFactory(this), - CopyobjectDefaults.makeORBStreamObjectCopierFactory(this))); + invocationInfo.setCopierFactory(CopyobjectDefaults.makeFallbackObjectCopierFactory( + CopyobjectDefaults.makeReflectObjectCopierFactory(this), CopyobjectDefaults.makeORBStreamObjectCopierFactory(this))); } @Override @@ -198,6 +196,4 @@ public boolean useLocalInvocation(Object self) { } } - } - diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/TestIDLNameTranslator.java b/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/TestIDLNameTranslator.java index ab99a932b..e8e0994ce 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/TestIDLNameTranslator.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/TestIDLNameTranslator.java @@ -31,120 +31,88 @@ public class TestIDLNameTranslator extends TestCase { - private static final Class[] nonRemoteInterfaces = { - InvalidRemotes.InvalidRemote1.class, - InvalidRemotes.InvalidRemote2.class, - InvalidRemotes.InvalidRemote3.class, - InvalidRemotes.InvalidRemote4.class, - InvalidRemotes.InvalidRemote5.class, - // InvalidRemote6 has a method that declares an unchecked exception. - // Although bad practice, this is not an error. - // InvalidRemotes.InvalidRemote6.class, - // InvalidRemotes.InvalidRemote7.class, - // InvalidRemotes.InvalidRemote8.class, - InvalidRemotes.InvalidRemote9.class, - InvalidRemotes.InvalidRemote10.class, - InvalidRemotes.InvalidRemote11.class, - // The following test for interfaces that inherit the - // same method from multiple super-interfaces. This is supposed - // to be illegal, but rmic allows it, so we will also allow it here. - //InvalidRemotes.InvalidRemote12.class, - //InvalidRemotes.InvalidRemote13.class, - //InvalidRemotes.InvalidRemote14.class, - //InvalidRemotes.InvalidRemote15.class, - InvalidRemotes.InvalidRemote16.class, - InvalidRemotes.InvalidRemote17.class, - InvalidRemotes.InvalidRemote18.class, - InvalidRemotes.InvalidRemote19.class - }; - - protected void setUp() {} - - protected void tearDown() {} - - public void testMultipleInterfaces() - { - doIDLNameTranslationTest( IDLMultipleInterfaceTest.class, - new Class[] { - IDLMultipleInterfaceTest.first.class, - IDLMultipleInterfaceTest.second.class - } - ) ; + private static final Class[] nonRemoteInterfaces = { InvalidRemotes.InvalidRemote1.class, InvalidRemotes.InvalidRemote2.class, + InvalidRemotes.InvalidRemote3.class, InvalidRemotes.InvalidRemote4.class, InvalidRemotes.InvalidRemote5.class, + // InvalidRemote6 has a method that declares an unchecked exception. + // Although bad practice, this is not an error. + // InvalidRemotes.InvalidRemote6.class, + // InvalidRemotes.InvalidRemote7.class, + // InvalidRemotes.InvalidRemote8.class, + InvalidRemotes.InvalidRemote9.class, InvalidRemotes.InvalidRemote10.class, InvalidRemotes.InvalidRemote11.class, + // The following test for interfaces that inherit the + // same method from multiple super-interfaces. This is supposed + // to be illegal, but rmic allows it, so we will also allow it here. + // InvalidRemotes.InvalidRemote12.class, + // InvalidRemotes.InvalidRemote13.class, + // InvalidRemotes.InvalidRemote14.class, + // InvalidRemotes.InvalidRemote15.class, + InvalidRemotes.InvalidRemote16.class, InvalidRemotes.InvalidRemote17.class, InvalidRemotes.InvalidRemote18.class, + InvalidRemotes.InvalidRemote19.class }; + + protected void setUp() { } - public void testIDLProperties() - { - doIDLNameTranslationTest(IDLPropertiesTest.class, - IDLPropertiesTest.IDLProperties.class); + protected void tearDown() { } - public void testOverloadedMethods() - { - doIDLNameTranslationTest(IDLOverloadedTest.class, - IDLOverloadedTest.IDLOverloaded.class); + public void testMultipleInterfaces() { + doIDLNameTranslationTest(IDLMultipleInterfaceTest.class, + new Class[] { IDLMultipleInterfaceTest.first.class, IDLMultipleInterfaceTest.second.class }); } - - public void testContainerClash() - { - - - doIDLNameTranslationTest(new String[] { "ContainerClash1_" }, - ContainerClash1.class); - - doIDLNameTranslationTest(new String[] { "ContainerCLASH2_" }, - ContainerClash2.class); - - doIDLNameTranslationTest(new String[] { "J_ContainerClash3_" }, - _ContainerClash3.class); - - doIDLNameTranslationTest(new String[] { "J_ContainerCLASH4_" }, - _ContainerClash4.class); + + public void testIDLProperties() { + doIDLNameTranslationTest(IDLPropertiesTest.class, IDLPropertiesTest.IDLProperties.class); + } + + public void testOverloadedMethods() { + doIDLNameTranslationTest(IDLOverloadedTest.class, IDLOverloadedTest.IDLOverloaded.class); } - public void testLeadingUnderscores() - { - doIDLNameTranslationTest(IDLLeadingUnderscoresTest.class, - IDLLeadingUnderscoresTest.IDLLeadingUnderscores.class); + public void testContainerClash() { + + doIDLNameTranslationTest(new String[] { "ContainerClash1_" }, ContainerClash1.class); + + doIDLNameTranslationTest(new String[] { "ContainerCLASH2_" }, ContainerClash2.class); + + doIDLNameTranslationTest(new String[] { "J_ContainerClash3_" }, _ContainerClash3.class); + + doIDLNameTranslationTest(new String[] { "J_ContainerCLASH4_" }, _ContainerClash4.class); } - public void testIDLCaseSensitivity() - { - doIDLNameTranslationTest(IDLCaseSensitivityTest.class, - IDLCaseSensitivityTest.IDLCaseSensitivity.class); + public void testLeadingUnderscores() { + doIDLNameTranslationTest(IDLLeadingUnderscoresTest.class, IDLLeadingUnderscoresTest.IDLLeadingUnderscores.class); } - public void testIDLKeywords() - { - doIDLNameTranslationTest(IDLKeywordsTest.class, - IDLKeywordsTest.IDLKeywords.class); + public void testIDLCaseSensitivity() { + doIDLNameTranslationTest(IDLCaseSensitivityTest.class, IDLCaseSensitivityTest.IDLCaseSensitivity.class); } - public void testDefaultPackageClasses() - { + public void testIDLKeywords() { + doIDLNameTranslationTest(IDLKeywordsTest.class, IDLKeywordsTest.IDLKeywords.class); + } + + public void testDefaultPackageClasses() { Class testClass = null; Class testInterface = null; try { testClass = Class.forName("corba.dynamicrmiiiop.testclasses.IDLDefaultTest"); testInterface = Class.forName("corba.dynamicrmiiiop.testclasses.IDLDefaultTest$IDLDefault"); - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } doIDLNameTranslationTest(testClass, testInterface); } - public void testInvalidInterfaces() - { - for(int i = 0; i < nonRemoteInterfaces.length; i++) { + public void testInvalidInterfaces() { + for (int i = 0; i < nonRemoteInterfaces.length; i++) { Class nonRemote = nonRemoteInterfaces[i]; - String msg = "Unexpected success for class " + nonRemote.getName() + - " at index " + i ; + String msg = "Unexpected success for class " + nonRemote.getName() + " at index " + i; try { - IDLNameTranslator translator = - IDLNameTranslatorImpl.get(nonRemote); + IDLNameTranslator translator = IDLNameTranslatorImpl.get(nonRemote); assertTrue(msg, false); - } catch(IllegalStateException ise) { + } catch (IllegalStateException ise) { // System.out.println(ise.getMessage()); } @@ -152,91 +120,65 @@ public void testInvalidInterfaces() } } - public void testIDLIdentifiers() - { - doIDLNameTranslationTest(IDLIdentifiersTest.class, - IDLIdentifiersTest.IDLIdentifiers.class); + public void testIDLIdentifiers() { + doIDLNameTranslationTest(IDLIdentifiersTest.class, IDLIdentifiersTest.IDLIdentifiers.class); } public void testIDLCombo1() { - doIDLNameTranslationTest(IDLComboTest1.class, - IDLComboTest1.IDLCombo.class); + doIDLNameTranslationTest(IDLComboTest1.class, IDLComboTest1.IDLCombo.class); } - private String[] getExpectedIdlNames( Class cls ) - { + private String[] getExpectedIdlNames(Class cls) { String[] expectedIdlNames = new String[0]; try { - Method idlNamesMethod = cls.getMethod("getIDLNames", - new Class[] {}); - expectedIdlNames = (String[]) - idlNamesMethod.invoke(null, new Object[] {}); - } catch(Exception e) { + Method idlNamesMethod = cls.getMethod("getIDLNames", new Class[] {}); + expectedIdlNames = (String[]) idlNamesMethod.invoke(null, new Object[] {}); + } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } - return expectedIdlNames ; + return expectedIdlNames; } - private void doIDLNameTranslationTest(Class testClass, - Class[] testInterfaces) - { - String[] expectedIdlNames = getExpectedIdlNames( testClass ) ; - IDLNameTranslator nameTranslator = - IDLNameTranslatorImpl.get(testInterfaces); - Method[] sortedMethods = getSortedMethods( testInterfaces ); + private void doIDLNameTranslationTest(Class testClass, Class[] testInterfaces) { + String[] expectedIdlNames = getExpectedIdlNames(testClass); + IDLNameTranslator nameTranslator = IDLNameTranslatorImpl.get(testInterfaces); + Method[] sortedMethods = getSortedMethods(testInterfaces); - doIDLNameTranslationTest(expectedIdlNames, nameTranslator, - sortedMethods ); + doIDLNameTranslationTest(expectedIdlNames, nameTranslator, sortedMethods); } - private void doIDLNameTranslationTest(Class testClass, - Class testInterface) - { - String[] expectedIdlNames = getExpectedIdlNames( testClass ) ; - doIDLNameTranslationTest( expectedIdlNames, testInterface ) ; + private void doIDLNameTranslationTest(Class testClass, Class testInterface) { + String[] expectedIdlNames = getExpectedIdlNames(testClass); + doIDLNameTranslationTest(expectedIdlNames, testInterface); } - private void doIDLNameTranslationTest(String[] expectedIdlNames, - Class testInterface) - { - IDLNameTranslator nameTranslator = - IDLNameTranslatorImpl.get(testInterface); - Method[] sortedMethods = getSortedMethods( - new Class[] { testInterface } ); - - doIDLNameTranslationTest(expectedIdlNames, nameTranslator, - sortedMethods ); + private void doIDLNameTranslationTest(String[] expectedIdlNames, Class testInterface) { + IDLNameTranslator nameTranslator = IDLNameTranslatorImpl.get(testInterface); + Method[] sortedMethods = getSortedMethods(new Class[] { testInterface }); + + doIDLNameTranslationTest(expectedIdlNames, nameTranslator, sortedMethods); } - private void doIDLNameTranslationTest( - String[] expectedIdlNames, IDLNameTranslator nameTranslator, - Method[] sortedMethods ) - { - for(int i = 0; i < sortedMethods.length; i++) { + private void doIDLNameTranslationTest(String[] expectedIdlNames, IDLNameTranslator nameTranslator, Method[] sortedMethods) { + for (int i = 0; i < sortedMethods.length; i++) { Method m = (Method) sortedMethods[i]; String expected = expectedIdlNames[i]; String translatedName = nameTranslator.getIDLName(m); - String msg = "expected '" + expected + "'" + - " got '" + translatedName + "' " + ":" + m; + String msg = "expected '" + expected + "'" + " got '" + translatedName + "' " + ":" + m; assertEquals(msg, expected, translatedName); - assertEquals(msg, m, - nameTranslator.getMethod(expected)); + assertEquals(msg, m, nameTranslator.getMethod(expected)); } } - public void testUnicodeTranslation() - { - IDLNameTranslatorImpl nameTranslator = - (IDLNameTranslatorImpl)IDLNameTranslatorImpl.get( - java.rmi.Remote.class); + public void testUnicodeTranslation() { + IDLNameTranslatorImpl nameTranslator = (IDLNameTranslatorImpl) IDLNameTranslatorImpl.get(java.rmi.Remote.class); - for( int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; i++ ) { + for (int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; i++) { char c = (char) i; - String unicode = IDLNameTranslatorImpl.charToUnicodeRepresentation( - c); + String unicode = IDLNameTranslatorImpl.charToUnicodeRepresentation(c); String msg = i + ":" + Character.toString(c) + ":" + unicode; // Make sure result is 5 characters long : 1 character for @@ -252,33 +194,29 @@ public void testUnicodeTranslation() } - private Method[] getSortedMethods(Class[] classes) - { + private Method[] getSortedMethods(Class[] classes) { SortedSet sortedMethods = new TreeSet(new MethodComparator()); - for(int classCtr = 0; classCtr < classes.length; classCtr++ ) { + for (int classCtr = 0; classCtr < classes.length; classCtr++) { Method[] methods = classes[classCtr].getMethods(); - for(int methodCtr = 0; methodCtr < methods.length; methodCtr++) { + for (int methodCtr = 0; methodCtr < methods.length; methodCtr++) { Method next = methods[methodCtr]; sortedMethods.add(next); } } Method[] sortedMethodArray = new Method[sortedMethods.size()]; - + sortedMethods.toArray(sortedMethodArray); - /** Uncomment to print method order. Useful when - debugging interfaces with multiple methods that have - complex signatures - - System.out.println(sortedMethodArray.length + " sorted methods : "); - for(int i = 0; i < sortedMethodArray.length; i++) { - System.out.println(sortedMethodArray[i]); - } - */ - + /** + * Uncomment to print method order. Useful when debugging interfaces with multiple methods that have complex signatures + * + * System.out.println(sortedMethodArray.length + " sorted methods : "); for(int i = 0; i < sortedMethodArray.length; + * i++) { System.out.println(sortedMethodArray[i]); } + */ + return sortedMethodArray; } @@ -287,20 +225,20 @@ private Method[] getSortedMethods(Class[] classes) // Method strings are composed of method name, // (case sensitive), followed by comma-separated list of the value // of Class.getName() for each parameter type. - // + // // private static class MethodComparator implements java.util.Comparator { public int compare(Object o1, Object o2) { - String m1 = getMethodString((Method)o1); - String m2 = getMethodString((Method)o2); + String m1 = getMethodString((Method) o1); + String m2 = getMethodString((Method) o2); return m1.compareTo(m2); } - + private String getMethodString(Method m) { StringBuilder methodStr = new StringBuilder(m.getName()); Class[] params = m.getParameterTypes(); for (Class next : params) { - methodStr.append("|"); + methodStr.append("|"); methodStr.append(next.getName()); } return methodStr.toString(); diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/TestRMIIDLTypes.java b/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/TestRMIIDLTypes.java index b09018c9a..04aae4eef 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/TestRMIIDLTypes.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/presentation/rmi/TestRMIIDLTypes.java @@ -36,189 +36,176 @@ public class TestRMIIDLTypes extends TestCase { private IDLTypesUtil idlTypesUtil; - public static Test suite() - { + public static Test suite() { return new TestSuite(TestRMIIDLTypes.class); } - protected void setUp() - { + protected void setUp() { idlTypesUtil = new IDLTypesUtil(); } - protected void tearDown() - { + protected void tearDown() { } - public void testPrimitiveTypes() - { - Class[] primitives = { - Void.TYPE, Boolean.TYPE, Byte.TYPE, Character.TYPE, - Short.TYPE, Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE - }; + public void testPrimitiveTypes() { + Class[] primitives = { Void.TYPE, Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE, Float.TYPE, + Double.TYPE }; - for(int i = 0; i < primitives.length; i++) { + for (int i = 0; i < primitives.length; i++) { Class primitive = primitives[i]; String msg = primitive.getName(); assertTrue(msg, idlTypesUtil.isPrimitive(primitive)); - assertFalse(msg,idlTypesUtil.isRemoteInterface(primitive)); - assertFalse(msg,idlTypesUtil.isValue(primitive)); - assertFalse(msg,idlTypesUtil.isArray(primitive)); - assertFalse(msg,idlTypesUtil.isException(primitive)); - assertFalse(msg,idlTypesUtil.isObjectReference(primitive)); - assertFalse(msg,idlTypesUtil.isEntity(primitive)); + assertFalse(msg, idlTypesUtil.isRemoteInterface(primitive)); + assertFalse(msg, idlTypesUtil.isValue(primitive)); + assertFalse(msg, idlTypesUtil.isArray(primitive)); + assertFalse(msg, idlTypesUtil.isException(primitive)); + assertFalse(msg, idlTypesUtil.isObjectReference(primitive)); + assertFalse(msg, idlTypesUtil.isEntity(primitive)); } - Class[] nonPrimitives = { - Byte.class, Short.class, Integer.class, Long.class, Float.class, - Double.class, String.class, java.util.Date.class, Object.class - }; + Class[] nonPrimitives = { Byte.class, Short.class, Integer.class, Long.class, Float.class, Double.class, String.class, + java.util.Date.class, Object.class }; - for(int i = 0; i < nonPrimitives.length; i++) { + for (int i = 0; i < nonPrimitives.length; i++) { Class nonPrimitive = nonPrimitives[i]; String msg = nonPrimitive.getName(); assertFalse(msg, idlTypesUtil.isPrimitive(nonPrimitive)); } - + } - public void testRemoteInterfaceTypes() - { + public void testRemoteInterfaceTypes() { Class[] remoteInterfaces = ValidRemotes.CLASSES; - for(int i = 0; i < remoteInterfaces.length; i++) { + for (int i = 0; i < remoteInterfaces.length; i++) { Class remoteIntf = remoteInterfaces[i]; String msg = remoteIntf.getName(); assertTrue(msg, idlTypesUtil.isRemoteInterface(remoteIntf)); - assertFalse(msg,idlTypesUtil.isPrimitive(remoteIntf)); - assertFalse(msg,idlTypesUtil.isValue(remoteIntf)); - assertFalse(msg,idlTypesUtil.isArray(remoteIntf)); - assertFalse(msg,idlTypesUtil.isException(remoteIntf)); - assertFalse(msg,idlTypesUtil.isObjectReference(remoteIntf)); - assertFalse(msg,idlTypesUtil.isEntity(remoteIntf)); + assertFalse(msg, idlTypesUtil.isPrimitive(remoteIntf)); + assertFalse(msg, idlTypesUtil.isValue(remoteIntf)); + assertFalse(msg, idlTypesUtil.isArray(remoteIntf)); + assertFalse(msg, idlTypesUtil.isException(remoteIntf)); + assertFalse(msg, idlTypesUtil.isObjectReference(remoteIntf)); + assertFalse(msg, idlTypesUtil.isEntity(remoteIntf)); } // NOTE invalid remote interfaces are tested in TestIDLNameTranslator } - - public void testValueTypes() - { + + public void testValueTypes() { Class[] values = ValidValues.CLASSES; - for(int i = 0; i < values.length; i++) { + for (int i = 0; i < values.length; i++) { Class value = values[i]; String msg = value.getName(); - assertTrue(msg,idlTypesUtil.isValue(value)); + assertTrue(msg, idlTypesUtil.isValue(value)); assertFalse(msg, idlTypesUtil.isPrimitive(value)); - assertFalse(msg,idlTypesUtil.isRemoteInterface(value)); - assertFalse(msg,idlTypesUtil.isArray(value)); - assertFalse(msg,idlTypesUtil.isException(value)); - assertFalse(msg,idlTypesUtil.isObjectReference(value)); - assertFalse(msg,idlTypesUtil.isEntity(value)); + assertFalse(msg, idlTypesUtil.isRemoteInterface(value)); + assertFalse(msg, idlTypesUtil.isArray(value)); + assertFalse(msg, idlTypesUtil.isException(value)); + assertFalse(msg, idlTypesUtil.isObjectReference(value)); + assertFalse(msg, idlTypesUtil.isEntity(value)); } Class[] nonValues = InvalidValues.CLASSES; - for(int i = 0; i < nonValues.length; i++) { + for (int i = 0; i < nonValues.length; i++) { Class nonValue = nonValues[i]; String msg = nonValue.getName(); assertFalse(msg, idlTypesUtil.isValue(nonValue)); } - + } - public void testExceptionTypes() - { + public void testExceptionTypes() { Class[] exceptions = ValidExceptions.CLASSES; - for(int i = 0; i < exceptions.length; i++) { + for (int i = 0; i < exceptions.length; i++) { Class excep = exceptions[i]; String msg = excep.getName(); - assertTrue(msg,idlTypesUtil.isException(excep)); + assertTrue(msg, idlTypesUtil.isException(excep)); // a valid exception is always a valid value type ! - assertTrue(msg,idlTypesUtil.isValue(excep)); + assertTrue(msg, idlTypesUtil.isValue(excep)); assertFalse(msg, idlTypesUtil.isPrimitive(excep)); - assertFalse(msg,idlTypesUtil.isRemoteInterface(excep)); - assertFalse(msg,idlTypesUtil.isArray(excep)); - assertFalse(msg,idlTypesUtil.isObjectReference(excep)); - assertFalse(msg,idlTypesUtil.isEntity(excep)); + assertFalse(msg, idlTypesUtil.isRemoteInterface(excep)); + assertFalse(msg, idlTypesUtil.isArray(excep)); + assertFalse(msg, idlTypesUtil.isObjectReference(excep)); + assertFalse(msg, idlTypesUtil.isEntity(excep)); } Class[] nonExceptions = InvalidExceptions.CLASSES; - for(int i = 0; i < nonExceptions.length; i++) { + for (int i = 0; i < nonExceptions.length; i++) { Class nonException = nonExceptions[i]; String msg = nonException.getName(); assertFalse(msg, idlTypesUtil.isException(nonException)); - } + } } - public void testObjRefs() - { + public void testObjRefs() { Class[] objRefs = ValidObjRefs.CLASSES; - for(int i = 0; i < objRefs.length; i++) { + for (int i = 0; i < objRefs.length; i++) { Class objRef = objRefs[i]; String msg = objRef.getName(); - assertTrue(msg,idlTypesUtil.isObjectReference(objRef)); + assertTrue(msg, idlTypesUtil.isObjectReference(objRef)); assertFalse(msg, idlTypesUtil.isPrimitive(objRef)); - assertFalse(msg,idlTypesUtil.isRemoteInterface(objRef)); - assertFalse(msg,idlTypesUtil.isValue(objRef)); - assertFalse(msg,idlTypesUtil.isArray(objRef)); - assertFalse(msg,idlTypesUtil.isException(objRef)); - assertFalse(msg,idlTypesUtil.isEntity(objRef)); + assertFalse(msg, idlTypesUtil.isRemoteInterface(objRef)); + assertFalse(msg, idlTypesUtil.isValue(objRef)); + assertFalse(msg, idlTypesUtil.isArray(objRef)); + assertFalse(msg, idlTypesUtil.isException(objRef)); + assertFalse(msg, idlTypesUtil.isEntity(objRef)); } Class[] nonObjRefs = InvalidObjRefs.CLASSES; - for(int i = 0; i < nonObjRefs.length; i++) { + for (int i = 0; i < nonObjRefs.length; i++) { Class nonObjRef = nonObjRefs[i]; String msg = nonObjRef.getName(); assertFalse(msg, idlTypesUtil.isObjectReference(nonObjRef)); - } + } } - public void testEntities() - { + public void testEntities() { Class[] entities = ValidEntities.CLASSES; - for(int i = 0; i < entities.length; i++) { + for (int i = 0; i < entities.length; i++) { Class entity = entities[i]; String msg = entity.getName(); - assertTrue(msg,idlTypesUtil.isEntity(entity)); + assertTrue(msg, idlTypesUtil.isEntity(entity)); // An entity type is always a value type - assertTrue(msg,idlTypesUtil.isValue(entity)); + assertTrue(msg, idlTypesUtil.isValue(entity)); assertFalse(msg, idlTypesUtil.isPrimitive(entity)); - assertFalse(msg,idlTypesUtil.isRemoteInterface(entity)); - assertFalse(msg,idlTypesUtil.isArray(entity)); - assertFalse(msg,idlTypesUtil.isException(entity)); - assertFalse(msg,idlTypesUtil.isObjectReference(entity)); + assertFalse(msg, idlTypesUtil.isRemoteInterface(entity)); + assertFalse(msg, idlTypesUtil.isArray(entity)); + assertFalse(msg, idlTypesUtil.isException(entity)); + assertFalse(msg, idlTypesUtil.isObjectReference(entity)); } Class[] nonEntities = InvalidEntities.CLASSES; - for(int i = 0; i < nonEntities.length; i++) { + for (int i = 0; i < nonEntities.length; i++) { Class nonEntity = nonEntities[i]; String msg = nonEntity.getName(); assertFalse(msg, idlTypesUtil.isEntity(nonEntity)); - } + } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/protocol/ClientRequestDispatcherImplTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/protocol/ClientRequestDispatcherImplTest.java index a3e2159c8..ec3b1b2ec 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/protocol/ClientRequestDispatcherImplTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/protocol/ClientRequestDispatcherImplTest.java @@ -172,7 +172,8 @@ public boolean isOneWay() { @Override public CDRInputObject waitForResponse() { - if (exception != null) throw exception; + if (exception != null) + throw exception; return null; } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/protocol/MessageParserTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/protocol/MessageParserTest.java index 9ae87ac5b..c009d7aff 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/protocol/MessageParserTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/protocol/MessageParserTest.java @@ -46,7 +46,7 @@ public class MessageParserTest { - private static final int BUFFER_SIZE = 1357; // pick a bizarre number that should not occur randomly + private static final int BUFFER_SIZE = 1357; // pick a bizarre number that should not occur randomly private ORBDataFake orbData = createStrictStub(ORBDataFake.class); private ORBFake orb = createStrictStub(ORBFake.class); @@ -64,7 +64,7 @@ public void setUp() throws Exception { @Test public void oldwhenBufferDoesNotContainEntireHeader_requestMore() { - byte[] header = {'G', 'I', 'O', 'P', 1, 0}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 0 }; ByteBuffer buffer = ByteBuffer.wrap(header); Message message = parser.parseBytes(buffer, connection); @@ -79,7 +79,7 @@ public void oldwhenBufferDoesNotContainEntireHeader_requestMore() { @Test public void whenBufferDoesNotContainEntireHeader_requestMoreAndDoNotCreateMediator() { - byte[] header = {'G', 'I', 'O', 'P', 1, 0}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 0 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -91,7 +91,7 @@ public void whenBufferDoesNotContainEntireHeader_requestMoreAndDoNotCreateMediat @Test public void oldwhenBufferContainsHeaderOnly_requestMore() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPCancelRequest, 0, 0, 0, 6, 1, 2}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPCancelRequest, 0, 0, 0, 6, 1, 2 }; ByteBuffer buffer = ByteBuffer.wrap(header); Message message = parser.parseBytes(buffer, connection); @@ -106,7 +106,7 @@ public void oldwhenBufferContainsHeaderOnly_requestMore() { @Test public void whenBufferContainsHeaderOnly_requestMoreAndDoNotCreateMediator() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPCancelRequest, 0, 0, 0, 6, 1, 2}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPCancelRequest, 0, 0, 0, 6, 1, 2 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -118,7 +118,7 @@ public void whenBufferContainsHeaderOnly_requestMoreAndDoNotCreateMediator() { @Test public void whenBufferIsLittleEndianAndContainsHeaderOnly_requestMoreAndDoNotCreateMediator() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.LITTLE_ENDIAN_BIT, Message.GIOPCancelRequest, 6, 0, 0, 0, 1, 2}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.LITTLE_ENDIAN_BIT, Message.GIOPCancelRequest, 6, 0, 0, 0, 1, 2 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -130,7 +130,7 @@ public void whenBufferIsLittleEndianAndContainsHeaderOnly_requestMoreAndDoNotCre @Test public void old_whenBufferContainsWholeMessage_consumeEntireBuffer() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); Message message = parser.parseBytes(buffer, connection); @@ -144,7 +144,7 @@ public void old_whenBufferContainsWholeMessage_consumeEntireBuffer() { @Test public void whenBufferContainsWholeMessage_consumeEntireBuffer() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -156,7 +156,7 @@ public void whenBufferContainsWholeMessage_consumeEntireBuffer() { @Test public void afterConsumingEntireBuffer_offerOfNullBufferClearsMessageMediator() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -166,7 +166,7 @@ public void afterConsumingEntireBuffer_offerOfNullBufferClearsMessageMediator() @Test public void whenIsLittleEndianAndBufferContainsWholeMessage_consumeEntireBuffer() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.LITTLE_ENDIAN_BIT, Message.GIOPReply, 6, 0, 0, 0, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.LITTLE_ENDIAN_BIT, Message.GIOPReply, 6, 0, 0, 0, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -178,8 +178,9 @@ public void whenIsLittleEndianAndBufferContainsWholeMessage_consumeEntireBuffer( @Test public void oldwhenBufferContainsRestOfMessage_consumeEntireBuffer() { - byte[] partMessage = {'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1}; - byte[] wholeMessage = {'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] partMessage = { 'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1 }; + byte[] wholeMessage = { 'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, + 6 }; ByteBuffer buffer = ByteBuffer.wrap(partMessage); parser.parseBytes(buffer, connection); @@ -195,8 +196,9 @@ public void oldwhenBufferContainsRestOfMessage_consumeEntireBuffer() { @Test public void whenBufferContainsRestOfMessage_consumeEntireBuffer() { - byte[] partMessage = {'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1}; - byte[] wholeMessage = {'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] partMessage = { 'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1 }; + byte[] wholeMessage = { 'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, + 6 }; parser.offerBuffer(ByteBuffer.wrap(partMessage)); parser.offerBuffer(ByteBuffer.wrap(wholeMessage)); @@ -208,7 +210,7 @@ public void whenBufferContainsRestOfMessage_consumeEntireBuffer() { @Test public void oldwhenBufferContainsWholeMessagePlusMore_consumeMessageAndLeaveMore() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, 'G'}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, 'G' }; ByteBuffer buffer = ByteBuffer.wrap(header); Message message = parser.parseBytes(buffer, connection); @@ -222,9 +224,8 @@ public void oldwhenBufferContainsWholeMessagePlusMore_consumeMessageAndLeaveMore @Test public void whenBufferContainsWholeMessageAndMore_consumeMessageBytesAndLeaveRemainder() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, - 1, 2, 3, 4, 5, 6, - 'R', 'M', 'I'}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, 'R', + 'M', 'I' }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -238,9 +239,8 @@ public void whenBufferContainsWholeMessageAndMore_consumeMessageBytesAndLeaveRem @Test public void afterConsumingMessage_offerOfPartialBufferClearsMessageMediator() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, - 1, 2, 3, 4, 5, 6, - 'R', 'M', 'I'}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, 'R', + 'M', 'I' }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -250,7 +250,7 @@ public void afterConsumingMessage_offerOfPartialBufferClearsMessageMediator() { @Test public void oldwhenBufferContainsWholeMessageNeedingFragments_consumeEntireBufferAndExpectMore() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); Message message = parser.parseBytes(buffer, connection); @@ -263,7 +263,7 @@ public void oldwhenBufferContainsWholeMessageNeedingFragments_consumeEntireBuffe @Test public void whenBufferContainsWholeMessageNeedingFragments_consumeEntireBuffer() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -276,8 +276,8 @@ public void whenBufferContainsWholeMessageNeedingFragments_consumeEntireBuffer() @Test public void oldwhenBufferContainsFinalFragment_consumeBuffer() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, - 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, 'G', 'I', + 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0, 0, 0, 4, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); Message message1 = parser.parseBytes(buffer, connection); @@ -292,8 +292,8 @@ public void oldwhenBufferContainsFinalFragment_consumeBuffer() { @Test public void whenBufferContainsFinalFragment_consumeBuffer() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, - 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0, 0, 0, 4, 1, 2, 3, 4}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, 'G', 'I', + 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0, 0, 0, 4, 1, 2, 3, 4 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); MessageMediator messageMediator1 = parser.getMessageMediator(); @@ -307,7 +307,8 @@ public void whenBufferContainsFinalFragment_consumeBuffer() { @Test public void oldwhenStartPositionNonZero_startReadingFromPosition() { - byte[] header = {0, 0, 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPLocateRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6, 'G'}; + byte[] header = { 0, 0, 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPLocateRequest, 0, 0, 0, 6, 1, 2, 3, + 4, 5, 6, 'G' }; ByteBuffer buffer = ByteBuffer.wrap(header); buffer.position(2); parser.setNextMessageStartPosition(2); @@ -321,10 +322,9 @@ public void oldwhenStartPositionNonZero_startReadingFromPosition() { assertEquals(18, parser.getMsgByteBuffer().limit()); } - @Test public void whenTimedOutBetweenMessages_doNothing() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -335,7 +335,7 @@ public void whenTimedOutBetweenMessages_doNothing() { @Test public void whenMidBodyButNotTimedOut_doNothing() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -346,7 +346,7 @@ public void whenMidBodyButNotTimedOut_doNothing() { @Test(expected = COMM_FAILURE.class) public void whenTimedOutMidHeader_throwAnException() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -356,7 +356,7 @@ public void whenTimedOutMidHeader_throwAnException() { @Test(expected = COMM_FAILURE.class) public void whenTimedOutMidBody_throwAnException() { - byte[] header = {'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPReply, 0, 0, 0, 6, 1 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); @@ -367,7 +367,7 @@ public void whenTimedOutMidBody_throwAnException() { @Test(expected = COMM_FAILURE.class) public void whenTimedOutWhileWaitingForFragment_throwAnException() { - byte[] header = {'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}; + byte[] header = { 'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, Message.GIOPReply, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6 }; ByteBuffer buffer = ByteBuffer.wrap(header); parser.offerBuffer(buffer); diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/transport/ConnectionImplTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/transport/ConnectionImplTest.java index f238846d0..a3febd2b2 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/transport/ConnectionImplTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/transport/ConnectionImplTest.java @@ -38,7 +38,7 @@ public class ConnectionImplTest extends TransportTestBase { - private static final byte[] BYTE_DATA = {0,1,2,3,4,5,6,7,8,9,10}; + private static final byte[] BYTE_DATA = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; @After public void tearDown() { @@ -47,18 +47,17 @@ public void tearDown() { } @Test - public void whenRequest1_0_receivedFromSocket_dispatchRequest() throws IOException { // REG + public void whenRequest1_0_receivedFromSocket_dispatchRequest() throws IOException { // REG final List params = new ArrayList(); - defineRequestDispatcher( new RequestDispatcher() { + defineRequestDispatcher(new RequestDispatcher() { public void readParameters(CDRInputObject input) { params.add(input.read_short()); } }); - readFromSocketWithoutChannelAndDispatch(new byte[]{'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPRequest, /* size */ 0, 0, 0, 38, /* no service contexts */ 0, 0, 0, 0, - /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* padding */ 0, 0, 0, - /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, - 0, 0, 0, /* principal */ 0, 0, 0, 0, /* short param */ 1, 1}); + readFromSocketWithoutChannelAndDispatch(new byte[] { 'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, + /* size */ 0, 0, 0, 38, /* no service contexts */ 0, 0, 0, 0, /* request ID */ 0, 0, 0, 2, /* response expected */ 1, + /* padding */ 0, 0, 0, /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, 0, 0, 0, + /* principal */ 0, 0, 0, 0, /* short param */ 1, 1 }); getConnection().doWork(); assertEquals(1, getMediators().size()); MessageMediator mediator = getMediators().remove(0); @@ -71,16 +70,15 @@ public void readParameters(CDRInputObject input) { @Test public void whenRequest1_0_receivedFromNio_dispatchRequest() throws IOException { final List params = new ArrayList(); - defineRequestDispatcher( new RequestDispatcher() { + defineRequestDispatcher(new RequestDispatcher() { public void readParameters(CDRInputObject input) { params.add(input.read_short()); } }); - readFromNio(new byte[]{'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPRequest, /* size */ 0, 0, 0, 38, /* no service contexts */ 0, 0, 0, 0, - /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* padding */ 0, 0, 0, - /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, - 0, 0, 0, /* principal */ 0, 0, 0, 0, /* short param */ 1, 1}); + readFromNio(new byte[] { 'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, /* size */ 0, 0, 0, 38, + /* no service contexts */ 0, 0, 0, 0, /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* padding */ 0, 0, 0, + /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, 0, 0, 0, /* principal */ 0, 0, + 0, 0, /* short param */ 1, 1 }); getConnection().doWork(); processQueuedWork(); @@ -95,16 +93,15 @@ public void readParameters(CDRInputObject input) { @Test public void whenRequest1_1_receivedFromNio_dispatchRequest() throws IOException { final List params = new ArrayList(); - defineRequestDispatcher( new RequestDispatcher() { + defineRequestDispatcher(new RequestDispatcher() { public void readParameters(CDRInputObject input) { params.add(input.read_short()); } }); - readFromNio(new byte[]{'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPRequest, /* size */ 0, 0, 0, 38, /* no service contexts */ 0, 0, 0, 0, - /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* padding */ 0,0,0, - /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, - 0, 0, 0, /* principal */ 0, 0, 0, 0, /* short param */ 1, 1}); + readFromNio(new byte[] { 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, /* size */ 0, 0, 0, 38, + /* no service contexts */ 0, 0, 0, 0, /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* padding */ 0, 0, 0, + /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, 0, 0, 0, /* principal */ 0, 0, + 0, 0, /* short param */ 1, 1 }); getConnection().doWork(); processQueuedWork(); @@ -119,17 +116,15 @@ public void readParameters(CDRInputObject input) { @Test public void whenLittleEndianRequest1_2_receivedFromNio_dispatchRequest() throws IOException { final List params = new ArrayList(); - defineRequestDispatcher( new RequestDispatcher() { + defineRequestDispatcher(new RequestDispatcher() { public void readParameters(CDRInputObject input) { params.add(input.read_short()); } }); - readFromNio(new byte[]{'G', 'I', 'O', 'P', 1, 2, Message.LITTLE_ENDIAN_BIT, - Message.GIOPRequest, /* size */ 38, 0, 0, 0, - /* request ID */ 2, 0, 0, 0, /* response expected */ 1, /* request reserved */ 0, 0, 0, - /* use key */ 0, 0, /* padding */ 0, 0, /* object key */ 4, 0, 0, 0, 0, 0, 0, 6, - /* operation */ 5, 0, 0, 0, 'd', 'o', 'I', 't', 0, - /* padding */ 0, 0, 0, /* no service contexts */ 0, 0, 0, 0, /* short param */ 1, 1}); + readFromNio(new byte[] { 'G', 'I', 'O', 'P', 1, 2, Message.LITTLE_ENDIAN_BIT, Message.GIOPRequest, /* size */ 38, 0, 0, 0, + /* request ID */ 2, 0, 0, 0, /* response expected */ 1, /* request reserved */ 0, 0, 0, /* use key */ 0, 0, /* padding */ 0, + 0, /* object key */ 4, 0, 0, 0, 0, 0, 0, 6, /* operation */ 5, 0, 0, 0, 'd', 'o', 'I', 't', 0, /* padding */ 0, 0, 0, + /* no service contexts */ 0, 0, 0, 0, /* short param */ 1, 1 }); getConnection().doWork(); processQueuedWork(); @@ -142,21 +137,20 @@ public void readParameters(CDRInputObject input) { } @Test - public void whenRequest1_1_receivedFromSocketWithFragments_dispatchRequest() throws IOException, InterruptedException { // REG + public void whenRequest1_1_receivedFromSocketWithFragments_dispatchRequest() throws IOException, InterruptedException { // REG final List params = new ArrayList(); - defineRequestDispatcher( new RequestDispatcher() { + defineRequestDispatcher(new RequestDispatcher() { public void readParameters(CDRInputObject input) { params.add(input.read_short()); } }); - readFromSocketWithoutChannelAndDispatch(new byte[]{'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, - Message.GIOPRequest, /* size */ 0, 0, 0, 36, /* no service contexts */ 0, 0, 0, 0, - /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* reserved */ 0, 0, 0, - /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, + readFromSocketWithoutChannelAndDispatch(new byte[] { 'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, + /* size */ 0, 0, 0, 36, /* no service contexts */ 0, 0, 0, 0, /* request ID */ 0, 0, 0, 2, /* response expected */ 1, + /* reserved */ 0, 0, 0, /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, /* padding */ 0, 0, 0, /* principal */ 0, 0, 0, 0, - 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, - /* size */ 0, 0, 0, 2, /* short param */ 1, 1}); + 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, /* size */ 0, 0, 0, 2, /* short param */ 1, + 1 }); processSocketMessageWithFragments(1); assertEquals(1, getMediators().size()); @@ -181,14 +175,13 @@ public void readParameters(CDRInputObject input) { params.add(input.read_short()); } }); - readFromNio(new byte[]{'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, - Message.GIOPRequest, /* size */ 0, 0, 0, 36, /* no service contexts */ 0, 0, 0, 0, - /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* reserved */ 0, 0, 0, - /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, - /* padding */ 0, 0, 0, /* principal */ 0, 0, 0, 0, + readFromNio(new byte[] { 'G', 'I', 'O', 'P', 1, 1, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, /* size */ 0, 0, 0, 36, + /* no service contexts */ 0, 0, 0, 0, /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* reserved */ 0, 0, 0, + /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, /* operation */ 0, 0, 0, 5, 'd', 'o', 'I', 't', 0, /* padding */ 0, 0, 0, + /* principal */ 0, 0, 0, 0, - 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, - /* size */ 0, 0, 0, 2, /* short param */ 1, 1}); + 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, /* size */ 0, 0, 0, 2, /* short param */ 1, + 1 }); processNioMessageWithFragments(1); assertEquals(1, getMediators().size()); @@ -207,15 +200,13 @@ public void readParameters(CDRInputObject input) { params.add(input.read_short()); } }); - readFromNio(new byte[]{'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, - Message.GIOPRequest, /* size */ 0, 0, 0, 36, - /* request ID */ 0, 0, 0, 2, /* response expected */ 1, /* reserved */ 0, 0, 0, - /* use key */ 0, 0, /* padding */ 0, 0, /* object key */ 0, 0, 0, 4, 0, 0, 0, 6, - /* operation */ 0, 0, 0, 8, 'g', 'o', 'A', 'g', 'a', 'i', 'n', 0, - /* no service contexts */ 0, 0, 0, 0, - - 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, - /* size */ 0, 0, 0, 6, /* request id */ 0, 0, 0, 2, /* short param */ 1, 1}); + readFromNio(new byte[] { + 'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, /* size */ 0, 0, 0, 36, /* request ID */ 0, 0, 0, + 2, /* response expected */ 1, /* reserved */ 0, 0, 0, /* use key */ 0, 0, /* padding */ 0, 0, /* object key */ 0, 0, 0, 4, + 0, 0, 0, 6, /* operation */ 0, 0, 0, 8, 'g', 'o', 'A', 'g', 'a', 'i', 'n', 0, /* no service contexts */ 0, 0, 0, 0, + + 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, /* size */ 0, 0, 0, 6, /* request id */ 0, + 0, 0, 2, /* short param */ 1, 1 }); processNioMessageWithFragments(1); assertEquals(1, getMediators().size()); @@ -236,8 +227,8 @@ private void processNioMessageWithFragments(int numFragments) throws Interrupted @Test public void whenCloseConnectionReceivedFromSocket_shutdownConnection() { - readFromSocketWithoutChannelAndDispatch(new byte[]{'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCloseConnection, /* size */ 0, 0, 0, 0}); + readFromSocketWithoutChannelAndDispatch(new byte[] { 'G', 'I', 'O', 'P', 1, 1, Message.FLAG_NO_FRAG_BIG_ENDIAN, + Message.GIOPCloseConnection, /* size */ 0, 0, 0, 0 }); getConnection().doWork(); assertEquals(1, getNumConnectionsRemoved()); getConnection().clearDiscardedThrowable(); @@ -258,7 +249,6 @@ public void whenNioFullBufferWritable_allDataIsWritten() throws IOException { assertArrayEquals(BYTE_DATA, getSocketChannel().getDataWritten()); } - @Test public void whenNioChannelMomentarilyBusy_allDataIsWritten() throws IOException { useNio(); @@ -271,7 +261,8 @@ public void whenNioChannelMomentarilyBusy_allDataIsWritten() throws IOException @Test public void whenNioWholeMessageReceived_queueSingleEntry() throws IOException { useNio(); - getSocketChannel().enqueData(new byte[]{'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}); + getSocketChannel().enqueData(new byte[] { 'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, + 6, 1, 2, 3, 4, 5, 6 }); getConnection().doWork(); assertEquals(1, getWorkQueue().size()); assertTrue(getWorkQueue().remove() instanceof MessageMediator); @@ -280,7 +271,8 @@ public void whenNioWholeMessageReceived_queueSingleEntry() throws IOException { @Test public void whenNioMessageReceivedInTwoReads_queueSingleEntryAfterSecond() throws IOException { useNio(); - getSocketChannel().enqueData(new byte[]{'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, 6, 1, 2, 3, 4, 5, 6}); + getSocketChannel().enqueData(new byte[] { 'G', 'I', 'O', 'P', 1, 0, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPRequest, 0, 0, 0, + 6, 1, 2, 3, 4, 5, 6 }); getSocketChannel().setNumBytesToRead(8, 0); getConnection().doWork(); getConnection().doWork(); @@ -291,9 +283,9 @@ public void whenNioMessageReceivedInTwoReads_queueSingleEntryAfterSecond() throw @Test public void whenNioFragmentsIncluded_queueFirstMessageAndAddFragmentsToFragmentList() throws IOException { useNio(); - byte[] messages = {'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, 0, 0, 0, 6, 0, 0, 0, 3, 5, 6, - 'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPFragment, 0, 0, 0, 6, 0, 0, 0, 3, 5, 6, - 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0, 0, 0, 4, 0, 0, 0, 3}; + byte[] messages = { 'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, 0, 0, 0, 6, 0, 0, 0, 3, 5, 6, 'G', + 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPFragment, 0, 0, 0, 6, 0, 0, 0, 3, 5, 6, 'G', 'I', 'O', 'P', 1, + 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0, 0, 0, 4, 0, 0, 0, 3 }; getSocketChannel().enqueData(messages); getConnection().doWork(); assertEquals(1, getWorkQueue().size()); @@ -305,9 +297,9 @@ public void whenNioFragmentsIncluded_queueFirstMessageAndAddFragmentsToFragmentL @Test public void whenMessageWithFragmentsReceivedFromSocket_dispatchEachPart() throws IOException { - byte[] messages = {'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, 0, 0, 0, 6, 0, 0, 0, 3, 5, 6, - 'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPFragment, 0, 0, 0, 6, 0, 0, 0, 3, 5, 6, - 'G', 'I', 'O', 'P', 1, 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0, 0, 0, 4, 0, 0, 0, 3}; + byte[] messages = { 'G', 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPRequest, 0, 0, 0, 6, 0, 0, 0, 3, 5, 6, 'G', + 'I', 'O', 'P', 1, 2, Message.MORE_FRAGMENTS_BIT, Message.GIOPFragment, 0, 0, 0, 6, 0, 0, 0, 3, 5, 6, 'G', 'I', 'O', 'P', 1, + 2, Message.FLAG_NO_FRAG_BIG_ENDIAN, Message.GIOPFragment, 0, 0, 0, 4, 0, 0, 0, 3 }; readFromSocketWithoutChannelAndDispatch(messages); collectMediatorsAsDispatched(); getConnection().doWork(); @@ -317,6 +309,4 @@ public void whenMessageWithFragmentsReceivedFromSocket_dispatchEachPart() throws assertEquals(3, getMediators().size()); } - - } diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/transport/SelectorImplTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/transport/SelectorImplTest.java index 3b48faa23..35d75d749 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/transport/SelectorImplTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/transport/SelectorImplTest.java @@ -134,7 +134,6 @@ public void whenEventHappens_resetTheTimer() throws IOException { assertFalse(eventHandler.timeout); } - protected void setPrivateFieldValue(Object obj, String fieldName, Object value) { try { Class theClass = obj.getClass(); @@ -146,7 +145,8 @@ protected void setPrivateFieldValue(Object obj, String fieldName, Object value) } } - private void setPrivateFieldValue(Object obj, Class theClass, String fieldName, Object value) throws NoSuchFieldException, IllegalAccessException { + private void setPrivateFieldValue(Object obj, Class theClass, String fieldName, Object value) + throws NoSuchFieldException, IllegalAccessException { try { Field field = theClass.getDeclaredField(fieldName); field.setAccessible(true); @@ -282,7 +282,6 @@ public SelectionKey register(Selector sel, int ops, Object attachment) throws Cl return selectionKey; } - public void clearReadyOps() { for (SelectionKeyFake key : keys) key.readyOps = 0; diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/transport/SocketChannelReaderTest.java b/orbmain/src/test/java/com/sun/corba/ee/impl/transport/SocketChannelReaderTest.java index b439b8b6d..d7fa4083e 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/transport/SocketChannelReaderTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/transport/SocketChannelReaderTest.java @@ -32,7 +32,7 @@ public class SocketChannelReaderTest extends TransportTestBase { - private static final byte[] DATA_TO_BE_READ = new byte[]{0, 1, 2, 3, 4, 5, 6}; + private static final byte[] DATA_TO_BE_READ = new byte[] { 0, 1, 2, 3, 4, 5, 6 }; private SocketChannelReader reader; @Before @@ -70,7 +70,7 @@ private void enqueData(byte[] dataToBeRead, int offset, int length) { } private byte[] getSubarray(byte[] dataToBeRead, int offset, int length) { - byte[] data = new byte[Math.min(length, dataToBeRead.length-offset)]; + byte[] data = new byte[Math.min(length, dataToBeRead.length - offset)]; System.arraycopy(dataToBeRead, offset, data, 0, data.length); return data; } @@ -86,9 +86,9 @@ private void assertPopulatedBufferContents(ByteBuffer buffer, byte[] bytes) { assertEqualData(bytes, actual); } - private void assertEqualData( byte[] expected, byte[] actual) { + private void assertEqualData(byte[] expected, byte[] actual) { if (!Arrays.equals(expected, actual)) - fail( "expected " + Arrays.toString(expected) + " but was " + Arrays.toString(actual)); + fail("expected " + Arrays.toString(expected) + " but was " + Arrays.toString(actual)); } @Test diff --git a/orbmain/src/test/java/com/sun/corba/ee/impl/transport/TransportTestBase.java b/orbmain/src/test/java/com/sun/corba/ee/impl/transport/TransportTestBase.java index e3a7b48b4..3039a90bb 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/impl/transport/TransportTestBase.java +++ b/orbmain/src/test/java/com/sun/corba/ee/impl/transport/TransportTestBase.java @@ -162,7 +162,7 @@ protected void collectMediatorsAsDispatched() { connection.dispatcher = new ConnectionImpl.Dispatcher() { @Override public boolean dispatch(MessageMediator messageMediator) { - mediators.add( messageMediator ); + mediators.add(messageMediator); return false; } }; @@ -171,7 +171,7 @@ public boolean dispatch(MessageMediator messageMediator) { protected void readFromSocketWithoutChannelAndDispatch(byte[] bytes) { socketChannel = null; orbData.useSelectThread = false; - socket.inputStream = new ByteArrayInputStream( bytes ); + socket.inputStream = new ByteArrayInputStream(bytes); connection = new ConnectionImpl(orb, acceptor, socket); connection.setConnectionCache(connectionCache); } @@ -424,9 +424,11 @@ protected void implConfigureBlocking(boolean block) throws IOException { @Override public int read(ByteBuffer dst) throws IOException { - if (endOfInput) return -1; + if (endOfInput) + return -1; int numBytesToRead = Math.min(getNumBytesToRead(), Math.min(dataSize(), bufferCapacity(dst))); - if (numBytesToRead == 0) return 0; + if (numBytesToRead == 0) + return 0; dst.put(readableData, readPos, numBytesToRead); readPos += numBytesToRead; @@ -445,7 +447,6 @@ protected byte[] getDataWritten() { return dataWritten; } - public void setEndOfInput() { endOfInput = true; } @@ -574,9 +575,11 @@ private class SocketFake extends Socket { public SocketChannel getChannel() { return socketChannel; } + public InputStream getInputStream() throws IOException { return inputStream; } + public OutputStream getOutputStream() throws IOException { return outputStream; } @@ -594,6 +597,7 @@ public void dispatch(MessageMediator messageMediator) { readParameters(messageMediator.getInputObject()); } - public void readParameters( CDRInputObject input ) {} + public void readParameters(CDRInputObject input) { + } } } diff --git a/orbmain/src/test/java/com/sun/corba/ee/spi/presentation/rmi/PresentationDefaultsTest.java b/orbmain/src/test/java/com/sun/corba/ee/spi/presentation/rmi/PresentationDefaultsTest.java index 646e0c0ed..c28a26285 100644 --- a/orbmain/src/test/java/com/sun/corba/ee/spi/presentation/rmi/PresentationDefaultsTest.java +++ b/orbmain/src/test/java/com/sun/corba/ee/spi/presentation/rmi/PresentationDefaultsTest.java @@ -35,37 +35,38 @@ public class PresentationDefaultsTest { - private List mementos = new ArrayList<>(); + private List mementos = new ArrayList<>(); - @Before - public void setUp() throws Exception { + @Before + public void setUp() throws Exception { - } + } - @After - public void tearDown() throws Exception { - for (Memento memento : mementos) memento.revert(); - } + @After + public void tearDown() throws Exception { + for (Memento memento : mementos) + memento.revert(); + } - @Test - public void dynamicStubFactory_createsDynamicStubs() throws Exception { - assertThat(PresentationDefaults.getDynamicStubFactoryFactory().createsDynamicStubs(), is(true)); - } + @Test + public void dynamicStubFactory_createsDynamicStubs() throws Exception { + assertThat(PresentationDefaults.getDynamicStubFactoryFactory().createsDynamicStubs(), is(true)); + } - @Test - public void staticStubFactory_doesNotCreateDynamicStubs() throws Exception { - assertThat(PresentationDefaults.getStaticStubFactoryFactory().createsDynamicStubs(), is(false)); - } + @Test + public void staticStubFactory_doesNotCreateDynamicStubs() throws Exception { + assertThat(PresentationDefaults.getStaticStubFactoryFactory().createsDynamicStubs(), is(false)); + } - @Test - public void defaultOrbPresentationManager_createsDynamicStubs() throws Exception { - assertThat(PresentationDefaults.makeOrbPresentationManager().useDynamicStubs(), is(true)); - } + @Test + public void defaultOrbPresentationManager_createsDynamicStubs() throws Exception { + assertThat(PresentationDefaults.makeOrbPresentationManager().useDynamicStubs(), is(true)); + } - @Test - public void whenSystemPropertyFalse_presentationManagerCreatesStaticStubs() throws Exception { - mementos.add(SystemPropertySupport.install(ORBConstants.USE_DYNAMIC_STUB_PROPERTY, "false")); + @Test + public void whenSystemPropertyFalse_presentationManagerCreatesStaticStubs() throws Exception { + mementos.add(SystemPropertySupport.install(ORBConstants.USE_DYNAMIC_STUB_PROPERTY, "false")); - assertThat(PresentationDefaults.makeOrbPresentationManager().useDynamicStubs(), is(false)); - } + assertThat(PresentationDefaults.makeOrbPresentationManager().useDynamicStubs(), is(false)); + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ContainerClash1.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ContainerClash1.java index 103eba25a..f525b6b4d 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ContainerClash1.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ContainerClash1.java @@ -22,5 +22,5 @@ public interface ContainerClash1 extends java.rmi.Remote { void ContainerClash1() throws java.rmi.RemoteException; - + } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ContainerClash2.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ContainerClash2.java index 06e1334d0..33745a57f 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ContainerClash2.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ContainerClash2.java @@ -22,5 +22,5 @@ public interface ContainerClash2 extends java.rmi.Remote { void ContainerCLASH2() throws java.rmi.RemoteException; - + } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/Default.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/Default.java index db5b310a0..87ae9d2de 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/Default.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/Default.java @@ -24,10 +24,13 @@ */ public class Default { - public class Inner {} + public class Inner { + } - public class _Inner {} + public class _Inner { + } - public class _Default {} + public class _Default { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLCaseSensitivityTest.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLCaseSensitivityTest.java index eaa2bccf5..3aaea403a 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLCaseSensitivityTest.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLCaseSensitivityTest.java @@ -23,50 +23,41 @@ public class IDLCaseSensitivityTest { // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. + // interface methods. See TestIDLNameTranslator for sorting details. // - public static final String[] IDL_NAMES = { - "ABCDEFGHIJKLmNOPQRSTUVWXYzA_0_1_2_3_4_5_6_7_8_9_10_11_13_14_15_16_17_18_19_20_21_22_23_24_26", - "B_0", - "JACK_0_1_2_3", - "JACKY", - "Jack_0", - "a", - "abcdefghijklMnopqrstuvwxyza_12", - "abcdefghijklmnopqrstuvwxyzA_26", - "b_", - "b__", - "jAcK_1_3", - "jack_" - }; - + public static final String[] IDL_NAMES = { + "ABCDEFGHIJKLmNOPQRSTUVWXYzA_0_1_2_3_4_5_6_7_8_9_10_11_13_14_15_16_17_18_19_20_21_22_23_24_26", "B_0", "JACK_0_1_2_3", "JACKY", + "Jack_0", "a", "abcdefghijklMnopqrstuvwxyza_12", "abcdefghijklmnopqrstuvwxyzA_26", "b_", "b__", "jAcK_1_3", "jack_" }; + public static String[] getIDLNames() { return IDL_NAMES; } public interface IDLCaseSensitivity extends java.rmi.Remote { - String ABCDEFGHIJKLmNOPQRSTUVWXYzA(int a) - throws java.rmi.RemoteException; + String ABCDEFGHIJKLmNOPQRSTUVWXYzA(int a) throws java.rmi.RemoteException; void B() throws java.rmi.RemoteException; boolean JACK() throws java.rmi.RemoteException; + void JACKY() throws java.rmi.RemoteException; + void Jack() throws java.rmi.RemoteException; void a() throws java.rmi.RemoteException; void abcdefghijklMnopqrstuvwxyza() throws java.rmi.RemoteException; + void abcdefghijklmnopqrstuvwxyzA() throws java.rmi.RemoteException; void b() throws java.rmi.RemoteException; void b__() throws java.rmi.RemoteException; - int jAcK() throws java.rmi.RemoteException; - void jack() throws java.rmi.RemoteException; - + + void jack() throws java.rmi.RemoteException; + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLComboTest1.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLComboTest1.java index cd1e9b724..17ec47656 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLComboTest1.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLComboTest1.java @@ -23,82 +23,64 @@ public class IDLComboTest1 { // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. + // interface methods. See TestIDLNameTranslator for sorting details. // - static final String[] IDL_NAMES = { - - "ABCDEF_0_1_2_3_4_5", - "CCDcxU04E3U05E90123_0_1_2", - "CCdCxU04E3U05E90123_0_1_3", - "ONEWay_0_1_2_3", - - "PLANT__corba_dynamicrmiiiop_testclasses_Raises", - "PLANT__corba_dynamicrmiiiop_testclasses_Raises__Union", - // "PLANT__corba_dynamicrmiiiop_testclasses_Raises__UniU8001code", - "PLANT__corba_dynamicrmiiiop_testclasses_Raises___Foo", - "PLANT__corba_dynamicrmiiiop_testclasses_Raises___Union", - - "QQQQQ__", - "QQQQQ__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises__long", - "RRRRR__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises__Union", - "RRRRR__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises__Union__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises___Foo__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises___Union", - - "SSSSS__corba_dynamicrmiiiop_testclasses_J_Raises", - "SSSSS__corba_dynamicrmiiiop_testclasses_J_Raises__Union", - "SSSSS__corba_dynamicrmiiiop_testclasses_J_Raises___Foo", - "SSSSS__corba_dynamicrmiiiop_testclasses_J_Raises___Union", - - "SSSTT__corba_dynamicrmiiiop_testclasses_J_upackage_Foo", - // "SSSTT__corba_dynamicrmiiiop_testclasses_dolU0024lar_Foo", - "SSSTT__corba_dynamicrmiiiop_testclasses_typedef_Foo", - - "TTTTT__", - "TTTTT__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises__long", - - - "TTTUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_J_upackage_seq1_Foo", - // "TTTUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_dolU0024lar_seq1_Foo", - "TTTUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_typedef_seq1_Foo", - - "UUUUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises__Union", - - "UUUUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises__Union__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises___Foo__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises___Union", - - "J_BU8001U0024", - "J_CCMcxU04E3U05E90123_1_2_3", - "J_CCmCxU04E3U05E90123_1_2_4", - "abcdef___", - "abcdef___long", - "_get_octet", - "_get_ZWepT_0_1_4", - "onewAy_4", - "_set_octet", - "zWePt_1_3" - + static final String[] IDL_NAMES = { + + "ABCDEF_0_1_2_3_4_5", "CCDcxU04E3U05E90123_0_1_2", "CCdCxU04E3U05E90123_0_1_3", "ONEWay_0_1_2_3", + + "PLANT__corba_dynamicrmiiiop_testclasses_Raises", "PLANT__corba_dynamicrmiiiop_testclasses_Raises__Union", + // "PLANT__corba_dynamicrmiiiop_testclasses_Raises__UniU8001code", + "PLANT__corba_dynamicrmiiiop_testclasses_Raises___Foo", "PLANT__corba_dynamicrmiiiop_testclasses_Raises___Union", + + "QQQQQ__", "QQQQQ__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises__long", + "RRRRR__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises__Union", + "RRRRR__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises__Union__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises___Foo__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Raises___Union", + + "SSSSS__corba_dynamicrmiiiop_testclasses_J_Raises", "SSSSS__corba_dynamicrmiiiop_testclasses_J_Raises__Union", + "SSSSS__corba_dynamicrmiiiop_testclasses_J_Raises___Foo", "SSSSS__corba_dynamicrmiiiop_testclasses_J_Raises___Union", + + "SSSTT__corba_dynamicrmiiiop_testclasses_J_upackage_Foo", + // "SSSTT__corba_dynamicrmiiiop_testclasses_dolU0024lar_Foo", + "SSSTT__corba_dynamicrmiiiop_testclasses_typedef_Foo", + + "TTTTT__", "TTTTT__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises__long", + + "TTTUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_J_upackage_seq1_Foo", + // "TTTUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_dolU0024lar_seq1_Foo", + "TTTUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_typedef_seq1_Foo", + + "UUUUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises__Union", + + "UUUUU__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises__Union__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises___Foo__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Raises___Union", + + "J_BU8001U0024", "J_CCMcxU04E3U05E90123_1_2_3", "J_CCmCxU04E3U05E90123_1_2_4", "abcdef___", "abcdef___long", "_get_octet", + "_get_ZWepT_0_1_4", "onewAy_4", "_set_octet", "zWePt_1_3" + }; - + public static String[] getIDLNames() { return IDL_NAMES; } /** - * RMI Interface with a set of methods that involve multiple mangling - * rules from the Java2IDL spec. + * RMI Interface with a set of methods that involve multiple mangling rules from the Java2IDL spec. */ public interface IDLCombo extends java.rmi.Remote { - // Differs in case with a() + // Differs in case with a() void ABCDEF() throws java.rmi.RemoteException; // methods that Differ in case and have illegal IDL chars void CCDcx\u04e3\u05E90123() throws java.rmi.RemoteException; + void CCdCx\u04e3\u05E90123() throws java.rmi.RemoteException; // Clashes with IDL keyword and differs only in case with onewAy - void ONEWay() throws java.rmi.RemoteException; + void ONEWay() throws java.rmi.RemoteException; // class name that clashes with idl keyword + overloading - void PLANT(Raises r) throws java.rmi.RemoteException; + void PLANT(Raises r) throws java.rmi.RemoteException; // inner class name that clashes with idl keyword, whose enclosing // class also clashes with idl keyword + overloading @@ -106,7 +88,7 @@ public interface IDLCombo extends java.rmi.Remote { // inner class with unicode chars that need to be mangled // void PLANT(Raises.Uni\u8001code f) throws java.rmi.RemoteException; - + // inner class beginning with underscore, whose enclosing class // clashes with idl keyword + overloading void PLANT(Raises._Foo r) throws java.rmi.RemoteException; @@ -118,61 +100,65 @@ public interface IDLCombo extends java.rmi.Remote { // overloading + class names that clash with keywords void QQQQQ() throws java.rmi.RemoteException; + void QQQQQ(Raises[] r, int q) throws java.rmi.RemoteException; void RRRRR(Raises.Union[] r) throws java.rmi.RemoteException; + void RRRRR(Raises.Union[] r, Raises._Foo[] s, Raises._Union[] t) throws java.rmi.RemoteException; - // class name that starts with underscore, where remainder + // class name that starts with underscore, where remainder // clashes with idl keyword - void SSSSS(_Raises r) throws java.rmi.RemoteException; + void SSSSS(_Raises r) throws java.rmi.RemoteException; // inner class that clashes with idl keyword, whose enclosing class // is underscore + keyword void SSSSS(_Raises.Union r) throws java.rmi.RemoteException; - + void SSSSS(_Raises._Foo r) throws java.rmi.RemoteException; - void SSSSS(_Raises._Union r) throws java.rmi.RemoteException; + void SSSSS(_Raises._Union r) throws java.rmi.RemoteException; // intermeidate package starting with an underscore - void SSSTT(corba.dynamicrmiiiop.testclasses._upackage.Foo r) - throws java.rmi.RemoteException; + void SSSTT(corba.dynamicrmiiiop.testclasses._upackage.Foo r) throws java.rmi.RemoteException; // subpackage name with illegal idl char // void SSSTT(corba.dynamicrmiiiop.testclasses.dol$lar.Foo r) - // throws java.rmi.RemoteException; + // throws java.rmi.RemoteException; // intermediate package name(typedef) that clashes with idl keyword - void SSSTT(corba.dynamicrmiiiop.testclasses.typedef.Foo r) - throws java.rmi.RemoteException; + void SSSTT(corba.dynamicrmiiiop.testclasses.typedef.Foo r) throws java.rmi.RemoteException; void TTTTT() throws java.rmi.RemoteException; - void TTTTT(_Raises[] r, int q) throws java.rmi.RemoteException; + + void TTTTT(_Raises[] r, int q) throws java.rmi.RemoteException; // intermediate package starting with an underscore void TTTUU(corba.dynamicrmiiiop.testclasses._upackage.Foo[] f) throws java.rmi.RemoteException; // subpackage name with illegal idl char // void TTTUU(corba.dynamicrmiiiop.testclasses.dol$lar.Foo[] r) - // throws java.rmi.RemoteException; + // throws java.rmi.RemoteException; // intermediate package name(typedef) that clashes with idl keyword void TTTUU(corba.dynamicrmiiiop.testclasses.typedef.Foo[] f) throws java.rmi.RemoteException; void UUUUU(_Raises.Union[] r) throws java.rmi.RemoteException; + void UUUUU(_Raises.Union[] r, _Raises._Foo[] s, _Raises._Union[] t) throws java.rmi.RemoteException; // Combo of leading underscore + illegal IDL chars - void _B\u8001$() throws java.rmi.RemoteException; + void _B\u8001$() throws java.rmi.RemoteException; // methods that Differ in case and have illegal IDL chars and // start with underscore void _CCMcx\u04e3\u05E90123() throws java.rmi.RemoteException; + void _CCmCx\u04e3\u05E90123() throws java.rmi.RemoteException; - + // Differs in case with ABCDEF() and is also overloaded void abcdef() throws java.rmi.RemoteException; + void abcdef(int a) throws java.rmi.RemoteException; // property with attribute name that is the same as an IDL keyword. @@ -183,7 +169,7 @@ void SSSTT(corba.dynamicrmiiiop.testclasses.typedef.Foo r) int getZWepT() throws java.rmi.RemoteException; // Clashes with IDL keyword and differs only in case with ONEWay - void onewAy() throws java.rmi.RemoteException; + void onewAy() throws java.rmi.RemoteException; // property with attribute name that is the same as an IDL keyword. // rmic does not mangle these. diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLDefaultTest.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLDefaultTest.java index 1661f20f5..cad3caf74 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLDefaultTest.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLDefaultTest.java @@ -23,44 +23,42 @@ public class IDLDefaultTest { // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. + // interface methods. See TestIDLNameTranslator for sorting details. // static final String[] IDL_NAMES = { - "AAA__corba_dynamicrmiiiop_testclasses_Default", - "AAA__corba_dynamicrmiiiop_testclasses_J_Default", - "BBB__corba_dynamicrmiiiop_testclasses_Default__corba_dynamicrmiiiop_testclasses_Default__Inner__corba_dynamicrmiiiop_testclasses_Default___Inner__corba_dynamicrmiiiop_testclasses_Default___Default", - "BBB__corba_dynamicrmiiiop_testclasses_J_Default__corba_dynamicrmiiiop_testclasses_J_Default__Inner__corba_dynamicrmiiiop_testclasses_J_Default___Inner__corba_dynamicrmiiiop_testclasses_J_Default__Default", - "CCC__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default", - "CCC__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default", + "AAA__corba_dynamicrmiiiop_testclasses_Default", "AAA__corba_dynamicrmiiiop_testclasses_J_Default", + "BBB__corba_dynamicrmiiiop_testclasses_Default__corba_dynamicrmiiiop_testclasses_Default__Inner__corba_dynamicrmiiiop_testclasses_Default___Inner__corba_dynamicrmiiiop_testclasses_Default___Default", + "BBB__corba_dynamicrmiiiop_testclasses_J_Default__corba_dynamicrmiiiop_testclasses_J_Default__Inner__corba_dynamicrmiiiop_testclasses_J_Default___Inner__corba_dynamicrmiiiop_testclasses_J_Default__Default", + "CCC__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default", + "CCC__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default", - "DDD__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default__Inner__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default___Inner__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default___Default", - "DDD__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default__Inner__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default___Inner__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default__Default" + "DDD__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default__Inner__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default___Inner__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_Default___Default", + "DDD__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default__Inner__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default___Inner__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_J_Default__Default" }; - + public static String[] getIDLNames() { return IDL_NAMES; } public interface IDLDefault extends java.rmi.Remote { - + void AAA(Default d) throws java.rmi.RemoteException; + void AAA(_Default d) throws java.rmi.RemoteException; - void BBB(Default d, Default.Inner e, Default._Inner f, - Default._Default g) throws java.rmi.RemoteException; - void BBB(_Default d, _Default.Inner e, _Default._Inner f, - _Default.Default g) throws java.rmi.RemoteException; - - + void BBB(Default d, Default.Inner e, Default._Inner f, Default._Default g) throws java.rmi.RemoteException; + + void BBB(_Default d, _Default.Inner e, _Default._Inner f, _Default.Default g) throws java.rmi.RemoteException; + void CCC(Default[] d) throws java.rmi.RemoteException; + void CCC(_Default[] d) throws java.rmi.RemoteException; - void DDD(Default[] d, Default.Inner[] e, Default._Inner[] f, - Default._Default[] g) throws java.rmi.RemoteException; - void DDD(_Default[] d, _Default.Inner[] e, _Default._Inner[] f, - _Default.Default[] g) throws java.rmi.RemoteException; + void DDD(Default[] d, Default.Inner[] e, Default._Inner[] f, Default._Default[] g) throws java.rmi.RemoteException; + + void DDD(_Default[] d, _Default.Inner[] e, _Default._Inner[] f, _Default.Default[] g) throws java.rmi.RemoteException; } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLIdentifiersTest.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLIdentifiersTest.java index 2ec2d58b7..02b3eb301 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLIdentifiersTest.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLIdentifiersTest.java @@ -23,29 +23,18 @@ public class IDLIdentifiersTest { // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. + // interface methods. See TestIDLNameTranslator for sorting details. // - static final String[] IDL_NAMES = { - - "ABCDEFGHIJKLMNOPQRSTUVWXYZ0", - "aU0024U0024U0024U0024", - "a0123456789", - "a_", - "a_0", - "abcdefghijklmnopqrstuvwxyz", - - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF", - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF", - - "U0100U0101U0170\u00FF\u00FEU0024", - "U0393U0394U0398U03B6", - "U0393U0394U0398U03B6_abc", - "U04E3U04F3U04D5U04E6", - "U05E9U05EAU05F0U05E5U05DE", - "U13E0U13F0U13F2U13F4", - "U50AFU50BFU50EF______", - }; - + static final String[] IDL_NAMES = { + + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0", "aU0024U0024U0024U0024", "a0123456789", "a_", "a_0", "abcdefghijklmnopqrstuvwxyz", + + "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF", + "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF", + + "U0100U0101U0170\u00FF\u00FEU0024", "U0393U0394U0398U03B6", "U0393U0394U0398U03B6_abc", "U04E3U04F3U04D5U04E6", + "U05E9U05EAU05F0U05E5U05DE", "U13E0U13F0U13F2U13F4", "U50AFU50BFU50EF______", }; + public static String[] getIDLNames() { return IDL_NAMES; } @@ -55,22 +44,29 @@ public interface IDLIdentifiers extends java.rmi.Remote { void ABCDEFGHIJKLMNOPQRSTUVWXYZ0() throws java.rmi.RemoteException; void a$$$$() throws java.rmi.RemoteException; + void a0123456789() throws java.rmi.RemoteException; + void a_() throws java.rmi.RemoteException; + void a_0() throws java.rmi.RemoteException; + void abcdefghijklmnopqrstuvwxyz() throws java.rmi.RemoteException; - - // note : no 00D7 (x) - void \u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF() throws java.rmi.RemoteException; + + // note : no 00D7 (x) + void \u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF() + throws java.rmi.RemoteException; // note : no 00F7 (/) - void \u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF() throws java.rmi.RemoteException; + void \u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF() + throws java.rmi.RemoteException; // latin extended-A, right outside the IDL range void \u0100\u0101\u0170\u00FF\u00FE\u0024() throws java.rmi.RemoteException; - + // some greek letters void \u0393\u0394\u0398\u03B6() throws java.rmi.RemoteException; + void \u0393\u0394\u0398\u03B6_abc() throws java.rmi.RemoteException; // some Cyrillic letters @@ -84,7 +80,7 @@ public interface IDLIdentifiers extends java.rmi.Remote { // some CJK Unified Ideographs void \u50AF\u50bF\u50Ef______() throws java.rmi.RemoteException; - + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLKeywordsTest.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLKeywordsTest.java index 32bf6beb9..8f32d1bad 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLKeywordsTest.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLKeywordsTest.java @@ -23,20 +23,16 @@ public class IDLKeywordsTest { // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. - // + // interface methods. See TestIDLNameTranslator for sorting details. + // // List doesn't contain the following // IDL Keywords : boolean, case, char, const, default, double, float, - // interface, long, Object, short, switch, void, num - // since they are also Java keywords + // interface, long, Object, short, switch, void, num + // since they are also Java keywords // - static final String[] IDL_NAMES = { - "_Any", "_EXCEPTION", "_RaiseS", "_TRUE", "_attribute", "_context", - "_falsE", "_in", "_inout", "_module", "_octet", - "_oneway", "_out", "_readonly", "_sequence", - "_string", "_struct", "_typedef", "_union", "_unsigNED" - }; - + static final String[] IDL_NAMES = { "_Any", "_EXCEPTION", "_RaiseS", "_TRUE", "_attribute", "_context", "_falsE", "_in", "_inout", + "_module", "_octet", "_oneway", "_out", "_readonly", "_sequence", "_string", "_struct", "_typedef", "_union", "_unsigNED" }; + public static String[] getIDLNames() { return IDL_NAMES; } @@ -44,31 +40,47 @@ public static String[] getIDLNames() { public interface IDLKeywords extends java.rmi.Remote { // Comparison to IDL keywords is case-insensitive. - - void Any() throws java.rmi.RemoteException; - void EXCEPTION() throws java.rmi.RemoteException; - void RaiseS() throws java.rmi.RemoteException; + + void Any() throws java.rmi.RemoteException; + + void EXCEPTION() throws java.rmi.RemoteException; + + void RaiseS() throws java.rmi.RemoteException; + void TRUE() throws java.rmi.RemoteException; - void attribute() throws java.rmi.RemoteException; - void context() throws java.rmi.RemoteException; - void falsE() throws java.rmi.RemoteException; + void attribute() throws java.rmi.RemoteException; + + void context() throws java.rmi.RemoteException; + + void falsE() throws java.rmi.RemoteException; + + void in() throws java.rmi.RemoteException; - void in() throws java.rmi.RemoteException; void inout() throws java.rmi.RemoteException; - void module() throws java.rmi.RemoteException; + + void module() throws java.rmi.RemoteException; + void octet() throws java.rmi.RemoteException; - void oneway() throws java.rmi.RemoteException; - void out() throws java.rmi.RemoteException; - void readonly() throws java.rmi.RemoteException; + void oneway() throws java.rmi.RemoteException; + + void out() throws java.rmi.RemoteException; + + void readonly() throws java.rmi.RemoteException; + void sequence() throws java.rmi.RemoteException; - void string() throws java.rmi.RemoteException; - void struct() throws java.rmi.RemoteException; - void typedef() throws java.rmi.RemoteException; - void union() throws java.rmi.RemoteException; - void unsigNED() throws java.rmi.RemoteException; - + + void string() throws java.rmi.RemoteException; + + void struct() throws java.rmi.RemoteException; + + void typedef() throws java.rmi.RemoteException; + + void union() throws java.rmi.RemoteException; + + void unsigNED() throws java.rmi.RemoteException; + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLLeadingUnderscoresTest.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLLeadingUnderscoresTest.java index 3dfef58dd..005757a3a 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLLeadingUnderscoresTest.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLLeadingUnderscoresTest.java @@ -23,20 +23,12 @@ public class IDLLeadingUnderscoresTest { // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. + // interface methods. See TestIDLNameTranslator for sorting details. // - static final String[] IDL_NAMES = { - - "J_", - "J_0", - "J_J_", - "J__", - "J______________________________Z", - "J__a", - "J_a", - "J_jj" - }; - + static final String[] IDL_NAMES = { + + "J_", "J_0", "J_J_", "J__", "J______________________________Z", "J__a", "J_a", "J_jj" }; + public static String[] getIDLNames() { return IDL_NAMES; } @@ -55,10 +47,10 @@ public interface IDLLeadingUnderscores extends java.rmi.Remote { void __a() throws java.rmi.RemoteException; - void _a() throws java.rmi.RemoteException; + void _a() throws java.rmi.RemoteException; + + void _jj() throws java.rmi.RemoteException; - void _jj() throws java.rmi.RemoteException; - } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLMultipleInterfaceTest.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLMultipleInterfaceTest.java index 15bac2050..38e300ec6 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLMultipleInterfaceTest.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLMultipleInterfaceTest.java @@ -19,32 +19,29 @@ package corba.dynamicrmiiiop.testclasses; -import java.rmi.RemoteException ; +import java.rmi.RemoteException; public class IDLMultipleInterfaceTest { // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. + // interface methods. See TestIDLNameTranslator for sorting details. // - public static final String[] IDL_NAMES = { - "A1", - "CB", - "CC", - "CD" - } ; + public static final String[] IDL_NAMES = { "A1", "CB", "CC", "CD" }; public static String[] getIDLNames() { return IDL_NAMES; } - + public interface first extends java.rmi.Remote { - void A1() throws RemoteException ; - void CC( int a ) throws RemoteException ; + void A1() throws RemoteException; + + void CC(int a) throws RemoteException; } public interface second extends java.rmi.Remote { - void CB( int a ) throws RemoteException ; - void CD( int a ) throws RemoteException ; + void CB(int a) throws RemoteException; + + void CD(int a) throws RemoteException; } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLOverloadedTest.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLOverloadedTest.java index 60f476608..83507823e 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLOverloadedTest.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLOverloadedTest.java @@ -23,83 +23,50 @@ public class IDLOverloadedTest { public class Inner\u0300 { - public class Extra\u0301Inner {} + public class Extra\u0301Inner { + } } - - + // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. + // interface methods. See TestIDLNameTranslator for sorting details. // - public static final String[] IDL_NAMES = { - - "A__", - "A__org_omg_boxedRMI_seq1_octet", - "A__org_omg_boxedRMI_seq1_wchar", - "A__org_omg_boxedRMI_seq1_double", - "A__org_omg_boxedRMI_seq1_float", - "A__org_omg_boxedRMI_seq1_long", - "A__org_omg_boxedRMI_seq1_long_long", - - "A__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_IDLOverloadedTest__InnerU0300__ExtraU0301Inner", - "A__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_IDLOverloadedTest__InnerU0300", - - "A__org_omg_boxedRMI_java_io_seq1_Externalizable", - "A__org_omg_boxedRMI_java_io_seq1_Serializable", - "A__org_omg_boxedRMI_java_lang_seq1_Boolean", - "A__org_omg_boxedRMI_java_lang_seq1_Byte", - "A__org_omg_boxedRMI_java_lang_seq1_Character", - "A__org_omg_boxedRMI_javax_rmi_CORBA_seq1_ClassDesc", - "A__org_omg_boxedRMI_java_lang_seq1_Double", - "A__org_omg_boxedRMI_java_lang_seq1_Float", - "A__org_omg_boxedRMI_java_lang_seq1_Integer", - "A__org_omg_boxedRMI_java_lang_seq1_Long", - "A__org_omg_boxedRMI_java_lang_seq1_Object", - - "A__org_omg_boxedRMI_java_lang_seq1_Short", - "A__org_omg_boxedRMI_CORBA_seq1_WStringValue", - "A__org_omg_boxedRMI_java_rmi_seq1_Remote", - "A__org_omg_boxedRMI_javax_swing_seq1_UIDefaults__ActiveValue", - "A__org_omg_boxedRMI_seq1_Object", - - "A__org_omg_boxedRMI_seq1_short", - "A__org_omg_boxedRMI_seq1_boolean", - "A__org_omg_boxedRMI_seq2_boolean", - "A__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq4_IDLOverloadedTest__InnerU0300__ExtraU0301Inner__org_omg_boxedRMI_CORBA_seq2_WStringValue__long", - "A__org_omg_boxedRMI_seq16_boolean", - "A__boolean", - "A__octet", - "A__wchar", - "A__corba_dynamicrmiiiop_testclasses_IDLOverloadedTest__InnerU0300", - "A__corba_dynamicrmiiiop_testclasses_IDLOverloadedTest__InnerU0300__ExtraU0301Inner", - "A__org_omg_boxedIDL_corba_dynamicrmiiiop_testclasses_TestStruct", - "A__double", - "A__float", - "A__long", - "A__long__float__double__wchar__octet__boolean__java_io_Serializable__CORBA_WStringValue", - - "A__java_io_Externalizable", - "A__java_io_Serializable", - "A__java_lang_Boolean", - "A__java_lang_Byte", - "A__java_lang_Character", - "A__javax_rmi_CORBA_ClassDesc", - "A__java_lang_Double", - "A__java_lang_Float", - "A__java_lang_Integer", - "A__java_lang_Long", - "A__java_lang_Object", - "A__java_lang_Short", - "A__CORBA_WStringValue", - "A__java_rmi_Remote", - "A__javax_swing_UIDefaults__ActiveValue", - - "A__long_long", - "A__Object", - "A__short" - + public static final String[] IDL_NAMES = { + + "A__", "A__org_omg_boxedRMI_seq1_octet", "A__org_omg_boxedRMI_seq1_wchar", "A__org_omg_boxedRMI_seq1_double", + "A__org_omg_boxedRMI_seq1_float", "A__org_omg_boxedRMI_seq1_long", "A__org_omg_boxedRMI_seq1_long_long", + + "A__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_IDLOverloadedTest__InnerU0300__ExtraU0301Inner", + "A__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq1_IDLOverloadedTest__InnerU0300", + + "A__org_omg_boxedRMI_java_io_seq1_Externalizable", "A__org_omg_boxedRMI_java_io_seq1_Serializable", + "A__org_omg_boxedRMI_java_lang_seq1_Boolean", "A__org_omg_boxedRMI_java_lang_seq1_Byte", + "A__org_omg_boxedRMI_java_lang_seq1_Character", "A__org_omg_boxedRMI_javax_rmi_CORBA_seq1_ClassDesc", + "A__org_omg_boxedRMI_java_lang_seq1_Double", "A__org_omg_boxedRMI_java_lang_seq1_Float", + "A__org_omg_boxedRMI_java_lang_seq1_Integer", "A__org_omg_boxedRMI_java_lang_seq1_Long", + "A__org_omg_boxedRMI_java_lang_seq1_Object", + + "A__org_omg_boxedRMI_java_lang_seq1_Short", "A__org_omg_boxedRMI_CORBA_seq1_WStringValue", + "A__org_omg_boxedRMI_java_rmi_seq1_Remote", "A__org_omg_boxedRMI_javax_swing_seq1_UIDefaults__ActiveValue", + "A__org_omg_boxedRMI_seq1_Object", + + "A__org_omg_boxedRMI_seq1_short", "A__org_omg_boxedRMI_seq1_boolean", "A__org_omg_boxedRMI_seq2_boolean", + "A__org_omg_boxedRMI_corba_dynamicrmiiiop_testclasses_seq4_IDLOverloadedTest__InnerU0300__ExtraU0301Inner__org_omg_boxedRMI_CORBA_seq2_WStringValue__long", + "A__org_omg_boxedRMI_seq16_boolean", "A__boolean", "A__octet", "A__wchar", + "A__corba_dynamicrmiiiop_testclasses_IDLOverloadedTest__InnerU0300", + "A__corba_dynamicrmiiiop_testclasses_IDLOverloadedTest__InnerU0300__ExtraU0301Inner", + "A__org_omg_boxedIDL_corba_dynamicrmiiiop_testclasses_TestStruct", "A__double", "A__float", "A__long", + "A__long__float__double__wchar__octet__boolean__java_io_Serializable__CORBA_WStringValue", + + "A__java_io_Externalizable", "A__java_io_Serializable", "A__java_lang_Boolean", "A__java_lang_Byte", "A__java_lang_Character", + "A__javax_rmi_CORBA_ClassDesc", "A__java_lang_Double", "A__java_lang_Float", "A__java_lang_Integer", "A__java_lang_Long", + "A__java_lang_Object", "A__java_lang_Short", "A__CORBA_WStringValue", "A__java_rmi_Remote", + "A__javax_swing_UIDefaults__ActiveValue", + + "A__long_long", "A__Object", "A__short" + }; - + public static String[] getIDLNames() { return IDL_NAMES; } @@ -109,74 +76,120 @@ public interface IDLOverloaded extends java.rmi.Remote { void A() throws java.rmi.RemoteException; void A(byte[] b) throws java.rmi.RemoteException; + void A(char[] c) throws java.rmi.RemoteException; + void A(double[] d) throws java.rmi.RemoteException; + void A(float[] f) throws java.rmi.RemoteException; + void A(int[] a) throws java.rmi.RemoteException; + void A(long[] a) throws java.rmi.RemoteException; void A(corba.dynamicrmiiiop.testclasses.IDLOverloadedTest.Inner\u0300.Extra\u0301Inner[] b) throws java.rmi.RemoteException; - void A(corba.dynamicrmiiiop.testclasses.IDLOverloadedTest.Inner\u0300[] a) - throws java.rmi.RemoteException; + + void A(corba.dynamicrmiiiop.testclasses.IDLOverloadedTest.Inner\u0300[] a) throws java.rmi.RemoteException; void A(java.io.Externalizable[] e) throws java.rmi.RemoteException; + void A(java.io.Serializable[] s) throws java.rmi.RemoteException; + void A(java.lang.Boolean[] b) throws java.rmi.RemoteException; + void A(java.lang.Byte[] b) throws java.rmi.RemoteException; + void A(java.lang.Character[] b) throws java.rmi.RemoteException; + void A(java.lang.Class[] c) throws java.rmi.RemoteException; + void A(java.lang.Double[] d) throws java.rmi.RemoteException; + void A(java.lang.Float[] f) throws java.rmi.RemoteException; + void A(java.lang.Integer[] i) throws java.rmi.RemoteException; + void A(java.lang.Long[] l) throws java.rmi.RemoteException; + void A(java.lang.Object[] o) throws java.rmi.RemoteException; void A(java.lang.Short[] s) throws java.rmi.RemoteException; + void A(java.lang.String[] s) throws java.rmi.RemoteException; + void A(java.rmi.Remote[] r) throws java.rmi.RemoteException; void A(javax.swing.UIDefaults.ActiveValue[] s) throws java.rmi.RemoteException; + void A(org.omg.CORBA.Object[] o) throws java.rmi.RemoteException; void A(short[] s) throws java.rmi.RemoteException; + void A(boolean[] b) throws java.rmi.RemoteException; + void A(boolean[][] b) throws java.rmi.RemoteException; - void A(corba.dynamicrmiiiop.testclasses.IDLOverloadedTest.Inner\u0300.Extra\u0301Inner[][][][] a, java.lang.String[][] b, int c) throws java.rmi.RemoteException; + + void A(corba.dynamicrmiiiop.testclasses.IDLOverloadedTest.Inner\u0300.Extra\u0301Inner[][][][] a, java.lang.String[][] b, int c) + throws java.rmi.RemoteException; + void A(boolean[][][][][][][][][][][][][][][][] b) throws java.rmi.RemoteException; void A(boolean z) throws java.rmi.RemoteException; + void A(byte b) throws java.rmi.RemoteException; + void A(char c) throws java.rmi.RemoteException; + void A(corba.dynamicrmiiiop.testclasses.IDLOverloadedTest.Inner\u0300 d) throws java.rmi.RemoteException; + void A(corba.dynamicrmiiiop.testclasses.IDLOverloadedTest.Inner\u0300.Extra\u0301Inner e) throws java.rmi.RemoteException; + void A(double d) throws java.rmi.RemoteException; + void A(float f) throws java.rmi.RemoteException; + void A(int i) throws java.rmi.RemoteException; - void A(int i, float f, double d, char c, byte b, boolean z, - java.io.Serializable s, java.lang.String t) throws java.rmi.RemoteException; + + void A(int i, float f, double d, char c, byte b, boolean z, java.io.Serializable s, java.lang.String t) + throws java.rmi.RemoteException; void A(java.io.Externalizable e) throws java.rmi.RemoteException; + void A(java.io.Serializable s) throws java.rmi.RemoteException; + void A(java.lang.Boolean b) throws java.rmi.RemoteException; + void A(java.lang.Byte b) throws java.rmi.RemoteException; + void A(java.lang.Character b) throws java.rmi.RemoteException; + void A(java.lang.Class c) throws java.rmi.RemoteException; + void A(java.lang.Double d) throws java.rmi.RemoteException; + void A(java.lang.Float f) throws java.rmi.RemoteException; + void A(java.lang.Integer i) throws java.rmi.RemoteException; + void A(java.lang.Long l) throws java.rmi.RemoteException; + void A(java.lang.Object o) throws java.rmi.RemoteException; + void A(java.lang.Short s) throws java.rmi.RemoteException; + void A(java.lang.String s) throws java.rmi.RemoteException; + void A(java.rmi.Remote r) throws java.rmi.RemoteException; + void A(javax.swing.UIDefaults.ActiveValue s) throws java.rmi.RemoteException; - void A(long j) throws java.rmi.RemoteException; - + void A(long j) throws java.rmi.RemoteException; + void A(org.omg.CORBA.Object o) throws java.rmi.RemoteException; + void A(short s) throws java.rmi.RemoteException; - - void A(TestStruct t) throws java.rmi.RemoteException; + + void A(TestStruct t) throws java.rmi.RemoteException; } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLPropertiesTest.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLPropertiesTest.java index df0ed78dd..c61cbb91e 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLPropertiesTest.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/IDLPropertiesTest.java @@ -23,35 +23,12 @@ public class IDLPropertiesTest { // // Set of idl names corresponding to alphabetically sorted set of - // interface methods. See TestIDLNameTranslator for sorting details. + // interface methods. See TestIDLNameTranslator for sorting details. // - static final String[] IDL_NAMES = { - "a", - "get", - "_get_a__", - "_get_ABc", - "_get_b", - "_get_CDE", - "getDAB", - "getDCD", - "getDzzz", - "getEfg", - "_get_zde", - "is", - "isA", - "isBCD", - "_get_c", - "_get_CCCCCe", - "isCZ", - "_get_cf", - "set", - "_set_a__", - "_set_b", - "setCDE", - "setEfg", - "_set_zde" - }; - + static final String[] IDL_NAMES = { "a", "get", "_get_a__", "_get_ABc", "_get_b", "_get_CDE", "getDAB", "getDCD", "getDzzz", "getEfg", + "_get_zde", "is", "isA", "isBCD", "_get_c", "_get_CCCCCe", "isCZ", "_get_cf", "set", "_set_a__", "_set_b", "setCDE", "setEfg", + "_set_zde" }; + public static String[] getIDLNames() { return IDL_NAMES; } @@ -63,16 +40,16 @@ public interface IDLProperties extends java.rmi.Remote { // not a property since there is no portion int get() throws java.rmi.RemoteException; - + // valid getter int getA() throws java.rmi.RemoteException; - + // valid getter int getABc() throws java.rmi.RemoteException; // valid getter int getB() throws java.rmi.RemoteException; - + // getter int getCDE() throws java.rmi.RemoteException; @@ -98,38 +75,38 @@ public interface IDLProperties extends java.rmi.Remote { // not a property since "is" only applies to boolean int isA() throws java.rmi.RemoteException; - // not valid. must be boolean primitive + // not valid. must be boolean primitive Boolean isBCD() throws java.rmi.RemoteException; - + // valid boolean property boolean isC() throws java.rmi.RemoteException; // valid boolean property boolean isCCCCCe() throws java.rmi.RemoteException; - // not boolean property. must have 0 args + // not boolean property. must have 0 args boolean isCZ(int a) throws java.rmi.RemoteException; // valid boolean property - boolean isCf() throws java.rmi.RemoteException; - + boolean isCf() throws java.rmi.RemoteException; + // not a property since there is no portion int set() throws java.rmi.RemoteException; void setA(int c) throws java.rmi.RemoteException; - + // valid setter void setB(int b) throws java.rmi.RemoteException; // not a setter. no corresponding getter with correct type. void setCDE(Integer i) throws java.rmi.RemoteException; - // not a setter. no corresponding getter. + // not a setter. no corresponding getter. void setEfg(int a) throws java.rmi.RemoteException; // valid setter void setZde(boolean a) throws java.rmi.RemoteException; - + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidEntities.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidEntities.java index 23b65d9a9..665d039ca 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidEntities.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidEntities.java @@ -24,28 +24,28 @@ */ public class InvalidEntities { - public static final Class[] CLASSES = { - InvalidEntity1.class, - InvalidEntity2.class, - InvalidEntity3.class, - InvalidEntity4.class, - InvalidEntity5.class, - InvalidEntity6.class - }; + public static final Class[] CLASSES = { InvalidEntity1.class, InvalidEntity2.class, InvalidEntity3.class, InvalidEntity4.class, + InvalidEntity5.class, InvalidEntity6.class }; // must be a class that is a subtype of org.omg.CORBA.portable.IDLEntity - public class InvalidEntity1 {} - + public class InvalidEntity1 { + } + // must be a class that is a subtype of org.omg.CORBA.portable.IDLEntity - public class InvalidEntity2 extends InvalidEntity1 {} + public class InvalidEntity2 extends InvalidEntity1 { + } + + // must be a class + public interface InvalidEntity3 { + } - // must be a class - public interface InvalidEntity3 {} - - public interface InvalidEntity4 extends InvalidEntity3 {} + public interface InvalidEntity4 extends InvalidEntity3 { + } - public interface InvalidEntity5 extends org.omg.CORBA.portable.IDLEntity {} + public interface InvalidEntity5 extends org.omg.CORBA.portable.IDLEntity { + } - public interface InvalidEntity6 extends InvalidEntity5 {} + public interface InvalidEntity6 extends InvalidEntity5 { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidExceptions.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidExceptions.java index 3219b27ea..cf71d1933 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidExceptions.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidExceptions.java @@ -24,47 +24,46 @@ */ public class InvalidExceptions { - public static final Class[] CLASSES = { - InvalidException1.class, - InvalidException2.class, - InvalidException3.class, - InvalidException4.class, - InvalidException5.class, - InvalidException6.class, - InvalidException7.class, - InvalidException8.class, - InvalidException9.class, - InvalidException10.class - }; + public static final Class[] CLASSES = { InvalidException1.class, InvalidException2.class, InvalidException3.class, + InvalidException4.class, InvalidException5.class, InvalidException6.class, InvalidException7.class, InvalidException8.class, + InvalidException9.class, InvalidException10.class }; // must be a checked exception - public class InvalidException1 {} + public class InvalidException1 { + } // must be a checked exception - public class InvalidException2 extends InvalidException1 {} + public class InvalidException2 extends InvalidException1 { + } // must be a checked exception - public class InvalidException3 extends Error {} + public class InvalidException3 extends Error { + } // must be a checked exception - public class InvalidException4 extends InvalidException3 {} + public class InvalidException4 extends InvalidException3 { + } // must be a checked exception - public class InvalidException5 extends RuntimeException {} + public class InvalidException5 extends RuntimeException { + } // must be a checked exception - public class InvalidException6 extends InvalidException5 {} + public class InvalidException6 extends InvalidException5 { + } // must be a checked exception - public interface InvalidException7 {} + public interface InvalidException7 { + } // must be a checked exception - public interface InvalidException8 extends java.io.Serializable {} + public interface InvalidException8 extends java.io.Serializable { + } - public class InvalidException9 extends Exception - implements java.rmi.Remote {} + public class InvalidException9 extends Exception implements java.rmi.Remote { + } - public class InvalidException10 extends InvalidException9 {} + public class InvalidException10 extends InvalidException9 { + } - } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidObjRefs.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidObjRefs.java index 4822c0e88..c7bfa2007 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidObjRefs.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidObjRefs.java @@ -24,40 +24,39 @@ */ public class InvalidObjRefs { - public static final Class[] CLASSES = { - InvalidObjRef1.class, - InvalidObjRef2.class, - InvalidObjRef3.class, - InvalidObjRef4.class, - InvalidObjRef5.class, - InvalidObjRef6.class, - InvalidObjRef7.class, - InvalidObjRef8.class - }; + public static final Class[] CLASSES = { InvalidObjRef1.class, InvalidObjRef2.class, InvalidObjRef3.class, InvalidObjRef4.class, + InvalidObjRef5.class, InvalidObjRef6.class, InvalidObjRef7.class, InvalidObjRef8.class }; // must be subtype of org.omg.CORBA.Object - public interface InvalidObjRef1 {} + public interface InvalidObjRef1 { + } // must be subtype of org.omg.CORBA.Object - public interface InvalidObjRef2 extends InvalidObjRef1 {} + public interface InvalidObjRef2 extends InvalidObjRef1 { + } // must be subtype of org.omg.CORBA.Object - public class InvalidObjRef3 {} + public class InvalidObjRef3 { + } // must be subtype of org.omg.CORBA.Object - public class InvalidObjRef4 extends InvalidObjRef3 {} + public class InvalidObjRef4 extends InvalidObjRef3 { + } // must be an interface - public abstract class InvalidObjRef5 - extends org.omg.CORBA.portable.ObjectImpl {} + public abstract class InvalidObjRef5 extends org.omg.CORBA.portable.ObjectImpl { + } // must be an interface - public abstract class InvalidObjRef6 extends InvalidObjRef5 {} + public abstract class InvalidObjRef6 extends InvalidObjRef5 { + } // must be an interface - public abstract class InvalidObjRef7 implements org.omg.CORBA.Object {} + public abstract class InvalidObjRef7 implements org.omg.CORBA.Object { + } // must be an interface - public abstract class InvalidObjRef8 extends InvalidObjRef7 {} + public abstract class InvalidObjRef8 extends InvalidObjRef7 { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidRemotes.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidRemotes.java index 1049213c6..30548cb43 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidRemotes.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidRemotes.java @@ -21,23 +21,26 @@ /** * Invalid RMI/IDL Remote Interface Types - */ + */ public class InvalidRemotes { // should extend java.rmi.Remote, either directly or indirectly - public interface InvalidRemote1 {} - - // should extend java.rmi.Remote, either directly or indirectly - public interface InvalidRemote2 extends InvalidRemote1 {} + public interface InvalidRemote1 { + } + + // should extend java.rmi.Remote, either directly or indirectly + public interface InvalidRemote2 extends InvalidRemote1 { + } // RMI/IDL Exceptions should not extend java.rmi.Remote, either directly // or indirectly - public class InvalidException1 extends java.lang.Exception - implements java.rmi.Remote {} + public class InvalidException1 extends java.lang.Exception implements java.rmi.Remote { + } // RMI/IDL Exceptions should not extend java.rmi.Remote, either directly // or indirectly - public class InvalidException2 extends InvalidException1 {} + public class InvalidException2 extends InvalidException1 { + } // contains method with invalid exception type public interface InvalidRemote3 extends java.rmi.Remote { @@ -53,26 +56,26 @@ public interface InvalidRemote4 extends java.rmi.Remote { // super-class exception types. public interface InvalidRemote5 extends java.rmi.Remote { public void foo1(); - } + } // contains method with invalid exception type public interface InvalidRemote6 extends java.rmi.Remote { public void foo1() throws java.rmi.RemoteException, java.lang.Error; - } + } // contains method with invalid exception type public interface InvalidRemote7 extends java.rmi.Remote { - public void foo1() throws java.rmi.RemoteException, - java.lang.RuntimeException; - } + public void foo1() throws java.rmi.RemoteException, java.lang.RuntimeException; + } + + private class InvalidException3 extends java.lang.RuntimeException { + } - private class InvalidException3 extends java.lang.RuntimeException {} // contains method with invalid exception type public interface InvalidRemote8 extends java.rmi.Remote { - public void foo1() throws java.rmi.RemoteException, - InvalidException3; - } - + public void foo1() throws java.rmi.RemoteException, InvalidException3; + } + // has a field other than primitive or String public interface InvalidRemote9 extends java.rmi.Remote { Object o = null; @@ -88,15 +91,20 @@ private interface B { // can't directly inherit from multiple base interfaces which define a // method with the same name - public interface InvalidRemote10 extends java.rmi.Remote, A, B {} + public interface InvalidRemote10 extends java.rmi.Remote, A, B { + } - private interface C extends A {} - private interface D extends B {} + private interface C extends A { + } + + private interface D extends B { + } // can't directly inherit from multiple base interfaces which define a - // method with the same name. - public interface InvalidRemote11 extends java.rmi.Remote, C, D {} - + // method with the same name. + public interface InvalidRemote11 extends java.rmi.Remote, C, D { + } + private interface E { void foo() throws java.rmi.RemoteException; } @@ -107,47 +115,55 @@ private interface F { // can't directly inherit from multiple base interfaces which define a // method with the same name - public interface InvalidRemote12 extends java.rmi.Remote, E, F {} + public interface InvalidRemote12 extends java.rmi.Remote, E, F { + } + + private interface G extends E { + } - private interface G extends E {} - private interface H extends F {} + private interface H extends F { + } // can't directly inherit from multiple base interfaces which define a // method with the same name - public interface InvalidRemote13 extends java.rmi.Remote, G, H {} + public interface InvalidRemote13 extends java.rmi.Remote, G, H { + } // can't directly inherit from multiple base interfaces which define a // method with the same name - public interface InvalidRemote14 extends G, java.rmi.Remote, H {} + public interface InvalidRemote14 extends G, java.rmi.Remote, H { + } - // can't directly inherit from multiple base interfaces which define a - // method with the same name. doesn't matter if a method with the same + // method with the same name. doesn't matter if a method with the same // name is defined in the most derived interface public interface InvalidRemote15 extends G, java.rmi.Remote, H { void foo() throws java.rmi.RemoteException; } // must be an interface - public class InvalidRemote16 {} + public class InvalidRemote16 { + } // illegal constant type. must be primitive or String public interface InvalidRemote17 extends java.rmi.Remote { int[] FOO = { 1, 2, 3 }; } - + // applying mangling rules results in clash public interface InvalidRemote18 extends java.rmi.Remote { void J_foo() throws java.rmi.RemoteException; + void _foo() throws java.rmi.RemoteException; } // applying mangling rules results in clash public interface InvalidRemote19 extends java.rmi.Remote { void foo() throws java.rmi.RemoteException; + void foo(int a) throws java.rmi.RemoteException; + void foo__long() throws java.rmi.RemoteException; } - } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidValues.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidValues.java index a3b18a5ab..d80d71aa9 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidValues.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/InvalidValues.java @@ -24,35 +24,35 @@ */ public class InvalidValues { - public static final Class[] CLASSES = { - InvalidValue1.class, InvalidValue2.class, - InvalidValue3.class, InvalidValue4.class, - InvalidValue5.class, InvalidValue6.class, - InvalidValue7.class - }; + public static final Class[] CLASSES = { InvalidValue1.class, InvalidValue2.class, InvalidValue3.class, InvalidValue4.class, + InvalidValue5.class, InvalidValue6.class, InvalidValue7.class }; // must be a subtype of Serializable - public class InvalidValue1 {} + public class InvalidValue1 { + } // must be a subtype of Serializable - public class InvalidValue2 extends InvalidValue1 {} + public class InvalidValue2 extends InvalidValue1 { + } // must be a class - public interface InvalidValue3 {} + public interface InvalidValue3 { + } // must be a class - public interface InvalidValue4 extends java.io.Serializable {} + public interface InvalidValue4 extends java.io.Serializable { + } // can't implement Remote - public class InvalidValue5 implements java.rmi.Remote {} - + public class InvalidValue5 implements java.rmi.Remote { + } + // can't implement Remote - public class InvalidValue6 implements java.io.Serializable, - java.rmi.Remote {} - + public class InvalidValue6 implements java.io.Serializable, java.rmi.Remote { + } + // can't implement Remote, directly or indirectly - public class InvalidValue7 extends InvalidValue5 {} + public class InvalidValue7 extends InvalidValue5 { + } - - } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/Raises.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/Raises.java index a608bb35b..0031f8150 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/Raises.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/Raises.java @@ -25,16 +25,18 @@ public class Raises { // Inner class with name that clashes with an IDL keyword. - public static class Union {} + public static class Union { + } // Inner class whose name has a leading underscore. - public static class _Foo {} + public static class _Foo { + } // Inner class with chars that need to be mangled. // public static class Uni\u8001code {} // Inner class with name that has leading underscore plus IDL keyword - public static class _Union {} - + public static class _Union { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/TestStruct.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/TestStruct.java index 3567144f0..613da9dfc 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/TestStruct.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/TestStruct.java @@ -19,16 +19,13 @@ package corba.dynamicrmiiiop.testclasses; -public final class TestStruct implements org.omg.CORBA.portable.IDLEntity -{ - public short x = (short)0; +public final class TestStruct implements org.omg.CORBA.portable.IDLEntity { + public short x = (short) 0; - public TestStruct () - { - } + public TestStruct() { + } - public TestStruct (short _x) - { + public TestStruct(short _x) { x = _x; } -} +} diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidEntities.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidEntities.java index 76b4a6a6c..601b079ca 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidEntities.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidEntities.java @@ -24,12 +24,12 @@ */ public class ValidEntities { - public static final Class[] CLASSES = { - ValidEntity1.class, ValidEntity2.class - }; + public static final Class[] CLASSES = { ValidEntity1.class, ValidEntity2.class }; - public class ValidEntity1 implements org.omg.CORBA.portable.IDLEntity {} + public class ValidEntity1 implements org.omg.CORBA.portable.IDLEntity { + } - public class ValidEntity2 extends ValidEntity1 {} + public class ValidEntity2 extends ValidEntity1 { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidExceptions.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidExceptions.java index 239845db1..f966afd22 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidExceptions.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidExceptions.java @@ -24,25 +24,25 @@ */ public class ValidExceptions { - public static final Class[] CLASSES = { - ValidException1.class, - ValidException2.class, - ValidException3.class, - ValidException4.class, - ValidException5.class, - ValidException6.class - }; - - public class ValidException1 extends java.lang.Exception {} - - public class ValidException2 extends ValidException1 {} - - public class ValidException3 extends Throwable {} - - public class ValidException4 extends ValidException3 {} - - public class ValidException5 extends java.io.IOException {} - - public class ValidException6 extends ValidException5 {} + public static final Class[] CLASSES = { ValidException1.class, ValidException2.class, ValidException3.class, ValidException4.class, + ValidException5.class, ValidException6.class }; + + public class ValidException1 extends java.lang.Exception { + } + + public class ValidException2 extends ValidException1 { + } + + public class ValidException3 extends Throwable { + } + + public class ValidException4 extends ValidException3 { + } + + public class ValidException5 extends java.io.IOException { + } + + public class ValidException6 extends ValidException5 { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidObjRefs.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidObjRefs.java index e1b45ae34..0d3027776 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidObjRefs.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidObjRefs.java @@ -24,13 +24,12 @@ */ public class ValidObjRefs { - public static final Class[] CLASSES = { - org.omg.CORBA.Object.class, - ValidObjRef1.class, ValidObjRef2.class - }; + public static final Class[] CLASSES = { org.omg.CORBA.Object.class, ValidObjRef1.class, ValidObjRef2.class }; - public interface ValidObjRef1 extends org.omg.CORBA.Object {} + public interface ValidObjRef1 extends org.omg.CORBA.Object { + } - public interface ValidObjRef2 extends ValidObjRef1 {} + public interface ValidObjRef2 extends ValidObjRef1 { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidRemotes.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidRemotes.java index 58940e629..4ae65190d 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidRemotes.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidRemotes.java @@ -24,33 +24,32 @@ */ public class ValidRemotes { - public static final Class[] CLASSES = { - java.rmi.Remote.class, - ValidRemote0.class, ValidRemote1.class, - ValidRemote2.class, ValidRemote3.class, - ValidRemote4.class, ValidRemote5.class, - ValidRemote6.class, ValidRemote7.class, - ValidRemote8.class, ValidRemote9.class, - ValidRemote10.class - }; - - public interface ValidRemote0 extends java.rmi.Remote {} - - public interface ValidRemote1 extends ValidRemote0 {} + public static final Class[] CLASSES = { java.rmi.Remote.class, ValidRemote0.class, ValidRemote1.class, ValidRemote2.class, + ValidRemote3.class, ValidRemote4.class, ValidRemote5.class, ValidRemote6.class, ValidRemote7.class, ValidRemote8.class, + ValidRemote9.class, ValidRemote10.class }; + + public interface ValidRemote0 extends java.rmi.Remote { + } + + public interface ValidRemote1 extends ValidRemote0 { + } public interface ValidRemote2 extends java.rmi.Remote { - public void foo1() throws java.rmi.RemoteException, - java.io.IOException, java.lang.Exception, java.lang.Throwable; + public void foo1() throws java.rmi.RemoteException, java.io.IOException, java.lang.Exception, java.lang.Throwable; } public interface ValidRemote3 extends java.rmi.Remote { public void foo1() throws java.rmi.RemoteException; + public void foo2() throws java.io.IOException; + public void foo3() throws java.lang.Exception; + public void foo4() throws java.lang.Throwable; } - public interface ValidRemote4 extends ValidRemote3 {} + public interface ValidRemote4 extends ValidRemote3 { + } public interface ValidRemote5 extends java.rmi.Remote { boolean a = true; @@ -66,28 +65,30 @@ public interface ValidRemote5 extends java.rmi.Remote { } public interface ValidRemote6 extends java.rmi.Remote { - public void foo1() throws java.rmi.RemoteException, - java.lang.Exception; - - public void foo2() - throws java.rmi.RemoteException, Exception1; - + public void foo1() throws java.rmi.RemoteException, java.lang.Exception; + + public void foo2() throws java.rmi.RemoteException, Exception1; + } - public static class Exception1 extends java.lang.Exception {} + public static class Exception1 extends java.lang.Exception { + } public interface ValidRemote7 extends java.rmi.Remote { void foo() throws java.rmi.RemoteException; + void foo(int a) throws java.rmi.RemoteException; + void foo(String[] b) throws java.rmi.RemoteException; } - public interface ValidRemote8 extends - ValidRemote2, ValidRemote5, ValidRemote7 {} + public interface ValidRemote8 extends ValidRemote2, ValidRemote5, ValidRemote7 { + } public interface ValidRemote9 extends ValidRemote8 { void foo(int a) throws java.rmi.RemoteException; } - public interface ValidRemote10 extends java.rmi.Remote, ValidRemote9 {} + public interface ValidRemote10 extends java.rmi.Remote, ValidRemote9 { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidValues.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidValues.java index 9a6e385d5..83e9e2101 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidValues.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/ValidValues.java @@ -24,14 +24,13 @@ */ public class ValidValues { - public static final Class[] CLASSES = { - ValidValue1.class, ValidValue2.class, - java.util.Date.class, java.lang.Integer.class, java.lang.String.class - }; + public static final Class[] CLASSES = { ValidValue1.class, ValidValue2.class, java.util.Date.class, java.lang.Integer.class, + java.lang.String.class }; - public class ValidValue1 implements java.io.Serializable {} - - public class ValidValue2 extends ValidValue1 {} + public class ValidValue1 implements java.io.Serializable { + } + public class ValidValue2 extends ValidValue1 { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_ContainerClash3.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_ContainerClash3.java index f9d8b3990..4e48fb529 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_ContainerClash3.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_ContainerClash3.java @@ -22,5 +22,5 @@ public interface _ContainerClash3 extends java.rmi.Remote { void _ContainerClash3() throws java.rmi.RemoteException; - + } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_ContainerClash4.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_ContainerClash4.java index 6aeffbe8c..790dd9661 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_ContainerClash4.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_ContainerClash4.java @@ -22,5 +22,5 @@ public interface _ContainerClash4 extends java.rmi.Remote { void _ContainerCLASH4() throws java.rmi.RemoteException; - + } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_Default.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_Default.java index 749ed1ef1..74bb65ea9 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_Default.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_Default.java @@ -21,10 +21,13 @@ public class _Default { - public class Inner {} + public class Inner { + } - public class _Inner {} + public class _Inner { + } - public class Default {} + public class Default { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_Raises.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_Raises.java index 54fa371fd..62d92550b 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_Raises.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_Raises.java @@ -25,13 +25,15 @@ public class _Raises { // Inner class with name that clashes with an IDL keyword. - public static class Union {} + public static class Union { + } // Inner class whose name has a leading underscore. - public static class _Foo {} + public static class _Foo { + } // Inner class with name that has leading underscore plus IDL keyword - public static class _Union {} - + public static class _Union { + } } diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_upackage/Foo.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_upackage/Foo.java index 35114aa9d..b88bc09c8 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_upackage/Foo.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/_upackage/Foo.java @@ -19,4 +19,5 @@ package corba.dynamicrmiiiop.testclasses._upackage; -public class Foo {} +public class Foo { +} diff --git a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/typedef/Foo.java b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/typedef/Foo.java index 7e127886b..b18aed9b6 100644 --- a/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/typedef/Foo.java +++ b/orbmain/src/test/java/corba/dynamicrmiiiop/testclasses/typedef/Foo.java @@ -19,4 +19,5 @@ package corba.dynamicrmiiiop.testclasses.typedef; -public class Foo {} +public class Foo { +} diff --git a/orbmain/src/test/java/org/glassfish/corba/testutils/HexBuffer.java b/orbmain/src/test/java/org/glassfish/corba/testutils/HexBuffer.java index f328df9ca..f579afb78 100644 --- a/orbmain/src/test/java/org/glassfish/corba/testutils/HexBuffer.java +++ b/orbmain/src/test/java/org/glassfish/corba/testutils/HexBuffer.java @@ -23,11 +23,11 @@ public class HexBuffer { public static final int BYTES_PER_LINE = 32; - public static final int SPACES_PER_LINE = 2*BYTES_PER_LINE + BYTES_PER_LINE/4; + public static final int SPACES_PER_LINE = 2 * BYTES_PER_LINE + BYTES_PER_LINE / 4; public static void dumpBuffer(byte[] bytes) { - for (int i = 0; i < bytes.length; i+= BYTES_PER_LINE) - dumpLine( i, subBuffer(bytes, i, i + BYTES_PER_LINE) ); + for (int i = 0; i < bytes.length; i += BYTES_PER_LINE) + dumpLine(i, subBuffer(bytes, i, i + BYTES_PER_LINE)); } private static void dumpLine(int start, byte[] bytes) { @@ -45,14 +45,14 @@ private static void dumpLine(int start, byte[] bytes) { sb.append(' '); sb.append(' '); for (byte aByte : bytes) { - sb.append(aByte < ' ' ? ' ' : (char)aByte); + sb.append(aByte < ' ' ? ' ' : (char) aByte); } System.out.println(sb.toString()); } private static byte[] subBuffer(byte[] input, int start, int limit) { int end = Math.min(limit, input.length); - byte[] result = new byte[end-start]; + byte[] result = new byte[end - start]; System.arraycopy(input, start, result, 0, result.length); return result; } diff --git a/orbmain/src/test/java/org/glassfish/corba/testutils/StubCorbaObject.java b/orbmain/src/test/java/org/glassfish/corba/testutils/StubCorbaObject.java index 5c1e79e19..f377ffe94 100644 --- a/orbmain/src/test/java/org/glassfish/corba/testutils/StubCorbaObject.java +++ b/orbmain/src/test/java/org/glassfish/corba/testutils/StubCorbaObject.java @@ -58,7 +58,8 @@ public Request _create_request(Context context, String s, NVList nvList, NamedVa return null; } - public Request _create_request(Context context, String s, NVList nvList, NamedValue namedValue, ExceptionList exceptionList, ContextList contextList) { + public Request _create_request(Context context, String s, NVList nvList, NamedValue namedValue, ExceptionList exceptionList, + ContextList contextList) { return null; }